Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrbrooks2010-07-24 08:02:08 +0000
committerrbrooks2010-07-24 08:02:08 +0000
commit4ed8bddc791fda93940f238c5135556a07041dc0 (patch)
tree64a118285c5006c3a38320dbb2d374e8ea72a061 /plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee
parent542cc7344d3f129d64e47f547384297c8e1b1f43 (diff)
downloadorg.eclipse.osee-4ed8bddc791fda93940f238c5135556a07041dc0.tar.gz
org.eclipse.osee-4ed8bddc791fda93940f238c5135556a07041dc0.tar.xz
org.eclipse.osee-4ed8bddc791fda93940f238c5135556a07041dc0.zip
converted all line terminators to unix style
Diffstat (limited to 'plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee')
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/DialogPopupLoggerListener.java152
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkImage.java438
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/GenerateTypeEnumAction.java334
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/IArtifactDecoratorPreferences.java62
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/IArtifactExplorerEventHandler.java36
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactImportPage.java1054
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/MatchingStrategy.java44
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OpenWithContributionItem.java484
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OpenWithMenuListener.java254
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OpenWithSelectionListener.java86
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OseeContributionItem.java192
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/RelationsComposite.java1660
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/SelectionProviderIntermediate.java206
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/SelectionProviderWrapper.java166
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/SkynetGuiPlugin.java396
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/WorkspaceContributionItem.java168
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/sections/BlamUsageSection.java202
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/BranchSelectComposite.java338
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/BranchSelectionDialog.java328
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeReportActionBarContributor.java182
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeReportEditorInput.java170
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeUiData.java244
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeUiUtil.java112
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/CompareType.java52
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/IChangeReportPreferences.java36
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/IChangeReportView.java12
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ParentBranchProvider.java38
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/UiOtherBranchDialogProvider.java106
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/UiSelectBetweenDeltasBranchProvider.java122
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/CompareAction.java92
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/CompareDropDown.java74
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/OpenAssociatedArtifact.java88
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/OpenQuickSearchAction.java80
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/ReloadChangeReportAction.java38
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/ShowDocumentOrderAction.java74
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadAssociatedArtifactOperation.java58
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadAssociatedArtifactOperationFromBranch.java38
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadChangesOperation.java48
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadCompareBaseToHead.java44
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadCompareBranchToBranch.java74
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/UpdateChangeUiData.java80
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/BaseToHeadHandler.java116
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/ChangeReportInfoPresenter.java228
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/CurrentsAgainstOtherHandler.java142
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/CurrentsAgainstParentHandler.java142
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/IChangeReportUiHandler.java40
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/SpecificTxsHandler.java124
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/view/ChangeReportInfo.java116
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/view/ChangeReportTable.java234
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/view/EditorSection.java144
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/AbstractSelectionChangedHandler.java104
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/AccessControlHandler.java126
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ChangeReportHandler.java146
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/CollapseTreeHandler.java90
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/CompressWordAttributesHandler.java218
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/CopyHandler.java182
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/DeleteArtifactHandler.java126
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ExpandTreeHandler.java110
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/Handlers.java186
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/OpenArtifactExplorerHandler.java104
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/OpenMassArtifactEditorHandler.java80
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/OpenSkywalkerEditorHandler.java94
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/PasteHandler.java168
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/PurgeArtifactHandler.java150
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/RevealInArtifactExplorer.java122
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/RevertArtifactHandler.java202
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/RevertAttributeHandler.java264
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/RevertJob.java118
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ShowArtifactInResourceHandler.java120
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ShowPreviewHandler.java104
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ViewerReportHandler.java96
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ArchiveBranchCompoundContributionItem.java194
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ArchiveBranchHandler.java134
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/BranchCreationHandler.java232
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/FlatPresentationHandler.java114
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/OpenAssociatedArtifactHandler.java140
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ToggleFavoriteBranchContributionItem.java114
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitBranchParameter.java50
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitHandler.java396
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitIntoParentCompoundContributionItem.java230
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitIntoParentHandler.java32
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/UpdateBranchHandler.java268
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/change/SingleNativeDiffHandler.java118
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/change/ViewWordChangeReportHandler.java178
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/merge/BranchIdParameter.java48
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/merge/MergeCompoundContributionItem.java248
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/merge/MergeManagerHandler.java172
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/AbstractEditorHandler.java80
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/ArtifactEditorHandler.java52
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/NativeEditorHandler.java52
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/NativePreviewEditorHandler.java72
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/OpenHandler.java48
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/OtherEditorHandler.java208
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/PreviewTisHandler.java74
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/PreviewWholeWordHandler.java74
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/PreviewWithChildWordHandler.java104
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/PreviewWordHandler.java98
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/WholeDocumentEditorHandler.java60
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/WordEditorHandler.java60
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/AttributeCompareItem.java48
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/CompareHandler.java92
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/CompareInput.java152
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/CompareItem.java192
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AbstractWordAttributeHealthOperation.java672
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/ArtifactIdWithoutVersionsCheck.java286
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AttributeBackingDataCheck.java344
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AuthorIdCheck.java256
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/BranchStateHealthCheck.java556
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CleanUpAddressingData.java214
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CleanUpAttrFromDeletedArt.java126
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CleanUpBackingData.java242
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CommitTransactions.java166
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DatabaseHealthOperation.java222
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DatabaseHealthOpsExtensionManager.java178
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DatabaseIntegrityCheckApplication.java386
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DuplicateAttributes.java558
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DuplicateHRID.java340
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/HealthHelper.java372
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/ItemsDeletedWithNoOtherModification.java360
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/LocalTxData.java54
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/MultipleParentRelations.java566
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RelationIntegrityCheck.java528
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RepeatEnumerationAttributeValues.java394
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/WordAttributeSmartTagsRemovedHealthOperation.java116
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/WordAttributeTrackChangeHealthOperation.java112
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/WordAttributeUpdateHyperlinksHealthOperation.java160
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dialogs/ArtifactPasteSpecialDialog.java200
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dialogs/ArtifactSelectionDialog.java546
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dialogs/ListDialogSortable.java110
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/diffWizard/DiffWizard.java174
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/diffWizard/DiffWizardPage.java462
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/export/ArtifactExportJob.java198
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/export/ArtifactExportPage.java202
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/export/ArtifactExportWizard.java102
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/export/ExportBranchPage.java234
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/group/GroupExplorer.java1208
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/group/GroupExplorerDragAndDrop.java630
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/group/GroupTreeViewer.java90
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/group/IGroupExplorerProvider.java20
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/handler/UIOutlineResolutionHandler.java116
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/listener/IRebuildMenuListener.java40
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/menu/ArtifactDiffMenu.java298
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/menu/GlobalMenuPermissions.java292
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/ConflictResolutionWizard.java212
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditAttributeWizardPage.java360
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditWFCAttributeWizardPage.java470
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedBooleanAttributeEditor.java284
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedBooleanEditor.java96
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedDateAttributeEditor.java294
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedDateEditor.java104
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedEnumAttributeEditor.java308
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedEnumEditor.java132
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedStringAttributeEditor.java310
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedStringEditor.java242
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbededAttributeEditorFactory.java126
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/IEmbeddedAttributeEditor.java64
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/notify/INotificationManager.java34
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/notify/OseeNotificationEvent.java156
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/notify/OseeNotificationManager.java152
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/AbstractItemSelectPanel.java326
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/ArtifactExtractorSelectPanel.java366
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/ArtifactSelectPanel.java182
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/ArtifactTypeSelectPanel.java174
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/AttributeTypeSelectPanel.java142
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/BranchSelectSimpleComposite.java550
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/DetailsBrowserComposite.java108
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/SearchComposite.java580
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/ArbitrationServerPage.java300
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/ConfigurationDetails.java248
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/DataSourceDetails.java274
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/DefaultWithStringAndIntegerFields.java400
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/EditorsPreferencePage.java218
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/MsWordPreferencePage.java186
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/relation/explorer/RelationExplorerWindow.java690
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/relation/explorer/RelationTableViewer.java502
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/ArtifactEditFileWatcher.java90
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/ArtifactFileMonitor.java126
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/ArtifactGuidToWordML.java90
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/DefaultArtifactRenderer.java356
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/FileSystemRenderer.java248
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IRenderer.java100
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/ITemplateRenderer.java50
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IVbaDiffGenerator.java56
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/OpenOfficeWriterRenderer.java104
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/PresentationType.java26
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RelationOrderRenderer.java210
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RendererManager.java556
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RenderingUtil.java306
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/TisRenderer.java200
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/UpdateArtifactJob.java500
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/VbaWordDiffGenerator.java312
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WholeDocumentRenderer.java190
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordImageChecker.java186
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordRenderer.java130
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java454
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordmlPicture.java156
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/artifactElement/IElementExtractor.java64
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/artifactElement/MergeEditArtifactElementExtractor.java214
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/artifactElement/WordArtifactElementExtractor.java580
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/ArtifactDeltaToFileConverter.java98
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/DefaultArtifactCompare.java44
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/IComparator.java24
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WholeWordCompare.java214
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WordChangeReportOperation.java252
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WordTemplateCompare.java232
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/AttributeElement.java154
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/Producer.java36
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordChangeReportOperation.java54
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordMLProducer.java718
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordTemplateFileDiffer.java306
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordTemplateProcessor.java1056
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/AddTemplateText.java98
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ArtifactProcessing.java302
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/BasicTemplateAttributeHandler.java176
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ITemplateAttributeHandler.java52
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ITemplateTask.java56
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/SRSSpecialPublishingAttributeHandler.java92
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/TISAttributeHandler.java78
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/TemplateAttribute.java272
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/WordAttributeTypeAttributeHandler.java96
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/WordTemplateManager.java624
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/IResultsEditorProvider.java50
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/IResultsEditorTab.java48
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/ResultsEditorConverter.java564
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/XResultData.java550
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/chart/ChartViewerSWT.java134
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/chart/IResultsEditorChartTab.java46
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/chart/ResultsEditorChartTab.java178
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/html/IResultsEditorHtmlTab.java46
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/html/ResultsEditorHtmlTab.java350
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/IResultsEditorTableTab.java56
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/IResultsXViewerRow.java42
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/ResultsEditorTableTab.java384
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/ResultsXViewerRow.java118
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/xresults/ResultsXViewer.java112
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/xresults/ResultsXViewerFactory.java90
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertContentProvider.java150
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertDeletionCheck.java94
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertLabelProvider.java184
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertWizard.java128
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertWizardPage.java350
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AbstractArtifactSearchQuery.java114
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AbstractLegacyArtifactSearchQuery.java52
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactSearchPage.java1206
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactTypeFilter.java102
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeFindReplaceDialog.java462
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/FilterArtifactSearchQuery.java146
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/HistoricalArtifactSearchQuery.java76
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/HridValueFilter.java100
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/IdArtifactSearch.java88
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/MaxMatchCountConfirmer.java84
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/QuickSearchOptionComposite.java1096
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/QuickSearchView.java528
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/RemoteArtifactSearch.java550
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/AbstractArtifactSearchViewPage.java50
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/ArtifactSearchLabelProvider.java560
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/ArtifactSearchPage.java1168
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/ArtifactTableContentProvider.java166
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/ArtifactTreeContentProvider.java476
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/AttributeLineElement.java202
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/AttributeMatch.java146
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/DecoratingArtifactSearchLabelProvider.java210
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/IArtifactSearchContentProvider.java44
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/skywalker/SkyWalkerArtTypeTabItem.java298
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/skywalker/SkyWalkerRelTypeTabItem.java270
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/skywalker/SkyWalkerView.java756
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/skywalker/arttype/ArtifactTypeWalker.java254
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/ArtifactTemplateProvider.java286
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/ITemplateProvider.java66
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/TemplateManager.java130
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/InterArtifactExplorerDropHandler.java298
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/ReflectArtifactStatusDialog.java66
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/ReflectContentProvider.java88
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/ReflectDecoratingLabelProvider.java96
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/TransferObject.java60
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/TransferStatus.java50
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/ArtifactDragAndDrop.java78
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/ArtifactPasteConfiguration.java84
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/DbConnectionExceptionComposite.java100
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/ElapsedTime.java62
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/FileUiUtil.java90
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/FormsUtil.java292
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/KeyEventExample.java482
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/LoadingComposite.java54
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/OseeDictionary.java306
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/PromptChangeUtil.java146
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/SkynetViews.java160
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/TransactionIdLabelProvider.java58
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/WordUiUtil.java196
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/email/EmailUserGroups.java224
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/email/EmailUtil.java124
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/filteredTree/MinMaxOSEECheckedFilteredTreeDialog.java126
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/DefaultBranchContentProvider.java168
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IArtifactStoredWidget.java88
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IArtifactWidget.java62
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IAttributeWidget.java70
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XArtifactTypeListViewer.java86
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XAttributeTypeListViewer.java98
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XBranchSelectComboWidget.java378
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XBranchSelectWidget.java406
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XBranchSelectWidgetProvider.java92
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XButtonViaAction.java68
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XCombo.java718
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XDate.java744
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XDateDam.java188
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFileTextWithSelectionDialog.java234
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFlatDam.java582
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFlatWidget.java806
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFloat.java158
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFloatDam.java160
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XLabelValue.java26
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XListDropViewer.java276
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XListViewer.java868
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XOption.java108
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XOptionHandler.java218
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XSelectFromDialog.java428
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XSelectFromMultiChoiceBranch.java80
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XSelectFromMultiChoiceDam.java224
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XStackedDam.java578
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XStackedWidget.java976
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XText.java1216
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XTextSpellCheckPaintListener.java490
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XTypeListViewer.java84
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XWidget.java840
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XWidgetUtility.java126
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XWidgetValidateUtility.java134
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/ArtifactListDialog.java178
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/ArtifactTypeFilteredTreeEntryDialog.java154
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryCheckDialog.java146
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryDialog.java638
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryDialogWithBranchSelect.java428
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryEntryDialog.java192
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/GroupListDialog.java252
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/AttributeXWidgetManager.java98
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/DefaultAttributeXWidgetProvider.java234
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/IAttributeXWidgetProvider.java48
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/IWorkDefinitionProvider.java78
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkDefinitionProvider.java112
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkFlowDefinition.java942
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkFlowDefinitionFactory.java66
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkItemAttributes.java92
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkItemDefinition.java478
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkItemDefinitionFactory.java492
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkItemWithChildrenDefinition.java190
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkPage.java538
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkPageDefinition.java240
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkRuleDefinition.java126
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkWidgetDefinition.java248
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/XWidgetFactory.java718
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchOptions.java18
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchView.java558
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchViewPresentationPreferences.java286
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchXViewer.java238
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/PolicyTableXViewerFactory.java62
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchTextFilter.java84
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchWidget.java756
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xHistory/HistoryView.java688
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xHistory/HistoryXViewer.java200
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xHistory/HistoryXViewerFactory.java158
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xHistory/XHistoryWidget.java656
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xbargraph/XBarGraphLine.java186
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xbargraph/XBarGraphLineSegment.java102
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xbargraph/XBarGraphTable.java434
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/ChangeXViewer.java230
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/ChangeXViewerFactory.java142
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/DefaultHierarchySorter.java184
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/XChangeTextFilter.java190
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeUtility.java686
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeView.java1966
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXViewer.java532
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXViewerFactory.java104
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXViewerSorter.java118
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXWidget.java1374
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/XMergeLabelProvider.java444
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xnavigate/XNavigateItemBlam.java78
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/SkynetCustomizations.java510
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/SkynetXViewerFactory.java284
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/XViewerAttributeSortDataType.java80
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerArtifactNameColumn.java124
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerArtifactTypeColumn.java150
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerAttributeColumn.java132
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerGuidColumn.java110
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerHridColumn.java128
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerLastModifiedByColumn.java126
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerLastModifiedDateColumn.java128
385 files changed, 47581 insertions, 47581 deletions
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/DialogPopupLoggerListener.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/DialogPopupLoggerListener.java
index d341e10e14b..359ef1ec63e 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/DialogPopupLoggerListener.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/DialogPopupLoggerListener.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.framework.ui.skynet;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.osee.framework.logging.ILoggerListener;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.ui.swt.Displays;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class DialogPopupLoggerListener implements ILoggerListener {
-
- @Override
- public void log(String loggerName, Level level, String message, Throwable th) {
- if (level == OseeLevel.SEVERE_POPUP) {
- String title = "OSEE Error";
- String messageText = message;
- String reasonMessage = "";
- if (th != null) {
- reasonMessage = th.getMessage();
- }
- final IStatus status;
- if (th != null) {
- List<IStatus> exc = new ArrayList<IStatus>();
- exceptionToString(true, loggerName, th, exc);
- status = new MultiStatus(loggerName, Status.ERROR, exc.toArray(new IStatus[exc.size()]), reasonMessage, th);
- } else {
- status = new Status(Status.ERROR, loggerName, -20, reasonMessage, th);
- }
- final String realTitle = title;
- final String realMessageText = messageText;
- Displays.pendInDisplayThread(new Runnable() {
- @Override
- public void run() {
- ErrorDialog.openError(Displays.getActiveShell(), realTitle, realMessageText, status);
- }
- });
- }
- }
-
- private static void exceptionToString(boolean firstTime, String loggerName, Throwable ex, List<IStatus> exc) {
- if (ex == null) {
- return;
- }
- if (!firstTime) {
- exc.add(new Status(Status.ERROR, loggerName, ex.getMessage()));
- }
- StackTraceElement st[] = ex.getStackTrace();
- for (int i = 0; i < st.length; i++) {
- StackTraceElement ste = st[i];
- exc.add(new Status(Status.ERROR, loggerName, ste.toString()));
- }
- Throwable cause = ex.getCause();
- if (cause != null) {
- exc.add(new Status(Status.ERROR, loggerName, " caused by "));
- exceptionToString(false, loggerName, cause, exc);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.osee.framework.logging.ILoggerListener;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.ui.swt.Displays;
+
+/**
+ * @author Andrew M. Finkbeiner
+ */
+public class DialogPopupLoggerListener implements ILoggerListener {
+
+ @Override
+ public void log(String loggerName, Level level, String message, Throwable th) {
+ if (level == OseeLevel.SEVERE_POPUP) {
+ String title = "OSEE Error";
+ String messageText = message;
+ String reasonMessage = "";
+ if (th != null) {
+ reasonMessage = th.getMessage();
+ }
+ final IStatus status;
+ if (th != null) {
+ List<IStatus> exc = new ArrayList<IStatus>();
+ exceptionToString(true, loggerName, th, exc);
+ status = new MultiStatus(loggerName, Status.ERROR, exc.toArray(new IStatus[exc.size()]), reasonMessage, th);
+ } else {
+ status = new Status(Status.ERROR, loggerName, -20, reasonMessage, th);
+ }
+ final String realTitle = title;
+ final String realMessageText = messageText;
+ Displays.pendInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ ErrorDialog.openError(Displays.getActiveShell(), realTitle, realMessageText, status);
+ }
+ });
+ }
+ }
+
+ private static void exceptionToString(boolean firstTime, String loggerName, Throwable ex, List<IStatus> exc) {
+ if (ex == null) {
+ return;
+ }
+ if (!firstTime) {
+ exc.add(new Status(Status.ERROR, loggerName, ex.getMessage()));
+ }
+ StackTraceElement st[] = ex.getStackTrace();
+ for (int i = 0; i < st.length; i++) {
+ StackTraceElement ste = st[i];
+ exc.add(new Status(Status.ERROR, loggerName, ste.toString()));
+ }
+ Throwable cause = ex.getCause();
+ if (cause != null) {
+ exc.add(new Status(Status.ERROR, loggerName, " caused by "));
+ exceptionToString(false, loggerName, cause, exc);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkImage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkImage.java
index 83b51405f98..302b9774b49 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkImage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/FrameworkImage.java
@@ -1,220 +1,220 @@
-/*******************************************************************************
- * Copyright (c) 2009 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.osee.framework.ui.swt.KeyedImage;
-
-/**
- * @author Ryan D. Brooks
- */
-public enum FrameworkImage implements KeyedImage {
- ACCEPT("accept.gif"),
- ADD_GREEN("add.png"),
- ARCHIVE("archive.gif"),
- ARTIFACT_EDITOR("artifact_editor.gif"),
- ARTIFACT_EXPLORER("artifact_explorer.gif"),
- ARTIFACT_IMPORT_WIZARD("artifact_import_wiz.png"),
- ARTIFACT_SEARCH("artifact_search.gif"),
- ARTIFACT_VERSION("artifact_version.gif"),
- ARROW_RIGHT_YELLOW("nav_forward.gif"),
- ARROW_UP_YELLOW("up.gif"),
- ARROW_DOWN_YELLOW("down.gif"),
- ARROW_LEFT_YELLOW("nav_backward.gif"),
- ATTRIBUTE_MOLECULE("molecule.gif"),
- ATTRIBUTE_SUB_A("attribute.gif"),
- ATTRIBUTE_DISABLED("disabled_attribute.gif"),
- APPLICATION_SERVER("appserver.gif"),
- AUTHENTICATED("authenticated.gif"),
- BACK("back.png"),
- BLAM("blam.gif"),
- BRANCH_CHANGE("branch_change.gif"),
- BRANCH("branch.gif"),
- BRANCH_SYSTEM_ROOT("branchYellow.gif"),
- BRANCH_BASELINE("baseline.gif"),
- BRANCH_CHANGE_DEST("branch_change_dest.gif"),
- BRANCH_CHANGE_SOURCE("branch_change_source.gif"),
- BRANCH_IN_CREATION_OVERLAY("waiting_ovr.gif"),
- BRANCH_MERGE("merge.gif"),
- BRANCH_WORKING("working.gif"),
- BRANCH_FAVORITE_OVERLAY("star_9_9.gif"),
- BRANCH_CHANGE_MANAGED("change_managed_branch.gif"),
- BRANCH_COMMIT("commitBranch.gif"),
- CHANGE_LOG("changelog_obj.gif"),
- CLOCK("clock.gif"),
- COLLAPSE_ALL("collapseAll.gif"),
- COMPARE_HEAD_TX("head.gif"),
- COMPARE_PARENT_BRANCH("branches.gif"),
- COMPARE_OTHER_BRANCH("branches_rep.gif"),
- CONFLICTING_Deleted("CONFLICTING_Deleted.gif"),
- CONFLICTING_Modified("CONFLICTING_Modified.gif"),
- CONFLICTING_New("CONFLICTING_New.gif"),
- COPYTOCLIPBOARD("copyToClipboard.gif"),
- CUSTOMIZE("customize.gif"),
- DELTAS("compare.GIF"),
- DELTAS_BASE_TO_HEAD_TXS("compareBaseToHeadTxs.GIF"),
- DELTAS_DIFFERENT_BRANCHES_WITH_MERGE("compareBranchesWithMerge.GIF"),
- DELTAS_DIFFERENT_BRANCHES("compareBranches.GIF"),
- DELTAS_TXS_SAME_BRANCH("compareTxs.GIF"),
- DB_ICON_BLUE("DBiconBlue.GIF"),
- DB_ICON_BLUE_EDIT("DBiconBlueEdit.GIF"),
- DELETE("delete.png"),
- DELETE_EDIT("delete_edit.gif"),
- DIRTY("dirty.gif"),
- DOCUMENT("docOrder.gif"),
- DOT_RED("red_light.gif"),
- DOT_YELLOW("yellow_light.gif"),
- DOT_GREEN("green_light.gif"),
- DUPLICATE("duplicate.gif"),
- EDIT("edit.gif"),
- EDIT2("edit2.gif"),
- EDIT_BLUE("DBiconBlueEdit.GIF"),
- EDIT_ARTIFACT("edit_artifact.gif"),
- EMAIL("email.gif"),
- ERROR("errorRound.gif"),
- ERROR_OVERLAY("error.gif"),
- EXPAND_ALL("expandAll.gif"),
- EXPORT_DATA("export_data.gif"),
- EXPORT_TABLE("export_table.gif"),
- EXCLAIM_RED("redExclaim.gif"),
- FLASHLIGHT("flashlight.gif"),
- FILTERS("filter.gif"),
- GEAR("gear.gif"),
- GREEN_PLUS("greenPlus.gif"),
- GROUP("group.gif"),
- HEADING("heading.gif"),
- HELP("help.gif"),
- IMPORT("import.gif"),
- INCOMING_ARTIFACT_DELETED("INCOMING_Deleted.gif"),
- INCOMING_DELETED("INCOMING_Deleted.gif"),
- INCOMING_INTRODUCED("INCOMING_New.gif"),
- INCOMING_MODIFIED("INCOMING_Modified.gif"),
- INCOMING_NEW("INCOMING_New.gif"),
- INFO_SM("info_sm.gif"),
- INFO_LG("info_lg.gif"),
- LASER("laser_16_16.gif"),
- LASER_OVERLAY("laser_8_8.gif"),
- LEFT_ARROW_1("leftarrow1.png"),
- LEFT_ARROW_N("leftarrowN.png"),
- LINE_MATCH("line_match.gif"),
- LOAD("load.gif"),
- LOCKED("lock.gif"),
- LOCK_OVERLAY("lock_overlay.gif"),
- LOCKED_KEY("lockkey.gif"),
- LOCKED_NO_ACCESS("red_lock.gif"),
- LOCKED_WITH_ACCESS("green_lock.gif"),
- OSEE_TYPES_LINK("link_obj.gif"),
- NOT_EQUAL("not_equal.gif"),
- NAV_BACKWARD("nav_backward.gif"),
- NAV_FORWARD("nav_forward.gif"),
- MAGNIFY("magnify.gif"),
- MERGE("merge.gif"),
- MERGE_SOURCE("green_s.gif"),
- MERGE_DEST("blue_d.gif"),
- MERGE_YELLOW_M("yellow_m.gif"),
- MERGE_START("conflict.gif"),
- MERGE_INFO("issue.gif"),
- MERGE_MARKED(PluginUiImage.CHECKBOX_ENABLED),
- MERGE_EDITED(PluginUiImage.CHECKBOX_DISABLED),
- MERGE_OUT_OF_DATE("chkbox_red.gif"),
- MERGE_OUT_OF_DATE_COMMITTED("chkbox_enabled_conflicted.gif"),
- MERGE_NO_CONFLICT("accept.gif"),
- MERGE_NOT_RESOLVEABLE("red_light.gif"),
- MERGE_SUCCESS("icon_success.gif"),
- MERGE_CAUTION("icon_warning.gif"),
- NARRITIVE("narrative.gif"),
- OPEN("open.gif"),
- OUTGOING_ARTIFACT_DELETED("OUTGOING_Deleted.gif"),
- OUTGOING_DELETED("OUTGOING_Deleted.gif"),
- OUTGOING_INTRODUCED("OUTGOING_New.gif"),
- OUTGOING_MERGED("branch_merge.gif"),
- OUTGOING_MODIFIED("OUTGOING_Modified.gif"),
- OUTGOING_NEW("OUTGOING_New.gif"),
- OUTLINE("outline_co.gif"),
- PASTE_SPECIAL_WIZ("paste_wiz.png"),
- PROBLEM("greenBug.gif"),
- PREVIEW_ARTIFACT("preview_artifact.gif"),
- PRINT("print.gif"),
- PURPLE("purple.gif"),
- RECTANGLE_16("rectangle16.gif"),
- RECTANGLE_24("rectangle24.gif"),
- RELATION("relate.gif"),
- RELOAD("reload.gif"),
- RES("res.gif"),
- REMOVE("remove.gif"),
- REMOVE_ALL("removeAll.gif"),
- REPORT("report.gif"),
- REJECT("reject.gif"),
- RIGHT_ARROW_1("rightarrow1.png"),
- RIGHT_ARROW_N("rightarrowN.png"),
- ROOT_HIERARCHY("package_obj.gif"),
- RUN_EXC("run_exc.gif"),
- PAGE("page.gif"),
- RULE("rule.gif"),
- SAVE_NEEDED("save.gif"),
- SAVED("saved.gif"),
- SAVE("save.gif"),
- SEVERITY_MAJOR("major.gif"),
- SEVERITY_MINOR("minor.gif"),
- SEVERITY_ISSUE("issue.gif"),
- SLASH_RED_OVERLAY("red_slash.gif"),
- SWITCHED("switched.gif"),
- TRASH("trash.gif"),
- TOOLS("tools.gif"),
- SKYWALKER("skywalker.gif"),
- SUPPORT("users2.gif"),
- USER("userPurple.gif"),
- USER_PURPLE("userPurple.gif"),
- USER_RED("userRed.gif"),
- USER_GREY("userGrey.gif"),
- USER_YELLOW("userYellow.gif"),
- USER_ADD("userAdd.gif"),
- USERS("users2.gif"),
- UN_ARCHIVE("unarchive.gif"),
- VERSION("version.gif"),
- WORKFLOW("workflow.gif"),
- WIDGET("widget.gif"),
- WARNING("warn.gif"),
- WARNING_OVERLAY("alert_8_8.gif"),
- WWW(PluginUiImage.URL),
- X_RED("redRemove.gif");
-
- private final String fileName;
- private final KeyedImage alias;
-
- private FrameworkImage(String fileName) {
- this.fileName = fileName;
- this.alias = null;
- }
-
- private FrameworkImage(KeyedImage alias) {
- this.fileName = alias.getImageKey();
- this.alias = alias;
- }
-
- @Override
- public ImageDescriptor createImageDescriptor() {
- if (alias == null) {
- return ImageManager.createImageDescriptor(SkynetGuiPlugin.PLUGIN_ID, "images", fileName);
- }
- return alias.createImageDescriptor();
- }
-
- @Override
- public String getImageKey() {
- if (alias == null) {
- return SkynetGuiPlugin.PLUGIN_ID + "." + fileName;
- }
- return alias.getImageKey();
- }
+/*******************************************************************************
+ * Copyright (c) 2009 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.osee.framework.ui.swt.KeyedImage;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public enum FrameworkImage implements KeyedImage {
+ ACCEPT("accept.gif"),
+ ADD_GREEN("add.png"),
+ ARCHIVE("archive.gif"),
+ ARTIFACT_EDITOR("artifact_editor.gif"),
+ ARTIFACT_EXPLORER("artifact_explorer.gif"),
+ ARTIFACT_IMPORT_WIZARD("artifact_import_wiz.png"),
+ ARTIFACT_SEARCH("artifact_search.gif"),
+ ARTIFACT_VERSION("artifact_version.gif"),
+ ARROW_RIGHT_YELLOW("nav_forward.gif"),
+ ARROW_UP_YELLOW("up.gif"),
+ ARROW_DOWN_YELLOW("down.gif"),
+ ARROW_LEFT_YELLOW("nav_backward.gif"),
+ ATTRIBUTE_MOLECULE("molecule.gif"),
+ ATTRIBUTE_SUB_A("attribute.gif"),
+ ATTRIBUTE_DISABLED("disabled_attribute.gif"),
+ APPLICATION_SERVER("appserver.gif"),
+ AUTHENTICATED("authenticated.gif"),
+ BACK("back.png"),
+ BLAM("blam.gif"),
+ BRANCH_CHANGE("branch_change.gif"),
+ BRANCH("branch.gif"),
+ BRANCH_SYSTEM_ROOT("branchYellow.gif"),
+ BRANCH_BASELINE("baseline.gif"),
+ BRANCH_CHANGE_DEST("branch_change_dest.gif"),
+ BRANCH_CHANGE_SOURCE("branch_change_source.gif"),
+ BRANCH_IN_CREATION_OVERLAY("waiting_ovr.gif"),
+ BRANCH_MERGE("merge.gif"),
+ BRANCH_WORKING("working.gif"),
+ BRANCH_FAVORITE_OVERLAY("star_9_9.gif"),
+ BRANCH_CHANGE_MANAGED("change_managed_branch.gif"),
+ BRANCH_COMMIT("commitBranch.gif"),
+ CHANGE_LOG("changelog_obj.gif"),
+ CLOCK("clock.gif"),
+ COLLAPSE_ALL("collapseAll.gif"),
+ COMPARE_HEAD_TX("head.gif"),
+ COMPARE_PARENT_BRANCH("branches.gif"),
+ COMPARE_OTHER_BRANCH("branches_rep.gif"),
+ CONFLICTING_Deleted("CONFLICTING_Deleted.gif"),
+ CONFLICTING_Modified("CONFLICTING_Modified.gif"),
+ CONFLICTING_New("CONFLICTING_New.gif"),
+ COPYTOCLIPBOARD("copyToClipboard.gif"),
+ CUSTOMIZE("customize.gif"),
+ DELTAS("compare.GIF"),
+ DELTAS_BASE_TO_HEAD_TXS("compareBaseToHeadTxs.GIF"),
+ DELTAS_DIFFERENT_BRANCHES_WITH_MERGE("compareBranchesWithMerge.GIF"),
+ DELTAS_DIFFERENT_BRANCHES("compareBranches.GIF"),
+ DELTAS_TXS_SAME_BRANCH("compareTxs.GIF"),
+ DB_ICON_BLUE("DBiconBlue.GIF"),
+ DB_ICON_BLUE_EDIT("DBiconBlueEdit.GIF"),
+ DELETE("delete.png"),
+ DELETE_EDIT("delete_edit.gif"),
+ DIRTY("dirty.gif"),
+ DOCUMENT("docOrder.gif"),
+ DOT_RED("red_light.gif"),
+ DOT_YELLOW("yellow_light.gif"),
+ DOT_GREEN("green_light.gif"),
+ DUPLICATE("duplicate.gif"),
+ EDIT("edit.gif"),
+ EDIT2("edit2.gif"),
+ EDIT_BLUE("DBiconBlueEdit.GIF"),
+ EDIT_ARTIFACT("edit_artifact.gif"),
+ EMAIL("email.gif"),
+ ERROR("errorRound.gif"),
+ ERROR_OVERLAY("error.gif"),
+ EXPAND_ALL("expandAll.gif"),
+ EXPORT_DATA("export_data.gif"),
+ EXPORT_TABLE("export_table.gif"),
+ EXCLAIM_RED("redExclaim.gif"),
+ FLASHLIGHT("flashlight.gif"),
+ FILTERS("filter.gif"),
+ GEAR("gear.gif"),
+ GREEN_PLUS("greenPlus.gif"),
+ GROUP("group.gif"),
+ HEADING("heading.gif"),
+ HELP("help.gif"),
+ IMPORT("import.gif"),
+ INCOMING_ARTIFACT_DELETED("INCOMING_Deleted.gif"),
+ INCOMING_DELETED("INCOMING_Deleted.gif"),
+ INCOMING_INTRODUCED("INCOMING_New.gif"),
+ INCOMING_MODIFIED("INCOMING_Modified.gif"),
+ INCOMING_NEW("INCOMING_New.gif"),
+ INFO_SM("info_sm.gif"),
+ INFO_LG("info_lg.gif"),
+ LASER("laser_16_16.gif"),
+ LASER_OVERLAY("laser_8_8.gif"),
+ LEFT_ARROW_1("leftarrow1.png"),
+ LEFT_ARROW_N("leftarrowN.png"),
+ LINE_MATCH("line_match.gif"),
+ LOAD("load.gif"),
+ LOCKED("lock.gif"),
+ LOCK_OVERLAY("lock_overlay.gif"),
+ LOCKED_KEY("lockkey.gif"),
+ LOCKED_NO_ACCESS("red_lock.gif"),
+ LOCKED_WITH_ACCESS("green_lock.gif"),
+ OSEE_TYPES_LINK("link_obj.gif"),
+ NOT_EQUAL("not_equal.gif"),
+ NAV_BACKWARD("nav_backward.gif"),
+ NAV_FORWARD("nav_forward.gif"),
+ MAGNIFY("magnify.gif"),
+ MERGE("merge.gif"),
+ MERGE_SOURCE("green_s.gif"),
+ MERGE_DEST("blue_d.gif"),
+ MERGE_YELLOW_M("yellow_m.gif"),
+ MERGE_START("conflict.gif"),
+ MERGE_INFO("issue.gif"),
+ MERGE_MARKED(PluginUiImage.CHECKBOX_ENABLED),
+ MERGE_EDITED(PluginUiImage.CHECKBOX_DISABLED),
+ MERGE_OUT_OF_DATE("chkbox_red.gif"),
+ MERGE_OUT_OF_DATE_COMMITTED("chkbox_enabled_conflicted.gif"),
+ MERGE_NO_CONFLICT("accept.gif"),
+ MERGE_NOT_RESOLVEABLE("red_light.gif"),
+ MERGE_SUCCESS("icon_success.gif"),
+ MERGE_CAUTION("icon_warning.gif"),
+ NARRITIVE("narrative.gif"),
+ OPEN("open.gif"),
+ OUTGOING_ARTIFACT_DELETED("OUTGOING_Deleted.gif"),
+ OUTGOING_DELETED("OUTGOING_Deleted.gif"),
+ OUTGOING_INTRODUCED("OUTGOING_New.gif"),
+ OUTGOING_MERGED("branch_merge.gif"),
+ OUTGOING_MODIFIED("OUTGOING_Modified.gif"),
+ OUTGOING_NEW("OUTGOING_New.gif"),
+ OUTLINE("outline_co.gif"),
+ PASTE_SPECIAL_WIZ("paste_wiz.png"),
+ PROBLEM("greenBug.gif"),
+ PREVIEW_ARTIFACT("preview_artifact.gif"),
+ PRINT("print.gif"),
+ PURPLE("purple.gif"),
+ RECTANGLE_16("rectangle16.gif"),
+ RECTANGLE_24("rectangle24.gif"),
+ RELATION("relate.gif"),
+ RELOAD("reload.gif"),
+ RES("res.gif"),
+ REMOVE("remove.gif"),
+ REMOVE_ALL("removeAll.gif"),
+ REPORT("report.gif"),
+ REJECT("reject.gif"),
+ RIGHT_ARROW_1("rightarrow1.png"),
+ RIGHT_ARROW_N("rightarrowN.png"),
+ ROOT_HIERARCHY("package_obj.gif"),
+ RUN_EXC("run_exc.gif"),
+ PAGE("page.gif"),
+ RULE("rule.gif"),
+ SAVE_NEEDED("save.gif"),
+ SAVED("saved.gif"),
+ SAVE("save.gif"),
+ SEVERITY_MAJOR("major.gif"),
+ SEVERITY_MINOR("minor.gif"),
+ SEVERITY_ISSUE("issue.gif"),
+ SLASH_RED_OVERLAY("red_slash.gif"),
+ SWITCHED("switched.gif"),
+ TRASH("trash.gif"),
+ TOOLS("tools.gif"),
+ SKYWALKER("skywalker.gif"),
+ SUPPORT("users2.gif"),
+ USER("userPurple.gif"),
+ USER_PURPLE("userPurple.gif"),
+ USER_RED("userRed.gif"),
+ USER_GREY("userGrey.gif"),
+ USER_YELLOW("userYellow.gif"),
+ USER_ADD("userAdd.gif"),
+ USERS("users2.gif"),
+ UN_ARCHIVE("unarchive.gif"),
+ VERSION("version.gif"),
+ WORKFLOW("workflow.gif"),
+ WIDGET("widget.gif"),
+ WARNING("warn.gif"),
+ WARNING_OVERLAY("alert_8_8.gif"),
+ WWW(PluginUiImage.URL),
+ X_RED("redRemove.gif");
+
+ private final String fileName;
+ private final KeyedImage alias;
+
+ private FrameworkImage(String fileName) {
+ this.fileName = fileName;
+ this.alias = null;
+ }
+
+ private FrameworkImage(KeyedImage alias) {
+ this.fileName = alias.getImageKey();
+ this.alias = alias;
+ }
+
+ @Override
+ public ImageDescriptor createImageDescriptor() {
+ if (alias == null) {
+ return ImageManager.createImageDescriptor(SkynetGuiPlugin.PLUGIN_ID, "images", fileName);
+ }
+ return alias.createImageDescriptor();
+ }
+
+ @Override
+ public String getImageKey() {
+ if (alias == null) {
+ return SkynetGuiPlugin.PLUGIN_ID + "." + fileName;
+ }
+ return alias.getImageKey();
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/GenerateTypeEnumAction.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/GenerateTypeEnumAction.java
index 7d03e32ee84..67099293020 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/GenerateTypeEnumAction.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/GenerateTypeEnumAction.java
@@ -1,167 +1,167 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osee.framework.database.init.SkynetTypesEnumGenerator;
-import org.eclipse.osee.framework.ui.ws.AWorkspace;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.IActionDelegate;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.CheckedTreeSelectionDialog;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-public class GenerateTypeEnumAction implements IActionDelegate {
-
- public GenerateTypeEnumAction() {
- super();
- }
-
- @SuppressWarnings("unchecked")
- public void run(IAction action) {
- try {
- StructuredSelection sel = AWorkspace.getSelection();
- Iterator i = sel.iterator();
- File selection = null;
- while (i.hasNext()) {
- Object obj = i.next();
- if (obj instanceof IResource) {
- IResource resource = (IResource) obj;
- if (resource != null) {
- selection = resource.getLocation().toFile();
- if (selection != null) {
-
- Object destinationObj = getFolderToStoreAutoGenFilesIn(resource);
- if (destinationObj instanceof IContainer) {
- IContainer destinationFolder = (IContainer) destinationObj;
- File storeAt = destinationFolder.getLocation().toFile();
- SkynetTypesEnumGenerator gen = new SkynetTypesEnumGenerator();
- gen.extractTypesFromSheet(selection, storeAt);
- gen.finish();
-
- destinationFolder.refreshLocal(IResource.DEPTH_INFINITE, null);
- }
- }
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private Object getFolderToStoreAutoGenFilesIn(IResource resource) {
- CheckedTreeSelectionDialog resourceDialog =
- new ResourceSelectionTree(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
- new WorkbenchLabelProvider(), new WorkbenchContentProvider());
-
- resourceDialog.setInput(resource.getWorkspace().getRoot());
- resourceDialog.addFilter(new ViewerFilter() {
-
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- IResource resource = null;
- if (element instanceof IContainer) {
- IContainer container = (IContainer) element;
- String name = container.getName();
- if (name.startsWith(".") == false && name.equals("bin") == false) {
- resource = container;
- }
- }
- if (resource != null) {
- return true;
- }
- return false;
- }
- });
- resourceDialog.setMessage("Select where Auto-Generated classes should be stored.");
- resourceDialog.setTitle("Select Destination");
- resourceDialog.setEmptyListMessage("No Projects Available");
- IContainer container = resource.getParent();
- resourceDialog.setInitialSelection(container);
- List<Object> expand = new ArrayList<Object>();
- expand.add(container);
- if (container.getParent() != null) {
- expand.add(container.getParent());
- }
- resourceDialog.setExpandedElements(expand.toArray(new Object[expand.size()]));
- int result = resourceDialog.open();
- return result != Window.CANCEL ? resourceDialog.getFirstResult() : null;
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
- private final class ResourceSelectionTree extends CheckedTreeSelectionDialog {
-
- public ResourceSelectionTree(Shell parent, ILabelProvider labelProvider, ITreeContentProvider contentProvider) {
- super(parent, labelProvider, contentProvider);
- }
-
- protected Control createDialogArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- applyDialogFont(composite);
-
- Label messageLabel = createMessageArea(composite);
- CheckboxTreeViewer treeViewer = createTreeViewer(composite);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = convertWidthInCharsToPixels(80);
- data.heightHint = convertHeightInCharsToPixels(16);
- Tree treeWidget = treeViewer.getTree();
- treeViewer.addCheckStateListener(new ICheckStateListener() {
-
- public void checkStateChanged(CheckStateChangedEvent event) {
- boolean wasChecked = event.getChecked();
- getTreeViewer().setAllChecked(false);
- event.getCheckable().setChecked(event.getElement(), wasChecked);
- }
-
- });
- treeWidget.setLayoutData(data);
- treeWidget.setFont(parent.getFont());
- messageLabel.setEnabled(true);
- treeWidget.setEnabled(true);
- return composite;
- }
- };
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.window.Window;
+import org.eclipse.osee.framework.database.init.SkynetTypesEnumGenerator;
+import org.eclipse.osee.framework.ui.ws.AWorkspace;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.IActionDelegate;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.CheckedTreeSelectionDialog;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+
+public class GenerateTypeEnumAction implements IActionDelegate {
+
+ public GenerateTypeEnumAction() {
+ super();
+ }
+
+ @SuppressWarnings("unchecked")
+ public void run(IAction action) {
+ try {
+ StructuredSelection sel = AWorkspace.getSelection();
+ Iterator i = sel.iterator();
+ File selection = null;
+ while (i.hasNext()) {
+ Object obj = i.next();
+ if (obj instanceof IResource) {
+ IResource resource = (IResource) obj;
+ if (resource != null) {
+ selection = resource.getLocation().toFile();
+ if (selection != null) {
+
+ Object destinationObj = getFolderToStoreAutoGenFilesIn(resource);
+ if (destinationObj instanceof IContainer) {
+ IContainer destinationFolder = (IContainer) destinationObj;
+ File storeAt = destinationFolder.getLocation().toFile();
+ SkynetTypesEnumGenerator gen = new SkynetTypesEnumGenerator();
+ gen.extractTypesFromSheet(selection, storeAt);
+ gen.finish();
+
+ destinationFolder.refreshLocal(IResource.DEPTH_INFINITE, null);
+ }
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private Object getFolderToStoreAutoGenFilesIn(IResource resource) {
+ CheckedTreeSelectionDialog resourceDialog =
+ new ResourceSelectionTree(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
+ new WorkbenchLabelProvider(), new WorkbenchContentProvider());
+
+ resourceDialog.setInput(resource.getWorkspace().getRoot());
+ resourceDialog.addFilter(new ViewerFilter() {
+
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ IResource resource = null;
+ if (element instanceof IContainer) {
+ IContainer container = (IContainer) element;
+ String name = container.getName();
+ if (name.startsWith(".") == false && name.equals("bin") == false) {
+ resource = container;
+ }
+ }
+ if (resource != null) {
+ return true;
+ }
+ return false;
+ }
+ });
+ resourceDialog.setMessage("Select where Auto-Generated classes should be stored.");
+ resourceDialog.setTitle("Select Destination");
+ resourceDialog.setEmptyListMessage("No Projects Available");
+ IContainer container = resource.getParent();
+ resourceDialog.setInitialSelection(container);
+ List<Object> expand = new ArrayList<Object>();
+ expand.add(container);
+ if (container.getParent() != null) {
+ expand.add(container.getParent());
+ }
+ resourceDialog.setExpandedElements(expand.toArray(new Object[expand.size()]));
+ int result = resourceDialog.open();
+ return result != Window.CANCEL ? resourceDialog.getFirstResult() : null;
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+ private final class ResourceSelectionTree extends CheckedTreeSelectionDialog {
+
+ public ResourceSelectionTree(Shell parent, ILabelProvider labelProvider, ITreeContentProvider contentProvider) {
+ super(parent, labelProvider, contentProvider);
+ }
+
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ applyDialogFont(composite);
+
+ Label messageLabel = createMessageArea(composite);
+ CheckboxTreeViewer treeViewer = createTreeViewer(composite);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.widthHint = convertWidthInCharsToPixels(80);
+ data.heightHint = convertHeightInCharsToPixels(16);
+ Tree treeWidget = treeViewer.getTree();
+ treeViewer.addCheckStateListener(new ICheckStateListener() {
+
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ boolean wasChecked = event.getChecked();
+ getTreeViewer().setAllChecked(false);
+ event.getCheckable().setChecked(event.getElement(), wasChecked);
+ }
+
+ });
+ treeWidget.setLayoutData(data);
+ treeWidget.setFont(parent.getFont());
+ messageLabel.setEnabled(true);
+ treeWidget.setEnabled(true);
+ return composite;
+ }
+ };
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/IArtifactDecoratorPreferences.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/IArtifactDecoratorPreferences.java
index ca776430d91..4d1a3aae20f 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/IArtifactDecoratorPreferences.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/IArtifactDecoratorPreferences.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.framework.ui.skynet;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-
-/**
- * @author Roberto E. Escobar
- */
-public interface IArtifactDecoratorPreferences {
-
- public String getSelectedAttributeData(Artifact artifact) throws OseeCoreException;
-
- public boolean showArtIds();
-
- public boolean showArtType();
-
- public boolean showArtBranch();
-
- public boolean showArtVersion();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet;
+
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface IArtifactDecoratorPreferences {
+
+ public String getSelectedAttributeData(Artifact artifact) throws OseeCoreException;
+
+ public boolean showArtIds();
+
+ public boolean showArtType();
+
+ public boolean showArtBranch();
+
+ public boolean showArtVersion();
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/IArtifactExplorerEventHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/IArtifactExplorerEventHandler.java
index def8e0f3dc9..940bc1442e8 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/IArtifactExplorerEventHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/IArtifactExplorerEventHandler.java
@@ -1,18 +1,18 @@
-/*
- * Created on Jun 30, 2010
- *
- * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
- */
-package org.eclipse.osee.framework.ui.skynet;
-
-
-/**
- * @author Donald G. Dunne
- */
-public interface IArtifactExplorerEventHandler {
-
- public ArtifactExplorer getArtifactExplorer();
-
- public boolean isDisposed();
-
-}
+/*
+ * Created on Jun 30, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.ui.skynet;
+
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IArtifactExplorerEventHandler {
+
+ public ArtifactExplorer getArtifactExplorer();
+
+ public boolean isDisposed();
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactImportPage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactImportPage.java
index 291ed0a670e..d0fc118c6a7 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactImportPage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/ArtifactImportPage.java
@@ -1,532 +1,532 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.Import;
-
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.ArtifactType;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-import org.eclipse.osee.framework.core.operation.CompositeOperation;
-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.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.search.ArtifactQuery;
-import org.eclipse.osee.framework.skynet.core.importing.ArtifactExtractorContributionManager;
-import org.eclipse.osee.framework.skynet.core.importing.RoughArtifact;
-import org.eclipse.osee.framework.skynet.core.importing.RoughArtifactKind;
-import org.eclipse.osee.framework.skynet.core.importing.operations.FilterArtifactTypesByAttributeTypes;
-import org.eclipse.osee.framework.skynet.core.importing.operations.RoughArtifactCollector;
-import org.eclipse.osee.framework.skynet.core.importing.operations.SourceToRoughArtifactOperation;
-import org.eclipse.osee.framework.skynet.core.importing.parsers.IArtifactExtractor;
-import org.eclipse.osee.framework.skynet.core.importing.parsers.IArtifactExtractorDelegate;
-import org.eclipse.osee.framework.ui.plugin.util.DirectoryOrFileSelector;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.panels.ArtifactExtractorSelectPanel;
-import org.eclipse.osee.framework.ui.skynet.panels.ArtifactSelectPanel;
-import org.eclipse.osee.framework.ui.skynet.panels.ArtifactTypeSelectPanel;
-import org.eclipse.osee.framework.ui.skynet.panels.AttributeTypeSelectPanel;
-import org.eclipse.osee.framework.ui.swt.ALayout;
-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.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.dialogs.WizardDataTransferPage;
-
-/**
- * @author Ryan C. Schmitt
- * @author Roberto E. Escobar
- */
-public class ArtifactImportPage extends WizardDataTransferPage {
-
- private static final String PAGE_NAME = "osee.define.wizardPage.artifactImportPage";
-
- private DirectoryOrFileSelector directoryFileSelector;
- private File defaultSourceFile;
- private Button updateExistingArtifacts;
- private Button updateByGuid;
- private Button deleteUnmatchedArtifacts;
-
- private final ArtifactSelectPanel artifactSelectPanel;
- private final ArtifactExtractorSelectPanel parserSelectPanel;
- private final ArtifactTypeSelectPanel artifactTypeSelectPanel;
- private final AttributeTypeSelectPanel attributeTypeSelectPanel;
- private final RoughArtifactCollector collector;
- private final ArtifactExtractorContributionManager importContributionManager;
- private final SelectionLatch selectionLatch;
- private final Collection<ArtifactType> selectedArtifactTypes;
-
- protected ArtifactImportPage() {
- super(PAGE_NAME);
- selectedArtifactTypes = new ArrayList<ArtifactType>();
- selectionLatch = new SelectionLatch();
- collector = new RoughArtifactCollector(new RoughArtifact(RoughArtifactKind.PRIMARY));
- artifactSelectPanel = new ArtifactSelectPanel();
- artifactSelectPanel.setDialogTitle("Select Destination Artifact");
- artifactSelectPanel.setDialogMessage("Select a destination artifact. Imported items will be added as children of the selected artifact.");
-
- artifactTypeSelectPanel = new ArtifactTypeSelectPanel();
- artifactTypeSelectPanel.setDialogTitle("Import as Artifact Type");
- artifactTypeSelectPanel.setDialogMessage("Select what artifact type data should be imported as.");
-
- attributeTypeSelectPanel = new AttributeTypeSelectPanel();
- attributeTypeSelectPanel.setDialogTitle("Select Attribute Types");
- attributeTypeSelectPanel.setDialogMessage("Select which attribute types should be used to match imported and existing artifacts.");
-
- importContributionManager = new ArtifactExtractorContributionManager();
- parserSelectPanel = new ArtifactExtractorSelectPanel(importContributionManager);
-
- setTitle("Import artifacts into OSEE");
- setDescription("Import artifacts into Define");
- setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.ARTIFACT_IMPORT_WIZARD));
-
- }
-
- public RoughArtifactCollector getCollectedArtifacts() {
- return collector;
- }
-
- public void setDefaultSourceFile(File resource) {
- this.defaultSourceFile = resource;
- }
-
- public void setDefaultDestinationArtifact(Artifact destinationArtifact) {
- artifactSelectPanel.setDefaultItem(destinationArtifact);
- }
-
- public Artifact getDefaultDestinationArtifact() {
- return artifactSelectPanel.getDefaultItem();
- }
-
- public File getDefaultSourceFile() {
- return defaultSourceFile;
- }
-
- @Override
- protected boolean allowNewContainerName() {
- return false;
- }
-
- @Override
- public void handleEvent(Event arg0) {
- updateWidgetEnablements();
- updateExtractedElements();
- updatePageCompletion();
- }
-
- @Override
- public void createControl(Composite parent) {
- initializeDialogUnits(parent);
-
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout(1, false));
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- composite.setFont(parent.getFont());
-
- createDestinationArtifactSelectArea(composite);
- createSourceFileArea(composite);
- createParserSelectionArea(composite);
- createArtifactTypeSelectArea(composite);
- createNonChangingAttributeTypeSelectArea(composite);
-
- restoreWidgetValues();
- updateWidgetEnablements();
- setPageComplete(determinePageCompletion());
- setControl(composite);
- selectionLatch.setCurrentValues(getDestinationArtifact(), getSourceFile(), getArtifactParser());
- selectionLatch.latch();
- }
-
- private void createDestinationArtifactSelectArea(Composite parent) {
- Label selectParentInstructions = new Label(parent, SWT.NONE);
- selectParentInstructions.setText("Select parent artifact:");
-
- artifactSelectPanel.createControl(parent);
- artifactSelectPanel.addListener(this);
- }
-
- private void createSourceFileArea(Composite parent) {
- directoryFileSelector = new DirectoryOrFileSelector(parent, SWT.NONE, "Import Source", this);
- if (defaultSourceFile == null) {
- directoryFileSelector.setDirectorySelected(true);
- } else {
- directoryFileSelector.setDirectorySelected(!defaultSourceFile.isFile());
- directoryFileSelector.setText(defaultSourceFile.getAbsolutePath());
- }
- directoryFileSelector.addListener(SWT.Selection, this);
- }
-
- private void createParserSelectionArea(Composite parent) {
- Group composite = new Group(parent, SWT.NONE);
- composite.setText("Select Parser");
- composite.setLayout(new GridLayout(1, false));
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- Label selectParserInstructions = new Label(composite, SWT.NONE);
- selectParserInstructions.setText("Select the method to be used for importing the selected file or directory:");
-
- parserSelectPanel.addListener(this);
- parserSelectPanel.createControl(composite);
- }
-
- private void createArtifactTypeSelectArea(Composite parent) {
- Label selectArtifactTypeInstructions = new Label(parent, SWT.NONE);
- selectArtifactTypeInstructions.setText("Select artifact type for imported data:");
-
- artifactTypeSelectPanel.createControl(parent);
- artifactTypeSelectPanel.addListener(this);
- }
-
- private void createNonChangingAttributeTypeSelectArea(Composite parent) {
- Group group = new Group(parent, SWT.NONE);
- group.setText("Options");
- group.setLayout(new GridLayout(1, false));
- group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- Composite updateComp = new Composite(group, SWT.NULL);
- updateComp.setLayout(ALayout.getZeroMarginLayout(2, false));
- updateComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- updateExistingArtifacts = new Button(updateComp, SWT.CHECK);
- updateExistingArtifacts.setText("Update existing child artifacts");
- updateExistingArtifacts.setToolTipText("All imported artifacts will be checked against the root\n" + "import artifact and the content will be placed on the artifact\n" + "that has the same identifying attributes and level from the root");
- updateExistingArtifacts.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
- updateExistingArtifacts.setSelection(false);
-
- updateByGuid = new Button(updateComp, SWT.CHECK);
- updateByGuid.setText("by GUID");
- updateByGuid.setToolTipText("Match imported artifacts based on user-supplied GUIDs");
- updateByGuid.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
- updateByGuid.setSelection(false);
- updateByGuid.setEnabled(false);
-
- deleteUnmatchedArtifacts = new Button(group, SWT.CHECK);
- deleteUnmatchedArtifacts.setText("Delete unmatched artifacts");
- deleteUnmatchedArtifacts.setToolTipText("Any child artifacts that cannot be matched to an imported artifact will be deleted.");
- deleteUnmatchedArtifacts.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
- deleteUnmatchedArtifacts.setSelection(false);
- deleteUnmatchedArtifacts.setEnabled(false);
-
- final Composite composite = new Composite(group, SWT.NONE);
- composite.setLayout(ALayout.getZeroMarginLayout(1, false));
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- composite.setEnabled(false);
- attributeTypeSelectPanel.createControl(composite);
- attributeTypeSelectPanel.addListener(this);
-
- updateExistingArtifacts.addListener(SWT.Selection, this);
- updateExistingArtifacts.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isNowSelected = updateExistingArtifacts.getSelection();
- widgetEnabledHelper(composite, isNowSelected);
- deleteUnmatchedArtifacts.setEnabled(isNowSelected);
- deleteUnmatchedArtifacts.setSelection(false);
- updateByGuid.setEnabled(isNowSelected);
- updateByGuid.setSelection(false);
- }
- });
- updateByGuid.addListener(SWT.Selection, this);
- widgetEnabledHelper(composite, false);
- }
-
- private void widgetEnabledHelper(Control control, boolean isEnabled) {
- control.setEnabled(isEnabled);
- if (control instanceof Composite) {
- for (Control child : ((Composite) control).getChildren()) {
- widgetEnabledHelper(child, isEnabled);
- }
- }
- }
-
- private boolean isUpdateExistingSelected() {
- return updateExistingArtifacts.getSelection();
- }
-
- private boolean isUpdateByGuidSelected() {
- return updateByGuid.getSelection();
- }
-
- public boolean isDeleteUnmatchedSelected() {
- return deleteUnmatchedArtifacts.getSelection();
- }
-
- public MatchingStrategy getMatchingStrategy() {
- if (isUpdateExistingSelected() && isUpdateByGuidSelected()) {
- return MatchingStrategy.GUID;
- } else if (isUpdateExistingSelected()) {
- return MatchingStrategy.ATTRIBUTE;
- } else {
- return MatchingStrategy.NONE;
- }
- }
-
- public boolean isDirectory() {
- boolean result = false;
- if (Widgets.isAccessible(directoryFileSelector)) {
- result = directoryFileSelector.isDirectorySelected();
- }
- return result;
- }
-
- public File getSourceFile() {
- File sourceFile = null;
- if (Widgets.isAccessible(directoryFileSelector)) {
- sourceFile = directoryFileSelector.getFile();
- }
- return sourceFile;
- }
-
- private IArtifactExtractor getArtifactParser() {
- return parserSelectPanel.getArtifactExtractor();
- }
-
- public Artifact getDestinationArtifact() {
- return artifactSelectPanel.getSelected();
- }
-
- public ArtifactType getArtifactType() {
- return artifactTypeSelectPanel.getSelected();
- }
-
- public Collection<AttributeType> getNonChangingAttributes() {
- return attributeTypeSelectPanel.getSelected();
- }
-
- @Override
- protected boolean validateSourceGroup() {
- return getSourceFile() != null;
- }
-
- @Override
- protected boolean validateDestinationGroup() {
- return getDestinationArtifact() != null;
- }
-
- @Override
- protected boolean validateOptionsGroup() {
- return getArtifactParser() != null && //
- selectionLatch.areSelectionsValid() && !selectionLatch.hasChanged() && //
- getArtifactType() != null && //
- (!updateExistingArtifacts.getSelection() || updateByGuid.getSelection() || getNonChangingAttributes() != null);
- }
-
- @Override
- protected void restoreWidgetValues() {
- super.restoreWidgetValues();
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- if (getDefaultSourceFile() == null) {
- directoryFileSelector.setDirectorySelected(settings.getBoolean("isDirectory"));
- String file = settings.get("source.file");
- if (Strings.isValid(file)) {
- directoryFileSelector.setText(file);
- }
- }
-
- String parser = settings.get("selected.parser");
- if (Strings.isValid(parser)) {
- for (IArtifactExtractor item : importContributionManager.getExtractors()) {
- if (parser.equals(item.getClass().getSimpleName())) {
- parserSelectPanel.setArtifactExtractor(item);
- }
- }
- }
- if (getDefaultDestinationArtifact() == null) {
- String guid = settings.get("destination.artifact.guid");
- String branch = settings.get("destination.branch.guid");
-
- if (Strings.isValid(guid) && Strings.isValid(branch)) {
- try {
- Artifact artifact = ArtifactQuery.getArtifactFromId(guid, BranchManager.getBranchByGuid(branch));
- artifactSelectPanel.setDefaultItem(artifact);
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, String.format(
- "Unable to restore destination artifact- guid:[%s] branch guid:[%s]", guid, branch));
- }
- }
- }
-
- boolean toUpdate = settings.getBoolean("is.update.existing.selected");
- updateExistingArtifacts.setSelection(toUpdate);
- deleteUnmatchedArtifacts.setEnabled(toUpdate);
- if (toUpdate) {
- try {
- attributeTypeSelectPanel.setAllowedAttributeTypes(getArtifactType().getAttributeTypes(
- getDestinationArtifact().getBranch()));
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex.getLocalizedMessage());
- }
- } else {
- attributeTypeSelectPanel.setAllowedAttributeTypes(new ArrayList<AttributeType>());
- }
- }
- }
-
- @Override
- protected void saveWidgetValues() {
- super.saveWidgetValues();
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
-
- settings.put("isDirectory", isDirectory());
-
- File file = getSourceFile();
- if (file != null) {
- settings.put("source.file", getSourceFile().getAbsolutePath());
- }
-
- IArtifactExtractor parser = getArtifactParser();
- if (parser != null) {
- settings.put("selected.parser", parser.getClass().getSimpleName());
- }
-
- Artifact artifact = getDestinationArtifact();
- if (artifact != null) {
- settings.put("destination.artifact.guid", artifact.getGuid());
- settings.put("destination.branch.guid", artifact.getBranch().getGuid());
- }
- settings.put("is.update.existing.selected", isUpdateExistingSelected());
- }
- }
-
- private synchronized void updateExtractedElements() {
- selectionLatch.setCurrentValues(getDestinationArtifact(), getSourceFile(), getArtifactParser());
- if (selectionLatch.areSelectionsValid()) {
- selectionLatch.latch();
-
- collector.reset();
-
- final Artifact destinationArtifact = selectionLatch.currentSelected.destinationArtifact;
- final File sourceFile = selectionLatch.currentSelected.sourceFile;
- final IArtifactExtractor extractor = selectionLatch.currentSelected.extractor;
-
- Collection<IOperation> ops = new ArrayList<IOperation>();
- ops.add(new SourceToRoughArtifactOperation(extractor, sourceFile, collector));
- ops.add(new FilterArtifactTypesByAttributeTypes(destinationArtifact.getBranch(), collector,
- selectedArtifactTypes));
- selectedArtifactTypes.clear();
- if (executeOperation(new CompositeOperation("Extracting data from source", SkynetGuiPlugin.PLUGIN_ID, ops))) {
- artifactTypeSelectPanel.setAllowedArtifactTypes(selectedArtifactTypes);
- try {
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.Import;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.logging.Level;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.type.ArtifactType;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.core.operation.CompositeOperation;
+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.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.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.importing.ArtifactExtractorContributionManager;
+import org.eclipse.osee.framework.skynet.core.importing.RoughArtifact;
+import org.eclipse.osee.framework.skynet.core.importing.RoughArtifactKind;
+import org.eclipse.osee.framework.skynet.core.importing.operations.FilterArtifactTypesByAttributeTypes;
+import org.eclipse.osee.framework.skynet.core.importing.operations.RoughArtifactCollector;
+import org.eclipse.osee.framework.skynet.core.importing.operations.SourceToRoughArtifactOperation;
+import org.eclipse.osee.framework.skynet.core.importing.parsers.IArtifactExtractor;
+import org.eclipse.osee.framework.skynet.core.importing.parsers.IArtifactExtractorDelegate;
+import org.eclipse.osee.framework.ui.plugin.util.DirectoryOrFileSelector;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.panels.ArtifactExtractorSelectPanel;
+import org.eclipse.osee.framework.ui.skynet.panels.ArtifactSelectPanel;
+import org.eclipse.osee.framework.ui.skynet.panels.ArtifactTypeSelectPanel;
+import org.eclipse.osee.framework.ui.skynet.panels.AttributeTypeSelectPanel;
+import org.eclipse.osee.framework.ui.swt.ALayout;
+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.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.dialogs.WizardDataTransferPage;
+
+/**
+ * @author Ryan C. Schmitt
+ * @author Roberto E. Escobar
+ */
+public class ArtifactImportPage extends WizardDataTransferPage {
+
+ private static final String PAGE_NAME = "osee.define.wizardPage.artifactImportPage";
+
+ private DirectoryOrFileSelector directoryFileSelector;
+ private File defaultSourceFile;
+ private Button updateExistingArtifacts;
+ private Button updateByGuid;
+ private Button deleteUnmatchedArtifacts;
+
+ private final ArtifactSelectPanel artifactSelectPanel;
+ private final ArtifactExtractorSelectPanel parserSelectPanel;
+ private final ArtifactTypeSelectPanel artifactTypeSelectPanel;
+ private final AttributeTypeSelectPanel attributeTypeSelectPanel;
+ private final RoughArtifactCollector collector;
+ private final ArtifactExtractorContributionManager importContributionManager;
+ private final SelectionLatch selectionLatch;
+ private final Collection<ArtifactType> selectedArtifactTypes;
+
+ protected ArtifactImportPage() {
+ super(PAGE_NAME);
+ selectedArtifactTypes = new ArrayList<ArtifactType>();
+ selectionLatch = new SelectionLatch();
+ collector = new RoughArtifactCollector(new RoughArtifact(RoughArtifactKind.PRIMARY));
+ artifactSelectPanel = new ArtifactSelectPanel();
+ artifactSelectPanel.setDialogTitle("Select Destination Artifact");
+ artifactSelectPanel.setDialogMessage("Select a destination artifact. Imported items will be added as children of the selected artifact.");
+
+ artifactTypeSelectPanel = new ArtifactTypeSelectPanel();
+ artifactTypeSelectPanel.setDialogTitle("Import as Artifact Type");
+ artifactTypeSelectPanel.setDialogMessage("Select what artifact type data should be imported as.");
+
+ attributeTypeSelectPanel = new AttributeTypeSelectPanel();
+ attributeTypeSelectPanel.setDialogTitle("Select Attribute Types");
+ attributeTypeSelectPanel.setDialogMessage("Select which attribute types should be used to match imported and existing artifacts.");
+
+ importContributionManager = new ArtifactExtractorContributionManager();
+ parserSelectPanel = new ArtifactExtractorSelectPanel(importContributionManager);
+
+ setTitle("Import artifacts into OSEE");
+ setDescription("Import artifacts into Define");
+ setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.ARTIFACT_IMPORT_WIZARD));
+
+ }
+
+ public RoughArtifactCollector getCollectedArtifacts() {
+ return collector;
+ }
+
+ public void setDefaultSourceFile(File resource) {
+ this.defaultSourceFile = resource;
+ }
+
+ public void setDefaultDestinationArtifact(Artifact destinationArtifact) {
+ artifactSelectPanel.setDefaultItem(destinationArtifact);
+ }
+
+ public Artifact getDefaultDestinationArtifact() {
+ return artifactSelectPanel.getDefaultItem();
+ }
+
+ public File getDefaultSourceFile() {
+ return defaultSourceFile;
+ }
+
+ @Override
+ protected boolean allowNewContainerName() {
+ return false;
+ }
+
+ @Override
+ public void handleEvent(Event arg0) {
+ updateWidgetEnablements();
+ updateExtractedElements();
+ updatePageCompletion();
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ initializeDialogUnits(parent);
+
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setLayout(new GridLayout(1, false));
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ composite.setFont(parent.getFont());
+
+ createDestinationArtifactSelectArea(composite);
+ createSourceFileArea(composite);
+ createParserSelectionArea(composite);
+ createArtifactTypeSelectArea(composite);
+ createNonChangingAttributeTypeSelectArea(composite);
+
+ restoreWidgetValues();
+ updateWidgetEnablements();
+ setPageComplete(determinePageCompletion());
+ setControl(composite);
+ selectionLatch.setCurrentValues(getDestinationArtifact(), getSourceFile(), getArtifactParser());
+ selectionLatch.latch();
+ }
+
+ private void createDestinationArtifactSelectArea(Composite parent) {
+ Label selectParentInstructions = new Label(parent, SWT.NONE);
+ selectParentInstructions.setText("Select parent artifact:");
+
+ artifactSelectPanel.createControl(parent);
+ artifactSelectPanel.addListener(this);
+ }
+
+ private void createSourceFileArea(Composite parent) {
+ directoryFileSelector = new DirectoryOrFileSelector(parent, SWT.NONE, "Import Source", this);
+ if (defaultSourceFile == null) {
+ directoryFileSelector.setDirectorySelected(true);
+ } else {
+ directoryFileSelector.setDirectorySelected(!defaultSourceFile.isFile());
+ directoryFileSelector.setText(defaultSourceFile.getAbsolutePath());
+ }
+ directoryFileSelector.addListener(SWT.Selection, this);
+ }
+
+ private void createParserSelectionArea(Composite parent) {
+ Group composite = new Group(parent, SWT.NONE);
+ composite.setText("Select Parser");
+ composite.setLayout(new GridLayout(1, false));
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ Label selectParserInstructions = new Label(composite, SWT.NONE);
+ selectParserInstructions.setText("Select the method to be used for importing the selected file or directory:");
+
+ parserSelectPanel.addListener(this);
+ parserSelectPanel.createControl(composite);
+ }
+
+ private void createArtifactTypeSelectArea(Composite parent) {
+ Label selectArtifactTypeInstructions = new Label(parent, SWT.NONE);
+ selectArtifactTypeInstructions.setText("Select artifact type for imported data:");
+
+ artifactTypeSelectPanel.createControl(parent);
+ artifactTypeSelectPanel.addListener(this);
+ }
+
+ private void createNonChangingAttributeTypeSelectArea(Composite parent) {
+ Group group = new Group(parent, SWT.NONE);
+ group.setText("Options");
+ group.setLayout(new GridLayout(1, false));
+ group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ Composite updateComp = new Composite(group, SWT.NULL);
+ updateComp.setLayout(ALayout.getZeroMarginLayout(2, false));
+ updateComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ updateExistingArtifacts = new Button(updateComp, SWT.CHECK);
+ updateExistingArtifacts.setText("Update existing child artifacts");
+ updateExistingArtifacts.setToolTipText("All imported artifacts will be checked against the root\n" + "import artifact and the content will be placed on the artifact\n" + "that has the same identifying attributes and level from the root");
+ updateExistingArtifacts.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
+ updateExistingArtifacts.setSelection(false);
+
+ updateByGuid = new Button(updateComp, SWT.CHECK);
+ updateByGuid.setText("by GUID");
+ updateByGuid.setToolTipText("Match imported artifacts based on user-supplied GUIDs");
+ updateByGuid.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
+ updateByGuid.setSelection(false);
+ updateByGuid.setEnabled(false);
+
+ deleteUnmatchedArtifacts = new Button(group, SWT.CHECK);
+ deleteUnmatchedArtifacts.setText("Delete unmatched artifacts");
+ deleteUnmatchedArtifacts.setToolTipText("Any child artifacts that cannot be matched to an imported artifact will be deleted.");
+ deleteUnmatchedArtifacts.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
+ deleteUnmatchedArtifacts.setSelection(false);
+ deleteUnmatchedArtifacts.setEnabled(false);
+
+ final Composite composite = new Composite(group, SWT.NONE);
+ composite.setLayout(ALayout.getZeroMarginLayout(1, false));
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ composite.setEnabled(false);
+ attributeTypeSelectPanel.createControl(composite);
+ attributeTypeSelectPanel.addListener(this);
+
+ updateExistingArtifacts.addListener(SWT.Selection, this);
+ updateExistingArtifacts.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean isNowSelected = updateExistingArtifacts.getSelection();
+ widgetEnabledHelper(composite, isNowSelected);
+ deleteUnmatchedArtifacts.setEnabled(isNowSelected);
+ deleteUnmatchedArtifacts.setSelection(false);
+ updateByGuid.setEnabled(isNowSelected);
+ updateByGuid.setSelection(false);
+ }
+ });
+ updateByGuid.addListener(SWT.Selection, this);
+ widgetEnabledHelper(composite, false);
+ }
+
+ private void widgetEnabledHelper(Control control, boolean isEnabled) {
+ control.setEnabled(isEnabled);
+ if (control instanceof Composite) {
+ for (Control child : ((Composite) control).getChildren()) {
+ widgetEnabledHelper(child, isEnabled);
+ }
+ }
+ }
+
+ private boolean isUpdateExistingSelected() {
+ return updateExistingArtifacts.getSelection();
+ }
+
+ private boolean isUpdateByGuidSelected() {
+ return updateByGuid.getSelection();
+ }
+
+ public boolean isDeleteUnmatchedSelected() {
+ return deleteUnmatchedArtifacts.getSelection();
+ }
+
+ public MatchingStrategy getMatchingStrategy() {
+ if (isUpdateExistingSelected() && isUpdateByGuidSelected()) {
+ return MatchingStrategy.GUID;
+ } else if (isUpdateExistingSelected()) {
+ return MatchingStrategy.ATTRIBUTE;
+ } else {
+ return MatchingStrategy.NONE;
+ }
+ }
+
+ public boolean isDirectory() {
+ boolean result = false;
+ if (Widgets.isAccessible(directoryFileSelector)) {
+ result = directoryFileSelector.isDirectorySelected();
+ }
+ return result;
+ }
+
+ public File getSourceFile() {
+ File sourceFile = null;
+ if (Widgets.isAccessible(directoryFileSelector)) {
+ sourceFile = directoryFileSelector.getFile();
+ }
+ return sourceFile;
+ }
+
+ private IArtifactExtractor getArtifactParser() {
+ return parserSelectPanel.getArtifactExtractor();
+ }
+
+ public Artifact getDestinationArtifact() {
+ return artifactSelectPanel.getSelected();
+ }
+
+ public ArtifactType getArtifactType() {
+ return artifactTypeSelectPanel.getSelected();
+ }
+
+ public Collection<AttributeType> getNonChangingAttributes() {
+ return attributeTypeSelectPanel.getSelected();
+ }
+
+ @Override
+ protected boolean validateSourceGroup() {
+ return getSourceFile() != null;
+ }
+
+ @Override
+ protected boolean validateDestinationGroup() {
+ return getDestinationArtifact() != null;
+ }
+
+ @Override
+ protected boolean validateOptionsGroup() {
+ return getArtifactParser() != null && //
+ selectionLatch.areSelectionsValid() && !selectionLatch.hasChanged() && //
+ getArtifactType() != null && //
+ (!updateExistingArtifacts.getSelection() || updateByGuid.getSelection() || getNonChangingAttributes() != null);
+ }
+
+ @Override
+ protected void restoreWidgetValues() {
+ super.restoreWidgetValues();
+ IDialogSettings settings = getDialogSettings();
+ if (settings != null) {
+ if (getDefaultSourceFile() == null) {
+ directoryFileSelector.setDirectorySelected(settings.getBoolean("isDirectory"));
+ String file = settings.get("source.file");
+ if (Strings.isValid(file)) {
+ directoryFileSelector.setText(file);
+ }
+ }
+
+ String parser = settings.get("selected.parser");
+ if (Strings.isValid(parser)) {
+ for (IArtifactExtractor item : importContributionManager.getExtractors()) {
+ if (parser.equals(item.getClass().getSimpleName())) {
+ parserSelectPanel.setArtifactExtractor(item);
+ }
+ }
+ }
+ if (getDefaultDestinationArtifact() == null) {
+ String guid = settings.get("destination.artifact.guid");
+ String branch = settings.get("destination.branch.guid");
+
+ if (Strings.isValid(guid) && Strings.isValid(branch)) {
+ try {
+ Artifact artifact = ArtifactQuery.getArtifactFromId(guid, BranchManager.getBranchByGuid(branch));
+ artifactSelectPanel.setDefaultItem(artifact);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, String.format(
+ "Unable to restore destination artifact- guid:[%s] branch guid:[%s]", guid, branch));
+ }
+ }
+ }
+
+ boolean toUpdate = settings.getBoolean("is.update.existing.selected");
+ updateExistingArtifacts.setSelection(toUpdate);
+ deleteUnmatchedArtifacts.setEnabled(toUpdate);
+ if (toUpdate) {
+ try {
+ attributeTypeSelectPanel.setAllowedAttributeTypes(getArtifactType().getAttributeTypes(
+ getDestinationArtifact().getBranch()));
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex.getLocalizedMessage());
+ }
+ } else {
+ attributeTypeSelectPanel.setAllowedAttributeTypes(new ArrayList<AttributeType>());
+ }
+ }
+ }
+
+ @Override
+ protected void saveWidgetValues() {
+ super.saveWidgetValues();
+ IDialogSettings settings = getDialogSettings();
+ if (settings != null) {
+
+ settings.put("isDirectory", isDirectory());
+
+ File file = getSourceFile();
+ if (file != null) {
+ settings.put("source.file", getSourceFile().getAbsolutePath());
+ }
+
+ IArtifactExtractor parser = getArtifactParser();
+ if (parser != null) {
+ settings.put("selected.parser", parser.getClass().getSimpleName());
+ }
+
+ Artifact artifact = getDestinationArtifact();
+ if (artifact != null) {
+ settings.put("destination.artifact.guid", artifact.getGuid());
+ settings.put("destination.branch.guid", artifact.getBranch().getGuid());
+ }
+ settings.put("is.update.existing.selected", isUpdateExistingSelected());
+ }
+ }
+
+ private synchronized void updateExtractedElements() {
+ selectionLatch.setCurrentValues(getDestinationArtifact(), getSourceFile(), getArtifactParser());
+ if (selectionLatch.areSelectionsValid()) {
+ selectionLatch.latch();
+
+ collector.reset();
+
+ final Artifact destinationArtifact = selectionLatch.currentSelected.destinationArtifact;
+ final File sourceFile = selectionLatch.currentSelected.sourceFile;
+ final IArtifactExtractor extractor = selectionLatch.currentSelected.extractor;
+
+ Collection<IOperation> ops = new ArrayList<IOperation>();
+ ops.add(new SourceToRoughArtifactOperation(extractor, sourceFile, collector));
+ ops.add(new FilterArtifactTypesByAttributeTypes(destinationArtifact.getBranch(), collector,
+ selectedArtifactTypes));
+ selectedArtifactTypes.clear();
+ if (executeOperation(new CompositeOperation("Extracting data from source", SkynetGuiPlugin.PLUGIN_ID, ops))) {
+ artifactTypeSelectPanel.setAllowedArtifactTypes(selectedArtifactTypes);
+ try {
if (getArtifactType() != null) {
attributeTypeSelectPanel.setAllowedAttributeTypes(getArtifactType().getAttributeTypes(
getDestinationArtifact().getBranch()));
}
- } catch (Exception ex) {
- }
- }
- }
- }
-
- protected boolean executeOperation(final IOperation operation) {
- try {
- getContainer().run(true, true, new IRunnableWithProgress() {
-
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- Operations.executeWorkAndCheckStatus(operation, monitor, -1);
- } catch (OseeCoreException ex) {
- if (monitor.isCanceled()) {
- throw new InterruptedException();
- } else {
- throw new InvocationTargetException(ex);
- }
- }
- }
- });
- } catch (InterruptedException e) {
- return false;
- } catch (InvocationTargetException e) {
- displayErrorDialog(e.getTargetException());
- return false;
- }
-
- IStatus status = operation.getStatus();
- if (status.isOK()) {
- setErrorMessage(null);
- } else {
- setErrorMessage(status.getMessage());
- }
- return true;
- }
- private static final class SelectionLatch {
- protected final SelectionData lastSelected;
- protected final SelectionData currentSelected;
-
- public SelectionLatch() {
- lastSelected = new SelectionData();
- currentSelected = new SelectionData();
- }
-
- public void setCurrentValues(Artifact destinationArtifact, File sourceFile, IArtifactExtractor extractor) {
- this.currentSelected.setValues(destinationArtifact, sourceFile, extractor);
- }
-
- public void latch() {
- lastSelected.setValues(currentSelected.destinationArtifact, currentSelected.sourceFile,
- currentSelected.extractor);
- }
-
- public boolean areSelectionsValid() {
- return currentSelected.isValid();
- }
-
- public boolean hasChanged() {
- return lastSelected.destinationArtifact != currentSelected.destinationArtifact && //
- lastSelected.sourceFile != currentSelected.sourceFile && //
- lastSelected.extractor != currentSelected.extractor && //
- lastSelected.delegate != currentSelected.delegate;
- }
- }
-
- private static final class SelectionData {
- protected Artifact destinationArtifact;
- protected File sourceFile;
- protected IArtifactExtractor extractor;
- protected IArtifactExtractorDelegate delegate;
-
- private SelectionData() {
- }
-
- public void setValues(Artifact destinationArtifact, File sourceFile, IArtifactExtractor extractor) {
- this.destinationArtifact = destinationArtifact;
- this.sourceFile = sourceFile;
- this.extractor = extractor;
- this.delegate = extractor != null ? extractor.getDelegate() : null;
- }
-
- public boolean isValid() {
- return destinationArtifact != null && sourceFile != null && extractor != null && (extractor.isDelegateRequired() ? extractor.hasDelegate() : true);
- }
- }
+ } catch (Exception ex) {
+ }
+ }
+ }
+ }
+
+ protected boolean executeOperation(final IOperation operation) {
+ try {
+ getContainer().run(true, true, new IRunnableWithProgress() {
+
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ try {
+ Operations.executeWorkAndCheckStatus(operation, monitor, -1);
+ } catch (OseeCoreException ex) {
+ if (monitor.isCanceled()) {
+ throw new InterruptedException();
+ } else {
+ throw new InvocationTargetException(ex);
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ return false;
+ } catch (InvocationTargetException e) {
+ displayErrorDialog(e.getTargetException());
+ return false;
+ }
+
+ IStatus status = operation.getStatus();
+ if (status.isOK()) {
+ setErrorMessage(null);
+ } else {
+ setErrorMessage(status.getMessage());
+ }
+ return true;
+ }
+ private static final class SelectionLatch {
+ protected final SelectionData lastSelected;
+ protected final SelectionData currentSelected;
+
+ public SelectionLatch() {
+ lastSelected = new SelectionData();
+ currentSelected = new SelectionData();
+ }
+
+ public void setCurrentValues(Artifact destinationArtifact, File sourceFile, IArtifactExtractor extractor) {
+ this.currentSelected.setValues(destinationArtifact, sourceFile, extractor);
+ }
+
+ public void latch() {
+ lastSelected.setValues(currentSelected.destinationArtifact, currentSelected.sourceFile,
+ currentSelected.extractor);
+ }
+
+ public boolean areSelectionsValid() {
+ return currentSelected.isValid();
+ }
+
+ public boolean hasChanged() {
+ return lastSelected.destinationArtifact != currentSelected.destinationArtifact && //
+ lastSelected.sourceFile != currentSelected.sourceFile && //
+ lastSelected.extractor != currentSelected.extractor && //
+ lastSelected.delegate != currentSelected.delegate;
+ }
+ }
+
+ private static final class SelectionData {
+ protected Artifact destinationArtifact;
+ protected File sourceFile;
+ protected IArtifactExtractor extractor;
+ protected IArtifactExtractorDelegate delegate;
+
+ private SelectionData() {
+ }
+
+ public void setValues(Artifact destinationArtifact, File sourceFile, IArtifactExtractor extractor) {
+ this.destinationArtifact = destinationArtifact;
+ this.sourceFile = sourceFile;
+ this.extractor = extractor;
+ this.delegate = extractor != null ? extractor.getDelegate() : null;
+ }
+
+ public boolean isValid() {
+ return destinationArtifact != null && sourceFile != null && extractor != null && (extractor.isDelegateRequired() ? extractor.hasDelegate() : true);
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/MatchingStrategy.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/MatchingStrategy.java
index 75d4cfa5c33..8ba68476995 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/MatchingStrategy.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/Import/MatchingStrategy.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.Import;
-
+package org.eclipse.osee.framework.ui.skynet.Import;
+
import java.util.Collection;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.type.ArtifactType;
@@ -19,23 +19,23 @@ import org.eclipse.osee.framework.skynet.core.importing.resolvers.AttributeBased
import org.eclipse.osee.framework.skynet.core.importing.resolvers.GuidBasedArtifactResolver;
import org.eclipse.osee.framework.skynet.core.importing.resolvers.IArtifactImportResolver;
import org.eclipse.osee.framework.skynet.core.importing.resolvers.NewArtifactImportResolver;
-
-public enum MatchingStrategy {
- ATTRIBUTE(), GUID(), NONE();
-
- private MatchingStrategy() {
- }
-
- public IArtifactImportResolver getResolver(ArtifactType primaryArtifactType, Collection<AttributeType> nonChangingAttributes, boolean createNewIfNotExist, boolean deleteUnmatchedArtifacts) throws OseeCoreException {
- ArtifactType secondaryArtifactType = ArtifactTypeManager.getType("Heading");
- if (this == ATTRIBUTE) {
- return new AttributeBasedArtifactResolver(primaryArtifactType, secondaryArtifactType,
- nonChangingAttributes, createNewIfNotExist, deleteUnmatchedArtifacts);
- } else if (this == GUID) {
- return new GuidBasedArtifactResolver(primaryArtifactType, secondaryArtifactType, createNewIfNotExist,
- deleteUnmatchedArtifacts);
- } else {
- return new NewArtifactImportResolver(primaryArtifactType, secondaryArtifactType);
- }
- }
-}
+
+public enum MatchingStrategy {
+ ATTRIBUTE(), GUID(), NONE();
+
+ private MatchingStrategy() {
+ }
+
+ public IArtifactImportResolver getResolver(ArtifactType primaryArtifactType, Collection<AttributeType> nonChangingAttributes, boolean createNewIfNotExist, boolean deleteUnmatchedArtifacts) throws OseeCoreException {
+ ArtifactType secondaryArtifactType = ArtifactTypeManager.getType("Heading");
+ if (this == ATTRIBUTE) {
+ return new AttributeBasedArtifactResolver(primaryArtifactType, secondaryArtifactType,
+ nonChangingAttributes, createNewIfNotExist, deleteUnmatchedArtifacts);
+ } else if (this == GUID) {
+ return new GuidBasedArtifactResolver(primaryArtifactType, secondaryArtifactType, createNewIfNotExist,
+ deleteUnmatchedArtifacts);
+ } else {
+ return new NewArtifactImportResolver(primaryArtifactType, secondaryArtifactType);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OpenWithContributionItem.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OpenWithContributionItem.java
index b5cf49088df..cfbd44cb929 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OpenWithContributionItem.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OpenWithContributionItem.java
@@ -1,250 +1,250 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.core.commands.Command;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-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.skynet.commandHandlers.Handlers;
-import org.eclipse.osee.framework.ui.skynet.render.IRenderer;
-import org.eclipse.osee.framework.ui.skynet.render.NativeRenderer;
-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.render.WordRenderer;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-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.swt.widgets.Shell;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.CompoundContributionItem;
-import org.eclipse.ui.commands.ICommandService;
-import org.eclipse.ui.menus.CommandContributionItem;
-import org.eclipse.ui.menus.CommandContributionItemParameter;
-
-/**
- * Dynamically provides the open with CommandContributionItem for menu items based off of calling applicable renderers
- * getCommandId(presenationType).
- *
- * @author Jeff C. Phillips
- */
-public class OpenWithContributionItem extends CompoundContributionItem {
- private ICommandService commandService;
-
- public OpenWithContributionItem() {
- this.commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
- }
-
- public OpenWithContributionItem(String id) {
- super(id);
- }
-
- @Override
- protected IContributionItem[] getContributionItems() {
- ArrayList<IContributionItem> contributionItems = new ArrayList<IContributionItem>(40);
- List<Artifact> artifacts = getSelectedArtifacts();
- if (artifacts != null && !artifacts.isEmpty()) {
- try {
- contributionItems.addAll(getCommonContributionItems(artifacts, PresentationType.PREVIEW));
- //add separator between preview and edit commands
- if (!contributionItems.isEmpty()) {
- contributionItems.add(new Separator());
- }
- contributionItems.addAll(getCommonContributionItems(artifacts, PresentationType.SPECIALIZED_EDIT));
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
-
- return contributionItems.toArray(new IContributionItem[0]);
- }
-
- private ArrayList<IContributionItem> getCommonContributionItems(List<Artifact> artifacts, PresentationType presentationType) throws OseeCoreException {
- ArrayList<IContributionItem> contributionItems = new ArrayList<IContributionItem>(25);
- List<IRenderer> commonRenders = RendererManager.getCommonRenderers(artifacts, presentationType);
- Artifact firstArtifact = artifacts.iterator().next();
- for (IRenderer render : commonRenders) {
- ImageDescriptor imageDescriptor = null;
- if (render instanceof WordRenderer) {
- imageDescriptor = WordRenderer.getImageDescriptor();
- } else if (render instanceof NativeRenderer) {
- String fileExtension = firstArtifact.getSoleAttributeValue(CoreAttributeTypes.NATIVE_EXTENSION.getName());
- if (Strings.isValid(fileExtension)) {
- imageDescriptor = ImageManager.getProgramImageDescriptor(fileExtension);
- }
- }
- List<IContributionItem> commandList = loadCommands(render, presentationType, imageDescriptor);
- contributionItems.addAll(commandList);
- }
- return contributionItems;
- }
-
- private ArrayList<IContributionItem> loadCommands(IRenderer renderer, PresentationType presentationType, ImageDescriptor imageDescriptor) {
- ArrayList<IContributionItem> contributionItems = new ArrayList<IContributionItem>(25);
- CommandContributionItem contributionItem = null;
-
- for (String commandId : renderer.getCommandId(presentationType)) {
- contributionItem =
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.core.commands.Command;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+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.skynet.commandHandlers.Handlers;
+import org.eclipse.osee.framework.ui.skynet.render.IRenderer;
+import org.eclipse.osee.framework.ui.skynet.render.NativeRenderer;
+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.render.WordRenderer;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+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.swt.widgets.Shell;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.CompoundContributionItem;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.menus.CommandContributionItem;
+import org.eclipse.ui.menus.CommandContributionItemParameter;
+
+/**
+ * Dynamically provides the open with CommandContributionItem for menu items based off of calling applicable renderers
+ * getCommandId(presenationType).
+ *
+ * @author Jeff C. Phillips
+ */
+public class OpenWithContributionItem extends CompoundContributionItem {
+ private ICommandService commandService;
+
+ public OpenWithContributionItem() {
+ this.commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
+ }
+
+ public OpenWithContributionItem(String id) {
+ super(id);
+ }
+
+ @Override
+ protected IContributionItem[] getContributionItems() {
+ ArrayList<IContributionItem> contributionItems = new ArrayList<IContributionItem>(40);
+ List<Artifact> artifacts = getSelectedArtifacts();
+ if (artifacts != null && !artifacts.isEmpty()) {
+ try {
+ contributionItems.addAll(getCommonContributionItems(artifacts, PresentationType.PREVIEW));
+ //add separator between preview and edit commands
+ if (!contributionItems.isEmpty()) {
+ contributionItems.add(new Separator());
+ }
+ contributionItems.addAll(getCommonContributionItems(artifacts, PresentationType.SPECIALIZED_EDIT));
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ return contributionItems.toArray(new IContributionItem[0]);
+ }
+
+ private ArrayList<IContributionItem> getCommonContributionItems(List<Artifact> artifacts, PresentationType presentationType) throws OseeCoreException {
+ ArrayList<IContributionItem> contributionItems = new ArrayList<IContributionItem>(25);
+ List<IRenderer> commonRenders = RendererManager.getCommonRenderers(artifacts, presentationType);
+ Artifact firstArtifact = artifacts.iterator().next();
+ for (IRenderer render : commonRenders) {
+ ImageDescriptor imageDescriptor = null;
+ if (render instanceof WordRenderer) {
+ imageDescriptor = WordRenderer.getImageDescriptor();
+ } else if (render instanceof NativeRenderer) {
+ String fileExtension = firstArtifact.getSoleAttributeValue(CoreAttributeTypes.NATIVE_EXTENSION.getName());
+ if (Strings.isValid(fileExtension)) {
+ imageDescriptor = ImageManager.getProgramImageDescriptor(fileExtension);
+ }
+ }
+ List<IContributionItem> commandList = loadCommands(render, presentationType, imageDescriptor);
+ contributionItems.addAll(commandList);
+ }
+ return contributionItems;
+ }
+
+ private ArrayList<IContributionItem> loadCommands(IRenderer renderer, PresentationType presentationType, ImageDescriptor imageDescriptor) {
+ ArrayList<IContributionItem> contributionItems = new ArrayList<IContributionItem>(25);
+ CommandContributionItem contributionItem = null;
+
+ for (String commandId : renderer.getCommandId(presentationType)) {
+ contributionItem =
new CommandContributionItem(new CommandContributionItemParameter(
PlatformUI.getWorkbench().getActiveWorkbenchWindow(), commandId, commandId, Collections.emptyMap(),
imageDescriptor, null, null, null, null, null, SWT.NONE, null, false));
-
- Command command = commandService.getCommand(contributionItem.getId());
- if (command != null && command.isEnabled()) {
- contributionItems.add(contributionItem);
- }
- }
-
- return contributionItems;
- }
-
- @Override
- public void fill(final ToolBar parent, int index) {
- final ToolItem toolItem = new ToolItem(parent, SWT.DROP_DOWN);
- toolItem.setImage(ImageManager.getImage(FrameworkImage.OPEN));
- toolItem.setToolTipText("Open the Artifact");
-
- OpenWithToolItemListener listener = new OpenWithToolItemListener(parent.getShell());
- toolItem.addListener(SWT.Selection, listener);
- toolItem.setEnabled(listener.isPreviewMenuEnabled());
- }
-
- @Override
- public void fill(Menu parent, int index) {
- /**
- * hard coded to show as the 2nd menu option; necessary for Xviewer menu options to work with Change View
- * command/handlers and this dynamic menu option
- */
- final MenuItem item = new MenuItem(parent, SWT.CASCADE, 1);
- item.setText("Open With");
-
- Menu subMenu = new Menu(parent);
- item.setMenu(subMenu);
- createDropDownMenu(parent.getShell(), subMenu);
- item.setEnabled(isMenuEnabled(subMenu));
- }
-
- private List<Artifact> getSelectedArtifacts() {
- IWorkbenchPage page = AWorkbench.getActivePage();
- if (page != null) {
- IWorkbenchPart part = page.getActivePart();
- if (part != null) {
- IWorkbenchPartSite site = part.getSite();
- if (site != null) {
- ISelectionProvider selectionProvider = site.getSelectionProvider();
- if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
- return Handlers.getArtifactsFromStructuredSelection(structuredSelection);
- }
- }
- }
- }
- return Collections.emptyList();
- }
-
- private void createDropDownMenu(Shell shell, Menu previewMenu) {
- List<Artifact> artifacts = getSelectedArtifacts();
- boolean previewable = false;
- try {
- if (artifacts != null && !artifacts.isEmpty()) {
- Artifact artifact = artifacts.iterator().next();
-
- if (RendererManager.getApplicableRenderers(PresentationType.PREVIEW, artifact, null).size() > 1) {
- previewable = true;
- }
-
- if (previewable) {
- if (OpenWithMenuListener.loadMenuItems(previewMenu, PresentationType.PREVIEW, artifacts)) {
- new MenuItem(previewMenu, SWT.SEPARATOR);
- }
- }
- OpenWithMenuListener.loadMenuItems(previewMenu, PresentationType.SPECIALIZED_EDIT, artifacts);
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
-
- public boolean isMenuEnabled(Menu menu) {
- boolean itemzEnabled = false;
- for (MenuItem menuItems : menu.getItems()) {
- if (menuItems.isEnabled()) {
- itemzEnabled = true;
- }
- }
- return itemzEnabled;
- }
-
- private final class OpenWithToolItemListener implements Listener {
- private final Menu previewMenu;
- private final boolean isPreviewEnabled;
-
- public OpenWithToolItemListener(Shell shell) {
- previewMenu = new Menu(shell, SWT.POP_UP);
- createDropDownMenu(shell, previewMenu);
- isPreviewEnabled = isPreviewMenuEnabled();
- }
-
- public boolean isPreviewMenuEnabled() {
- return isMenuEnabled(previewMenu);
- }
-
- @Override
- public void handleEvent(Event event) {
- Widget widget = event.widget;
- if (widget instanceof ToolItem) {
- ToolItem toolItem = (ToolItem) widget;
- ToolBar toolBar = toolItem.getParent();
-
- if (event.detail == SWT.ARROW) {
- Rectangle rect = toolItem.getBounds();
- Point pt = new Point(rect.x, rect.y + rect.height);
- pt = toolBar.toDisplay(pt);
- previewMenu.setLocation(pt.x, pt.y);
- previewMenu.setVisible(true);
- }
-
- if (event.detail == 0) {
+
+ Command command = commandService.getCommand(contributionItem.getId());
+ if (command != null && command.isEnabled()) {
+ contributionItems.add(contributionItem);
+ }
+ }
+
+ return contributionItems;
+ }
+
+ @Override
+ public void fill(final ToolBar parent, int index) {
+ final ToolItem toolItem = new ToolItem(parent, SWT.DROP_DOWN);
+ toolItem.setImage(ImageManager.getImage(FrameworkImage.OPEN));
+ toolItem.setToolTipText("Open the Artifact");
+
+ OpenWithToolItemListener listener = new OpenWithToolItemListener(parent.getShell());
+ toolItem.addListener(SWT.Selection, listener);
+ toolItem.setEnabled(listener.isPreviewMenuEnabled());
+ }
+
+ @Override
+ public void fill(Menu parent, int index) {
+ /**
+ * hard coded to show as the 2nd menu option; necessary for Xviewer menu options to work with Change View
+ * command/handlers and this dynamic menu option
+ */
+ final MenuItem item = new MenuItem(parent, SWT.CASCADE, 1);
+ item.setText("Open With");
+
+ Menu subMenu = new Menu(parent);
+ item.setMenu(subMenu);
+ createDropDownMenu(parent.getShell(), subMenu);
+ item.setEnabled(isMenuEnabled(subMenu));
+ }
+
+ private List<Artifact> getSelectedArtifacts() {
+ IWorkbenchPage page = AWorkbench.getActivePage();
+ if (page != null) {
+ IWorkbenchPart part = page.getActivePart();
+ if (part != null) {
+ IWorkbenchPartSite site = part.getSite();
+ if (site != null) {
+ ISelectionProvider selectionProvider = site.getSelectionProvider();
+ if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
+ return Handlers.getArtifactsFromStructuredSelection(structuredSelection);
+ }
+ }
+ }
+ }
+ return Collections.emptyList();
+ }
+
+ private void createDropDownMenu(Shell shell, Menu previewMenu) {
+ List<Artifact> artifacts = getSelectedArtifacts();
+ boolean previewable = false;
+ try {
+ if (artifacts != null && !artifacts.isEmpty()) {
+ Artifact artifact = artifacts.iterator().next();
+
+ if (RendererManager.getApplicableRenderers(PresentationType.PREVIEW, artifact, null).size() > 1) {
+ previewable = true;
+ }
+
+ if (previewable) {
+ if (OpenWithMenuListener.loadMenuItems(previewMenu, PresentationType.PREVIEW, artifacts)) {
+ new MenuItem(previewMenu, SWT.SEPARATOR);
+ }
+ }
+ OpenWithMenuListener.loadMenuItems(previewMenu, PresentationType.SPECIALIZED_EDIT, artifacts);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ public boolean isMenuEnabled(Menu menu) {
+ boolean itemzEnabled = false;
+ for (MenuItem menuItems : menu.getItems()) {
+ if (menuItems.isEnabled()) {
+ itemzEnabled = true;
+ }
+ }
+ return itemzEnabled;
+ }
+
+ private final class OpenWithToolItemListener implements Listener {
+ private final Menu previewMenu;
+ private final boolean isPreviewEnabled;
+
+ public OpenWithToolItemListener(Shell shell) {
+ previewMenu = new Menu(shell, SWT.POP_UP);
+ createDropDownMenu(shell, previewMenu);
+ isPreviewEnabled = isPreviewMenuEnabled();
+ }
+
+ public boolean isPreviewMenuEnabled() {
+ return isMenuEnabled(previewMenu);
+ }
+
+ @Override
+ public void handleEvent(Event event) {
+ Widget widget = event.widget;
+ if (widget instanceof ToolItem) {
+ ToolItem toolItem = (ToolItem) widget;
+ ToolBar toolBar = toolItem.getParent();
+
+ if (event.detail == SWT.ARROW) {
+ Rectangle rect = toolItem.getBounds();
+ Point pt = new Point(rect.x, rect.y + rect.height);
+ pt = toolBar.toDisplay(pt);
+ previewMenu.setLocation(pt.x, pt.y);
+ previewMenu.setVisible(true);
+ }
+
+ if (event.detail == 0) {
List<Artifact> artifacts = getSelectedArtifacts();
if (artifacts != null && !artifacts.isEmpty()) {
Artifact artifact = artifacts.iterator().next();
if (isPreviewEnabled && artifact != null) {
RendererManager.openInJob(artifacts, PresentationType.DEFAULT_OPEN);
- }
- }
- }
- }
- }
- }
-}
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OpenWithMenuListener.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OpenWithMenuListener.java
index 479c207db33..d64e9401bc9 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OpenWithMenuListener.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OpenWithMenuListener.java
@@ -1,127 +1,127 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.core.commands.Command;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-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.relation.RelationLink;
-import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
-import org.eclipse.osee.framework.ui.skynet.listener.IRebuildMenuListener;
-import org.eclipse.osee.framework.ui.skynet.render.IRenderer;
-import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
-import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
-import org.eclipse.search.ui.text.Match;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MenuEvent;
-import org.eclipse.swt.events.MenuListener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.commands.ICommandService;
-
-/**
- * @author Ryan D. Brooks
- * @author Jeff C. Phillips
- */
-
-public class OpenWithMenuListener implements MenuListener {
- private Menu parentMenu;
- private Viewer viewer;
- private IRebuildMenuListener rebuildMenuListener;
- private static ICommandService commandService =
- (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
-
- public OpenWithMenuListener(Menu parentMenu, final Viewer viewer, IRebuildMenuListener rebuildMenuListener) {
- super();
- this.parentMenu = parentMenu;
- this.viewer = viewer;
- this.rebuildMenuListener = rebuildMenuListener;
- }
-
- @Override
- public void menuHidden(MenuEvent e) {
- }
-
- @Override
- public void menuShown(MenuEvent e) {
- try {
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
-
- if (selection.isEmpty()) {
- return;
- }
-
- rebuildMenuListener.rebuildMenu();
-
- Iterator<?> iterator = selection.iterator();
- ArrayList<Artifact> artifacts = new ArrayList<Artifact>(selection.size());
-
- //load artifacts in the list
- Artifact artifact = null;
- while (iterator.hasNext()) {
- Object object = iterator.next();
- if (object instanceof IAdaptable) {
- artifact = (Artifact) ((IAdaptable) object).getAdapter(Artifact.class);
- } else if (object instanceof Match) {
- artifact = (Artifact) ((Match) object).getElement();
- } else if (object instanceof RelationLink) {
- RelationLink link = (RelationLink) object;
- try {
- List<Artifact> edittedArtifacts =
- Handlers.getArtifactsFromStructuredSelection((IStructuredSelection) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getSelection());
- artifact = link.getArtifactOnOtherSide(edittedArtifacts.iterator().next());
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- artifacts.add(artifact);
- }
-
- if (loadMenuItems(parentMenu, PresentationType.PREVIEW, artifacts)) {
- new MenuItem(parentMenu, SWT.SEPARATOR);
- }
- loadMenuItems(parentMenu, PresentationType.SPECIALIZED_EDIT, artifacts);
-
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
-
- public static boolean loadMenuItems(Menu parentMenu, PresentationType presentationType, List<Artifact> artifacts) throws OseeCoreException, NotDefinedException {
- List<IRenderer> commonRenders = RendererManager.getCommonRenderers(artifacts, presentationType);
- Artifact artifact = artifacts.iterator().next();
- boolean hasMenus = false;
- for (IRenderer renderer : commonRenders) {
- for (String commandId : renderer.getCommandId(presentationType)) {
- Command command = commandService.getCommand(commandId);
- if (command != null && command.isEnabled()) {
- hasMenus = true;
- MenuItem menuItem = new MenuItem(parentMenu, SWT.PUSH);
- menuItem.setText(command.getName());
- menuItem.setImage(renderer.getImage(artifact));
- menuItem.addSelectionListener(new OpenWithSelectionListener(command));
- }
- }
- }
- return hasMenus;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.common.NotDefinedException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+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.relation.RelationLink;
+import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
+import org.eclipse.osee.framework.ui.skynet.listener.IRebuildMenuListener;
+import org.eclipse.osee.framework.ui.skynet.render.IRenderer;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
+import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
+import org.eclipse.search.ui.text.Match;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.events.MenuListener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+
+/**
+ * @author Ryan D. Brooks
+ * @author Jeff C. Phillips
+ */
+
+public class OpenWithMenuListener implements MenuListener {
+ private Menu parentMenu;
+ private Viewer viewer;
+ private IRebuildMenuListener rebuildMenuListener;
+ private static ICommandService commandService =
+ (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
+
+ public OpenWithMenuListener(Menu parentMenu, final Viewer viewer, IRebuildMenuListener rebuildMenuListener) {
+ super();
+ this.parentMenu = parentMenu;
+ this.viewer = viewer;
+ this.rebuildMenuListener = rebuildMenuListener;
+ }
+
+ @Override
+ public void menuHidden(MenuEvent e) {
+ }
+
+ @Override
+ public void menuShown(MenuEvent e) {
+ try {
+ IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+
+ if (selection.isEmpty()) {
+ return;
+ }
+
+ rebuildMenuListener.rebuildMenu();
+
+ Iterator<?> iterator = selection.iterator();
+ ArrayList<Artifact> artifacts = new ArrayList<Artifact>(selection.size());
+
+ //load artifacts in the list
+ Artifact artifact = null;
+ while (iterator.hasNext()) {
+ Object object = iterator.next();
+ if (object instanceof IAdaptable) {
+ artifact = (Artifact) ((IAdaptable) object).getAdapter(Artifact.class);
+ } else if (object instanceof Match) {
+ artifact = (Artifact) ((Match) object).getElement();
+ } else if (object instanceof RelationLink) {
+ RelationLink link = (RelationLink) object;
+ try {
+ List<Artifact> edittedArtifacts =
+ Handlers.getArtifactsFromStructuredSelection((IStructuredSelection) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getSelection());
+ artifact = link.getArtifactOnOtherSide(edittedArtifacts.iterator().next());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ artifacts.add(artifact);
+ }
+
+ if (loadMenuItems(parentMenu, PresentationType.PREVIEW, artifacts)) {
+ new MenuItem(parentMenu, SWT.SEPARATOR);
+ }
+ loadMenuItems(parentMenu, PresentationType.SPECIALIZED_EDIT, artifacts);
+
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ public static boolean loadMenuItems(Menu parentMenu, PresentationType presentationType, List<Artifact> artifacts) throws OseeCoreException, NotDefinedException {
+ List<IRenderer> commonRenders = RendererManager.getCommonRenderers(artifacts, presentationType);
+ Artifact artifact = artifacts.iterator().next();
+ boolean hasMenus = false;
+ for (IRenderer renderer : commonRenders) {
+ for (String commandId : renderer.getCommandId(presentationType)) {
+ Command command = commandService.getCommand(commandId);
+ if (command != null && command.isEnabled()) {
+ hasMenus = true;
+ MenuItem menuItem = new MenuItem(parentMenu, SWT.PUSH);
+ menuItem.setText(command.getName());
+ menuItem.setImage(renderer.getImage(artifact));
+ menuItem.addSelectionListener(new OpenWithSelectionListener(command));
+ }
+ }
+ }
+ return hasMenus;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OpenWithSelectionListener.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OpenWithSelectionListener.java
index c3ea0112618..d3237b511d5 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OpenWithSelectionListener.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OpenWithSelectionListener.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.framework.ui.skynet;
-
-import org.eclipse.core.commands.Command;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.handlers.IHandlerService;
-
-/**
- * @author Ryan D. Brooks
- * @author Jeff C. Phillips
- */
-public class OpenWithSelectionListener extends SelectionAdapter {
- private final Command command;
- private final IHandlerService handlerService;
-
- public OpenWithSelectionListener(Command command) {
- super();
- this.command = command;
- this.handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
- }
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- handlerService.executeCommand(command.getId(), null);
- } catch (Exception 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.framework.ui.skynet;
+
+import org.eclipse.core.commands.Command;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.IHandlerService;
+
+/**
+ * @author Ryan D. Brooks
+ * @author Jeff C. Phillips
+ */
+public class OpenWithSelectionListener extends SelectionAdapter {
+ private final Command command;
+ private final IHandlerService handlerService;
+
+ public OpenWithSelectionListener(Command command) {
+ super();
+ this.command = command;
+ this.handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ handlerService.executeCommand(command.getId(), null);
+ } catch (Exception ex) {
OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
-}
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OseeContributionItem.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OseeContributionItem.java
index 63a57e0a462..33f34f9636c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OseeContributionItem.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/OseeContributionItem.java
@@ -1,96 +1,96 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet;
-
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.osee.framework.ui.skynet.ats.IOseeAtsService;
-import org.eclipse.osee.framework.ui.skynet.ats.OseeAts;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.part.IPageSite;
-import org.eclipse.ui.part.MultiPageEditorPart;
-import org.eclipse.ui.part.ViewPart;
-import org.eclipse.ui.texteditor.StatusLineContributionItem;
-
-/**
- * @author Jeff C. Phillips
- */
-public abstract class OseeContributionItem extends StatusLineContributionItem {
-
- protected OseeContributionItem(String id) {
- this(id, 4);
- }
-
- protected OseeContributionItem(String id, int width) {
- super(id, true, width);
- }
-
- protected abstract String getEnabledToolTip();
-
- protected abstract String getDisabledToolTip();
-
- protected abstract Image getEnabledImage();
-
- protected abstract Image getDisabledImage();
-
- protected void updateStatus(final boolean isActive) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- Image image = isActive ? getEnabledImage() : getDisabledImage();
- String toolTip = isActive ? getEnabledToolTip() : getDisabledToolTip();
-
- if (image != null) {
- setImage(image);
- }
- if (toolTip != null) {
- setToolTipText(toolTip);
- }
- }
- });
- }
-
- public static void addTo(IStatusLineManager manager) {
- OseeBuildTypeContributionItem.addTo(manager);
- ResServiceContributionItem.addTo(manager);
- IOseeAtsService atsService = OseeAts.getInstance();
- if (atsService != null && atsService.isAtsAdmin()) {
- AdminContributionItem.addTo(manager);
- }
- SkynetServiceContributionItem.addTo(manager);
- OseeServicesStatusContributionItem.addTo(manager);
- SessionContributionItem.addTo(manager);
- }
-
- public static void addTo(IPageSite pageSite, boolean update) {
- addTo(pageSite.getActionBars().getStatusLineManager());
-
- if (update) {
- pageSite.getActionBars().updateActionBars();
- }
- }
-
- public static void addTo(ViewPart view, boolean update) {
- addTo(view.getViewSite().getActionBars().getStatusLineManager());
-
- if (update) {
- view.getViewSite().getActionBars().updateActionBars();
- }
- }
-
- public static void addTo(MultiPageEditorPart editorPart, boolean update) {
- addTo(editorPart.getEditorSite().getActionBars().getStatusLineManager());
- if (update) {
- editorPart.getEditorSite().getActionBars().updateActionBars();
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet;
+
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.osee.framework.ui.skynet.ats.IOseeAtsService;
+import org.eclipse.osee.framework.ui.skynet.ats.OseeAts;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.part.IPageSite;
+import org.eclipse.ui.part.MultiPageEditorPart;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.ui.texteditor.StatusLineContributionItem;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public abstract class OseeContributionItem extends StatusLineContributionItem {
+
+ protected OseeContributionItem(String id) {
+ this(id, 4);
+ }
+
+ protected OseeContributionItem(String id, int width) {
+ super(id, true, width);
+ }
+
+ protected abstract String getEnabledToolTip();
+
+ protected abstract String getDisabledToolTip();
+
+ protected abstract Image getEnabledImage();
+
+ protected abstract Image getDisabledImage();
+
+ protected void updateStatus(final boolean isActive) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ Image image = isActive ? getEnabledImage() : getDisabledImage();
+ String toolTip = isActive ? getEnabledToolTip() : getDisabledToolTip();
+
+ if (image != null) {
+ setImage(image);
+ }
+ if (toolTip != null) {
+ setToolTipText(toolTip);
+ }
+ }
+ });
+ }
+
+ public static void addTo(IStatusLineManager manager) {
+ OseeBuildTypeContributionItem.addTo(manager);
+ ResServiceContributionItem.addTo(manager);
+ IOseeAtsService atsService = OseeAts.getInstance();
+ if (atsService != null && atsService.isAtsAdmin()) {
+ AdminContributionItem.addTo(manager);
+ }
+ SkynetServiceContributionItem.addTo(manager);
+ OseeServicesStatusContributionItem.addTo(manager);
+ SessionContributionItem.addTo(manager);
+ }
+
+ public static void addTo(IPageSite pageSite, boolean update) {
+ addTo(pageSite.getActionBars().getStatusLineManager());
+
+ if (update) {
+ pageSite.getActionBars().updateActionBars();
+ }
+ }
+
+ public static void addTo(ViewPart view, boolean update) {
+ addTo(view.getViewSite().getActionBars().getStatusLineManager());
+
+ if (update) {
+ view.getViewSite().getActionBars().updateActionBars();
+ }
+ }
+
+ public static void addTo(MultiPageEditorPart editorPart, boolean update) {
+ addTo(editorPart.getEditorSite().getActionBars().getStatusLineManager());
+ if (update) {
+ editorPart.getEditorSite().getActionBars().updateActionBars();
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/RelationsComposite.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/RelationsComposite.java
index b9a863032c9..8a3ba9b0494 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/RelationsComposite.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/RelationsComposite.java
@@ -1,831 +1,831 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.ITreeViewerListener;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.jface.viewers.TreeExpansionEvent;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.osee.framework.core.data.IRelationSorterId;
-import org.eclipse.osee.framework.core.enums.IRelationEnumeration;
-import org.eclipse.osee.framework.core.enums.RelationSide;
-import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.RelationType;
-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.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactData;
-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.relation.RelationManager;
-import org.eclipse.osee.framework.skynet.core.relation.RelationTypeSide;
-import org.eclipse.osee.framework.skynet.core.relation.RelationTypeSideSorter;
-import org.eclipse.osee.framework.ui.skynet.artifact.massEditor.MassArtifactEditor;
-import org.eclipse.osee.framework.ui.skynet.relation.explorer.RelationExplorerWindow;
-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.SkynetDragAndDrop;
-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.dnd.DND;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.MenuEvent;
-import org.eclipse.swt.events.MenuListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * <REM2> handled by IArtifactEditorEventHandler
- *
- * @author Ryan D. Brooks
- */
-public class RelationsComposite extends Composite implements IFrameworkTransactionEventListener {
- private TreeViewer treeViewer;
- private Tree tree;
- private NeedSelectedArtifactListener needSelectedArtifactListener;
- private final IDirtiableEditor editor;
- public static final String VIEW_ID = "osee.define.relation.RelationExplorer";
- public static final String[] columnNames = new String[] {" ", "Rationale"};
- // the index of column order
- private static int COLUMN_ORDER = 1;
-
- private MenuItem openMenuItem;
- private MenuItem wordPreviewItem;
- // private MenuItem openWithMenuItem;
- private MenuItem editMenuItem;
- private MenuItem viewRelationTreeItem;
- private MenuItem orderRelationMenuItem;
- private MenuItem deleteRelationMenuItem;
- private MenuItem deleteArtifactMenuItem;
- private MenuItem massEditMenuItem;
-
- private final Artifact artifact;
- private final RelationLabelProvider relationLabelProvider;
- private final ToolBar toolBar;
-
- public RelationsComposite(IDirtiableEditor editor, Composite parent, int style, Artifact artifact) {
- this(editor, parent, style, artifact, null);
- }
-
- public RelationsComposite(IDirtiableEditor editor, Composite parent, int style, Artifact artifact, ToolBar toolBar) {
- super(parent, style);
-
- if (artifact == null) {
- throw new IllegalArgumentException("Can not edit a null artifact");
- }
-
- this.artifact = artifact;
- this.editor = editor;
- this.relationLabelProvider = new RelationLabelProvider(artifact);
-
- createPartControl();
- OseeEventManager.addListener(this);
- this.toolBar = toolBar;
- }
-
- public TreeViewer getTreeViewer() {
- return treeViewer;
- }
-
- public void createPartControl() {
- this.setLayout(new GridLayout());
- this.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- createTreeArea(this);
- createColumns();
- packColumnData();
-
- needSelectedArtifactListener = new NeedSelectedArtifactListener();
- createPopupMenu();
- setHelpContexts();
- }
-
- private void createTreeArea(Composite parent) {
- treeViewer = new TreeViewer(parent, SWT.FULL_SELECTION | SWT.MULTI | SWT.NO_SCROLL);
- tree = treeViewer.getTree();
- tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- tree.setHeaderVisible(true);
-
- CellEditor[] editors = new CellEditor[columnNames.length];
- editors[1] = new TextCellEditor(tree);
- treeViewer.setCellEditors(editors);
- treeViewer.setCellModifier(new RelationCellModifier(treeViewer));
- treeViewer.setColumnProperties(columnNames);
- treeViewer.setContentProvider(new RelationContentProvider());
- treeViewer.setLabelProvider(relationLabelProvider);
- treeViewer.setUseHashlookup(true);
- treeViewer.setInput(new ArtifactRoot(artifact));
-
- treeViewer.addDoubleClickListener(new DoubleClickListener());
- tree.addKeyListener(new KeySelectedListener());
- treeViewer.addTreeListener(new ITreeViewerListener() {
- @Override
- public void treeCollapsed(TreeExpansionEvent event) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- packColumnData();
- }
- });
- }
-
- @Override
- public void treeExpanded(TreeExpansionEvent event) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- packColumnData();
- }
- });
- }
- });
-
- tree.addMouseMoveListener(new MouseMoveListener() {
- @Override
- public void mouseMove(MouseEvent e) {
- }
- });
-
- expandItemsThatHaveChildren();
- new RelationSkynetDragAndDrop(tree, VIEW_ID);
- }
-
- private void expandItemsThatHaveChildren() {
- //expand items that have children
- Object[] types = ((ITreeContentProvider) treeViewer.getContentProvider()).getChildren(treeViewer.getInput());
- for (Object obj : types) {
- if (obj instanceof RelationType) {
- RelationType type = (RelationType) obj;
- if (RelationManager.getRelatedArtifactsCount(artifact, type, null) > 0) {
- treeViewer.expandToLevel(obj, 1);
- }
- }
- }
- }
-
- private void createColumns() {
- for (int index = 0; index < columnNames.length; index++) {
- TreeColumn column = new TreeColumn(tree, SWT.LEFT, index);
- column.setText(columnNames[index]);
- }
- }
-
- private void packColumnData() {
- TreeColumn[] columns = treeViewer.getTree().getColumns();
- for (TreeColumn column : columns) {
- column.pack();
- }
- }
-
- public void createPopupMenu() {
- Menu popupMenu = new Menu(treeViewer.getTree().getParent());
- popupMenu.addMenuListener(needSelectedArtifactListener);
-
- createOpenMenuItem(popupMenu);
- createWordPreviewMenuItem(popupMenu);
- // createOpenWithMenuItem(popupMenu);
- new MenuItem(popupMenu, SWT.SEPARATOR);
- createEditMenuItem(popupMenu);
- createMassEditMenuItem(popupMenu);
- new MenuItem(popupMenu, SWT.SEPARATOR);
- createViewRelationTreeMenuItem(popupMenu);
- new MenuItem(popupMenu, SWT.SEPARATOR);
- createOrderRelationTreeMenuItem(popupMenu);
- new MenuItem(popupMenu, SWT.SEPARATOR);
- createDeleteRelationMenuItem(popupMenu);
- new MenuItem(popupMenu, SWT.SEPARATOR);
-
- createExpandAllMenuItem(popupMenu);
- createSelectAllMenuItem(popupMenu);
-
- new MenuItem(popupMenu, SWT.SEPARATOR);
- createDeleteArtifactMenuItem(popupMenu);
-
- tree.setMenu(popupMenu);
- }
-
- public class DoubleClickListener implements IDoubleClickListener {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- openViewer((IStructuredSelection) event.getSelection());
- }
- }
-
- private void createOrderRelationTreeMenuItem(final Menu parentMenu) {
-
- orderRelationMenuItem = new MenuItem(parentMenu, SWT.CASCADE);
- orderRelationMenuItem.setText("&Order Relations");
- needSelectedArtifactListener.add(orderRelationMenuItem);
-
- Menu subMenu = new Menu(parentMenu);
- orderRelationMenuItem.setMenu(subMenu);
-
- List<IRelationSorterId> orderTypes = RelationManager.getRelationOrderTypes();
- for (IRelationSorterId id : orderTypes) {
- MenuItem idMenu = new MenuItem(subMenu, SWT.CASCADE | SWT.CHECK);
- idMenu.setText(id.getName());
- idMenu.addSelectionListener(new SelectionId(id));
- }
-
- parentMenu.addListener(SWT.Show, new Listener() {
-
- @Override
- public void handleEvent(Event event) {
- IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
- Object[] objects = selection.toArray();
- if (objects.length == 1 && objects[0] instanceof RelationTypeSideSorter) {
- orderRelationMenuItem.setEnabled(true);
- try {
- checkCurrentOrderStrategy(orderRelationMenuItem.getMenu(), (RelationTypeSideSorter) objects[0]);
- } catch (OseeCoreException ex) {
- }
- } else {
- orderRelationMenuItem.setEnabled(false);
- }
- }
-
- });
- orderRelationMenuItem.setEnabled(true);
- }
-
- private void checkCurrentOrderStrategy(Menu menu, RelationTypeSideSorter rts) throws OseeCoreException {
- String relationOrderName = rts.getSorterName();
-
- for (MenuItem item : menu.getItems()) {
- String itemName = item.getText();
- if (itemName.equals(relationOrderName)) {
- item.setSelection(true);
- } else {
- item.setSelection(false);
- }
- }
- }
-
- private class SelectionId implements SelectionListener {
-
- private final IRelationSorterId id;
-
- SelectionId(IRelationSorterId id) {
- this.id = id;
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
- Object[] objects = selection.toArray();
- if (objects.length == 1 && objects[0] instanceof RelationTypeSideSorter) {
- RelationTypeSideSorter typeSide = (RelationTypeSideSorter) objects[0];
- try {
- typeSide.getArtifact().setRelationOrder(typeSide, id);
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- }
- }
-
- private void createDeleteRelationMenuItem(final Menu parentMenu) {
- deleteRelationMenuItem = new MenuItem(parentMenu, SWT.CASCADE);
- deleteRelationMenuItem.setText("&Delete Relation");
- needSelectedArtifactListener.add(deleteRelationMenuItem);
- deleteRelationMenuItem.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
- performDeleteRelation(selection);
- }
- });
-
- deleteRelationMenuItem.setEnabled(true);
- }
-
- private void createDeleteArtifactMenuItem(final Menu parentMenu) {
- deleteArtifactMenuItem = new MenuItem(parentMenu, SWT.CASCADE);
- deleteArtifactMenuItem.setText("&Delete Artifact");
- needSelectedArtifactListener.add(deleteArtifactMenuItem);
- deleteArtifactMenuItem.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
-
- performDeleteArtifact(selection);
- }
- });
-
- deleteArtifactMenuItem.setEnabled(true);
- }
-
- private void createMassEditMenuItem(final Menu parentMenu) {
- massEditMenuItem = new MenuItem(parentMenu, SWT.CASCADE);
- massEditMenuItem.setText("&Mass Edit");
- needSelectedArtifactListener.add(massEditMenuItem);
- massEditMenuItem.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
-
- performMassEdit(selection);
- }
- });
-
- massEditMenuItem.setEnabled(true);
- }
-
- private void createViewRelationTreeMenuItem(Menu menu) {
- viewRelationTreeItem = new MenuItem(menu, SWT.PUSH);
- viewRelationTreeItem.setText("&View Relation Table Report");
- viewRelationTreeItem.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- TreeViewerReport report =
- new TreeViewerReport("Relation View Report for " + artifact.getName(), treeViewer);
- ArrayList<Integer> ignoreCols = new ArrayList<Integer>();
- ignoreCols.add(COLUMN_ORDER);
- report.setIgnoreColumns(ignoreCols);
- report.open();
- }
- });
- }
-
- private void createOpenMenuItem(Menu parentMenu) {
- openMenuItem = new MenuItem(parentMenu, SWT.PUSH);
- openMenuItem.setText("Open");
- needSelectedArtifactListener.addArtifactEnabled(openMenuItem);
- openMenuItem.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent event) {
- openViewer((IStructuredSelection) treeViewer.getSelection());
- }
- });
- }
-
- private void openViewer(IStructuredSelection selection) {
- for (Object object : selection.toArray()) {
- if (object instanceof WrapperForRelationLink) {
- WrapperForRelationLink link = (WrapperForRelationLink) object;
- try {
- RendererManager.open(link.getOther(), PresentationType.GENERALIZED_EDIT);
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
- }
-
- private void createWordPreviewMenuItem(Menu parentMenu) {
- wordPreviewItem = new MenuItem(parentMenu, SWT.PUSH);
- wordPreviewItem.setText("Open Preview");
- needSelectedArtifactListener.addArtifactEnabled(wordPreviewItem);
- wordPreviewItem.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent event) {
- openWordViewer((IStructuredSelection) treeViewer.getSelection());
- }
- });
- }
-
- private void openWordViewer(IStructuredSelection selection) {
- List<Artifact> artifacts = new ArrayList<Artifact>();
-
- for (Object object : selection.toArray()) {
- if (object instanceof WrapperForRelationLink) {
- WrapperForRelationLink link = (WrapperForRelationLink) object;
- artifacts.add(link.getOther());
- }
- }
- RendererManager.openInJob(artifacts, PresentationType.PREVIEW);
- }
-
- private void performMassEdit(IStructuredSelection selection) {
- Set<Artifact> selectedArtifacts = getSelectedArtifacts(selection);
- MassArtifactEditor.editArtifacts("Mass Edit", selectedArtifacts);
- }
-
- private Set<Artifact> getSelectedArtifacts(IStructuredSelection selection) {
- Set<Artifact> selectedArtifacts = new HashSet<Artifact>();
- Iterator<?> iter = selection.iterator();
- while (iter.hasNext()) {
- Object object = iter.next();
- if (object instanceof WrapperForRelationLink) {
- WrapperForRelationLink wrapped = (WrapperForRelationLink) object;
- selectedArtifacts.add(wrapped.getOther());
- }
- }
- return selectedArtifacts;
- }
-
- private void createEditMenuItem(Menu parentMenu) {
- editMenuItem = new MenuItem(parentMenu, SWT.PUSH);
- editMenuItem.setText("&Edit");
-
- needSelectedArtifactListener.add(editMenuItem);
- editMenuItem.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent event) {
- IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
- Object object = selection.getFirstElement();
-
- if (object instanceof WrapperForRelationLink) {
- RendererManager.openInJob(((WrapperForRelationLink) object).getOther(),
- PresentationType.SPECIALIZED_EDIT);
- }
- }
- });
- }
-
- private void createExpandAllMenuItem(Menu parentMenu) {
- MenuItem menuItem = new MenuItem(parentMenu, SWT.PUSH);
- menuItem.setText("Expand All\tCtrl+X");
- menuItem.addSelectionListener(new ExpandListener());
- }
-
- public class ExpandListener extends SelectionAdapter {
- @Override
- public void widgetSelected(SelectionEvent event) {
- IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
- Iterator<?> iter = selection.iterator();
- while (iter.hasNext()) {
- treeViewer.expandToLevel(iter.next(), TreeViewer.ALL_LEVELS);
- }
- packColumnData();
- }
- }
-
- public class NeedSelectedArtifactListener implements MenuListener {
- Collection<MenuItem> accessControlitems;
- Collection<MenuItem> artEnabledOnlyitems;
-
- public NeedSelectedArtifactListener() {
- this.accessControlitems = new LinkedList<MenuItem>();
- this.artEnabledOnlyitems = new LinkedList<MenuItem>();
- }
-
- public void addArtifactEnabled(MenuItem item) {
- artEnabledOnlyitems.add(item);
-
- }
-
- public void add(MenuItem item) {
- accessControlitems.add(item);
- }
-
- @Override
- public void menuHidden(MenuEvent e) {
- }
-
- @Override
- public void menuShown(MenuEvent e) {
- IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
- boolean valid = selection.getFirstElement() instanceof WrapperForRelationLink;
-
- for (MenuItem item : accessControlitems) {
- item.setEnabled(valid && !artifact.isReadOnly());
- }
-
- for (MenuItem item : artEnabledOnlyitems) {
- item.setEnabled(valid);
- }
- }
- }
-
- private void createSelectAllMenuItem(Menu parentMenu) {
- MenuItem menuItem = new MenuItem(parentMenu, SWT.PUSH);
- menuItem.setText("&Select All\tCtrl+A");
- menuItem.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(org.eclipse.swt.widgets.Event event) {
- treeViewer.getTree().selectAll();
- }
- });
- }
-
- @Override
- public void dispose() {
- OseeEventManager.removeListener(this);
- super.dispose();
- }
-
- private void expandAll(IStructuredSelection selection) {
- Iterator<?> iter = selection.iterator();
- while (iter.hasNext()) {
- treeViewer.expandToLevel(iter.next(), TreeViewer.ALL_LEVELS);
- }
- this.packColumnData();
- }
-
- /**
- * Performs the deletion functionality
- *
- * @param selection
- */
- private void performDeleteArtifact(IStructuredSelection selection) {
- try {
- Set<Artifact> artifactsToBeDeleted = getSelectedArtifacts(selection);
-
- //Ask if they are sure they want all artifacts to be deleted
- if (!artifactsToBeDeleted.isEmpty()) {
- if (MessageDialog.openConfirm(
- Displays.getActiveShell(),
- "Delete Artifact (s)",
- "Delete Artifact (s)?\n\n\"" + Collections.toString(",", artifactsToBeDeleted) + "\"\n\nNOTE: This will delete the artifact from the system. Use \"Delete Relation\" to remove this artifact from the relation.")) {
-
- for (Artifact artifact : artifactsToBeDeleted) {
- artifact.deleteAndPersist();
- }
- }
- }
-
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- refresh();
- }
-
- /**
- * Performs the deletion functionality
- *
- * @param selection
- * @throws ArtifactDoesNotExist
- */
- private void performDeleteRelation(IStructuredSelection selection) {
- if (artifact.isReadOnly()) {
- MessageDialog.openError(
- Displays.getActiveShell(),
- "Delete Relation Error",
- "Access control has restricted this action. The current user does not have sufficient permission to delete objects on this artifact.");
- return;
- }
-
- Object[] objects = selection.toArray();
- for (Object object : objects) {
- if (object instanceof WrapperForRelationLink) {
- WrapperForRelationLink wrapper = (WrapperForRelationLink) object;
- try {
- wrapper.getArtifactA().deleteRelation(
- new RelationTypeSide(wrapper.getRelationType(), RelationSide.SIDE_B), wrapper.getArtifactB());
- Object parent = ((ITreeContentProvider) treeViewer.getContentProvider()).getParent(object);
- if (parent != null) {
- treeViewer.refresh(parent);
- } else {
- treeViewer.refresh();
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- } else if (object instanceof RelationTypeSideSorter) {
- RelationTypeSideSorter group = (RelationTypeSideSorter) object;
- try {
- RelationManager.deleteRelations(artifact, group.getRelationType(), group.getSide());
- treeViewer.refresh(group);
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- }
- editor.onDirtied();
- }
-
- public void refresh() {
- if (!treeViewer.getTree().isDisposed()) {
- treeViewer.refresh();
- packColumnData();
- }
- }
-
- private final class KeySelectedListener implements KeyListener {
- @Override
- public void keyPressed(KeyEvent e) {
- }
-
- @Override
- public void keyReleased(KeyEvent e) {
- if (e.keyCode == SWT.DEL) {
- performDeleteRelation((IStructuredSelection) treeViewer.getSelection());
- }
- if (e.keyCode == 'a' && e.stateMask == SWT.CONTROL) {
- treeViewer.getTree().selectAll();
- }
- if (e.keyCode == 'x' && e.stateMask == SWT.CONTROL) {
- expandAll((IStructuredSelection) treeViewer.getSelection());
- }
- }
- }
-
- public Artifact getArtifact() {
- return artifact;
- }
-
- public void refreshArtifact(Artifact newArtifact) {
- relationLabelProvider.setArtifact(newArtifact);
- treeViewer.setInput(newArtifact);
- expandItemsThatHaveChildren();
- refresh();
- }
-
- private class RelationSkynetDragAndDrop extends SkynetDragAndDrop {
- boolean isFeedbackAfter = false;
-
- public RelationSkynetDragAndDrop(Tree tree, String viewId) {
- super(tree, viewId);
- }
-
- @Override
- public Artifact[] getArtifacts() {
- IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
- Object[] objects = selection.toArray();
- Artifact[] artifacts = null;
-
- if (objects.length > 0 && objects[0] instanceof WrapperForRelationLink) {
- artifacts = new Artifact[objects.length];
-
- for (int index = 0; index < objects.length; index++) {
- WrapperForRelationLink link = (WrapperForRelationLink) objects[index];
- artifacts[index] = link.getOther();
- }
- }
- return artifacts;
- }
-
- @Override
- public void performDragOver(DropTargetEvent event) {
- Tree tree = treeViewer.getTree();
- TreeItem selected = tree.getItem(treeViewer.getTree().toControl(event.x, event.y));
-
- event.feedback = DND.FEEDBACK_EXPAND;
- event.detail = DND.DROP_NONE;
-
- if (selected != null && selected.getData() instanceof RelationTypeSideSorter) {
- if (artifact.isReadOnly()) {
- event.detail = DND.DROP_NONE;
-
- MessageDialog.openError(
- Displays.getActiveShell(),
- "Create Relation Error",
- "Access control has restricted this action. The current user does not have sufficient permission to create relations on this artifact.");
- return;
- } else {
- event.detail = DND.DROP_COPY;
- tree.setInsertMark(null, false);
- }
- } else if (selected != null && selected.getData() instanceof WrapperForRelationLink) {
- WrapperForRelationLink targetLink = (WrapperForRelationLink) selected.getData();
- IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
- Object obj = selection.getFirstElement();
- if (obj instanceof WrapperForRelationLink) {
- WrapperForRelationLink dropTarget = (WrapperForRelationLink) obj;
-
- if (artifact.isReadOnly()) {
- event.detail = DND.DROP_NONE;
- MessageDialog.openError(
- Displays.getActiveShell(),
- "Create Relation Error",
- "Access control has restricted this action. The current user does not have sufficient permission to create relations on this artifact.");
- return;
- }
- // the links must be in the same group
- if (relationLinkIsInSameGroup(targetLink, dropTarget)) {
- if (isFeedbackAfter) {
- event.feedback = DND.FEEDBACK_INSERT_AFTER;
- } else {
- event.feedback = DND.FEEDBACK_INSERT_BEFORE;
- }
- event.detail = DND.DROP_MOVE;
- }
- }
- } else {
- tree.setInsertMark(null, false);
- }
- }
-
- private boolean relationLinkIsInSameGroup(WrapperForRelationLink targetLink, WrapperForRelationLink dropTarget) {
- return targetLink.getRelationType().equals(dropTarget.getRelationType()) && //same type
- (targetLink.getArtifactA().equals(dropTarget.getArtifactA()) || //either the A or B side is equal, meaning they are on the same side
- targetLink.getArtifactB().equals(dropTarget.getArtifactB()));
- }
-
- @Override
- public void operationChanged(DropTargetEvent event) {
- if (!isCtrlPressed(event)) {
- isFeedbackAfter = false;
- }
- }
-
- private boolean isCtrlPressed(DropTargetEvent event) {
- boolean ctrPressed = event.detail == 1;
-
- if (ctrPressed) {
- isFeedbackAfter = true;
- }
- return ctrPressed;
- }
-
- @Override
- public void performDrop(DropTargetEvent event) {
- TreeItem selected = treeViewer.getTree().getItem(treeViewer.getTree().toControl(event.x, event.y));
- Object object = selected.getData();
- try {
- if (object instanceof WrapperForRelationLink) {//used for ordering
- WrapperForRelationLink targetLink = (WrapperForRelationLink) object;
- Artifact[] artifactsToMove = ((ArtifactData) event.data).getArtifacts();
- for (Artifact artifactToMove : artifactsToMove) {
- IRelationEnumeration typeSide =
- new RelationTypeSide(targetLink.getRelationType(), targetLink.getRelationSide());
- artifact.setRelationOrder(typeSide, targetLink.getOther(), isFeedbackAfter, artifactToMove);
- }
- treeViewer.refresh();
- editor.onDirtied();
- } else if (object instanceof RelationTypeSideSorter) {
- RelationTypeSideSorter group = (RelationTypeSideSorter) object;
-
- RelationExplorerWindow window = new RelationExplorerWindow(treeViewer, group);
-
- ArtifactDragDropSupport.performDragDrop(event, window,
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
- window.createArtifactInformationBox();
- treeViewer.refresh();
- editor.onDirtied();
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
-
- isFeedbackAfter = false;
- }
- }
-
- private void setHelpContexts() {
- SkynetGuiPlugin.getInstance().setHelp(treeViewer.getControl(), "relation_page_tree_viewer",
- "org.eclipse.osee.framework.help.ui");
- }
-
- public ToolBar getToolBar() {
- return toolBar;
- }
-
- @Override
- public void handleFrameworkTransactionEvent(Sender sender, FrameworkTransactionData transData) {
- if (transData.isRelAddedChangedDeleted(this.artifact)) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (!treeViewer.getControl().isDisposed()) {
- treeViewer.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.framework.ui.skynet;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.ITreeViewerListener;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.TreeExpansionEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.osee.framework.core.data.IRelationSorterId;
+import org.eclipse.osee.framework.core.enums.IRelationEnumeration;
+import org.eclipse.osee.framework.core.enums.RelationSide;
+import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.type.RelationType;
+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.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactData;
+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.relation.RelationManager;
+import org.eclipse.osee.framework.skynet.core.relation.RelationTypeSide;
+import org.eclipse.osee.framework.skynet.core.relation.RelationTypeSideSorter;
+import org.eclipse.osee.framework.ui.skynet.artifact.massEditor.MassArtifactEditor;
+import org.eclipse.osee.framework.ui.skynet.relation.explorer.RelationExplorerWindow;
+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.SkynetDragAndDrop;
+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.dnd.DND;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.events.MenuListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * <REM2> handled by IArtifactEditorEventHandler
+ *
+ * @author Ryan D. Brooks
+ */
+public class RelationsComposite extends Composite implements IFrameworkTransactionEventListener {
+ private TreeViewer treeViewer;
+ private Tree tree;
+ private NeedSelectedArtifactListener needSelectedArtifactListener;
+ private final IDirtiableEditor editor;
+ public static final String VIEW_ID = "osee.define.relation.RelationExplorer";
+ public static final String[] columnNames = new String[] {" ", "Rationale"};
+ // the index of column order
+ private static int COLUMN_ORDER = 1;
+
+ private MenuItem openMenuItem;
+ private MenuItem wordPreviewItem;
+ // private MenuItem openWithMenuItem;
+ private MenuItem editMenuItem;
+ private MenuItem viewRelationTreeItem;
+ private MenuItem orderRelationMenuItem;
+ private MenuItem deleteRelationMenuItem;
+ private MenuItem deleteArtifactMenuItem;
+ private MenuItem massEditMenuItem;
+
+ private final Artifact artifact;
+ private final RelationLabelProvider relationLabelProvider;
+ private final ToolBar toolBar;
+
+ public RelationsComposite(IDirtiableEditor editor, Composite parent, int style, Artifact artifact) {
+ this(editor, parent, style, artifact, null);
+ }
+
+ public RelationsComposite(IDirtiableEditor editor, Composite parent, int style, Artifact artifact, ToolBar toolBar) {
+ super(parent, style);
+
+ if (artifact == null) {
+ throw new IllegalArgumentException("Can not edit a null artifact");
+ }
+
+ this.artifact = artifact;
+ this.editor = editor;
+ this.relationLabelProvider = new RelationLabelProvider(artifact);
+
+ createPartControl();
+ OseeEventManager.addListener(this);
+ this.toolBar = toolBar;
+ }
+
+ public TreeViewer getTreeViewer() {
+ return treeViewer;
+ }
+
+ public void createPartControl() {
+ this.setLayout(new GridLayout());
+ this.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ createTreeArea(this);
+ createColumns();
+ packColumnData();
+
+ needSelectedArtifactListener = new NeedSelectedArtifactListener();
+ createPopupMenu();
+ setHelpContexts();
+ }
+
+ private void createTreeArea(Composite parent) {
+ treeViewer = new TreeViewer(parent, SWT.FULL_SELECTION | SWT.MULTI | SWT.NO_SCROLL);
+ tree = treeViewer.getTree();
+ tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ tree.setHeaderVisible(true);
+
+ CellEditor[] editors = new CellEditor[columnNames.length];
+ editors[1] = new TextCellEditor(tree);
+ treeViewer.setCellEditors(editors);
+ treeViewer.setCellModifier(new RelationCellModifier(treeViewer));
+ treeViewer.setColumnProperties(columnNames);
+ treeViewer.setContentProvider(new RelationContentProvider());
+ treeViewer.setLabelProvider(relationLabelProvider);
+ treeViewer.setUseHashlookup(true);
+ treeViewer.setInput(new ArtifactRoot(artifact));
+
+ treeViewer.addDoubleClickListener(new DoubleClickListener());
+ tree.addKeyListener(new KeySelectedListener());
+ treeViewer.addTreeListener(new ITreeViewerListener() {
+ @Override
+ public void treeCollapsed(TreeExpansionEvent event) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ packColumnData();
+ }
+ });
+ }
+
+ @Override
+ public void treeExpanded(TreeExpansionEvent event) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ packColumnData();
+ }
+ });
+ }
+ });
+
+ tree.addMouseMoveListener(new MouseMoveListener() {
+ @Override
+ public void mouseMove(MouseEvent e) {
+ }
+ });
+
+ expandItemsThatHaveChildren();
+ new RelationSkynetDragAndDrop(tree, VIEW_ID);
+ }
+
+ private void expandItemsThatHaveChildren() {
+ //expand items that have children
+ Object[] types = ((ITreeContentProvider) treeViewer.getContentProvider()).getChildren(treeViewer.getInput());
+ for (Object obj : types) {
+ if (obj instanceof RelationType) {
+ RelationType type = (RelationType) obj;
+ if (RelationManager.getRelatedArtifactsCount(artifact, type, null) > 0) {
+ treeViewer.expandToLevel(obj, 1);
+ }
+ }
+ }
+ }
+
+ private void createColumns() {
+ for (int index = 0; index < columnNames.length; index++) {
+ TreeColumn column = new TreeColumn(tree, SWT.LEFT, index);
+ column.setText(columnNames[index]);
+ }
+ }
+
+ private void packColumnData() {
+ TreeColumn[] columns = treeViewer.getTree().getColumns();
+ for (TreeColumn column : columns) {
+ column.pack();
+ }
+ }
+
+ public void createPopupMenu() {
+ Menu popupMenu = new Menu(treeViewer.getTree().getParent());
+ popupMenu.addMenuListener(needSelectedArtifactListener);
+
+ createOpenMenuItem(popupMenu);
+ createWordPreviewMenuItem(popupMenu);
+ // createOpenWithMenuItem(popupMenu);
+ new MenuItem(popupMenu, SWT.SEPARATOR);
+ createEditMenuItem(popupMenu);
+ createMassEditMenuItem(popupMenu);
+ new MenuItem(popupMenu, SWT.SEPARATOR);
+ createViewRelationTreeMenuItem(popupMenu);
+ new MenuItem(popupMenu, SWT.SEPARATOR);
+ createOrderRelationTreeMenuItem(popupMenu);
+ new MenuItem(popupMenu, SWT.SEPARATOR);
+ createDeleteRelationMenuItem(popupMenu);
+ new MenuItem(popupMenu, SWT.SEPARATOR);
+
+ createExpandAllMenuItem(popupMenu);
+ createSelectAllMenuItem(popupMenu);
+
+ new MenuItem(popupMenu, SWT.SEPARATOR);
+ createDeleteArtifactMenuItem(popupMenu);
+
+ tree.setMenu(popupMenu);
+ }
+
+ public class DoubleClickListener implements IDoubleClickListener {
+ @Override
+ public void doubleClick(DoubleClickEvent event) {
+ openViewer((IStructuredSelection) event.getSelection());
+ }
+ }
+
+ private void createOrderRelationTreeMenuItem(final Menu parentMenu) {
+
+ orderRelationMenuItem = new MenuItem(parentMenu, SWT.CASCADE);
+ orderRelationMenuItem.setText("&Order Relations");
+ needSelectedArtifactListener.add(orderRelationMenuItem);
+
+ Menu subMenu = new Menu(parentMenu);
+ orderRelationMenuItem.setMenu(subMenu);
+
+ List<IRelationSorterId> orderTypes = RelationManager.getRelationOrderTypes();
+ for (IRelationSorterId id : orderTypes) {
+ MenuItem idMenu = new MenuItem(subMenu, SWT.CASCADE | SWT.CHECK);
+ idMenu.setText(id.getName());
+ idMenu.addSelectionListener(new SelectionId(id));
+ }
+
+ parentMenu.addListener(SWT.Show, new Listener() {
+
+ @Override
+ public void handleEvent(Event event) {
+ IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
+ Object[] objects = selection.toArray();
+ if (objects.length == 1 && objects[0] instanceof RelationTypeSideSorter) {
+ orderRelationMenuItem.setEnabled(true);
+ try {
+ checkCurrentOrderStrategy(orderRelationMenuItem.getMenu(), (RelationTypeSideSorter) objects[0]);
+ } catch (OseeCoreException ex) {
+ }
+ } else {
+ orderRelationMenuItem.setEnabled(false);
+ }
+ }
+
+ });
+ orderRelationMenuItem.setEnabled(true);
+ }
+
+ private void checkCurrentOrderStrategy(Menu menu, RelationTypeSideSorter rts) throws OseeCoreException {
+ String relationOrderName = rts.getSorterName();
+
+ for (MenuItem item : menu.getItems()) {
+ String itemName = item.getText();
+ if (itemName.equals(relationOrderName)) {
+ item.setSelection(true);
+ } else {
+ item.setSelection(false);
+ }
+ }
+ }
+
+ private class SelectionId implements SelectionListener {
+
+ private final IRelationSorterId id;
+
+ SelectionId(IRelationSorterId id) {
+ this.id = id;
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
+ Object[] objects = selection.toArray();
+ if (objects.length == 1 && objects[0] instanceof RelationTypeSideSorter) {
+ RelationTypeSideSorter typeSide = (RelationTypeSideSorter) objects[0];
+ try {
+ typeSide.getArtifact().setRelationOrder(typeSide, id);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ }
+
+ private void createDeleteRelationMenuItem(final Menu parentMenu) {
+ deleteRelationMenuItem = new MenuItem(parentMenu, SWT.CASCADE);
+ deleteRelationMenuItem.setText("&Delete Relation");
+ needSelectedArtifactListener.add(deleteRelationMenuItem);
+ deleteRelationMenuItem.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
+ performDeleteRelation(selection);
+ }
+ });
+
+ deleteRelationMenuItem.setEnabled(true);
+ }
+
+ private void createDeleteArtifactMenuItem(final Menu parentMenu) {
+ deleteArtifactMenuItem = new MenuItem(parentMenu, SWT.CASCADE);
+ deleteArtifactMenuItem.setText("&Delete Artifact");
+ needSelectedArtifactListener.add(deleteArtifactMenuItem);
+ deleteArtifactMenuItem.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
+
+ performDeleteArtifact(selection);
+ }
+ });
+
+ deleteArtifactMenuItem.setEnabled(true);
+ }
+
+ private void createMassEditMenuItem(final Menu parentMenu) {
+ massEditMenuItem = new MenuItem(parentMenu, SWT.CASCADE);
+ massEditMenuItem.setText("&Mass Edit");
+ needSelectedArtifactListener.add(massEditMenuItem);
+ massEditMenuItem.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
+
+ performMassEdit(selection);
+ }
+ });
+
+ massEditMenuItem.setEnabled(true);
+ }
+
+ private void createViewRelationTreeMenuItem(Menu menu) {
+ viewRelationTreeItem = new MenuItem(menu, SWT.PUSH);
+ viewRelationTreeItem.setText("&View Relation Table Report");
+ viewRelationTreeItem.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ TreeViewerReport report =
+ new TreeViewerReport("Relation View Report for " + artifact.getName(), treeViewer);
+ ArrayList<Integer> ignoreCols = new ArrayList<Integer>();
+ ignoreCols.add(COLUMN_ORDER);
+ report.setIgnoreColumns(ignoreCols);
+ report.open();
+ }
+ });
+ }
+
+ private void createOpenMenuItem(Menu parentMenu) {
+ openMenuItem = new MenuItem(parentMenu, SWT.PUSH);
+ openMenuItem.setText("Open");
+ needSelectedArtifactListener.addArtifactEnabled(openMenuItem);
+ openMenuItem.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ openViewer((IStructuredSelection) treeViewer.getSelection());
+ }
+ });
+ }
+
+ private void openViewer(IStructuredSelection selection) {
+ for (Object object : selection.toArray()) {
+ if (object instanceof WrapperForRelationLink) {
+ WrapperForRelationLink link = (WrapperForRelationLink) object;
+ try {
+ RendererManager.open(link.getOther(), PresentationType.GENERALIZED_EDIT);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+ }
+
+ private void createWordPreviewMenuItem(Menu parentMenu) {
+ wordPreviewItem = new MenuItem(parentMenu, SWT.PUSH);
+ wordPreviewItem.setText("Open Preview");
+ needSelectedArtifactListener.addArtifactEnabled(wordPreviewItem);
+ wordPreviewItem.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ openWordViewer((IStructuredSelection) treeViewer.getSelection());
+ }
+ });
+ }
+
+ private void openWordViewer(IStructuredSelection selection) {
+ List<Artifact> artifacts = new ArrayList<Artifact>();
+
+ for (Object object : selection.toArray()) {
+ if (object instanceof WrapperForRelationLink) {
+ WrapperForRelationLink link = (WrapperForRelationLink) object;
+ artifacts.add(link.getOther());
+ }
+ }
+ RendererManager.openInJob(artifacts, PresentationType.PREVIEW);
+ }
+
+ private void performMassEdit(IStructuredSelection selection) {
+ Set<Artifact> selectedArtifacts = getSelectedArtifacts(selection);
+ MassArtifactEditor.editArtifacts("Mass Edit", selectedArtifacts);
+ }
+
+ private Set<Artifact> getSelectedArtifacts(IStructuredSelection selection) {
+ Set<Artifact> selectedArtifacts = new HashSet<Artifact>();
+ Iterator<?> iter = selection.iterator();
+ while (iter.hasNext()) {
+ Object object = iter.next();
+ if (object instanceof WrapperForRelationLink) {
+ WrapperForRelationLink wrapped = (WrapperForRelationLink) object;
+ selectedArtifacts.add(wrapped.getOther());
+ }
+ }
+ return selectedArtifacts;
+ }
+
+ private void createEditMenuItem(Menu parentMenu) {
+ editMenuItem = new MenuItem(parentMenu, SWT.PUSH);
+ editMenuItem.setText("&Edit");
+
+ needSelectedArtifactListener.add(editMenuItem);
+ editMenuItem.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
+ Object object = selection.getFirstElement();
+
+ if (object instanceof WrapperForRelationLink) {
+ RendererManager.openInJob(((WrapperForRelationLink) object).getOther(),
+ PresentationType.SPECIALIZED_EDIT);
+ }
+ }
+ });
+ }
+
+ private void createExpandAllMenuItem(Menu parentMenu) {
+ MenuItem menuItem = new MenuItem(parentMenu, SWT.PUSH);
+ menuItem.setText("Expand All\tCtrl+X");
+ menuItem.addSelectionListener(new ExpandListener());
+ }
+
+ public class ExpandListener extends SelectionAdapter {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
+ Iterator<?> iter = selection.iterator();
+ while (iter.hasNext()) {
+ treeViewer.expandToLevel(iter.next(), TreeViewer.ALL_LEVELS);
+ }
+ packColumnData();
+ }
+ }
+
+ public class NeedSelectedArtifactListener implements MenuListener {
+ Collection<MenuItem> accessControlitems;
+ Collection<MenuItem> artEnabledOnlyitems;
+
+ public NeedSelectedArtifactListener() {
+ this.accessControlitems = new LinkedList<MenuItem>();
+ this.artEnabledOnlyitems = new LinkedList<MenuItem>();
+ }
+
+ public void addArtifactEnabled(MenuItem item) {
+ artEnabledOnlyitems.add(item);
+
+ }
+
+ public void add(MenuItem item) {
+ accessControlitems.add(item);
+ }
+
+ @Override
+ public void menuHidden(MenuEvent e) {
+ }
+
+ @Override
+ public void menuShown(MenuEvent e) {
+ IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
+ boolean valid = selection.getFirstElement() instanceof WrapperForRelationLink;
+
+ for (MenuItem item : accessControlitems) {
+ item.setEnabled(valid && !artifact.isReadOnly());
+ }
+
+ for (MenuItem item : artEnabledOnlyitems) {
+ item.setEnabled(valid);
+ }
+ }
+ }
+
+ private void createSelectAllMenuItem(Menu parentMenu) {
+ MenuItem menuItem = new MenuItem(parentMenu, SWT.PUSH);
+ menuItem.setText("&Select All\tCtrl+A");
+ menuItem.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(org.eclipse.swt.widgets.Event event) {
+ treeViewer.getTree().selectAll();
+ }
+ });
+ }
+
+ @Override
+ public void dispose() {
+ OseeEventManager.removeListener(this);
+ super.dispose();
+ }
+
+ private void expandAll(IStructuredSelection selection) {
+ Iterator<?> iter = selection.iterator();
+ while (iter.hasNext()) {
+ treeViewer.expandToLevel(iter.next(), TreeViewer.ALL_LEVELS);
+ }
+ this.packColumnData();
+ }
+
+ /**
+ * Performs the deletion functionality
+ *
+ * @param selection
+ */
+ private void performDeleteArtifact(IStructuredSelection selection) {
+ try {
+ Set<Artifact> artifactsToBeDeleted = getSelectedArtifacts(selection);
+
+ //Ask if they are sure they want all artifacts to be deleted
+ if (!artifactsToBeDeleted.isEmpty()) {
+ if (MessageDialog.openConfirm(
+ Displays.getActiveShell(),
+ "Delete Artifact (s)",
+ "Delete Artifact (s)?\n\n\"" + Collections.toString(",", artifactsToBeDeleted) + "\"\n\nNOTE: This will delete the artifact from the system. Use \"Delete Relation\" to remove this artifact from the relation.")) {
+
+ for (Artifact artifact : artifactsToBeDeleted) {
+ artifact.deleteAndPersist();
+ }
+ }
+ }
+
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ refresh();
+ }
+
+ /**
+ * Performs the deletion functionality
+ *
+ * @param selection
+ * @throws ArtifactDoesNotExist
+ */
+ private void performDeleteRelation(IStructuredSelection selection) {
+ if (artifact.isReadOnly()) {
+ MessageDialog.openError(
+ Displays.getActiveShell(),
+ "Delete Relation Error",
+ "Access control has restricted this action. The current user does not have sufficient permission to delete objects on this artifact.");
+ return;
+ }
+
+ Object[] objects = selection.toArray();
+ for (Object object : objects) {
+ if (object instanceof WrapperForRelationLink) {
+ WrapperForRelationLink wrapper = (WrapperForRelationLink) object;
+ try {
+ wrapper.getArtifactA().deleteRelation(
+ new RelationTypeSide(wrapper.getRelationType(), RelationSide.SIDE_B), wrapper.getArtifactB());
+ Object parent = ((ITreeContentProvider) treeViewer.getContentProvider()).getParent(object);
+ if (parent != null) {
+ treeViewer.refresh(parent);
+ } else {
+ treeViewer.refresh();
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ } else if (object instanceof RelationTypeSideSorter) {
+ RelationTypeSideSorter group = (RelationTypeSideSorter) object;
+ try {
+ RelationManager.deleteRelations(artifact, group.getRelationType(), group.getSide());
+ treeViewer.refresh(group);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ editor.onDirtied();
+ }
+
+ public void refresh() {
+ if (!treeViewer.getTree().isDisposed()) {
+ treeViewer.refresh();
+ packColumnData();
+ }
+ }
+
+ private final class KeySelectedListener implements KeyListener {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ }
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ if (e.keyCode == SWT.DEL) {
+ performDeleteRelation((IStructuredSelection) treeViewer.getSelection());
+ }
+ if (e.keyCode == 'a' && e.stateMask == SWT.CONTROL) {
+ treeViewer.getTree().selectAll();
+ }
+ if (e.keyCode == 'x' && e.stateMask == SWT.CONTROL) {
+ expandAll((IStructuredSelection) treeViewer.getSelection());
+ }
+ }
+ }
+
+ public Artifact getArtifact() {
+ return artifact;
+ }
+
+ public void refreshArtifact(Artifact newArtifact) {
+ relationLabelProvider.setArtifact(newArtifact);
+ treeViewer.setInput(newArtifact);
+ expandItemsThatHaveChildren();
+ refresh();
+ }
+
+ private class RelationSkynetDragAndDrop extends SkynetDragAndDrop {
+ boolean isFeedbackAfter = false;
+
+ public RelationSkynetDragAndDrop(Tree tree, String viewId) {
+ super(tree, viewId);
+ }
+
+ @Override
+ public Artifact[] getArtifacts() {
+ IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
+ Object[] objects = selection.toArray();
+ Artifact[] artifacts = null;
+
+ if (objects.length > 0 && objects[0] instanceof WrapperForRelationLink) {
+ artifacts = new Artifact[objects.length];
+
+ for (int index = 0; index < objects.length; index++) {
+ WrapperForRelationLink link = (WrapperForRelationLink) objects[index];
+ artifacts[index] = link.getOther();
+ }
+ }
+ return artifacts;
+ }
+
+ @Override
+ public void performDragOver(DropTargetEvent event) {
+ Tree tree = treeViewer.getTree();
+ TreeItem selected = tree.getItem(treeViewer.getTree().toControl(event.x, event.y));
+
+ event.feedback = DND.FEEDBACK_EXPAND;
+ event.detail = DND.DROP_NONE;
+
+ if (selected != null && selected.getData() instanceof RelationTypeSideSorter) {
+ if (artifact.isReadOnly()) {
+ event.detail = DND.DROP_NONE;
+
+ MessageDialog.openError(
+ Displays.getActiveShell(),
+ "Create Relation Error",
+ "Access control has restricted this action. The current user does not have sufficient permission to create relations on this artifact.");
+ return;
+ } else {
+ event.detail = DND.DROP_COPY;
+ tree.setInsertMark(null, false);
+ }
+ } else if (selected != null && selected.getData() instanceof WrapperForRelationLink) {
+ WrapperForRelationLink targetLink = (WrapperForRelationLink) selected.getData();
+ IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
+ Object obj = selection.getFirstElement();
+ if (obj instanceof WrapperForRelationLink) {
+ WrapperForRelationLink dropTarget = (WrapperForRelationLink) obj;
+
+ if (artifact.isReadOnly()) {
+ event.detail = DND.DROP_NONE;
+ MessageDialog.openError(
+ Displays.getActiveShell(),
+ "Create Relation Error",
+ "Access control has restricted this action. The current user does not have sufficient permission to create relations on this artifact.");
+ return;
+ }
+ // the links must be in the same group
+ if (relationLinkIsInSameGroup(targetLink, dropTarget)) {
+ if (isFeedbackAfter) {
+ event.feedback = DND.FEEDBACK_INSERT_AFTER;
+ } else {
+ event.feedback = DND.FEEDBACK_INSERT_BEFORE;
+ }
+ event.detail = DND.DROP_MOVE;
+ }
+ }
+ } else {
+ tree.setInsertMark(null, false);
+ }
+ }
+
+ private boolean relationLinkIsInSameGroup(WrapperForRelationLink targetLink, WrapperForRelationLink dropTarget) {
+ return targetLink.getRelationType().equals(dropTarget.getRelationType()) && //same type
+ (targetLink.getArtifactA().equals(dropTarget.getArtifactA()) || //either the A or B side is equal, meaning they are on the same side
+ targetLink.getArtifactB().equals(dropTarget.getArtifactB()));
+ }
+
+ @Override
+ public void operationChanged(DropTargetEvent event) {
+ if (!isCtrlPressed(event)) {
+ isFeedbackAfter = false;
+ }
+ }
+
+ private boolean isCtrlPressed(DropTargetEvent event) {
+ boolean ctrPressed = event.detail == 1;
+
+ if (ctrPressed) {
+ isFeedbackAfter = true;
+ }
+ return ctrPressed;
+ }
+
+ @Override
+ public void performDrop(DropTargetEvent event) {
+ TreeItem selected = treeViewer.getTree().getItem(treeViewer.getTree().toControl(event.x, event.y));
+ Object object = selected.getData();
+ try {
+ if (object instanceof WrapperForRelationLink) {//used for ordering
+ WrapperForRelationLink targetLink = (WrapperForRelationLink) object;
+ Artifact[] artifactsToMove = ((ArtifactData) event.data).getArtifacts();
+ for (Artifact artifactToMove : artifactsToMove) {
+ IRelationEnumeration typeSide =
+ new RelationTypeSide(targetLink.getRelationType(), targetLink.getRelationSide());
+ artifact.setRelationOrder(typeSide, targetLink.getOther(), isFeedbackAfter, artifactToMove);
+ }
+ treeViewer.refresh();
+ editor.onDirtied();
+ } else if (object instanceof RelationTypeSideSorter) {
+ RelationTypeSideSorter group = (RelationTypeSideSorter) object;
+
+ RelationExplorerWindow window = new RelationExplorerWindow(treeViewer, group);
+
+ ArtifactDragDropSupport.performDragDrop(event, window,
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+ window.createArtifactInformationBox();
+ treeViewer.refresh();
+ editor.onDirtied();
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ isFeedbackAfter = false;
+ }
+ }
+
+ private void setHelpContexts() {
+ SkynetGuiPlugin.getInstance().setHelp(treeViewer.getControl(), "relation_page_tree_viewer",
+ "org.eclipse.osee.framework.help.ui");
+ }
+
+ public ToolBar getToolBar() {
+ return toolBar;
+ }
+
+ @Override
+ public void handleFrameworkTransactionEvent(Sender sender, FrameworkTransactionData transData) {
+ if (transData.isRelAddedChangedDeleted(this.artifact)) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (!treeViewer.getControl().isDisposed()) {
+ treeViewer.refresh();
+ }
+ }
+ });
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/SelectionProviderIntermediate.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/SelectionProviderIntermediate.java
index 95d3874d5d3..dfd2013776f 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/SelectionProviderIntermediate.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/SelectionProviderIntermediate.java
@@ -8,112 +8,112 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet;
-
+package org.eclipse.osee.framework.ui.skynet;
+
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.jface.viewers.IPostSelectionProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
-
-public class SelectionProviderIntermediate implements IPostSelectionProvider {
-
- private final ListenerList selectionListeners = new ListenerList();
-
- private final ListenerList postSelectionListeners = new ListenerList();
-
- private ISelectionProvider delegate;
-
- private ISelectionChangedListener selectionListener = new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- if (event.getSelectionProvider() == delegate) {
- fireSelectionChanged(event.getSelection());
- }
- }
- };
-
- private ISelectionChangedListener postSelectionListener = new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- if (event.getSelectionProvider() == delegate) {
- firePostSelectionChanged(event.getSelection());
- }
- }
- };
-
- /**
- * Sets a new selection provider to delegate to. Selection listeners
- * registered with the previous delegate are removed before.
- *
- * @param newDelegate new selection provider
- */
- public void setSelectionProviderDelegate(ISelectionProvider newDelegate) {
- if (delegate == newDelegate) {
- return;
- }
- if (delegate != null) {
- delegate.removeSelectionChangedListener(selectionListener);
- if (delegate instanceof IPostSelectionProvider) {
- ((IPostSelectionProvider)delegate).removePostSelectionChangedListener(postSelectionListener);
- }
- }
- delegate = newDelegate;
- if (newDelegate != null) {
- newDelegate.addSelectionChangedListener(selectionListener);
- if (newDelegate instanceof IPostSelectionProvider) {
- ((IPostSelectionProvider)newDelegate).addPostSelectionChangedListener(postSelectionListener);
- }
- fireSelectionChanged(newDelegate.getSelection());
- firePostSelectionChanged(newDelegate.getSelection());
- }
- }
-
- protected void fireSelectionChanged(ISelection selection) {
- fireSelectionChanged(selectionListeners, selection);
- }
-
- protected void firePostSelectionChanged(ISelection selection) {
- fireSelectionChanged(postSelectionListeners, selection);
- }
-
- private void fireSelectionChanged(ListenerList list, ISelection selection) {
- SelectionChangedEvent event = new SelectionChangedEvent(delegate, selection);
- Object[] listeners = list.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- ISelectionChangedListener listener = (ISelectionChangedListener) listeners[i];
- listener.selectionChanged(event);
- }
- }
-
- // IPostSelectionProvider Implementation
-
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- selectionListeners.add(listener);
- }
-
- public void removeSelectionChangedListener(
- ISelectionChangedListener listener) {
- selectionListeners.remove(listener);
- }
-
- public void addPostSelectionChangedListener(
- ISelectionChangedListener listener) {
- postSelectionListeners.add(listener);
- }
-
- public void removePostSelectionChangedListener(
- ISelectionChangedListener listener) {
- postSelectionListeners.remove(listener);
- }
-
- public ISelection getSelection() {
- return delegate == null ? null : delegate.getSelection();
- }
-
- public void setSelection(ISelection selection) {
- if (delegate != null) {
- delegate.setSelection(selection);
- }
- }
-
-}
+
+public class SelectionProviderIntermediate implements IPostSelectionProvider {
+
+ private final ListenerList selectionListeners = new ListenerList();
+
+ private final ListenerList postSelectionListeners = new ListenerList();
+
+ private ISelectionProvider delegate;
+
+ private ISelectionChangedListener selectionListener = new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ if (event.getSelectionProvider() == delegate) {
+ fireSelectionChanged(event.getSelection());
+ }
+ }
+ };
+
+ private ISelectionChangedListener postSelectionListener = new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ if (event.getSelectionProvider() == delegate) {
+ firePostSelectionChanged(event.getSelection());
+ }
+ }
+ };
+
+ /**
+ * Sets a new selection provider to delegate to. Selection listeners
+ * registered with the previous delegate are removed before.
+ *
+ * @param newDelegate new selection provider
+ */
+ public void setSelectionProviderDelegate(ISelectionProvider newDelegate) {
+ if (delegate == newDelegate) {
+ return;
+ }
+ if (delegate != null) {
+ delegate.removeSelectionChangedListener(selectionListener);
+ if (delegate instanceof IPostSelectionProvider) {
+ ((IPostSelectionProvider)delegate).removePostSelectionChangedListener(postSelectionListener);
+ }
+ }
+ delegate = newDelegate;
+ if (newDelegate != null) {
+ newDelegate.addSelectionChangedListener(selectionListener);
+ if (newDelegate instanceof IPostSelectionProvider) {
+ ((IPostSelectionProvider)newDelegate).addPostSelectionChangedListener(postSelectionListener);
+ }
+ fireSelectionChanged(newDelegate.getSelection());
+ firePostSelectionChanged(newDelegate.getSelection());
+ }
+ }
+
+ protected void fireSelectionChanged(ISelection selection) {
+ fireSelectionChanged(selectionListeners, selection);
+ }
+
+ protected void firePostSelectionChanged(ISelection selection) {
+ fireSelectionChanged(postSelectionListeners, selection);
+ }
+
+ private void fireSelectionChanged(ListenerList list, ISelection selection) {
+ SelectionChangedEvent event = new SelectionChangedEvent(delegate, selection);
+ Object[] listeners = list.getListeners();
+ for (int i = 0; i < listeners.length; i++) {
+ ISelectionChangedListener listener = (ISelectionChangedListener) listeners[i];
+ listener.selectionChanged(event);
+ }
+ }
+
+ // IPostSelectionProvider Implementation
+
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ selectionListeners.add(listener);
+ }
+
+ public void removeSelectionChangedListener(
+ ISelectionChangedListener listener) {
+ selectionListeners.remove(listener);
+ }
+
+ public void addPostSelectionChangedListener(
+ ISelectionChangedListener listener) {
+ postSelectionListeners.add(listener);
+ }
+
+ public void removePostSelectionChangedListener(
+ ISelectionChangedListener listener) {
+ postSelectionListeners.remove(listener);
+ }
+
+ public ISelection getSelection() {
+ return delegate == null ? null : delegate.getSelection();
+ }
+
+ public void setSelection(ISelection selection) {
+ if (delegate != null) {
+ delegate.setSelection(selection);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/SelectionProviderWrapper.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/SelectionProviderWrapper.java
index 486afebf5e6..1c8d90c8cf3 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/SelectionProviderWrapper.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/SelectionProviderWrapper.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet;
-
+package org.eclipse.osee.framework.ui.skynet;
+
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -18,84 +18,84 @@ import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
-
-public class SelectionProviderWrapper implements ISelectionProvider {
-
- private ISelectionProvider provider;
- private List<Object> selectionListeners;
- private ISelection sel = StructuredSelection.EMPTY;
-
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- if (selectionListeners == null) {
- selectionListeners = new ArrayList<Object>(1);
- }
- selectionListeners.add(listener);
- if (provider != null) {
- provider.addSelectionChangedListener(listener);
- }
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- if (selectionListeners != null) {
- selectionListeners.remove(listener);
- if (provider != null) {
- provider.removeSelectionChangedListener(listener);
- }
- }
- }
-
- public ISelection getSelection() {
- return provider != null ? provider.getSelection() : sel;
- }
-
- public void setSelection(ISelection selection) {
- if (provider != null) {
- provider.setSelection(selection);
- } else {
- sel = selection;
- if (selectionListeners != null) {
- SelectionChangedEvent event = new SelectionChangedEvent(this, selection);
- for (Iterator<?> it = selectionListeners.iterator(); it.hasNext();) {
- ((ISelectionChangedListener) it.next()).selectionChanged(event);
- }
- }
-
- }
- }
-
- public void setSelectionProvider(ISelectionProvider provider) {
- if (this.provider != provider) {
- ISelection _sel = null;
- if (selectionListeners != null) {
- int c = selectionListeners.size();
- ISelectionChangedListener listener;
- if (this.provider != null) {
- for (int i = 0; i < c; i++) {
- listener = (ISelectionChangedListener) selectionListeners.get(i);
- this.provider.removeSelectionChangedListener(listener);
- }
- }
-
- if (provider != null) {
- for (int i = 0; i < c; i++) {
- listener = (ISelectionChangedListener) selectionListeners.get(i);
- provider.addSelectionChangedListener(listener);
- }
-
- _sel = provider.getSelection();
- } else {
- _sel = sel;
- }
- }
- this.provider = provider;
- if (_sel != null) {
- //force a selection change event propagation
- setSelection(_sel);
- }
- }
- }
-
- public ISelectionProvider getSelectionProvider() {
- return provider;
- }
-}
+
+public class SelectionProviderWrapper implements ISelectionProvider {
+
+ private ISelectionProvider provider;
+ private List<Object> selectionListeners;
+ private ISelection sel = StructuredSelection.EMPTY;
+
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ if (selectionListeners == null) {
+ selectionListeners = new ArrayList<Object>(1);
+ }
+ selectionListeners.add(listener);
+ if (provider != null) {
+ provider.addSelectionChangedListener(listener);
+ }
+ }
+
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {
+ if (selectionListeners != null) {
+ selectionListeners.remove(listener);
+ if (provider != null) {
+ provider.removeSelectionChangedListener(listener);
+ }
+ }
+ }
+
+ public ISelection getSelection() {
+ return provider != null ? provider.getSelection() : sel;
+ }
+
+ public void setSelection(ISelection selection) {
+ if (provider != null) {
+ provider.setSelection(selection);
+ } else {
+ sel = selection;
+ if (selectionListeners != null) {
+ SelectionChangedEvent event = new SelectionChangedEvent(this, selection);
+ for (Iterator<?> it = selectionListeners.iterator(); it.hasNext();) {
+ ((ISelectionChangedListener) it.next()).selectionChanged(event);
+ }
+ }
+
+ }
+ }
+
+ public void setSelectionProvider(ISelectionProvider provider) {
+ if (this.provider != provider) {
+ ISelection _sel = null;
+ if (selectionListeners != null) {
+ int c = selectionListeners.size();
+ ISelectionChangedListener listener;
+ if (this.provider != null) {
+ for (int i = 0; i < c; i++) {
+ listener = (ISelectionChangedListener) selectionListeners.get(i);
+ this.provider.removeSelectionChangedListener(listener);
+ }
+ }
+
+ if (provider != null) {
+ for (int i = 0; i < c; i++) {
+ listener = (ISelectionChangedListener) selectionListeners.get(i);
+ provider.addSelectionChangedListener(listener);
+ }
+
+ _sel = provider.getSelection();
+ } else {
+ _sel = sel;
+ }
+ }
+ this.provider = provider;
+ if (_sel != null) {
+ //force a selection change event propagation
+ setSelection(_sel);
+ }
+ }
+ }
+
+ public ISelectionProvider getSelectionProvider() {
+ return provider;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/SkynetGuiPlugin.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/SkynetGuiPlugin.java
index 0e7e6809f96..27cc119aa34 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/SkynetGuiPlugin.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/SkynetGuiPlugin.java
@@ -1,199 +1,199 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet;
-
-import java.util.logging.Level;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.osee.framework.core.client.ClientSessionManager;
-import org.eclipse.osee.framework.core.exception.OseeAuthenticationRequiredException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.database.IOseeDatabaseServiceProvider;
-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.event.BroadcastEventType;
-import org.eclipse.osee.framework.skynet.core.event.IBroadcastEventListener;
-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.BroadcastEvent;
-import org.eclipse.osee.framework.skynet.core.utility.DbUtil;
-import org.eclipse.osee.framework.ui.plugin.OseeFormActivator;
-import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactSaveNotificationHandler;
-import org.eclipse.osee.framework.ui.skynet.ats.IOseeAtsService;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchListener;
-import org.eclipse.ui.PlatformUI;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.packageadmin.PackageAdmin;
-import org.osgi.util.tracker.ServiceTracker;
-
-public class SkynetGuiPlugin extends OseeFormActivator implements IBroadcastEventListener, IOseeDatabaseServiceProvider {
- private static SkynetGuiPlugin pluginInstance; // The shared instance.
- public static final String PLUGIN_ID = "org.eclipse.osee.framework.ui.skynet";
- public static final String CHANGE_REPORT_ATTRIBUTES_PREF =
- "org.eclipse.osee.framework.ui.skynet.changeReportAttributes";
- public static final String ARTIFACT_EXPLORER_ATTRIBUTES_PREF =
- "org.eclipse.osee.framework.ui.skynet.artifactExplorerAttributes";
-
- public static final String ARTIFACT_SEARCH_RESULTS_ATTRIBUTES_PREF =
- "org.eclipse.osee.framework.ui.skynet.artifactSearchResultsAttributes";
- private ServiceTracker packageAdminTracker;
- private ServiceTracker cacheServiceTracker;
- private ServiceTracker databaseServiceTracker;
- private ServiceTracker atsServiceTracker;
-
- public SkynetGuiPlugin() {
- super();
- pluginInstance = this;
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- packageAdminTracker.close();
- cacheServiceTracker.close();
- databaseServiceTracker.close();
- atsServiceTracker.close();
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- packageAdminTracker = new ServiceTracker(context, PackageAdmin.class.getName(), null);
- packageAdminTracker.open();
-
- cacheServiceTracker = new ServiceTracker(context, IOseeCachingService.class.getName(), null);
- cacheServiceTracker.open();
-
- databaseServiceTracker = new ServiceTracker(context, IOseeDatabaseService.class.getName(), null);
- databaseServiceTracker.open();
-
- atsServiceTracker = new ServiceTracker(context, IOseeAtsService.class.getName(), null);
- atsServiceTracker.open();
-
- OseeEventManager.addListener(this);
-
- if (PlatformUI.isWorkbenchRunning()) {
-
- OseeLog.registerLoggerListener(new DialogPopupLoggerListener());
-
- IWorkbench workbench = PlatformUI.getWorkbench();
- workbench.addWorkbenchListener(new IWorkbenchListener() {
-
- @Override
- public void postShutdown(IWorkbench workbench) {
- }
-
- @Override
- public boolean preShutdown(IWorkbench workbench, boolean forced) {
- if (!DbUtil.isDbInit()) {
- try {
- UserManager.getUser().saveSettings();
- } catch (Throwable th) {
- th.printStackTrace();
- }
- }
- return true;
- }
- });
-
- PlatformUI.getWorkbench().addWorkbenchListener(new ArtifactSaveNotificationHandler());
- }
- }
-
- public static SkynetGuiPlugin getInstance() {
- return pluginInstance;
- }
-
- @Override
- protected String getPluginName() {
- return PLUGIN_ID;
- }
-
- public PackageAdmin getPackageAdmin() {
- return (PackageAdmin) this.packageAdminTracker.getService();
- }
-
- public IOseeCachingService getOseeCacheService() {
- return (IOseeCachingService) cacheServiceTracker.getService();
- }
-
- public IOseeDatabaseService getOseeDatabaseService() {
- return (IOseeDatabaseService) databaseServiceTracker.getService();
- }
-
- public IOseeAtsService getOseeAtsService() {
- return (IOseeAtsService) atsServiceTracker.getService();
- }
-
- @Override
- public void handleBroadcastEvent(Sender sender, final BroadcastEvent broadcastEvent) {
-
- // Determine whether this is a shutdown event
- // Prevent shutting down users without a valid message
- if (broadcastEvent.getBroadcastEventType() == BroadcastEventType.Force_Shutdown) {
- if (broadcastEvent.getMessage() == null || broadcastEvent.getMessage().length() == 0) {
- return;
- }
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- boolean isShutdownRequest = false;
- try {
- isShutdownRequest = broadcastEvent.getUsers().contains(UserManager.getUser());
- } catch (OseeCoreException ex) {
- // do nothing
- }
- if (isShutdownRequest) {
- MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Shutdown Requested", broadcastEvent.getMessage());
- // Shutdown the bench when this event is received
- PlatformUI.getWorkbench().close();
- }
- }
- });
- } else if (broadcastEvent.getBroadcastEventType() == BroadcastEventType.Message) {
- if (broadcastEvent.getMessage() == null || broadcastEvent.getMessage().length() == 0) {
- return;
- }
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Remote Message", broadcastEvent.getMessage());
- }
- });
- } else if (broadcastEvent.getBroadcastEventType() == BroadcastEventType.Ping) {
- // Another client ping'd this client for session information; Pong back with
- // original client's session id so it can be identified as the correct pong
- try {
- OseeEventManager.kickBroadcastEvent(this, new BroadcastEvent(BroadcastEventType.Pong, null,
- sender.getOseeSession().toString()));
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- } else if (broadcastEvent.getBroadcastEventType() == BroadcastEventType.Pong) {
- // Got pong from another client; If message == this client's sessionId, then it's
- // the response from this client's ping
- try {
- if (broadcastEvent.getMessage() != null && broadcastEvent.getMessage().equals(
- ClientSessionManager.getSession().toString())) {
- OseeLog.log(SkynetGuiPlugin.class, Level.INFO, "Pong: " + sender.toString());
- }
- } catch (OseeAuthenticationRequiredException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, "Pong: " + sender.toString(), 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.framework.ui.skynet;
+
+import java.util.logging.Level;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osee.framework.core.client.ClientSessionManager;
+import org.eclipse.osee.framework.core.exception.OseeAuthenticationRequiredException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.services.IOseeCachingService;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
+import org.eclipse.osee.framework.database.IOseeDatabaseServiceProvider;
+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.event.BroadcastEventType;
+import org.eclipse.osee.framework.skynet.core.event.IBroadcastEventListener;
+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.BroadcastEvent;
+import org.eclipse.osee.framework.skynet.core.utility.DbUtil;
+import org.eclipse.osee.framework.ui.plugin.OseeFormActivator;
+import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactSaveNotificationHandler;
+import org.eclipse.osee.framework.ui.skynet.ats.IOseeAtsService;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchListener;
+import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.packageadmin.PackageAdmin;
+import org.osgi.util.tracker.ServiceTracker;
+
+public class SkynetGuiPlugin extends OseeFormActivator implements IBroadcastEventListener, IOseeDatabaseServiceProvider {
+ private static SkynetGuiPlugin pluginInstance; // The shared instance.
+ public static final String PLUGIN_ID = "org.eclipse.osee.framework.ui.skynet";
+ public static final String CHANGE_REPORT_ATTRIBUTES_PREF =
+ "org.eclipse.osee.framework.ui.skynet.changeReportAttributes";
+ public static final String ARTIFACT_EXPLORER_ATTRIBUTES_PREF =
+ "org.eclipse.osee.framework.ui.skynet.artifactExplorerAttributes";
+
+ public static final String ARTIFACT_SEARCH_RESULTS_ATTRIBUTES_PREF =
+ "org.eclipse.osee.framework.ui.skynet.artifactSearchResultsAttributes";
+ private ServiceTracker packageAdminTracker;
+ private ServiceTracker cacheServiceTracker;
+ private ServiceTracker databaseServiceTracker;
+ private ServiceTracker atsServiceTracker;
+
+ public SkynetGuiPlugin() {
+ super();
+ pluginInstance = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ packageAdminTracker.close();
+ cacheServiceTracker.close();
+ databaseServiceTracker.close();
+ atsServiceTracker.close();
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ packageAdminTracker = new ServiceTracker(context, PackageAdmin.class.getName(), null);
+ packageAdminTracker.open();
+
+ cacheServiceTracker = new ServiceTracker(context, IOseeCachingService.class.getName(), null);
+ cacheServiceTracker.open();
+
+ databaseServiceTracker = new ServiceTracker(context, IOseeDatabaseService.class.getName(), null);
+ databaseServiceTracker.open();
+
+ atsServiceTracker = new ServiceTracker(context, IOseeAtsService.class.getName(), null);
+ atsServiceTracker.open();
+
+ OseeEventManager.addListener(this);
+
+ if (PlatformUI.isWorkbenchRunning()) {
+
+ OseeLog.registerLoggerListener(new DialogPopupLoggerListener());
+
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ workbench.addWorkbenchListener(new IWorkbenchListener() {
+
+ @Override
+ public void postShutdown(IWorkbench workbench) {
+ }
+
+ @Override
+ public boolean preShutdown(IWorkbench workbench, boolean forced) {
+ if (!DbUtil.isDbInit()) {
+ try {
+ UserManager.getUser().saveSettings();
+ } catch (Throwable th) {
+ th.printStackTrace();
+ }
+ }
+ return true;
+ }
+ });
+
+ PlatformUI.getWorkbench().addWorkbenchListener(new ArtifactSaveNotificationHandler());
+ }
+ }
+
+ public static SkynetGuiPlugin getInstance() {
+ return pluginInstance;
+ }
+
+ @Override
+ protected String getPluginName() {
+ return PLUGIN_ID;
+ }
+
+ public PackageAdmin getPackageAdmin() {
+ return (PackageAdmin) this.packageAdminTracker.getService();
+ }
+
+ public IOseeCachingService getOseeCacheService() {
+ return (IOseeCachingService) cacheServiceTracker.getService();
+ }
+
+ public IOseeDatabaseService getOseeDatabaseService() {
+ return (IOseeDatabaseService) databaseServiceTracker.getService();
+ }
+
+ public IOseeAtsService getOseeAtsService() {
+ return (IOseeAtsService) atsServiceTracker.getService();
+ }
+
+ @Override
+ public void handleBroadcastEvent(Sender sender, final BroadcastEvent broadcastEvent) {
+
+ // Determine whether this is a shutdown event
+ // Prevent shutting down users without a valid message
+ if (broadcastEvent.getBroadcastEventType() == BroadcastEventType.Force_Shutdown) {
+ if (broadcastEvent.getMessage() == null || broadcastEvent.getMessage().length() == 0) {
+ return;
+ }
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ boolean isShutdownRequest = false;
+ try {
+ isShutdownRequest = broadcastEvent.getUsers().contains(UserManager.getUser());
+ } catch (OseeCoreException ex) {
+ // do nothing
+ }
+ if (isShutdownRequest) {
+ MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ "Shutdown Requested", broadcastEvent.getMessage());
+ // Shutdown the bench when this event is received
+ PlatformUI.getWorkbench().close();
+ }
+ }
+ });
+ } else if (broadcastEvent.getBroadcastEventType() == BroadcastEventType.Message) {
+ if (broadcastEvent.getMessage() == null || broadcastEvent.getMessage().length() == 0) {
+ return;
+ }
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ "Remote Message", broadcastEvent.getMessage());
+ }
+ });
+ } else if (broadcastEvent.getBroadcastEventType() == BroadcastEventType.Ping) {
+ // Another client ping'd this client for session information; Pong back with
+ // original client's session id so it can be identified as the correct pong
+ try {
+ OseeEventManager.kickBroadcastEvent(this, new BroadcastEvent(BroadcastEventType.Pong, null,
+ sender.getOseeSession().toString()));
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ } else if (broadcastEvent.getBroadcastEventType() == BroadcastEventType.Pong) {
+ // Got pong from another client; If message == this client's sessionId, then it's
+ // the response from this client's ping
+ try {
+ if (broadcastEvent.getMessage() != null && broadcastEvent.getMessage().equals(
+ ClientSessionManager.getSession().toString())) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.INFO, "Pong: " + sender.toString());
+ }
+ } catch (OseeAuthenticationRequiredException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, "Pong: " + sender.toString(), ex);
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/WorkspaceContributionItem.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/WorkspaceContributionItem.java
index eda8b623834..1e0c48fb266 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/WorkspaceContributionItem.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/WorkspaceContributionItem.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.framework.ui.skynet;
-
-import java.io.File;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.program.Program;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IViewReference;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.ViewPart;
-import org.eclipse.ui.texteditor.StatusLineContributionItem;
-
-public class WorkspaceContributionItem extends StatusLineContributionItem {
- public WorkspaceContributionItem() {
- super("org.eclipse.osee.framework.ui.skynet.workspace.status", true, getShortPath().length() + 5);
- setToolTipText(ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString());
- setText(getShortPath());
- setActionHandler(new Action() {
- @Override
- public void run() {
- Program.launch(ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString());
- }
- });
- }
-
- private static String getShortPath() {
- String path = ResourcesPlugin.getWorkspace().getRoot().getLocation().toString();
- String elements[] = path.split("\\/");
- if (elements.length >= 2) {
- return elements[elements.length - 2] + File.separator + elements[elements.length - 1];
- }
- return path;
- }
-
- public static void addToAllViews() {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- try {
- if (PlatformUI.getWorkbench() == null || PlatformUI.getWorkbench().getActiveWorkbenchWindow() == null) {
- return;
- }
- for (IViewReference viewDesc : PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences()) {
- IViewPart viewPart = viewDesc.getView(false);
- if (viewPart != null) {
- addToViewpart((ViewPart) viewPart);
- }
- }
- } catch (Exception ex) {
- // DO NOTHING
- }
- }
- });
- }
-
- public static void addToViewpart(ViewPart viewPart) {
- // Attempt to add to PackageExplorerPart
- try {
- if (viewPart != null) {
- for (IContributionItem item : viewPart.getViewSite().getActionBars().getStatusLineManager().getItems()) {
- if (item instanceof WorkspaceContributionItem) {
- return;
- }
- }
- // System.err.println("Adding to " + viewPart);
- viewPart.getViewSite().getActionBars().getStatusLineManager().add(new WorkspaceContributionItem());
- }
- } catch (Exception ex) {
- // do nothing
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet;
+
+import java.io.File;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.program.Program;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IViewReference;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.ui.texteditor.StatusLineContributionItem;
+
+public class WorkspaceContributionItem extends StatusLineContributionItem {
+ public WorkspaceContributionItem() {
+ super("org.eclipse.osee.framework.ui.skynet.workspace.status", true, getShortPath().length() + 5);
+ setToolTipText(ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString());
+ setText(getShortPath());
+ setActionHandler(new Action() {
+ @Override
+ public void run() {
+ Program.launch(ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString());
+ }
+ });
+ }
+
+ private static String getShortPath() {
+ String path = ResourcesPlugin.getWorkspace().getRoot().getLocation().toString();
+ String elements[] = path.split("\\/");
+ if (elements.length >= 2) {
+ return elements[elements.length - 2] + File.separator + elements[elements.length - 1];
+ }
+ return path;
+ }
+
+ public static void addToAllViews() {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ if (PlatformUI.getWorkbench() == null || PlatformUI.getWorkbench().getActiveWorkbenchWindow() == null) {
+ return;
+ }
+ for (IViewReference viewDesc : PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences()) {
+ IViewPart viewPart = viewDesc.getView(false);
+ if (viewPart != null) {
+ addToViewpart((ViewPart) viewPart);
+ }
+ }
+ } catch (Exception ex) {
+ // DO NOTHING
+ }
+ }
+ });
+ }
+
+ public static void addToViewpart(ViewPart viewPart) {
+ // Attempt to add to PackageExplorerPart
+ try {
+ if (viewPart != null) {
+ for (IContributionItem item : viewPart.getViewSite().getActionBars().getStatusLineManager().getItems()) {
+ if (item instanceof WorkspaceContributionItem) {
+ return;
+ }
+ }
+ // System.err.println("Adding to " + viewPart);
+ viewPart.getViewSite().getActionBars().getStatusLineManager().add(new WorkspaceContributionItem());
+ }
+ } catch (Exception ex) {
+ // do nothing
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/sections/BlamUsageSection.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/sections/BlamUsageSection.java
index 0d012758dae..c4b24c40f75 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/sections/BlamUsageSection.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/sections/BlamUsageSection.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.framework.ui.skynet.blam.sections;
-
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.ui.skynet.XFormToolkit;
-import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam;
-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.Composite;
-import org.eclipse.ui.forms.IManagedForm;
-import org.eclipse.ui.forms.editor.FormEditor;
-import org.eclipse.ui.forms.widgets.FormText;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * @author Roberto E. Escobar
- */
-public class BlamUsageSection extends BaseBlamSection {
-
- private FormText formText;
- private IManagedForm form;
-
- public BlamUsageSection(FormEditor editor, AbstractBlam abstractBlam, Composite parent, FormToolkit toolkit, int style) {
- super(editor, abstractBlam, parent, toolkit, style);
- }
-
- @Override
- public void initialize(IManagedForm form) {
- this.form = form;
- super.initialize(form);
- Section section = getSection();
- section.setText("Description and Usage");
- section.setLayout(new GridLayout());
- section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- XFormToolkit.addHelpLinkToSection(form.getToolkit(), section, "/org.eclipse.pde.doc.user/guide/pde_running.htm");
- updateText(true);
- }
-
- private void updateText(boolean isCreate) {
- if (isCreate) {
- final FormToolkit toolkit = getManagedForm().getToolkit();
- Composite composite = toolkit.createComposite(getSection(), toolkit.getBorderStyle() | SWT.WRAP);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- formText = toolkit.createFormText(composite, false);
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
- gd.widthHint = 200;
- formText.setLayoutData(gd);
-
- getSection().setClient(composite);
- toolkit.paintBordersFor(composite);
-
- getSection().layout(true);
- form.getForm().getBody().layout(true);
-
- }
-
- if (Widgets.isAccessible(formText)) {
- try {
- String data = getAbstractBlam().getDescriptionUsage();
- boolean parseTags = false;
- if (data.startsWith("<form>")) {
- parseTags = true;
- }
- formText.setText(data, parseTags, parseTags);
- } catch (Exception ex) {
- formText.setText(Lib.exceptionToString(ex), false, false);
- }
- getManagedForm().reflow(true);
- }
-
- }
-
- @Override
- public void dispose() {
- if (Widgets.isAccessible(formText)) {
- formText.dispose();
- }
- super.dispose();
- }
-
- @Override
- public void refresh() {
- super.refresh();
- updateText(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.framework.ui.skynet.blam.sections;
+
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.ui.skynet.XFormToolkit;
+import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam;
+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.Composite;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.widgets.FormText;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class BlamUsageSection extends BaseBlamSection {
+
+ private FormText formText;
+ private IManagedForm form;
+
+ public BlamUsageSection(FormEditor editor, AbstractBlam abstractBlam, Composite parent, FormToolkit toolkit, int style) {
+ super(editor, abstractBlam, parent, toolkit, style);
+ }
+
+ @Override
+ public void initialize(IManagedForm form) {
+ this.form = form;
+ super.initialize(form);
+ Section section = getSection();
+ section.setText("Description and Usage");
+ section.setLayout(new GridLayout());
+ section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ XFormToolkit.addHelpLinkToSection(form.getToolkit(), section, "/org.eclipse.pde.doc.user/guide/pde_running.htm");
+ updateText(true);
+ }
+
+ private void updateText(boolean isCreate) {
+ if (isCreate) {
+ final FormToolkit toolkit = getManagedForm().getToolkit();
+ Composite composite = toolkit.createComposite(getSection(), toolkit.getBorderStyle() | SWT.WRAP);
+ composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ formText = toolkit.createFormText(composite, false);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gd.widthHint = 200;
+ formText.setLayoutData(gd);
+
+ getSection().setClient(composite);
+ toolkit.paintBordersFor(composite);
+
+ getSection().layout(true);
+ form.getForm().getBody().layout(true);
+
+ }
+
+ if (Widgets.isAccessible(formText)) {
+ try {
+ String data = getAbstractBlam().getDescriptionUsage();
+ boolean parseTags = false;
+ if (data.startsWith("<form>")) {
+ parseTags = true;
+ }
+ formText.setText(data, parseTags, parseTags);
+ } catch (Exception ex) {
+ formText.setText(Lib.exceptionToString(ex), false, false);
+ }
+ getManagedForm().reflow(true);
+ }
+
+ }
+
+ @Override
+ public void dispose() {
+ if (Widgets.isAccessible(formText)) {
+ formText.dispose();
+ }
+ super.dispose();
+ }
+
+ @Override
+ public void refresh() {
+ super.refresh();
+ updateText(false);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/BranchSelectComposite.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/BranchSelectComposite.java
index a7b3845e5e2..706363466b6 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/BranchSelectComposite.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/BranchSelectComposite.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.framework.ui.skynet.branch;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-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.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-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.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * @author Roberto E. Escobar
- */
-public class BranchSelectComposite extends Composite implements Listener {
- protected static final int SIZING_TEXT_FIELD_WIDTH = 250;
-
- private Button branchSelectButton;
- private Text branchSelectTextWidget;
- private Branch selectedBranch;
- private final Set<Listener> listeners;
- private final boolean allowOnlyWorkingBranches;
-
- public BranchSelectComposite(Composite parent, int style, boolean allowOnlyWorkingBranches) {
- super(parent, style);
- this.allowOnlyWorkingBranches = allowOnlyWorkingBranches;
- this.listeners = Collections.synchronizedSet(new HashSet<Listener>());
- createControl(this);
- }
-
- public static BranchSelectComposite createWorkingBranchSelectComposite(Composite parent, int style) {
- return new BranchSelectComposite(parent, style, true);
- }
-
- public static BranchSelectComposite createBranchSelectComposite(Composite parent, int style) {
- return new BranchSelectComposite(parent, style, false);
- }
-
- private void createControl(Composite parent) {
- parent.setLayout(ALayout.getZeroMarginLayout(2, false));
- parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- branchSelectTextWidget = new Text(parent, SWT.BORDER | SWT.READ_ONLY);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- branchSelectTextWidget.setLayoutData(data);
- branchSelectTextWidget.setBackground(Displays.getSystemColor(SWT.COLOR_WHITE));
- branchSelectTextWidget.setText(" -- Select A Branch -- ");
- branchSelectTextWidget.setDoubleClickEnabled(false);
- branchSelectTextWidget.addListener(SWT.MouseDoubleClick, new Listener() {
- @Override
- public void handleEvent(Event event) {
- handleSelectedBranch(event);
- notifyListener(event);
- }
- });
-
- branchSelectButton = new Button(parent, SWT.PUSH);
- branchSelectButton.setText("Select Branch...");
- branchSelectButton.addListener(SWT.Selection, this);
- branchSelectButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- branchSelectButton.addListener(SWT.MouseUp, new Listener() {
- @Override
- public void handleEvent(Event event) {
- if (event.button == 3) {
- try {
- setSelected(BranchManager.getCommonBranch());
- notifyListener(event);
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
- });
- }
-
- public Branch getSelectedBranch() {
- return selectedBranch;
- }
-
- private boolean areOnlyWorkingBranchesAllowed() {
- return allowOnlyWorkingBranches;
- }
-
- public void handleEvent(Event event) {
- handleSelectedBranch(event);
- notifyListener(event);
- }
-
- private void handleSelectedBranch(Event event) {
- if (event.widget == branchSelectButton || (event.widget == branchSelectTextWidget && branchSelectTextWidget.getDoubleClickEnabled())) {
- if (areOnlyWorkingBranchesAllowed()) {
- Branch newBranch = BranchSelectionDialog.getWorkingBranchFromUser();
- if (newBranch != null) {
- setSelected(newBranch);
- }
- } else {
- Branch newBranch = BranchSelectionDialog.getBranchFromUser();
- if (newBranch != null) {
- setSelected(newBranch);
- }
- }
- }
- }
-
- public void setSelected(Branch branch) {
- if (branch != null) {
- selectedBranch = branch;
- branchSelectTextWidget.setText(selectedBranch.getName());
- } else {
- branchSelectTextWidget.setText(" -- Select A Branch -- ");
- }
- }
-
- private void notifyListener(Event event) {
- synchronized (listeners) {
- for (Listener listener : listeners) {
- listener.handleEvent(event);
- }
- }
- }
-
- public void addListener(Listener listener) {
- synchronized (listeners) {
- listeners.add(listener);
- }
- }
-
- public void removeListener(Listener listener) {
- synchronized (listeners) {
- listeners.remove(listener);
- }
- }
-
- /**
- * @param defaultSelectedBranch the defaultSelectedBranch to set
- */
- public void setDefaultSelectedBranch(Branch defaultSelectedBranch) {
- setSelected(defaultSelectedBranch);
- }
-
- /**
- * @return the branchSelectLabel
- */
- public Text getBranchSelectText() {
- return branchSelectTextWidget;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.branch;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+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.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+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.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class BranchSelectComposite extends Composite implements Listener {
+ protected static final int SIZING_TEXT_FIELD_WIDTH = 250;
+
+ private Button branchSelectButton;
+ private Text branchSelectTextWidget;
+ private Branch selectedBranch;
+ private final Set<Listener> listeners;
+ private final boolean allowOnlyWorkingBranches;
+
+ public BranchSelectComposite(Composite parent, int style, boolean allowOnlyWorkingBranches) {
+ super(parent, style);
+ this.allowOnlyWorkingBranches = allowOnlyWorkingBranches;
+ this.listeners = Collections.synchronizedSet(new HashSet<Listener>());
+ createControl(this);
+ }
+
+ public static BranchSelectComposite createWorkingBranchSelectComposite(Composite parent, int style) {
+ return new BranchSelectComposite(parent, style, true);
+ }
+
+ public static BranchSelectComposite createBranchSelectComposite(Composite parent, int style) {
+ return new BranchSelectComposite(parent, style, false);
+ }
+
+ private void createControl(Composite parent) {
+ parent.setLayout(ALayout.getZeroMarginLayout(2, false));
+ parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ branchSelectTextWidget = new Text(parent, SWT.BORDER | SWT.READ_ONLY);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
+ data.widthHint = SIZING_TEXT_FIELD_WIDTH;
+ branchSelectTextWidget.setLayoutData(data);
+ branchSelectTextWidget.setBackground(Displays.getSystemColor(SWT.COLOR_WHITE));
+ branchSelectTextWidget.setText(" -- Select A Branch -- ");
+ branchSelectTextWidget.setDoubleClickEnabled(false);
+ branchSelectTextWidget.addListener(SWT.MouseDoubleClick, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ handleSelectedBranch(event);
+ notifyListener(event);
+ }
+ });
+
+ branchSelectButton = new Button(parent, SWT.PUSH);
+ branchSelectButton.setText("Select Branch...");
+ branchSelectButton.addListener(SWT.Selection, this);
+ branchSelectButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+ branchSelectButton.addListener(SWT.MouseUp, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ if (event.button == 3) {
+ try {
+ setSelected(BranchManager.getCommonBranch());
+ notifyListener(event);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+ });
+ }
+
+ public Branch getSelectedBranch() {
+ return selectedBranch;
+ }
+
+ private boolean areOnlyWorkingBranchesAllowed() {
+ return allowOnlyWorkingBranches;
+ }
+
+ public void handleEvent(Event event) {
+ handleSelectedBranch(event);
+ notifyListener(event);
+ }
+
+ private void handleSelectedBranch(Event event) {
+ if (event.widget == branchSelectButton || (event.widget == branchSelectTextWidget && branchSelectTextWidget.getDoubleClickEnabled())) {
+ if (areOnlyWorkingBranchesAllowed()) {
+ Branch newBranch = BranchSelectionDialog.getWorkingBranchFromUser();
+ if (newBranch != null) {
+ setSelected(newBranch);
+ }
+ } else {
+ Branch newBranch = BranchSelectionDialog.getBranchFromUser();
+ if (newBranch != null) {
+ setSelected(newBranch);
+ }
+ }
+ }
+ }
+
+ public void setSelected(Branch branch) {
+ if (branch != null) {
+ selectedBranch = branch;
+ branchSelectTextWidget.setText(selectedBranch.getName());
+ } else {
+ branchSelectTextWidget.setText(" -- Select A Branch -- ");
+ }
+ }
+
+ private void notifyListener(Event event) {
+ synchronized (listeners) {
+ for (Listener listener : listeners) {
+ listener.handleEvent(event);
+ }
+ }
+ }
+
+ public void addListener(Listener listener) {
+ synchronized (listeners) {
+ listeners.add(listener);
+ }
+ }
+
+ public void removeListener(Listener listener) {
+ synchronized (listeners) {
+ listeners.remove(listener);
+ }
+ }
+
+ /**
+ * @param defaultSelectedBranch the defaultSelectedBranch to set
+ */
+ public void setDefaultSelectedBranch(Branch defaultSelectedBranch) {
+ setSelected(defaultSelectedBranch);
+ }
+
+ /**
+ * @return the branchSelectLabel
+ */
+ public Text getBranchSelectText() {
+ return branchSelectTextWidget;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/BranchSelectionDialog.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/BranchSelectionDialog.java
index 546fef96c3b..f39c1ee2f7c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/BranchSelectionDialog.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/branch/BranchSelectionDialog.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.framework.ui.skynet.branch;
-
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchOptions;
-import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.XBranchWidget;
-import org.eclipse.osee.framework.ui.swt.Displays;
-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.Button;
-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.TreeItem;
-
-/**
- * @author Donald G. Dunne
- */
-public class BranchSelectionDialog extends MessageDialog {
-
- private Branch selected;
- private XBranchWidget branchWidget;
- private boolean allowOnlyWorkingBranches;
- private final Collection<Branch> branches;
-
- public BranchSelectionDialog(String title, Collection<Branch> branches) {
- super(Displays.getActiveShell(), title, null, null, MessageDialog.NONE,
- new String[] {"Ok", "Cancel"}, 0);
- this.allowOnlyWorkingBranches = false;
- this.selected = null;
- this.branches = branches;
- setShellStyle(getShellStyle() | SWT.RESIZE);
- }
-
- public BranchSelectionDialog(String title, boolean allowOnlyWorkingBranches) {
- this(title, null);
- this.allowOnlyWorkingBranches = allowOnlyWorkingBranches;
- }
-
- public Branch getSelection() {
- return selected;
- }
-
- @Override
- protected Control createDialogArea(Composite container) {
- branchWidget = new XBranchWidget(true, true);
- branchWidget.setDisplayLabel(false);
- branchWidget.createWidgets(container, 1);
- branchWidget.setBranchOptions(BranchOptions.FAVORITES_FIRST, BranchOptions.FLAT);
- branchWidget.setShowWorkingBranchesOnly(allowOnlyWorkingBranches);
- branchWidget.getXViewer().getFilterDataUI().addFilterTextListener(new KeyListener() {
-
- @Override
- public void keyReleased(KeyEvent e) {
- Collection<TreeItem> visibleItems = branchWidget.getXViewer().getVisibleItems();
- if (visibleItems.size() == 1) {
- branchWidget.getXViewer().setSelection(
- new StructuredSelection(new Object[] {visibleItems.iterator().next().getData()}));
- getButton(IDialogConstants.OK_ID).setEnabled(true);
- storeSelectedBranch();
- }
- }
-
- @Override
- public void keyPressed(KeyEvent e) {
- }
- });
- if (branches != null) {
- branchWidget.loadData(branches);
- } else {
- branchWidget.loadData();
- }
-
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
- gd.heightHint = 500;
- gd.widthHint = 800;
- branchWidget.getXViewer().getTree().setLayoutData(gd);
- branchWidget.getXViewer().getTree().addListener(SWT.MouseDoubleClick, new Listener() {
- @Override
- public void handleEvent(Event event) {
- handleDoubleClick();
- }
- });
- branchWidget.getXViewer().getTree().addSelectionListener(new SelectionListener() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- getButton(IDialogConstants.OK_ID).setEnabled(true);
- storeSelectedBranch();
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
- return branchWidget.getControl();
- }
-
- @Override
- protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
- Button selectionButton = super.createButton(parent, id, label, defaultButton);
- // default the ok button to disabled until the user selects a branch
- if (id == IDialogConstants.OK_ID) {
- selectionButton.setEnabled(false);
- }
- return selectionButton;
- }
-
- public Branch getSelected() {
- return selected;
- }
-
- private void storeSelectedBranch() {
- List<Branch> branches = branchWidget.getSelectedBranches();
-
- if (!branches.isEmpty()) {
- selected = branches.iterator().next();
- BranchManager.setLastBranch(selected);
- }
- }
-
- private void handleDoubleClick() {
- storeSelectedBranch();
- okPressed();
- }
-
- private static Branch createDialog(boolean allowOnlyWorkingBranches) {
- Branch toReturn = null;
- BranchSelectionDialog branchSelection = new BranchSelectionDialog("Select Branch", allowOnlyWorkingBranches);
- int result = branchSelection.open();
- if (result == Window.OK) {
- toReturn = branchSelection.getSelection();
- }
- return toReturn;
- }
-
- public static Branch getBranchFromUser() {
- return createDialog(false);
- }
-
- public static Branch getWorkingBranchFromUser() {
- return createDialog(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.framework.ui.skynet.branch;
+
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchOptions;
+import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.XBranchWidget;
+import org.eclipse.osee.framework.ui.swt.Displays;
+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.Button;
+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.TreeItem;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class BranchSelectionDialog extends MessageDialog {
+
+ private Branch selected;
+ private XBranchWidget branchWidget;
+ private boolean allowOnlyWorkingBranches;
+ private final Collection<Branch> branches;
+
+ public BranchSelectionDialog(String title, Collection<Branch> branches) {
+ super(Displays.getActiveShell(), title, null, null, MessageDialog.NONE,
+ new String[] {"Ok", "Cancel"}, 0);
+ this.allowOnlyWorkingBranches = false;
+ this.selected = null;
+ this.branches = branches;
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ }
+
+ public BranchSelectionDialog(String title, boolean allowOnlyWorkingBranches) {
+ this(title, null);
+ this.allowOnlyWorkingBranches = allowOnlyWorkingBranches;
+ }
+
+ public Branch getSelection() {
+ return selected;
+ }
+
+ @Override
+ protected Control createDialogArea(Composite container) {
+ branchWidget = new XBranchWidget(true, true);
+ branchWidget.setDisplayLabel(false);
+ branchWidget.createWidgets(container, 1);
+ branchWidget.setBranchOptions(BranchOptions.FAVORITES_FIRST, BranchOptions.FLAT);
+ branchWidget.setShowWorkingBranchesOnly(allowOnlyWorkingBranches);
+ branchWidget.getXViewer().getFilterDataUI().addFilterTextListener(new KeyListener() {
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ Collection<TreeItem> visibleItems = branchWidget.getXViewer().getVisibleItems();
+ if (visibleItems.size() == 1) {
+ branchWidget.getXViewer().setSelection(
+ new StructuredSelection(new Object[] {visibleItems.iterator().next().getData()}));
+ getButton(IDialogConstants.OK_ID).setEnabled(true);
+ storeSelectedBranch();
+ }
+ }
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+ }
+ });
+ if (branches != null) {
+ branchWidget.loadData(branches);
+ } else {
+ branchWidget.loadData();
+ }
+
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gd.heightHint = 500;
+ gd.widthHint = 800;
+ branchWidget.getXViewer().getTree().setLayoutData(gd);
+ branchWidget.getXViewer().getTree().addListener(SWT.MouseDoubleClick, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ handleDoubleClick();
+ }
+ });
+ branchWidget.getXViewer().getTree().addSelectionListener(new SelectionListener() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ getButton(IDialogConstants.OK_ID).setEnabled(true);
+ storeSelectedBranch();
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+ return branchWidget.getControl();
+ }
+
+ @Override
+ protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
+ Button selectionButton = super.createButton(parent, id, label, defaultButton);
+ // default the ok button to disabled until the user selects a branch
+ if (id == IDialogConstants.OK_ID) {
+ selectionButton.setEnabled(false);
+ }
+ return selectionButton;
+ }
+
+ public Branch getSelected() {
+ return selected;
+ }
+
+ private void storeSelectedBranch() {
+ List<Branch> branches = branchWidget.getSelectedBranches();
+
+ if (!branches.isEmpty()) {
+ selected = branches.iterator().next();
+ BranchManager.setLastBranch(selected);
+ }
+ }
+
+ private void handleDoubleClick() {
+ storeSelectedBranch();
+ okPressed();
+ }
+
+ private static Branch createDialog(boolean allowOnlyWorkingBranches) {
+ Branch toReturn = null;
+ BranchSelectionDialog branchSelection = new BranchSelectionDialog("Select Branch", allowOnlyWorkingBranches);
+ int result = branchSelection.open();
+ if (result == Window.OK) {
+ toReturn = branchSelection.getSelection();
+ }
+ return toReturn;
+ }
+
+ public static Branch getBranchFromUser() {
+ return createDialog(false);
+ }
+
+ public static Branch getWorkingBranchFromUser() {
+ return createDialog(true);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeReportActionBarContributor.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeReportActionBarContributor.java
index 77583cbb49e..bce24714f8b 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeReportActionBarContributor.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeReportActionBarContributor.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.framework.ui.skynet.change;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.osee.framework.ui.plugin.OseeUiActions;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.artifact.editor.IActionContributor;
-import org.eclipse.osee.framework.ui.skynet.change.actions.OpenAssociatedArtifact;
-import org.eclipse.osee.framework.ui.skynet.change.actions.OpenQuickSearchAction;
-import org.eclipse.osee.framework.ui.skynet.change.actions.ReloadChangeReportAction;
-import org.eclipse.osee.framework.ui.skynet.change.actions.ShowDocumentOrderAction;
-import org.eclipse.osee.framework.ui.skynet.change.view.ChangeReportEditor;
-import org.eclipse.ui.IEditorSite;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ChangeReportActionBarContributor implements IActionContributor {
-
- private final ChangeReportEditor editor;
- private Action bugAction;
- private Action reloadAction;
- private OpenAssociatedArtifact openAssocAction;
-
- public ChangeReportActionBarContributor(ChangeReportEditor editor) {
- this.editor = editor;
- }
-
- @Override
- public void contributeToToolBar(IToolBarManager manager) {
- ChangeUiData uiData = editor.getEditorInput().getChangeData();
- manager.add(getReloadAction());
- manager.add(new Separator());
- // manager.add(createCompareMenu());
- manager.add(new ShowDocumentOrderAction(editor.getPreferences()));
- manager.add(new Separator());
- manager.add(getOpenAssociatedArtifactAction());
- manager.add(new OpenQuickSearchAction(new UiSelectBetweenDeltasBranchProvider(uiData)));
- manager.add(new Separator());
- manager.add(getAtsBugAction());
- }
-
- // public Action createCompareMenu() {
- // if (compareMenu == null) {
- // ChangeUiData uiData = editor.getEditorInput().getChangeData();
- //
- // compareMenu = new CompareDropDown();
- // compareMenu.add(new CompareAction(CompareType.COMPARE_BASE_TO_HEAD, editor, uiData));
- // compareMenu.add(new CompareAction(CompareType.COMPARE_CURRENTS_AGAINST_PARENT, editor, uiData));
- // // TODO FUTURE -- Not Supported at this time on the server side
- // // compareMenu.add(new CompareAction(CompareType.COMPARE_CURRENTS_AGAINST_OTHER_BRANCH, editor, uiData));
- // }
- // return compareMenu;
- // }
-
- public OpenAssociatedArtifact getOpenAssociatedArtifactAction() {
- if (openAssocAction == null) {
- openAssocAction = new OpenAssociatedArtifact(editor.getEditorInput().getChangeData());
- }
- return openAssocAction;
- }
-
- public Action getReloadAction() {
- if (reloadAction == null) {
- reloadAction = new ReloadChangeReportAction(editor);
- }
- return reloadAction;
- }
-
- public Action getAtsBugAction() {
- if (bugAction == null) {
- IEditorSite site = editor.getEditorSite();
- bugAction =
- OseeUiActions.createBugAction(SkynetGuiPlugin.getInstance(), editor, site.getId(),
- site.getRegisteredName());
- }
- return bugAction;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.change;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.osee.framework.ui.plugin.OseeUiActions;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.artifact.editor.IActionContributor;
+import org.eclipse.osee.framework.ui.skynet.change.actions.OpenAssociatedArtifact;
+import org.eclipse.osee.framework.ui.skynet.change.actions.OpenQuickSearchAction;
+import org.eclipse.osee.framework.ui.skynet.change.actions.ReloadChangeReportAction;
+import org.eclipse.osee.framework.ui.skynet.change.actions.ShowDocumentOrderAction;
+import org.eclipse.osee.framework.ui.skynet.change.view.ChangeReportEditor;
+import org.eclipse.ui.IEditorSite;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ChangeReportActionBarContributor implements IActionContributor {
+
+ private final ChangeReportEditor editor;
+ private Action bugAction;
+ private Action reloadAction;
+ private OpenAssociatedArtifact openAssocAction;
+
+ public ChangeReportActionBarContributor(ChangeReportEditor editor) {
+ this.editor = editor;
+ }
+
+ @Override
+ public void contributeToToolBar(IToolBarManager manager) {
+ ChangeUiData uiData = editor.getEditorInput().getChangeData();
+ manager.add(getReloadAction());
+ manager.add(new Separator());
+ // manager.add(createCompareMenu());
+ manager.add(new ShowDocumentOrderAction(editor.getPreferences()));
+ manager.add(new Separator());
+ manager.add(getOpenAssociatedArtifactAction());
+ manager.add(new OpenQuickSearchAction(new UiSelectBetweenDeltasBranchProvider(uiData)));
+ manager.add(new Separator());
+ manager.add(getAtsBugAction());
+ }
+
+ // public Action createCompareMenu() {
+ // if (compareMenu == null) {
+ // ChangeUiData uiData = editor.getEditorInput().getChangeData();
+ //
+ // compareMenu = new CompareDropDown();
+ // compareMenu.add(new CompareAction(CompareType.COMPARE_BASE_TO_HEAD, editor, uiData));
+ // compareMenu.add(new CompareAction(CompareType.COMPARE_CURRENTS_AGAINST_PARENT, editor, uiData));
+ // // TODO FUTURE -- Not Supported at this time on the server side
+ // // compareMenu.add(new CompareAction(CompareType.COMPARE_CURRENTS_AGAINST_OTHER_BRANCH, editor, uiData));
+ // }
+ // return compareMenu;
+ // }
+
+ public OpenAssociatedArtifact getOpenAssociatedArtifactAction() {
+ if (openAssocAction == null) {
+ openAssocAction = new OpenAssociatedArtifact(editor.getEditorInput().getChangeData());
+ }
+ return openAssocAction;
+ }
+
+ public Action getReloadAction() {
+ if (reloadAction == null) {
+ reloadAction = new ReloadChangeReportAction(editor);
+ }
+ return reloadAction;
+ }
+
+ public Action getAtsBugAction() {
+ if (bugAction == null) {
+ IEditorSite site = editor.getEditorSite();
+ bugAction =
+ OseeUiActions.createBugAction(SkynetGuiPlugin.getInstance(), editor, site.getId(),
+ site.getRegisteredName());
+ }
+ return bugAction;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeReportEditorInput.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeReportEditorInput.java
index a871f07816b..db0262d3e6a 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeReportEditorInput.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeReportEditorInput.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change;
-
+package org.eclipse.osee.framework.ui.skynet.change;
+
import java.util.logging.Level;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
@@ -21,86 +21,86 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPersistableElement;
-
-public class ChangeReportEditorInput implements IEditorInput, IPersistableElement {
-
- private final ChangeUiData changeData;
-
- public ChangeReportEditorInput(ChangeUiData changeData) {
- this.changeData = changeData;
- }
-
- @Override
- public boolean exists() {
- return true;
- }
-
- public Image getImage() {
- return ImageManager.getImage(changeData.getCompareType().getHandler().getActionImage());
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- return ImageManager.getImageDescriptor(changeData.getCompareType().getHandler().getActionImage());
- }
-
- @Override
- public String getName() {
- return String.format("Change Report: " + changeData.getCompareType().getHandler().getName(changeData.getTxDelta()));
- }
-
- @Override
- public IPersistableElement getPersistable() {
- try {
- if (EditorsPreferencePage.isCloseChangeReportEditorsOnShutdown()) {
- return null;
- } else {
- return this;
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex.toString(), ex);
- }
- return null;
- }
-
- @Override
- public String getToolTipText() {
- return getName();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- public ChangeUiData getChangeData() {
- return changeData;
- }
-
- @Override
- public boolean equals(Object object) {
- boolean result = false;
- if (object instanceof ChangeReportEditorInput) {
- ChangeReportEditorInput other = (ChangeReportEditorInput) object;
- result = this.getChangeData().equals(other.getChangeData());
- }
- return result;
- }
-
- @Override
- public int hashCode() {
- return changeData.hashCode();
- }
-
- @Override
- public String getFactoryId() {
- return ChangeReportEditorInputFactory.ID;
- }
-
- @Override
- public void saveState(IMemento memento) {
- ChangeReportEditorInputFactory.saveState(memento, this);
- }
-
-}
+
+public class ChangeReportEditorInput implements IEditorInput, IPersistableElement {
+
+ private final ChangeUiData changeData;
+
+ public ChangeReportEditorInput(ChangeUiData changeData) {
+ this.changeData = changeData;
+ }
+
+ @Override
+ public boolean exists() {
+ return true;
+ }
+
+ public Image getImage() {
+ return ImageManager.getImage(changeData.getCompareType().getHandler().getActionImage());
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return ImageManager.getImageDescriptor(changeData.getCompareType().getHandler().getActionImage());
+ }
+
+ @Override
+ public String getName() {
+ return String.format("Change Report: " + changeData.getCompareType().getHandler().getName(changeData.getTxDelta()));
+ }
+
+ @Override
+ public IPersistableElement getPersistable() {
+ try {
+ if (EditorsPreferencePage.isCloseChangeReportEditorsOnShutdown()) {
+ return null;
+ } else {
+ return this;
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex.toString(), ex);
+ }
+ return null;
+ }
+
+ @Override
+ public String getToolTipText() {
+ return getName();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+ public ChangeUiData getChangeData() {
+ return changeData;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ boolean result = false;
+ if (object instanceof ChangeReportEditorInput) {
+ ChangeReportEditorInput other = (ChangeReportEditorInput) object;
+ result = this.getChangeData().equals(other.getChangeData());
+ }
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ return changeData.hashCode();
+ }
+
+ @Override
+ public String getFactoryId() {
+ return ChangeReportEditorInputFactory.ID;
+ }
+
+ @Override
+ public void saveState(IMemento memento) {
+ ChangeReportEditorInputFactory.saveState(memento, this);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeUiData.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeUiData.java
index cbf42ba83a3..44aafdf8efc 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeUiData.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeUiData.java
@@ -8,132 +8,132 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change;
-
+package org.eclipse.osee.framework.ui.skynet.change;
+
import java.util.ArrayList;
import java.util.Collection;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.TransactionDelta;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.change.Change;
-
-public class ChangeUiData {
- private final Collection<Change> changes = new ArrayList<Change>();
- private Artifact associatedArtifact;
- private boolean isLoaded;
- private boolean loadOnOpen;
- private boolean areBranchesValid;
- private CompareType compareType;
-
- private TransactionDelta txDelta;
- private Branch mergeBranch;
-
- public ChangeUiData(CompareType compareType, TransactionDelta txDelta) {
- this.compareType = compareType;
- this.txDelta = txDelta;
- }
-
- public void setCompareType(CompareType compareType) {
- this.compareType = compareType;
- }
-
- public CompareType getCompareType() {
- return compareType;
- }
-
- public void setTxDelta(TransactionDelta txDelta) {
- this.txDelta = txDelta;
- }
-
- public void reset() {
- changes.clear();
- setAssociatedArtifact(null);
- setIsLoaded(false);
- }
-
- public boolean isMergeBranchValid() {
- return mergeBranch != null;
- }
-
- public void setMergeBranch(Branch mergeBranch) {
- this.mergeBranch = mergeBranch;
- }
-
- public boolean isLoaded() {
- return isLoaded;
- }
-
- public void setIsLoaded(boolean isLoaded) {
- this.isLoaded = isLoaded;
- }
-
- public void setLoadOnOpen(boolean loadOnOpen) {
- this.loadOnOpen = loadOnOpen;
- }
-
- public boolean isLoadOnOpenEnabled() {
- return loadOnOpen;
- }
-
- public Collection<Change> getChanges() {
- return changes;
- }
-
- public void setAssociatedArtifact(Artifact associatedArtifact) {
- this.associatedArtifact = associatedArtifact;
- }
-
- public Artifact getAssociatedArtifact() {
- return associatedArtifact;
- }
-
- public TransactionDelta getTxDelta() {
- return txDelta;
- }
-
- public boolean areBranchesValid() {
- return areBranchesValid;
- }
-
- public void setAreBranchesValid(boolean areBranchesValid) {
- this.areBranchesValid = areBranchesValid;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((compareType == null) ? 0 : compareType.hashCode());
- result = prime * result + ((txDelta == null) ? 0 : txDelta.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- ChangeUiData other = (ChangeUiData) obj;
- if (compareType == null) {
- if (other.compareType != null) {
- return false;
- }
- } else if (!compareType.equals(other.compareType)) {
- return false;
- }
- if (txDelta == null) {
- if (other.txDelta != null) {
- return false;
- }
- } else if (!txDelta.equals(other.txDelta)) {
- return false;
- }
- return true;
- }
+
+public class ChangeUiData {
+ private final Collection<Change> changes = new ArrayList<Change>();
+ private Artifact associatedArtifact;
+ private boolean isLoaded;
+ private boolean loadOnOpen;
+ private boolean areBranchesValid;
+ private CompareType compareType;
+
+ private TransactionDelta txDelta;
+ private Branch mergeBranch;
+
+ public ChangeUiData(CompareType compareType, TransactionDelta txDelta) {
+ this.compareType = compareType;
+ this.txDelta = txDelta;
+ }
+
+ public void setCompareType(CompareType compareType) {
+ this.compareType = compareType;
+ }
+
+ public CompareType getCompareType() {
+ return compareType;
+ }
+
+ public void setTxDelta(TransactionDelta txDelta) {
+ this.txDelta = txDelta;
+ }
+
+ public void reset() {
+ changes.clear();
+ setAssociatedArtifact(null);
+ setIsLoaded(false);
+ }
+
+ public boolean isMergeBranchValid() {
+ return mergeBranch != null;
+ }
+
+ public void setMergeBranch(Branch mergeBranch) {
+ this.mergeBranch = mergeBranch;
+ }
+
+ public boolean isLoaded() {
+ return isLoaded;
+ }
+
+ public void setIsLoaded(boolean isLoaded) {
+ this.isLoaded = isLoaded;
+ }
+
+ public void setLoadOnOpen(boolean loadOnOpen) {
+ this.loadOnOpen = loadOnOpen;
+ }
+
+ public boolean isLoadOnOpenEnabled() {
+ return loadOnOpen;
+ }
+
+ public Collection<Change> getChanges() {
+ return changes;
+ }
+
+ public void setAssociatedArtifact(Artifact associatedArtifact) {
+ this.associatedArtifact = associatedArtifact;
+ }
+
+ public Artifact getAssociatedArtifact() {
+ return associatedArtifact;
+ }
+
+ public TransactionDelta getTxDelta() {
+ return txDelta;
+ }
+
+ public boolean areBranchesValid() {
+ return areBranchesValid;
+ }
+
+ public void setAreBranchesValid(boolean areBranchesValid) {
+ this.areBranchesValid = areBranchesValid;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((compareType == null) ? 0 : compareType.hashCode());
+ result = prime * result + ((txDelta == null) ? 0 : txDelta.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ ChangeUiData other = (ChangeUiData) obj;
+ if (compareType == null) {
+ if (other.compareType != null) {
+ return false;
+ }
+ } else if (!compareType.equals(other.compareType)) {
+ return false;
+ }
+ if (txDelta == null) {
+ if (other.txDelta != null) {
+ return false;
+ }
+ } else if (!txDelta.equals(other.txDelta)) {
+ return false;
+ }
+ return true;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeUiUtil.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeUiUtil.java
index 4a354a0ac10..1404bf669e1 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeUiUtil.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ChangeUiUtil.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change;
-
+package org.eclipse.osee.framework.ui.skynet.change;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -26,57 +26,57 @@ import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
import org.eclipse.osee.framework.ui.skynet.change.view.ChangeReportEditor;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.progress.UIJob;
-
-public final class ChangeUiUtil {
-
- private ChangeUiUtil() {
- }
-
- public static void open(Branch branch) throws OseeCoreException {
- Conditions.checkNotNull(branch, "Branch");
- open(createInput(branch, true));
- }
-
- public static void open(TransactionRecord transactionId) throws OseeCoreException {
- Conditions.checkNotNull(transactionId, "TransactionId");
- open(createInput(transactionId, true));
- }
-
- public static ChangeReportEditorInput createInput(TransactionRecord transactionId, boolean loadOnOpen) throws OseeCoreException {
- TransactionRecord startTx = TransactionManager.getPriorTransaction(transactionId);
- TransactionRecord endTx = transactionId;
- TransactionDelta txDelta = new TransactionDelta(startTx, endTx);
- return createInput(CompareType.COMPARE_SPECIFIC_TRANSACTIONS, txDelta, loadOnOpen);
- }
-
- public static ChangeReportEditorInput createInput(Branch branch, boolean loadOnOpen) throws OseeCoreException {
- Branch parentBranch = branch.getParentBranch();
- TransactionRecord startTx = TransactionManager.getHeadTransaction(branch);
- TransactionRecord endTx = TransactionManager.getHeadTransaction(parentBranch);
- TransactionDelta txDelta = new TransactionDelta(startTx, endTx);
- return createInput(CompareType.COMPARE_CURRENTS_AGAINST_PARENT, txDelta, loadOnOpen);
- }
-
- public static ChangeReportEditorInput createInput(CompareType compareType, TransactionDelta txDelta, boolean loadOnOpen) {
- ChangeUiData uiData = new ChangeUiData(compareType, txDelta);
- uiData.setLoadOnOpen(loadOnOpen);
- return new ChangeReportEditorInput(uiData);
- }
-
- public static void open(final ChangeReportEditorInput editorInput) {
- Job job = new UIJob("Open Change Report") {
-
- @Override
- public IStatus runInUIThread(IProgressMonitor monitor) {
- IStatus status = Status.OK_STATUS;
- try {
- AWorkbench.getActivePage().openEditor(editorInput, ChangeReportEditor.EDITOR_ID);
- } catch (PartInitException ex) {
- status = new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, "Error opening change report", ex);
- }
- return status;
- }
- };
- Jobs.startJob(job, true);
- }
-}
+
+public final class ChangeUiUtil {
+
+ private ChangeUiUtil() {
+ }
+
+ public static void open(Branch branch) throws OseeCoreException {
+ Conditions.checkNotNull(branch, "Branch");
+ open(createInput(branch, true));
+ }
+
+ public static void open(TransactionRecord transactionId) throws OseeCoreException {
+ Conditions.checkNotNull(transactionId, "TransactionId");
+ open(createInput(transactionId, true));
+ }
+
+ public static ChangeReportEditorInput createInput(TransactionRecord transactionId, boolean loadOnOpen) throws OseeCoreException {
+ TransactionRecord startTx = TransactionManager.getPriorTransaction(transactionId);
+ TransactionRecord endTx = transactionId;
+ TransactionDelta txDelta = new TransactionDelta(startTx, endTx);
+ return createInput(CompareType.COMPARE_SPECIFIC_TRANSACTIONS, txDelta, loadOnOpen);
+ }
+
+ public static ChangeReportEditorInput createInput(Branch branch, boolean loadOnOpen) throws OseeCoreException {
+ Branch parentBranch = branch.getParentBranch();
+ TransactionRecord startTx = TransactionManager.getHeadTransaction(branch);
+ TransactionRecord endTx = TransactionManager.getHeadTransaction(parentBranch);
+ TransactionDelta txDelta = new TransactionDelta(startTx, endTx);
+ return createInput(CompareType.COMPARE_CURRENTS_AGAINST_PARENT, txDelta, loadOnOpen);
+ }
+
+ public static ChangeReportEditorInput createInput(CompareType compareType, TransactionDelta txDelta, boolean loadOnOpen) {
+ ChangeUiData uiData = new ChangeUiData(compareType, txDelta);
+ uiData.setLoadOnOpen(loadOnOpen);
+ return new ChangeReportEditorInput(uiData);
+ }
+
+ public static void open(final ChangeReportEditorInput editorInput) {
+ Job job = new UIJob("Open Change Report") {
+
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ IStatus status = Status.OK_STATUS;
+ try {
+ AWorkbench.getActivePage().openEditor(editorInput, ChangeReportEditor.EDITOR_ID);
+ } catch (PartInitException ex) {
+ status = new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, "Error opening change report", ex);
+ }
+ return status;
+ }
+ };
+ Jobs.startJob(job, true);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/CompareType.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/CompareType.java
index 1ca8dfa1678..ab8b201450b 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/CompareType.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/CompareType.java
@@ -8,35 +8,35 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change;
-
+package org.eclipse.osee.framework.ui.skynet.change;
+
import org.eclipse.osee.framework.ui.skynet.change.presenter.BaseToHeadHandler;
import org.eclipse.osee.framework.ui.skynet.change.presenter.CurrentsAgainstOtherHandler;
import org.eclipse.osee.framework.ui.skynet.change.presenter.CurrentsAgainstParentHandler;
import org.eclipse.osee.framework.ui.skynet.change.presenter.IChangeReportUiHandler;
import org.eclipse.osee.framework.ui.skynet.change.presenter.SpecificTxsHandler;
-
-public enum CompareType {
- COMPARE_SPECIFIC_TRANSACTIONS(new SpecificTxsHandler()),
- COMPARE_BASE_TO_HEAD(new BaseToHeadHandler()),
- COMPARE_CURRENTS_AGAINST_PARENT(new CurrentsAgainstParentHandler()),
- COMPARE_CURRENTS_AGAINST_OTHER_BRANCH(new CurrentsAgainstOtherHandler());
-
- private IChangeReportUiHandler handler;
-
- private CompareType(IChangeReportUiHandler handler) {
- this.handler = handler;
- }
-
- public boolean areSpecificTxs() {
- return this == CompareType.COMPARE_SPECIFIC_TRANSACTIONS;
- }
-
- public boolean isBaselineTxIncluded() {
- return this == CompareType.COMPARE_BASE_TO_HEAD;
- }
-
- public IChangeReportUiHandler getHandler() {
- return handler;
- }
+
+public enum CompareType {
+ COMPARE_SPECIFIC_TRANSACTIONS(new SpecificTxsHandler()),
+ COMPARE_BASE_TO_HEAD(new BaseToHeadHandler()),
+ COMPARE_CURRENTS_AGAINST_PARENT(new CurrentsAgainstParentHandler()),
+ COMPARE_CURRENTS_AGAINST_OTHER_BRANCH(new CurrentsAgainstOtherHandler());
+
+ private IChangeReportUiHandler handler;
+
+ private CompareType(IChangeReportUiHandler handler) {
+ this.handler = handler;
+ }
+
+ public boolean areSpecificTxs() {
+ return this == CompareType.COMPARE_SPECIFIC_TRANSACTIONS;
+ }
+
+ public boolean isBaselineTxIncluded() {
+ return this == CompareType.COMPARE_BASE_TO_HEAD;
+ }
+
+ public IChangeReportUiHandler getHandler() {
+ return handler;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/IChangeReportPreferences.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/IChangeReportPreferences.java
index 03159b2b76a..b2501f2e633 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/IChangeReportPreferences.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/IChangeReportPreferences.java
@@ -8,21 +8,21 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change;
-
-public interface IChangeReportPreferences {
-
- public static interface Listener {
- void onDocumentOrderChange(boolean value);
- }
-
- void saveState();
-
- boolean isInDocumentOrder();
-
- void setInDocumentOrder(boolean isEnabled);
-
- void addListener(Listener listener);
-
- void removeListener(Listener listener);
-}
+package org.eclipse.osee.framework.ui.skynet.change;
+
+public interface IChangeReportPreferences {
+
+ public static interface Listener {
+ void onDocumentOrderChange(boolean value);
+ }
+
+ void saveState();
+
+ boolean isInDocumentOrder();
+
+ void setInDocumentOrder(boolean isEnabled);
+
+ void addListener(Listener listener);
+
+ void removeListener(Listener listener);
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/IChangeReportView.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/IChangeReportView.java
index 59e329f6b64..443d6b1bace 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/IChangeReportView.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/IChangeReportView.java
@@ -8,9 +8,9 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change;
-
-public interface IChangeReportView {
-
- public void recomputeChangeReport();
-}
+package org.eclipse.osee.framework.ui.skynet.change;
+
+public interface IChangeReportView {
+
+ public void recomputeChangeReport();
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ParentBranchProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ParentBranchProvider.java
index 09999f40759..721438e17ca 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ParentBranchProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/ParentBranchProvider.java
@@ -8,29 +8,29 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change;
-
+package org.eclipse.osee.framework.ui.skynet.change;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.TransactionDelta;
import org.eclipse.osee.framework.core.util.Conditions;
import org.eclipse.osee.framework.skynet.core.artifact.IBranchProvider;
-
-public final class ParentBranchProvider implements IBranchProvider {
- private final ChangeUiData uiData;
-
- public ParentBranchProvider(ChangeUiData uiData) {
- this.uiData = uiData;
- }
-
- @Override
- public Branch getBranch(IProgressMonitor monitor) throws OseeCoreException {
- Branch selectedBranch = null;
- TransactionDelta txDelta = uiData.getTxDelta();
- Branch childBranch = txDelta.getStartTx().getBranch();
- selectedBranch = childBranch.getParentBranch();
- Conditions.checkNotNull(selectedBranch, "parent branch");
- return selectedBranch;
- }
+
+public final class ParentBranchProvider implements IBranchProvider {
+ private final ChangeUiData uiData;
+
+ public ParentBranchProvider(ChangeUiData uiData) {
+ this.uiData = uiData;
+ }
+
+ @Override
+ public Branch getBranch(IProgressMonitor monitor) throws OseeCoreException {
+ Branch selectedBranch = null;
+ TransactionDelta txDelta = uiData.getTxDelta();
+ Branch childBranch = txDelta.getStartTx().getBranch();
+ selectedBranch = childBranch.getParentBranch();
+ Conditions.checkNotNull(selectedBranch, "parent branch");
+ return selectedBranch;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/UiOtherBranchDialogProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/UiOtherBranchDialogProvider.java
index c50c85bba9a..7564e1ef3a9 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/UiOtherBranchDialogProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/UiOtherBranchDialogProvider.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change;
-
+package org.eclipse.osee.framework.ui.skynet.change;
+
import java.util.Collection;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -26,55 +26,55 @@ import org.eclipse.osee.framework.ui.skynet.branch.BranchSelectionDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.UIJob;
-
-public final class UiOtherBranchDialogProvider implements IBranchProvider {
- private final ChangeUiData uiData;
-
- public UiOtherBranchDialogProvider(ChangeUiData uiData) {
- this.uiData = uiData;
- }
-
- @Override
- public Branch getBranch(IProgressMonitor monitor) throws OseeCoreException {
- final Branch[] selectedBranch = new Branch[1];
- final Collection<Branch> selectable = BranchManager.getBaselineBranches();
- selectable.remove(uiData.getTxDelta().getStartTx().getBranch());
- IStatus status = executeInUiThread(selectable, selectedBranch);
- monitor.setCanceled(status.getSeverity() == IStatus.CANCEL);
- return selectedBranch[0];
- }
-
- private IStatus executeInUiThread(final Collection<Branch> selectable, final Branch[] selectedBranch) throws OseeCoreException {
- IStatus status = null;
- Display display = PlatformUI.getWorkbench().getDisplay();
- if (display.getThread().equals(Thread.currentThread())) {
- status = getUserSelection(selectable, selectedBranch);
- } else {
- Job job = new UIJob("Select Branch") {
- @Override
- public IStatus runInUIThread(IProgressMonitor monitor) {
- return getUserSelection(selectable, selectedBranch);
- }
- };
- try {
- Jobs.startJob(job).join();
- } catch (InterruptedException ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- status = job.getResult();
- }
- return status;
- }
-
- private IStatus getUserSelection(Collection<Branch> selectable, Branch[] selectedBranch) {
- IStatus status = Status.OK_STATUS;
- BranchSelectionDialog dialog = new BranchSelectionDialog("Select branch to compare against", selectable);
- int result = dialog.open();
- if (result == Window.OK) {
- selectedBranch[0] = dialog.getSelected();
- } else {
- status = Status.CANCEL_STATUS;
- }
- return status;
- }
+
+public final class UiOtherBranchDialogProvider implements IBranchProvider {
+ private final ChangeUiData uiData;
+
+ public UiOtherBranchDialogProvider(ChangeUiData uiData) {
+ this.uiData = uiData;
+ }
+
+ @Override
+ public Branch getBranch(IProgressMonitor monitor) throws OseeCoreException {
+ final Branch[] selectedBranch = new Branch[1];
+ final Collection<Branch> selectable = BranchManager.getBaselineBranches();
+ selectable.remove(uiData.getTxDelta().getStartTx().getBranch());
+ IStatus status = executeInUiThread(selectable, selectedBranch);
+ monitor.setCanceled(status.getSeverity() == IStatus.CANCEL);
+ return selectedBranch[0];
+ }
+
+ private IStatus executeInUiThread(final Collection<Branch> selectable, final Branch[] selectedBranch) throws OseeCoreException {
+ IStatus status = null;
+ Display display = PlatformUI.getWorkbench().getDisplay();
+ if (display.getThread().equals(Thread.currentThread())) {
+ status = getUserSelection(selectable, selectedBranch);
+ } else {
+ Job job = new UIJob("Select Branch") {
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ return getUserSelection(selectable, selectedBranch);
+ }
+ };
+ try {
+ Jobs.startJob(job).join();
+ } catch (InterruptedException ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ status = job.getResult();
+ }
+ return status;
+ }
+
+ private IStatus getUserSelection(Collection<Branch> selectable, Branch[] selectedBranch) {
+ IStatus status = Status.OK_STATUS;
+ BranchSelectionDialog dialog = new BranchSelectionDialog("Select branch to compare against", selectable);
+ int result = dialog.open();
+ if (result == Window.OK) {
+ selectedBranch[0] = dialog.getSelected();
+ } else {
+ status = Status.CANCEL_STATUS;
+ }
+ return status;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/UiSelectBetweenDeltasBranchProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/UiSelectBetweenDeltasBranchProvider.java
index 31a5d7130f7..f2d22f71f1e 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/UiSelectBetweenDeltasBranchProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/UiSelectBetweenDeltasBranchProvider.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change;
-
+package org.eclipse.osee.framework.ui.skynet.change;
+
import java.util.ArrayList;
import java.util.Collection;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -27,63 +27,63 @@ import org.eclipse.osee.framework.ui.skynet.branch.BranchSelectionDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.UIJob;
-
-public final class UiSelectBetweenDeltasBranchProvider implements IBranchProvider {
- private final ChangeUiData uiData;
-
- public UiSelectBetweenDeltasBranchProvider(ChangeUiData uiData) {
- this.uiData = uiData;
- }
-
- @Override
- public Branch getBranch(IProgressMonitor monitor) throws OseeCoreException {
- final Branch[] selectedBranch = new Branch[1];
-
- TransactionDelta txDelta = uiData.getTxDelta();
- if (txDelta.areOnTheSameBranch()) {
- selectedBranch[0] = txDelta.getStartTx().getBranch();
- } else {
- final Collection<Branch> selectable = new ArrayList<Branch>();
- selectable.add(uiData.getTxDelta().getStartTx().getBranch());
- selectable.add(uiData.getTxDelta().getEndTx().getBranch());
- IStatus status = executeInUiThread(selectable, selectedBranch);
- monitor.setCanceled(status.getSeverity() == IStatus.CANCEL);
- }
- return selectedBranch[0];
- }
-
- private IStatus executeInUiThread(final Collection<Branch> selectable, final Branch[] selectedBranch) throws OseeCoreException {
- IStatus status = null;
- Display display = PlatformUI.getWorkbench().getDisplay();
- if (display.getThread().equals(Thread.currentThread())) {
- status = getUserSelection(selectable, selectedBranch);
- } else {
- Job job = new UIJob("Select Branch") {
- @Override
- public IStatus runInUIThread(IProgressMonitor monitor) {
- return getUserSelection(selectable, selectedBranch);
- }
- };
- try {
- Jobs.startJob(job).join();
- } catch (InterruptedException ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- status = job.getResult();
- }
- return status;
- }
-
- private IStatus getUserSelection(Collection<Branch> selectable, Branch[] selectedBranch) {
- IStatus status = Status.OK_STATUS;
- BranchSelectionDialog dialog = new BranchSelectionDialog("Select branch to compare against", selectable);
- int result = dialog.open();
- if (result == Window.OK) {
- selectedBranch[0] = dialog.getSelected();
- } else {
- status = Status.CANCEL_STATUS;
- }
- return status;
- }
-
+
+public final class UiSelectBetweenDeltasBranchProvider implements IBranchProvider {
+ private final ChangeUiData uiData;
+
+ public UiSelectBetweenDeltasBranchProvider(ChangeUiData uiData) {
+ this.uiData = uiData;
+ }
+
+ @Override
+ public Branch getBranch(IProgressMonitor monitor) throws OseeCoreException {
+ final Branch[] selectedBranch = new Branch[1];
+
+ TransactionDelta txDelta = uiData.getTxDelta();
+ if (txDelta.areOnTheSameBranch()) {
+ selectedBranch[0] = txDelta.getStartTx().getBranch();
+ } else {
+ final Collection<Branch> selectable = new ArrayList<Branch>();
+ selectable.add(uiData.getTxDelta().getStartTx().getBranch());
+ selectable.add(uiData.getTxDelta().getEndTx().getBranch());
+ IStatus status = executeInUiThread(selectable, selectedBranch);
+ monitor.setCanceled(status.getSeverity() == IStatus.CANCEL);
+ }
+ return selectedBranch[0];
+ }
+
+ private IStatus executeInUiThread(final Collection<Branch> selectable, final Branch[] selectedBranch) throws OseeCoreException {
+ IStatus status = null;
+ Display display = PlatformUI.getWorkbench().getDisplay();
+ if (display.getThread().equals(Thread.currentThread())) {
+ status = getUserSelection(selectable, selectedBranch);
+ } else {
+ Job job = new UIJob("Select Branch") {
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ return getUserSelection(selectable, selectedBranch);
+ }
+ };
+ try {
+ Jobs.startJob(job).join();
+ } catch (InterruptedException ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ status = job.getResult();
+ }
+ return status;
+ }
+
+ private IStatus getUserSelection(Collection<Branch> selectable, Branch[] selectedBranch) {
+ IStatus status = Status.OK_STATUS;
+ BranchSelectionDialog dialog = new BranchSelectionDialog("Select branch to compare against", selectable);
+ int result = dialog.open();
+ if (result == Window.OK) {
+ selectedBranch[0] = dialog.getSelected();
+ } else {
+ status = Status.CANCEL_STATUS;
+ }
+ return status;
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/CompareAction.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/CompareAction.java
index 6131f6b687f..77fcb948501 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/CompareAction.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/CompareAction.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change.actions;
-
+package org.eclipse.osee.framework.ui.skynet.change.actions;
+
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
@@ -26,48 +26,48 @@ import org.eclipse.osee.framework.ui.skynet.change.UiOtherBranchDialogProvider;
import org.eclipse.osee.framework.ui.skynet.change.operations.LoadCompareBaseToHead;
import org.eclipse.osee.framework.ui.skynet.change.operations.LoadCompareBranchToBranch;
import org.eclipse.osee.framework.ui.swt.ImageManager;
-
-public final class CompareAction extends Action {
-
- private final ChangeUiData uiData;
- private final CompareType compareType;
-
- public CompareAction(CompareType compareType, ChangeUiData uiData) {
- super(compareType.getHandler().getActionName(), Action.AS_PUSH_BUTTON);
- this.compareType = compareType;
- this.uiData = uiData;
- setToolTipText(compareType.getHandler().getActionDescription());
- setImageDescriptor(ImageManager.getImageDescriptor(compareType.getHandler().getActionImage()));
- }
-
- @Override
- public void run() {
- TransactionDelta txDelta = new TransactionDelta(uiData.getTxDelta().getStartTx(), uiData.getTxDelta().getEndTx());
- final ChangeUiData newUiData = new ChangeUiData(compareType, txDelta);
-
- IOperation operation = null;
- switch (compareType) {
- case COMPARE_BASE_TO_HEAD:
- operation = new LoadCompareBaseToHead(newUiData);
- break;
- case COMPARE_CURRENTS_AGAINST_OTHER_BRANCH:
- operation = new LoadCompareBranchToBranch(newUiData, new UiOtherBranchDialogProvider(newUiData));
- break;
- case COMPARE_CURRENTS_AGAINST_PARENT:
- operation = new LoadCompareBranchToBranch(newUiData, new ParentBranchProvider(newUiData));
- break;
- default:
- throw new UnsupportedOperationException();
- }
- Operations.executeAsJob(operation, true, Job.LONG, new JobChangeAdapter() {
-
- @Override
- public void done(IJobChangeEvent event) {
- if (event.getResult().isOK()) {
- newUiData.setLoadOnOpen(true);
- ChangeUiUtil.open(new ChangeReportEditorInput(newUiData));
- }
- }
- });
- }
+
+public final class CompareAction extends Action {
+
+ private final ChangeUiData uiData;
+ private final CompareType compareType;
+
+ public CompareAction(CompareType compareType, ChangeUiData uiData) {
+ super(compareType.getHandler().getActionName(), Action.AS_PUSH_BUTTON);
+ this.compareType = compareType;
+ this.uiData = uiData;
+ setToolTipText(compareType.getHandler().getActionDescription());
+ setImageDescriptor(ImageManager.getImageDescriptor(compareType.getHandler().getActionImage()));
+ }
+
+ @Override
+ public void run() {
+ TransactionDelta txDelta = new TransactionDelta(uiData.getTxDelta().getStartTx(), uiData.getTxDelta().getEndTx());
+ final ChangeUiData newUiData = new ChangeUiData(compareType, txDelta);
+
+ IOperation operation = null;
+ switch (compareType) {
+ case COMPARE_BASE_TO_HEAD:
+ operation = new LoadCompareBaseToHead(newUiData);
+ break;
+ case COMPARE_CURRENTS_AGAINST_OTHER_BRANCH:
+ operation = new LoadCompareBranchToBranch(newUiData, new UiOtherBranchDialogProvider(newUiData));
+ break;
+ case COMPARE_CURRENTS_AGAINST_PARENT:
+ operation = new LoadCompareBranchToBranch(newUiData, new ParentBranchProvider(newUiData));
+ break;
+ default:
+ throw new UnsupportedOperationException();
+ }
+ Operations.executeAsJob(operation, true, Job.LONG, new JobChangeAdapter() {
+
+ @Override
+ public void done(IJobChangeEvent event) {
+ if (event.getResult().isOK()) {
+ newUiData.setLoadOnOpen(true);
+ ChangeUiUtil.open(new ChangeReportEditorInput(newUiData));
+ }
+ }
+ });
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/CompareDropDown.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/CompareDropDown.java
index 4f653bb27f2..a86e301296c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/CompareDropDown.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/CompareDropDown.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change.actions;
-
+package org.eclipse.osee.framework.ui.skynet.change.actions;
+
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuCreator;
@@ -18,38 +18,38 @@ import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
import org.eclipse.osee.framework.ui.swt.ImageManager;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
-
-public class CompareDropDown extends Action {
- private final MenuManager manager;
-
- public CompareDropDown() {
- super("Compare Against...", Action.AS_DROP_DOWN_MENU);
- setToolTipText("Select from the drop down to change the current change report settings.");
- setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.CHANGE_LOG));
- manager = new MenuManager();
- setMenuCreator(new CompareMenuCreator());
- }
-
- public void add(IAction action) {
- manager.add(action);
- }
-
- private final class CompareMenuCreator implements IMenuCreator {
-
- public void dispose() {
- manager.dispose();
- }
-
- public Menu getMenu(Control parent) {
- if (manager.getMenu() == null) {
- manager.createContextMenu(parent);
- }
- return manager.getMenu();
- }
-
- public Menu getMenu(Menu parent) {
- return null;
- }
-
- }
-}
+
+public class CompareDropDown extends Action {
+ private final MenuManager manager;
+
+ public CompareDropDown() {
+ super("Compare Against...", Action.AS_DROP_DOWN_MENU);
+ setToolTipText("Select from the drop down to change the current change report settings.");
+ setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.CHANGE_LOG));
+ manager = new MenuManager();
+ setMenuCreator(new CompareMenuCreator());
+ }
+
+ public void add(IAction action) {
+ manager.add(action);
+ }
+
+ private final class CompareMenuCreator implements IMenuCreator {
+
+ public void dispose() {
+ manager.dispose();
+ }
+
+ public Menu getMenu(Control parent) {
+ if (manager.getMenu() == null) {
+ manager.createContextMenu(parent);
+ }
+ return manager.getMenu();
+ }
+
+ public Menu getMenu(Menu parent) {
+ return null;
+ }
+
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/OpenAssociatedArtifact.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/OpenAssociatedArtifact.java
index dcd78018ca8..cdb4597736b 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/OpenAssociatedArtifact.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/OpenAssociatedArtifact.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change.actions;
-
+package org.eclipse.osee.framework.ui.skynet.change.actions;
+
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
@@ -27,46 +27,46 @@ import org.eclipse.osee.framework.ui.skynet.change.operations.LoadAssociatedArti
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.ImageManager;
-
-public class OpenAssociatedArtifact extends Action {
- private final ChangeUiData changeData;
-
- public OpenAssociatedArtifact(ChangeUiData changeData) {
- super("Open Associated Artifact", Action.AS_PUSH_BUTTON);
- this.changeData = changeData;
- setId("open.associated.artifact.change.report");
- setToolTipText("Open Associated Artifact");
- setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.EDIT));
- }
-
- @Override
- public void run() {
- IOperation operation = new LoadAssociatedArtifactOperation(changeData);
- Operations.executeAsJob(operation, false, Job.SHORT, new JobChangeAdapter() {
-
- @Override
- public void done(IJobChangeEvent event) {
- if (changeData.getAssociatedArtifact() == null) {
- AWorkbench.popup("ERROR", "Cannot access associated artifact.");
- } else {
- RendererManager.openInJob(changeData.getAssociatedArtifact(), PresentationType.GENERALIZED_EDIT);
- }
- }
- });
- }
-
- public void updateEnablement() {
- Artifact associatedArtifact = changeData.getAssociatedArtifact();
- boolean isEnabled;
- ImageDescriptor descriptor;
- if (associatedArtifact != null && !(associatedArtifact instanceof User)) {
- descriptor = ArtifactImageManager.getImageDescriptor(associatedArtifact);
- isEnabled = true;
- } else {
- descriptor = ImageManager.getImageDescriptor(FrameworkImage.EDIT);
- isEnabled = false;
- }
- setImageDescriptor(descriptor);
- setEnabled(isEnabled);
- }
+
+public class OpenAssociatedArtifact extends Action {
+ private final ChangeUiData changeData;
+
+ public OpenAssociatedArtifact(ChangeUiData changeData) {
+ super("Open Associated Artifact", Action.AS_PUSH_BUTTON);
+ this.changeData = changeData;
+ setId("open.associated.artifact.change.report");
+ setToolTipText("Open Associated Artifact");
+ setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.EDIT));
+ }
+
+ @Override
+ public void run() {
+ IOperation operation = new LoadAssociatedArtifactOperation(changeData);
+ Operations.executeAsJob(operation, false, Job.SHORT, new JobChangeAdapter() {
+
+ @Override
+ public void done(IJobChangeEvent event) {
+ if (changeData.getAssociatedArtifact() == null) {
+ AWorkbench.popup("ERROR", "Cannot access associated artifact.");
+ } else {
+ RendererManager.openInJob(changeData.getAssociatedArtifact(), PresentationType.GENERALIZED_EDIT);
+ }
+ }
+ });
+ }
+
+ public void updateEnablement() {
+ Artifact associatedArtifact = changeData.getAssociatedArtifact();
+ boolean isEnabled;
+ ImageDescriptor descriptor;
+ if (associatedArtifact != null && !(associatedArtifact instanceof User)) {
+ descriptor = ArtifactImageManager.getImageDescriptor(associatedArtifact);
+ isEnabled = true;
+ } else {
+ descriptor = ImageManager.getImageDescriptor(FrameworkImage.EDIT);
+ isEnabled = false;
+ }
+ setImageDescriptor(descriptor);
+ setEnabled(isEnabled);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/OpenQuickSearchAction.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/OpenQuickSearchAction.java
index 2092dc4d323..e523b43d1bc 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/OpenQuickSearchAction.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/OpenQuickSearchAction.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change.actions;
-
+package org.eclipse.osee.framework.ui.skynet.change.actions;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -25,42 +25,42 @@ import org.eclipse.osee.framework.ui.swt.ImageManager;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.UIJob;
-
-public class OpenQuickSearchAction extends Action {
-
- private final IBranchProvider branchProvider;
-
- public OpenQuickSearchAction(IBranchProvider branchProvider) {
- super("Open Quick Search", Action.AS_PUSH_BUTTON);
- this.branchProvider = branchProvider;
- setId("open.quick.search.change.report");
- setToolTipText("Open Quick Search");
- setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.ARTIFACT_SEARCH));
- }
-
- @Override
- public void run() {
- Job job = new UIJob("Open Quick Search") {
-
- @Override
- public IStatus runInUIThread(IProgressMonitor monitor) {
- IStatus status = Status.OK_STATUS;
- try {
- Branch branch = branchProvider.getBranch(monitor);
- if (branch != null) {
- IViewPart viewPart =
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(
- QuickSearchView.VIEW_ID);
- if (viewPart != null) {
- ((QuickSearchView) viewPart).setBranch(branch);
- }
- }
- } catch (Exception ex) {
- status = new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, "Error opening quick search view", ex);
- }
- return status;
- }
- };
- Jobs.startJob(job, true);
- }
+
+public class OpenQuickSearchAction extends Action {
+
+ private final IBranchProvider branchProvider;
+
+ public OpenQuickSearchAction(IBranchProvider branchProvider) {
+ super("Open Quick Search", Action.AS_PUSH_BUTTON);
+ this.branchProvider = branchProvider;
+ setId("open.quick.search.change.report");
+ setToolTipText("Open Quick Search");
+ setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.ARTIFACT_SEARCH));
+ }
+
+ @Override
+ public void run() {
+ Job job = new UIJob("Open Quick Search") {
+
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ IStatus status = Status.OK_STATUS;
+ try {
+ Branch branch = branchProvider.getBranch(monitor);
+ if (branch != null) {
+ IViewPart viewPart =
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(
+ QuickSearchView.VIEW_ID);
+ if (viewPart != null) {
+ ((QuickSearchView) viewPart).setBranch(branch);
+ }
+ }
+ } catch (Exception ex) {
+ status = new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, "Error opening quick search view", ex);
+ }
+ return status;
+ }
+ };
+ Jobs.startJob(job, true);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/ReloadChangeReportAction.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/ReloadChangeReportAction.java
index 0c290e17279..9b0378524f9 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/ReloadChangeReportAction.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/ReloadChangeReportAction.java
@@ -8,27 +8,27 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change.actions;
-
+package org.eclipse.osee.framework.ui.skynet.change.actions;
+
import org.eclipse.jface.action.Action;
import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
import org.eclipse.osee.framework.ui.skynet.change.IChangeReportView;
import org.eclipse.osee.framework.ui.swt.ImageManager;
-
-public class ReloadChangeReportAction extends Action {
-
- private final IChangeReportView view;
-
- public ReloadChangeReportAction(IChangeReportView view) {
- super("Reload Change Report", Action.AS_PUSH_BUTTON);
- setId("reload.change.report");
- setToolTipText("Reloads the change report");
- setImageDescriptor(ImageManager.getImageDescriptor(PluginUiImage.REFRESH));
- this.view = view;
- }
-
- @Override
- public void run() {
- view.recomputeChangeReport();
- }
+
+public class ReloadChangeReportAction extends Action {
+
+ private final IChangeReportView view;
+
+ public ReloadChangeReportAction(IChangeReportView view) {
+ super("Reload Change Report", Action.AS_PUSH_BUTTON);
+ setId("reload.change.report");
+ setToolTipText("Reloads the change report");
+ setImageDescriptor(ImageManager.getImageDescriptor(PluginUiImage.REFRESH));
+ this.view = view;
+ }
+
+ @Override
+ public void run() {
+ view.recomputeChangeReport();
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/ShowDocumentOrderAction.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/ShowDocumentOrderAction.java
index 6540c5fe796..a9b17966615 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/ShowDocumentOrderAction.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/actions/ShowDocumentOrderAction.java
@@ -8,44 +8,44 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change.actions;
-
+package org.eclipse.osee.framework.ui.skynet.change.actions;
+
import org.eclipse.jface.action.Action;
import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
import org.eclipse.osee.framework.ui.skynet.change.IChangeReportPreferences;
import org.eclipse.osee.framework.ui.swt.ImageManager;
-
-public class ShowDocumentOrderAction extends Action implements IChangeReportPreferences.Listener {
-
- private final IChangeReportPreferences documentPreferences;
-
- public ShowDocumentOrderAction(IChangeReportPreferences documentPreferences) {
- super("Show Changes in Document Order", Action.AS_CHECK_BOX);
- setId("show.change.report.in.document.order");
- this.documentPreferences = documentPreferences;
- setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.DOCUMENT));
- updateToolTip();
- documentPreferences.addListener(this);
- }
-
- @Override
- public void run() {
- documentPreferences.setInDocumentOrder(!documentPreferences.isInDocumentOrder());
- }
-
- @Override
- public void onDocumentOrderChange(boolean isChecked) {
- setChecked(isChecked);
- updateToolTip();
- }
-
- private void updateToolTip() {
- String message;
- if (isChecked()) {
- message = "Click to show change report in loaded order";
- } else {
- message = "Click to show change report in document order";
- }
- setToolTipText(message);
- }
-}
+
+public class ShowDocumentOrderAction extends Action implements IChangeReportPreferences.Listener {
+
+ private final IChangeReportPreferences documentPreferences;
+
+ public ShowDocumentOrderAction(IChangeReportPreferences documentPreferences) {
+ super("Show Changes in Document Order", Action.AS_CHECK_BOX);
+ setId("show.change.report.in.document.order");
+ this.documentPreferences = documentPreferences;
+ setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.DOCUMENT));
+ updateToolTip();
+ documentPreferences.addListener(this);
+ }
+
+ @Override
+ public void run() {
+ documentPreferences.setInDocumentOrder(!documentPreferences.isInDocumentOrder());
+ }
+
+ @Override
+ public void onDocumentOrderChange(boolean isChecked) {
+ setChecked(isChecked);
+ updateToolTip();
+ }
+
+ private void updateToolTip() {
+ String message;
+ if (isChecked()) {
+ message = "Click to show change report in loaded order";
+ } else {
+ message = "Click to show change report in document order";
+ }
+ setToolTipText(message);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadAssociatedArtifactOperation.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadAssociatedArtifactOperation.java
index 3ec05258ef2..941fe35a002 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadAssociatedArtifactOperation.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadAssociatedArtifactOperation.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change.operations;
-
+package org.eclipse.osee.framework.ui.skynet.change.operations;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.TransactionDelta;
@@ -20,31 +20,31 @@ import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
import org.eclipse.osee.framework.ui.skynet.change.ChangeUiData;
-
-public class LoadAssociatedArtifactOperation extends AbstractOperation {
- private final ChangeUiData changeData;
-
- public LoadAssociatedArtifactOperation(ChangeUiData changeData) {
- super("Load Associated Artifact", SkynetGuiPlugin.PLUGIN_ID);
- this.changeData = changeData;
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- Artifact associatedArtifact = null;
- TransactionDelta txDelta = changeData.getTxDelta();
- if (changeData.getCompareType().areSpecificTxs()) {
- TransactionRecord txRecord = txDelta.getEndTx();
- int commitId = txRecord.getCommit();
- if (commitId != 0) {
- associatedArtifact = ArtifactQuery.getArtifactFromId(commitId, BranchManager.getCommonBranch());
- }
- } else {
- Branch sourceBranch = txDelta.getStartTx().getBranch();
- associatedArtifact = BranchManager.getAssociatedArtifact(sourceBranch);
- }
- monitor.worked(calculateWork(0.80));
- changeData.setAssociatedArtifact(associatedArtifact);
- monitor.worked(calculateWork(0.20));
- }
+
+public class LoadAssociatedArtifactOperation extends AbstractOperation {
+ private final ChangeUiData changeData;
+
+ public LoadAssociatedArtifactOperation(ChangeUiData changeData) {
+ super("Load Associated Artifact", SkynetGuiPlugin.PLUGIN_ID);
+ this.changeData = changeData;
+ }
+
+ @Override
+ protected void doWork(IProgressMonitor monitor) throws Exception {
+ Artifact associatedArtifact = null;
+ TransactionDelta txDelta = changeData.getTxDelta();
+ if (changeData.getCompareType().areSpecificTxs()) {
+ TransactionRecord txRecord = txDelta.getEndTx();
+ int commitId = txRecord.getCommit();
+ if (commitId != 0) {
+ associatedArtifact = ArtifactQuery.getArtifactFromId(commitId, BranchManager.getCommonBranch());
+ }
+ } else {
+ Branch sourceBranch = txDelta.getStartTx().getBranch();
+ associatedArtifact = BranchManager.getAssociatedArtifact(sourceBranch);
+ }
+ monitor.worked(calculateWork(0.80));
+ changeData.setAssociatedArtifact(associatedArtifact);
+ monitor.worked(calculateWork(0.20));
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadAssociatedArtifactOperationFromBranch.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadAssociatedArtifactOperationFromBranch.java
index 4ffe612ec83..57ab63ca887 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadAssociatedArtifactOperationFromBranch.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadAssociatedArtifactOperationFromBranch.java
@@ -8,28 +8,28 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change.operations;
-
+package org.eclipse.osee.framework.ui.skynet.change.operations;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.core.operation.AbstractOperation;
import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
import org.eclipse.osee.framework.skynet.core.artifact.IBranchProvider;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-
-public class LoadAssociatedArtifactOperationFromBranch extends AbstractOperation {
-
- private final IBranchProvider branchProvider;
-
- public LoadAssociatedArtifactOperationFromBranch(IBranchProvider branchProvider) {
- super("Load Associated Artifact", SkynetGuiPlugin.PLUGIN_ID);
- this.branchProvider = branchProvider;
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- branchProvider.getBranch(monitor);
- monitor.worked(calculateWork(0.80));
- BranchManager.getAssociatedArtifact(branchProvider.getBranch(null));
- monitor.worked(calculateWork(0.20));
- }
+
+public class LoadAssociatedArtifactOperationFromBranch extends AbstractOperation {
+
+ private final IBranchProvider branchProvider;
+
+ public LoadAssociatedArtifactOperationFromBranch(IBranchProvider branchProvider) {
+ super("Load Associated Artifact", SkynetGuiPlugin.PLUGIN_ID);
+ this.branchProvider = branchProvider;
+ }
+
+ @Override
+ protected void doWork(IProgressMonitor monitor) throws Exception {
+ branchProvider.getBranch(monitor);
+ monitor.worked(calculateWork(0.80));
+ BranchManager.getAssociatedArtifact(branchProvider.getBranch(null));
+ monitor.worked(calculateWork(0.20));
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadChangesOperation.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadChangesOperation.java
index 5782afd867d..acf16a81798 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadChangesOperation.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadChangesOperation.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change.operations;
-
+package org.eclipse.osee.framework.ui.skynet.change.operations;
+
import java.util.Collection;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.core.operation.AbstractOperation;
@@ -18,26 +18,26 @@ import org.eclipse.osee.framework.skynet.core.change.Change;
import org.eclipse.osee.framework.skynet.core.revision.ChangeDataLoader;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
import org.eclipse.osee.framework.ui.skynet.change.ChangeUiData;
-
-public class LoadChangesOperation extends AbstractOperation {
- private final ChangeUiData changeData;
-
- public LoadChangesOperation(ChangeUiData changeData) {
- super("Load Change Data", SkynetGuiPlugin.PLUGIN_ID);
- this.changeData = changeData;
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- changeData.setIsLoaded(false);
- Collection<Change> changes = changeData.getChanges();
- changes.clear();
- monitor.worked(calculateWork(0.10));
-
- IOperation subOp = new ChangeDataLoader(changes, changeData.getTxDelta());
- doSubWork(subOp, monitor, 0.80);
-
- changeData.setIsLoaded(true);
- monitor.worked(calculateWork(0.10));
- }
+
+public class LoadChangesOperation extends AbstractOperation {
+ private final ChangeUiData changeData;
+
+ public LoadChangesOperation(ChangeUiData changeData) {
+ super("Load Change Data", SkynetGuiPlugin.PLUGIN_ID);
+ this.changeData = changeData;
+ }
+
+ @Override
+ protected void doWork(IProgressMonitor monitor) throws Exception {
+ changeData.setIsLoaded(false);
+ Collection<Change> changes = changeData.getChanges();
+ changes.clear();
+ monitor.worked(calculateWork(0.10));
+
+ IOperation subOp = new ChangeDataLoader(changes, changeData.getTxDelta());
+ doSubWork(subOp, monitor, 0.80);
+
+ changeData.setIsLoaded(true);
+ monitor.worked(calculateWork(0.10));
+ }
}; \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadCompareBaseToHead.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadCompareBaseToHead.java
index 615e1e66d3f..7adbe668480 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadCompareBaseToHead.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadCompareBaseToHead.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change.operations;
-
+package org.eclipse.osee.framework.ui.skynet.change.operations;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.TransactionDelta;
@@ -19,23 +19,23 @@ import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
import org.eclipse.osee.framework.ui.skynet.change.ChangeUiData;
import org.eclipse.osee.framework.ui.skynet.change.CompareType;
-
-public class LoadCompareBaseToHead extends AbstractOperation {
-
- private final ChangeUiData uiData;
-
- public LoadCompareBaseToHead(ChangeUiData uiData) {
- super("Load Data to compare from base to head transaction", SkynetGuiPlugin.PLUGIN_ID);
- this.uiData = uiData;
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- Branch branch = uiData.getTxDelta().getStartTx().getBranch();
- TransactionRecord startTx = branch.getBaseTransaction();
- TransactionRecord endTx = TransactionManager.getHeadTransaction(branch);
- TransactionDelta txDelta = new TransactionDelta(startTx, endTx);
- uiData.setTxDelta(txDelta);
- uiData.setCompareType(CompareType.COMPARE_BASE_TO_HEAD);
- }
-}
+
+public class LoadCompareBaseToHead extends AbstractOperation {
+
+ private final ChangeUiData uiData;
+
+ public LoadCompareBaseToHead(ChangeUiData uiData) {
+ super("Load Data to compare from base to head transaction", SkynetGuiPlugin.PLUGIN_ID);
+ this.uiData = uiData;
+ }
+
+ @Override
+ protected void doWork(IProgressMonitor monitor) throws Exception {
+ Branch branch = uiData.getTxDelta().getStartTx().getBranch();
+ TransactionRecord startTx = branch.getBaseTransaction();
+ TransactionRecord endTx = TransactionManager.getHeadTransaction(branch);
+ TransactionDelta txDelta = new TransactionDelta(startTx, endTx);
+ uiData.setTxDelta(txDelta);
+ uiData.setCompareType(CompareType.COMPARE_BASE_TO_HEAD);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadCompareBranchToBranch.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadCompareBranchToBranch.java
index 95bddbb8fa5..8fe38337eee 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadCompareBranchToBranch.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/LoadCompareBranchToBranch.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change.operations;
-
+package org.eclipse.osee.framework.ui.skynet.change.operations;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.TransactionDelta;
@@ -22,38 +22,38 @@ import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
import org.eclipse.osee.framework.ui.skynet.change.ChangeUiData;
import org.eclipse.osee.framework.ui.skynet.change.CompareType;
-
-public class LoadCompareBranchToBranch extends AbstractOperation {
-
- private final ChangeUiData uiData;
- private final IBranchProvider branchProvider;
-
- public LoadCompareBranchToBranch(ChangeUiData uiData, IBranchProvider branchProvider) {
- super("Load data to compare different branches", SkynetGuiPlugin.PLUGIN_ID);
- this.uiData = uiData;
- this.branchProvider = branchProvider;
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- Branch startBranch = uiData.getTxDelta().getStartTx().getBranch();
- Branch otherBranch = branchProvider.getBranch(monitor);
- checkForCancelledStatus(monitor);
-
- Conditions.checkNotNull(otherBranch, "other branch to compare to");
-
- TransactionRecord startTx = TransactionManager.getHeadTransaction(startBranch);
- TransactionRecord endTx = TransactionManager.getHeadTransaction(otherBranch);
- TransactionDelta txDelta = new TransactionDelta(startTx, endTx);
- uiData.setTxDelta(txDelta);
-
- Branch mergeBranch = BranchManager.getMergeBranch(startBranch, otherBranch, true);
- uiData.setMergeBranch(mergeBranch);
-
- if (otherBranch.equals(startBranch.getParentBranch())) {
- uiData.setCompareType(CompareType.COMPARE_CURRENTS_AGAINST_PARENT);
- } else {
- uiData.setCompareType(CompareType.COMPARE_CURRENTS_AGAINST_OTHER_BRANCH);
- }
- }
-}
+
+public class LoadCompareBranchToBranch extends AbstractOperation {
+
+ private final ChangeUiData uiData;
+ private final IBranchProvider branchProvider;
+
+ public LoadCompareBranchToBranch(ChangeUiData uiData, IBranchProvider branchProvider) {
+ super("Load data to compare different branches", SkynetGuiPlugin.PLUGIN_ID);
+ this.uiData = uiData;
+ this.branchProvider = branchProvider;
+ }
+
+ @Override
+ protected void doWork(IProgressMonitor monitor) throws Exception {
+ Branch startBranch = uiData.getTxDelta().getStartTx().getBranch();
+ Branch otherBranch = branchProvider.getBranch(monitor);
+ checkForCancelledStatus(monitor);
+
+ Conditions.checkNotNull(otherBranch, "other branch to compare to");
+
+ TransactionRecord startTx = TransactionManager.getHeadTransaction(startBranch);
+ TransactionRecord endTx = TransactionManager.getHeadTransaction(otherBranch);
+ TransactionDelta txDelta = new TransactionDelta(startTx, endTx);
+ uiData.setTxDelta(txDelta);
+
+ Branch mergeBranch = BranchManager.getMergeBranch(startBranch, otherBranch, true);
+ uiData.setMergeBranch(mergeBranch);
+
+ if (otherBranch.equals(startBranch.getParentBranch())) {
+ uiData.setCompareType(CompareType.COMPARE_CURRENTS_AGAINST_PARENT);
+ } else {
+ uiData.setCompareType(CompareType.COMPARE_CURRENTS_AGAINST_OTHER_BRANCH);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/UpdateChangeUiData.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/UpdateChangeUiData.java
index d841af0c1bb..96361e954e8 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/UpdateChangeUiData.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/operations/UpdateChangeUiData.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change.operations;
-
+package org.eclipse.osee.framework.ui.skynet.change.operations;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.core.enums.BranchState;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
@@ -22,41 +22,41 @@ import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
import org.eclipse.osee.framework.ui.skynet.change.ChangeUiData;
import org.eclipse.osee.framework.ui.skynet.change.CompareType;
-
-public class UpdateChangeUiData extends AbstractOperation {
- private final ChangeUiData changeData;
-
- public UpdateChangeUiData(ChangeUiData changeData) {
- super("Update Change Ui Data", SkynetGuiPlugin.PLUGIN_ID);
- this.changeData = changeData;
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- TransactionDelta txDelta = changeData.getTxDelta();
-
- CompareType compareType = changeData.getCompareType();
- if (!compareType.areSpecificTxs()) {
- TransactionRecord startTx = txDelta.getStartTx();
- if (!compareType.isBaselineTxIncluded()) {
- startTx = TransactionManager.getHeadTransaction(startTx.getBranch());
- }
- TransactionRecord endTx = TransactionManager.getHeadTransaction(txDelta.getEndTx().getBranch());
-
- txDelta = new TransactionDelta(startTx, endTx);
- changeData.setTxDelta(txDelta);
- }
-
- if (!txDelta.areOnTheSameBranch()) {
- Branch mergeBranch =
- BranchManager.getMergeBranch(txDelta.getStartTx().getBranch(), txDelta.getEndTx().getBranch(), true);
- changeData.setMergeBranch(mergeBranch);
- }
- boolean areBranchesValid = !hasBeenRebaselined(txDelta.getStartTx()) && !hasBeenRebaselined(txDelta.getEndTx());
- changeData.setAreBranchesValid(areBranchesValid);
- }
-
- private boolean hasBeenRebaselined(TransactionRecord tx) throws OseeCoreException {
- return tx.getBranch().getBranchState().equals(BranchState.REBASELINED);
- }
-}
+
+public class UpdateChangeUiData extends AbstractOperation {
+ private final ChangeUiData changeData;
+
+ public UpdateChangeUiData(ChangeUiData changeData) {
+ super("Update Change Ui Data", SkynetGuiPlugin.PLUGIN_ID);
+ this.changeData = changeData;
+ }
+
+ @Override
+ protected void doWork(IProgressMonitor monitor) throws Exception {
+ TransactionDelta txDelta = changeData.getTxDelta();
+
+ CompareType compareType = changeData.getCompareType();
+ if (!compareType.areSpecificTxs()) {
+ TransactionRecord startTx = txDelta.getStartTx();
+ if (!compareType.isBaselineTxIncluded()) {
+ startTx = TransactionManager.getHeadTransaction(startTx.getBranch());
+ }
+ TransactionRecord endTx = TransactionManager.getHeadTransaction(txDelta.getEndTx().getBranch());
+
+ txDelta = new TransactionDelta(startTx, endTx);
+ changeData.setTxDelta(txDelta);
+ }
+
+ if (!txDelta.areOnTheSameBranch()) {
+ Branch mergeBranch =
+ BranchManager.getMergeBranch(txDelta.getStartTx().getBranch(), txDelta.getEndTx().getBranch(), true);
+ changeData.setMergeBranch(mergeBranch);
+ }
+ boolean areBranchesValid = !hasBeenRebaselined(txDelta.getStartTx()) && !hasBeenRebaselined(txDelta.getEndTx());
+ changeData.setAreBranchesValid(areBranchesValid);
+ }
+
+ private boolean hasBeenRebaselined(TransactionRecord tx) throws OseeCoreException {
+ return tx.getBranch().getBranchState().equals(BranchState.REBASELINED);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/BaseToHeadHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/BaseToHeadHandler.java
index 26f3082e3c6..5aa21b4eace 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/BaseToHeadHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/BaseToHeadHandler.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change.presenter;
-
+package org.eclipse.osee.framework.ui.skynet.change.presenter;
+
import java.text.NumberFormat;
import java.util.logging.Level;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
@@ -20,60 +20,60 @@ import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
import org.eclipse.osee.framework.ui.skynet.change.ChangeUiData;
import org.eclipse.osee.framework.ui.swt.KeyedImage;
-
-public final class BaseToHeadHandler implements IChangeReportUiHandler {
-
- @Override
- public String getActionName() {
- return "Open report showing all changes made the branch";
- }
-
- @Override
- public String getActionDescription() {
- return "Compute changes made to a branch from when the branch was create until its last transaction.";
- }
-
- @Override
- public String getName(TransactionDelta txDelta) {
- String branchName;
- try {
- branchName = txDelta.getEndTx().getBranch().getShortName();
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex.toString(), ex);
- branchName = "Unknown";
- }
- return String.format("%s - All Changes", branchName);
- }
-
- @Override
- public KeyedImage getActionImage() {
- return FrameworkImage.COMPARE_HEAD_TX;
- }
-
- @Override
- public KeyedImage getScenarioImage(ChangeUiData changeUiData) {
- return FrameworkImage.DELTAS_BASE_TO_HEAD_TXS;
- }
-
- @Override
- public String getScenarioDescriptionHtml(ChangeUiData changeUiData) throws OseeCoreException {
- TransactionDelta txDelta = changeUiData.getTxDelta();
- NumberFormat formatter = NumberFormat.getInstance();
- return String.format(
- "Shows all changes made to [<b>%s</b>] from when it was created (transaction <b>%s</b>) until it was last modified (transaction <b>%s</b>).",
- AXml.textToXml(txDelta.getStartTx().getBranch().getName()),
- AXml.textToXml(formatter.format(txDelta.getStartTx().getId())),
- AXml.textToXml(formatter.format(txDelta.getEndTx().getId())));
- }
-
- @Override
- public void appendTransactionInfoHtml(StringBuilder sb, ChangeUiData changeUiData) throws OseeCoreException {
- TransactionDelta txDelta = changeUiData.getTxDelta();
- sb.append("<b>Created: </b><br/>");
- ChangeReportInfoPresenter.addTransactionInfo(sb, txDelta.getStartTx());
- sb.append("<br/><br/>");
- sb.append("<b>Last Modified: </b><br/>");
- ChangeReportInfoPresenter.addTransactionInfo(sb, txDelta.getEndTx());
- }
-
+
+public final class BaseToHeadHandler implements IChangeReportUiHandler {
+
+ @Override
+ public String getActionName() {
+ return "Open report showing all changes made the branch";
+ }
+
+ @Override
+ public String getActionDescription() {
+ return "Compute changes made to a branch from when the branch was create until its last transaction.";
+ }
+
+ @Override
+ public String getName(TransactionDelta txDelta) {
+ String branchName;
+ try {
+ branchName = txDelta.getEndTx().getBranch().getShortName();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex.toString(), ex);
+ branchName = "Unknown";
+ }
+ return String.format("%s - All Changes", branchName);
+ }
+
+ @Override
+ public KeyedImage getActionImage() {
+ return FrameworkImage.COMPARE_HEAD_TX;
+ }
+
+ @Override
+ public KeyedImage getScenarioImage(ChangeUiData changeUiData) {
+ return FrameworkImage.DELTAS_BASE_TO_HEAD_TXS;
+ }
+
+ @Override
+ public String getScenarioDescriptionHtml(ChangeUiData changeUiData) throws OseeCoreException {
+ TransactionDelta txDelta = changeUiData.getTxDelta();
+ NumberFormat formatter = NumberFormat.getInstance();
+ return String.format(
+ "Shows all changes made to [<b>%s</b>] from when it was created (transaction <b>%s</b>) until it was last modified (transaction <b>%s</b>).",
+ AXml.textToXml(txDelta.getStartTx().getBranch().getName()),
+ AXml.textToXml(formatter.format(txDelta.getStartTx().getId())),
+ AXml.textToXml(formatter.format(txDelta.getEndTx().getId())));
+ }
+
+ @Override
+ public void appendTransactionInfoHtml(StringBuilder sb, ChangeUiData changeUiData) throws OseeCoreException {
+ TransactionDelta txDelta = changeUiData.getTxDelta();
+ sb.append("<b>Created: </b><br/>");
+ ChangeReportInfoPresenter.addTransactionInfo(sb, txDelta.getStartTx());
+ sb.append("<br/><br/>");
+ sb.append("<b>Last Modified: </b><br/>");
+ ChangeReportInfoPresenter.addTransactionInfo(sb, txDelta.getEndTx());
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/ChangeReportInfoPresenter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/ChangeReportInfoPresenter.java
index af880f99599..09a6e1c15db 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/ChangeReportInfoPresenter.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/ChangeReportInfoPresenter.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change.presenter;
-
+package org.eclipse.osee.framework.ui.skynet.change.presenter;
+
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.logging.Level;
@@ -27,115 +27,115 @@ import org.eclipse.osee.framework.ui.skynet.change.view.EditorSection;
import org.eclipse.osee.framework.ui.swt.KeyedImage;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.IManagedForm;
-
-public class ChangeReportInfoPresenter implements EditorSection.IWidget {
-
- private static final String LOADING = "<form><p vspace='false'><b>Loading ...</b></p></form>";
- private static final String NO_CHANGES_FOUND = "<b>No changes were found</b><br/>";
-
- public static interface Display {
- void setImage(KeyedImage image);
-
- void setText(String value);
-
- void onCreate(IManagedForm managedForm, Composite parent);
- }
-
- private final Display display;
- private final ChangeUiData changeData;
-
- public ChangeReportInfoPresenter(Display display, ChangeUiData changeData) {
- this.display = display;
- this.changeData = changeData;
- }
-
- public void onLoading() {
- display.setImage(FrameworkImage.DELTAS);
- display.setText(LOADING);
- }
-
- public void onUpdate() {
- display.setImage(getKeyedImage());
- display.setText(createInfoPage());
- }
-
- private KeyedImage getKeyedImage() {
- KeyedImage imageKey = FrameworkImage.DELTAS;
- if (changeData.areBranchesValid()) {
- imageKey = changeData.getCompareType().getHandler().getScenarioImage(changeData);
- }
- return imageKey;
- }
-
- public String createInfoPage() {
- StringBuilder sb = new StringBuilder();
- sb.append("<form>");
- sb.append("<p>");
- if (!changeData.isLoaded()) {
- sb.append("<b>Cleared on shut down. Press refresh to reload</b><br/><br/>");
- }
- addInterpretation(sb);
-
- if (!changeData.areBranchesValid()) {
- sb.append("<br/><b>The branch has been updated from parent and cannot be refreshed.</b><br/>");
- sb.append("<b>Please close down and re-open this change report</b>");
- } else {
- sb.append("<br/>");
- if (changeData.isLoaded() && changeData.getChanges().isEmpty()) {
- sb.append(NO_CHANGES_FOUND);
- sb.append("<br/>");
- }
- sb.append("<br/>");
- addAssociated(sb);
- try {
- changeData.getCompareType().getHandler().appendTransactionInfoHtml(sb, changeData);
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- sb.append("</p>");
- sb.append("</form>");
- return sb.toString();
- }
-
- private void addInterpretation(StringBuilder sb) {
- sb.append("<b>Description: </b> ");
- try {
- sb.append(changeData.getCompareType().getHandler().getScenarioDescriptionHtml(changeData));
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- sb.append(changeData.getCompareType().getHandler().getActionDescription());
- }
- sb.append("");
- }
-
- private void addAssociated(StringBuilder sb) {
- String message = "";
- Artifact associatedArtifact = changeData.getAssociatedArtifact();
- if (associatedArtifact != null) {
- message = AXml.textToXml(associatedArtifact.getName());
- } else {
- message = "Unkown";
- }
- sb.append(String.format("<b>Associated With: </b> %s<br/>", message));
- }
-
- public static void addTransactionInfo(StringBuilder sb, TransactionRecord transaction) {
- String author = "Unknown";
- try {
- User user = UserManager.getUserByArtId(transaction.getAuthor());
- author = user.toString();
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- DateFormat dateFormat = SimpleDateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG);
- sb.append(String.format(" <b>On: </b> %s<br/>", dateFormat.format(transaction.getTimeStamp())));
- sb.append(String.format(" <b>By: </b> %s<br/>", AXml.textToXml(author)));
- sb.append(String.format(" <b>Comment: </b> %s", AXml.textToXml(transaction.getComment())));
- }
-
- @Override
- public void onCreate(IManagedForm managedForm, Composite parent) {
- display.onCreate(managedForm, parent);
- }
-}
+
+public class ChangeReportInfoPresenter implements EditorSection.IWidget {
+
+ private static final String LOADING = "<form><p vspace='false'><b>Loading ...</b></p></form>";
+ private static final String NO_CHANGES_FOUND = "<b>No changes were found</b><br/>";
+
+ public static interface Display {
+ void setImage(KeyedImage image);
+
+ void setText(String value);
+
+ void onCreate(IManagedForm managedForm, Composite parent);
+ }
+
+ private final Display display;
+ private final ChangeUiData changeData;
+
+ public ChangeReportInfoPresenter(Display display, ChangeUiData changeData) {
+ this.display = display;
+ this.changeData = changeData;
+ }
+
+ public void onLoading() {
+ display.setImage(FrameworkImage.DELTAS);
+ display.setText(LOADING);
+ }
+
+ public void onUpdate() {
+ display.setImage(getKeyedImage());
+ display.setText(createInfoPage());
+ }
+
+ private KeyedImage getKeyedImage() {
+ KeyedImage imageKey = FrameworkImage.DELTAS;
+ if (changeData.areBranchesValid()) {
+ imageKey = changeData.getCompareType().getHandler().getScenarioImage(changeData);
+ }
+ return imageKey;
+ }
+
+ public String createInfoPage() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("<form>");
+ sb.append("<p>");
+ if (!changeData.isLoaded()) {
+ sb.append("<b>Cleared on shut down. Press refresh to reload</b><br/><br/>");
+ }
+ addInterpretation(sb);
+
+ if (!changeData.areBranchesValid()) {
+ sb.append("<br/><b>The branch has been updated from parent and cannot be refreshed.</b><br/>");
+ sb.append("<b>Please close down and re-open this change report</b>");
+ } else {
+ sb.append("<br/>");
+ if (changeData.isLoaded() && changeData.getChanges().isEmpty()) {
+ sb.append(NO_CHANGES_FOUND);
+ sb.append("<br/>");
+ }
+ sb.append("<br/>");
+ addAssociated(sb);
+ try {
+ changeData.getCompareType().getHandler().appendTransactionInfoHtml(sb, changeData);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ sb.append("</p>");
+ sb.append("</form>");
+ return sb.toString();
+ }
+
+ private void addInterpretation(StringBuilder sb) {
+ sb.append("<b>Description: </b> ");
+ try {
+ sb.append(changeData.getCompareType().getHandler().getScenarioDescriptionHtml(changeData));
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ sb.append(changeData.getCompareType().getHandler().getActionDescription());
+ }
+ sb.append("");
+ }
+
+ private void addAssociated(StringBuilder sb) {
+ String message = "";
+ Artifact associatedArtifact = changeData.getAssociatedArtifact();
+ if (associatedArtifact != null) {
+ message = AXml.textToXml(associatedArtifact.getName());
+ } else {
+ message = "Unkown";
+ }
+ sb.append(String.format("<b>Associated With: </b> %s<br/>", message));
+ }
+
+ public static void addTransactionInfo(StringBuilder sb, TransactionRecord transaction) {
+ String author = "Unknown";
+ try {
+ User user = UserManager.getUserByArtId(transaction.getAuthor());
+ author = user.toString();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ DateFormat dateFormat = SimpleDateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG);
+ sb.append(String.format(" <b>On: </b> %s<br/>", dateFormat.format(transaction.getTimeStamp())));
+ sb.append(String.format(" <b>By: </b> %s<br/>", AXml.textToXml(author)));
+ sb.append(String.format(" <b>Comment: </b> %s", AXml.textToXml(transaction.getComment())));
+ }
+
+ @Override
+ public void onCreate(IManagedForm managedForm, Composite parent) {
+ display.onCreate(managedForm, parent);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/CurrentsAgainstOtherHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/CurrentsAgainstOtherHandler.java
index 199d74e6fe1..bd72d0d8dd5 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/CurrentsAgainstOtherHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/CurrentsAgainstOtherHandler.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change.presenter;
-
+package org.eclipse.osee.framework.ui.skynet.change.presenter;
+
import java.util.logging.Level;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.TransactionDelta;
@@ -19,73 +19,73 @@ import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
import org.eclipse.osee.framework.ui.skynet.change.ChangeUiData;
import org.eclipse.osee.framework.ui.swt.KeyedImage;
-
-public final class CurrentsAgainstOtherHandler implements IChangeReportUiHandler {
-
- @Override
- public String getActionName() {
- return "Open changes between the branch and the lastest changes from another branch";
- }
-
- @Override
- public String getActionDescription() {
- return "Computes changes between a child branch and its parent branch. If a merge branch exists, its changes are included as part of the child branch.";
- }
-
- @Override
- public String getName(TransactionDelta txDelta) {
- String branchName;
- try {
- branchName = txDelta.getStartTx().getBranch().getShortName();
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex.toString(), ex);
- branchName = "Unknown";
- }
- return String.format("%s - Compared to Other Branch", branchName);
- }
-
- @Override
- public KeyedImage getActionImage() {
- return FrameworkImage.COMPARE_PARENT_BRANCH;
- }
-
- @Override
- public KeyedImage getScenarioImage(ChangeUiData changeUiData) {
- KeyedImage imageKey = FrameworkImage.DELTAS;
- if (changeUiData.isMergeBranchValid()) {
- imageKey = FrameworkImage.DELTAS_DIFFERENT_BRANCHES_WITH_MERGE;
- } else {
- imageKey = FrameworkImage.DELTAS_DIFFERENT_BRANCHES;
- }
- return imageKey;
- }
-
- @Override
- public String getScenarioDescriptionHtml(ChangeUiData changeUiData) throws OseeCoreException {
- TransactionDelta txDelta = changeUiData.getTxDelta();
- String data;
- if (changeUiData.isMergeBranchValid()) {
- data =
- String.format(
- "Shows all changes made to [<b>%s</b>], including changes found in the merge branch compared to branch [<b>%s</b>].",
- AXml.textToXml(txDelta.getStartTx().getBranch().getName()),
- AXml.textToXml(txDelta.getEndTx().getBranch().getName()));
- } else {
- data =
- String.format("Shows all changes made to [<b>%s</b>] compared to branch [<b>%s</b>].",
- AXml.textToXml(txDelta.getStartTx().getBranch().getName()),
- AXml.textToXml(txDelta.getEndTx().getBranch().getName()));
- }
- return data;
- }
-
- @Override
- public void appendTransactionInfoHtml(StringBuilder sb, ChangeUiData changeUiData) throws OseeCoreException {
- TransactionDelta txDelta = changeUiData.getTxDelta();
- sb.append("<b>Branch 1 Last Modified</b>:<br/>");
- ChangeReportInfoPresenter.addTransactionInfo(sb, txDelta.getStartTx());
- sb.append("<br/><br/>");
- sb.append("<b>Branch 2 Last Modified: </b><br/>");
- ChangeReportInfoPresenter.addTransactionInfo(sb, txDelta.getEndTx());
- }
+
+public final class CurrentsAgainstOtherHandler implements IChangeReportUiHandler {
+
+ @Override
+ public String getActionName() {
+ return "Open changes between the branch and the lastest changes from another branch";
+ }
+
+ @Override
+ public String getActionDescription() {
+ return "Computes changes between a child branch and its parent branch. If a merge branch exists, its changes are included as part of the child branch.";
+ }
+
+ @Override
+ public String getName(TransactionDelta txDelta) {
+ String branchName;
+ try {
+ branchName = txDelta.getStartTx().getBranch().getShortName();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex.toString(), ex);
+ branchName = "Unknown";
+ }
+ return String.format("%s - Compared to Other Branch", branchName);
+ }
+
+ @Override
+ public KeyedImage getActionImage() {
+ return FrameworkImage.COMPARE_PARENT_BRANCH;
+ }
+
+ @Override
+ public KeyedImage getScenarioImage(ChangeUiData changeUiData) {
+ KeyedImage imageKey = FrameworkImage.DELTAS;
+ if (changeUiData.isMergeBranchValid()) {
+ imageKey = FrameworkImage.DELTAS_DIFFERENT_BRANCHES_WITH_MERGE;
+ } else {
+ imageKey = FrameworkImage.DELTAS_DIFFERENT_BRANCHES;
+ }
+ return imageKey;
+ }
+
+ @Override
+ public String getScenarioDescriptionHtml(ChangeUiData changeUiData) throws OseeCoreException {
+ TransactionDelta txDelta = changeUiData.getTxDelta();
+ String data;
+ if (changeUiData.isMergeBranchValid()) {
+ data =
+ String.format(
+ "Shows all changes made to [<b>%s</b>], including changes found in the merge branch compared to branch [<b>%s</b>].",
+ AXml.textToXml(txDelta.getStartTx().getBranch().getName()),
+ AXml.textToXml(txDelta.getEndTx().getBranch().getName()));
+ } else {
+ data =
+ String.format("Shows all changes made to [<b>%s</b>] compared to branch [<b>%s</b>].",
+ AXml.textToXml(txDelta.getStartTx().getBranch().getName()),
+ AXml.textToXml(txDelta.getEndTx().getBranch().getName()));
+ }
+ return data;
+ }
+
+ @Override
+ public void appendTransactionInfoHtml(StringBuilder sb, ChangeUiData changeUiData) throws OseeCoreException {
+ TransactionDelta txDelta = changeUiData.getTxDelta();
+ sb.append("<b>Branch 1 Last Modified</b>:<br/>");
+ ChangeReportInfoPresenter.addTransactionInfo(sb, txDelta.getStartTx());
+ sb.append("<br/><br/>");
+ sb.append("<b>Branch 2 Last Modified: </b><br/>");
+ ChangeReportInfoPresenter.addTransactionInfo(sb, txDelta.getEndTx());
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/CurrentsAgainstParentHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/CurrentsAgainstParentHandler.java
index 4e648d36a78..ce5a3a8aaae 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/CurrentsAgainstParentHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/CurrentsAgainstParentHandler.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change.presenter;
-
+package org.eclipse.osee.framework.ui.skynet.change.presenter;
+
import java.util.logging.Level;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.TransactionDelta;
@@ -19,73 +19,73 @@ import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
import org.eclipse.osee.framework.ui.skynet.change.ChangeUiData;
import org.eclipse.osee.framework.ui.swt.KeyedImage;
-
-public final class CurrentsAgainstParentHandler implements IChangeReportUiHandler {
-
- @Override
- public String getActionName() {
- return "Open changes between the branch and the lastest changes from its parent branch";
- }
-
- @Override
- public String getActionDescription() {
- return "Computes changes between a child branch and its parent branch. If a merge branch exists, its changes are included as part of the child branch.";
- }
-
- @Override
- public String getName(TransactionDelta txDelta) {
- String branchName;
- try {
- branchName = txDelta.getStartTx().getBranch().getShortName();
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex.toString(), ex);
- branchName = "Unknown";
- }
- return String.format("%s - Compared to Parent Branch", branchName);
- }
-
- @Override
- public KeyedImage getActionImage() {
- return FrameworkImage.COMPARE_PARENT_BRANCH;
- }
-
- @Override
- public KeyedImage getScenarioImage(ChangeUiData changeUiData) {
- KeyedImage imageKey = FrameworkImage.DELTAS;
- if (changeUiData.isMergeBranchValid()) {
- imageKey = FrameworkImage.DELTAS_DIFFERENT_BRANCHES_WITH_MERGE;
- } else {
- imageKey = FrameworkImage.DELTAS_DIFFERENT_BRANCHES;
- }
- return imageKey;
- }
-
- @Override
- public String getScenarioDescriptionHtml(ChangeUiData changeUiData) throws OseeCoreException {
- TransactionDelta txDelta = changeUiData.getTxDelta();
- String data;
- if (changeUiData.isMergeBranchValid()) {
- data =
- String.format(
- "Shows all changes made to [<b>%s</b>], including changes found in the merge branch compared to%s branch [<b>%s</b>].",
- AXml.textToXml(txDelta.getStartTx().getBranch().getName()), " its parent",
- AXml.textToXml(txDelta.getEndTx().getBranch().getName()));
- } else {
- data =
- String.format("Shows all changes made to [<b>%s</b>] compared to%s branch [<b>%s</b>].",
- AXml.textToXml(txDelta.getStartTx().getBranch().getName()), " its parent",
- AXml.textToXml(txDelta.getEndTx().getBranch().getName()));
- }
- return data;
- }
-
- @Override
- public void appendTransactionInfoHtml(StringBuilder sb, ChangeUiData changeUiData) throws OseeCoreException {
- TransactionDelta txDelta = changeUiData.getTxDelta();
- sb.append("<b>Working Branch Last Modified</b>:<br/>");
- ChangeReportInfoPresenter.addTransactionInfo(sb, txDelta.getStartTx());
- sb.append("<br/><br/>");
- sb.append("<b>Parent Branch Last Modified: </b><br/>");
- ChangeReportInfoPresenter.addTransactionInfo(sb, txDelta.getEndTx());
- }
+
+public final class CurrentsAgainstParentHandler implements IChangeReportUiHandler {
+
+ @Override
+ public String getActionName() {
+ return "Open changes between the branch and the lastest changes from its parent branch";
+ }
+
+ @Override
+ public String getActionDescription() {
+ return "Computes changes between a child branch and its parent branch. If a merge branch exists, its changes are included as part of the child branch.";
+ }
+
+ @Override
+ public String getName(TransactionDelta txDelta) {
+ String branchName;
+ try {
+ branchName = txDelta.getStartTx().getBranch().getShortName();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex.toString(), ex);
+ branchName = "Unknown";
+ }
+ return String.format("%s - Compared to Parent Branch", branchName);
+ }
+
+ @Override
+ public KeyedImage getActionImage() {
+ return FrameworkImage.COMPARE_PARENT_BRANCH;
+ }
+
+ @Override
+ public KeyedImage getScenarioImage(ChangeUiData changeUiData) {
+ KeyedImage imageKey = FrameworkImage.DELTAS;
+ if (changeUiData.isMergeBranchValid()) {
+ imageKey = FrameworkImage.DELTAS_DIFFERENT_BRANCHES_WITH_MERGE;
+ } else {
+ imageKey = FrameworkImage.DELTAS_DIFFERENT_BRANCHES;
+ }
+ return imageKey;
+ }
+
+ @Override
+ public String getScenarioDescriptionHtml(ChangeUiData changeUiData) throws OseeCoreException {
+ TransactionDelta txDelta = changeUiData.getTxDelta();
+ String data;
+ if (changeUiData.isMergeBranchValid()) {
+ data =
+ String.format(
+ "Shows all changes made to [<b>%s</b>], including changes found in the merge branch compared to%s branch [<b>%s</b>].",
+ AXml.textToXml(txDelta.getStartTx().getBranch().getName()), " its parent",
+ AXml.textToXml(txDelta.getEndTx().getBranch().getName()));
+ } else {
+ data =
+ String.format("Shows all changes made to [<b>%s</b>] compared to%s branch [<b>%s</b>].",
+ AXml.textToXml(txDelta.getStartTx().getBranch().getName()), " its parent",
+ AXml.textToXml(txDelta.getEndTx().getBranch().getName()));
+ }
+ return data;
+ }
+
+ @Override
+ public void appendTransactionInfoHtml(StringBuilder sb, ChangeUiData changeUiData) throws OseeCoreException {
+ TransactionDelta txDelta = changeUiData.getTxDelta();
+ sb.append("<b>Working Branch Last Modified</b>:<br/>");
+ ChangeReportInfoPresenter.addTransactionInfo(sb, txDelta.getStartTx());
+ sb.append("<br/><br/>");
+ sb.append("<b>Parent Branch Last Modified: </b><br/>");
+ ChangeReportInfoPresenter.addTransactionInfo(sb, txDelta.getEndTx());
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/IChangeReportUiHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/IChangeReportUiHandler.java
index 5ac9c32a3b7..9d231f52ba5 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/IChangeReportUiHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/IChangeReportUiHandler.java
@@ -8,27 +8,27 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change.presenter;
-
+package org.eclipse.osee.framework.ui.skynet.change.presenter;
+
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.TransactionDelta;
import org.eclipse.osee.framework.ui.skynet.change.ChangeUiData;
import org.eclipse.osee.framework.ui.swt.KeyedImage;
-
-public interface IChangeReportUiHandler {
-
- public KeyedImage getActionImage();
-
- public String getActionName();
-
- public KeyedImage getScenarioImage(ChangeUiData changeUiData);
-
- public String getScenarioDescriptionHtml(ChangeUiData changeUiData) throws OseeCoreException;
-
- public String getActionDescription();
-
- public String getName(TransactionDelta txDelta);
-
- public void appendTransactionInfoHtml(StringBuilder sb, ChangeUiData changeUiData) throws OseeCoreException;
-
-}
+
+public interface IChangeReportUiHandler {
+
+ public KeyedImage getActionImage();
+
+ public String getActionName();
+
+ public KeyedImage getScenarioImage(ChangeUiData changeUiData);
+
+ public String getScenarioDescriptionHtml(ChangeUiData changeUiData) throws OseeCoreException;
+
+ public String getActionDescription();
+
+ public String getName(TransactionDelta txDelta);
+
+ public void appendTransactionInfoHtml(StringBuilder sb, ChangeUiData changeUiData) throws OseeCoreException;
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/SpecificTxsHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/SpecificTxsHandler.java
index 14568cdf9ba..8adc4022d63 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/SpecificTxsHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/presenter/SpecificTxsHandler.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change.presenter;
-
+package org.eclipse.osee.framework.ui.skynet.change.presenter;
+
import java.text.NumberFormat;
import java.util.logging.Level;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
@@ -20,64 +20,64 @@ import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
import org.eclipse.osee.framework.ui.skynet.change.ChangeUiData;
import org.eclipse.osee.framework.ui.swt.KeyedImage;
-
-public final class SpecificTxsHandler implements IChangeReportUiHandler {
-
- @Override
- public String getActionName() {
- return "Compare two transactions on a branch";
- }
-
- @Override
- public String getActionDescription() {
- return "Compares two specific transactions on a branch.";
- }
-
- @Override
- public String getName(TransactionDelta txDelta) {
- String branchName;
- try {
- branchName = txDelta.getEndTx().getBranch().getShortName();
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex.toString(), ex);
- branchName = "Unknown";
- }
- String toReturn;
- if (txDelta.getEndTx().getComment() != null) {
- toReturn = String.format(" - %s", txDelta.getEndTx().getComment());
- } else {
- toReturn = String.format("%s - Transactions", branchName);
- }
- return toReturn;
- }
-
- @Override
- public KeyedImage getActionImage() {
- return FrameworkImage.BRANCH_CHANGE;
- }
-
- @Override
- public KeyedImage getScenarioImage(ChangeUiData changeUiData) {
- return FrameworkImage.DELTAS_TXS_SAME_BRANCH;
- }
-
- @Override
- public String getScenarioDescriptionHtml(ChangeUiData changeUiData) throws OseeCoreException {
- TransactionDelta txDelta = changeUiData.getTxDelta();
- NumberFormat formatter = NumberFormat.getInstance();
- return String.format("Shows changes made to [<b>%s</b>] between transactions [<b>%s</b>] and [<b>%s</b>].",
- AXml.textToXml(txDelta.getStartTx().getBranch().getName()),
- AXml.textToXml(formatter.format(txDelta.getStartTx().getId())),
- AXml.textToXml(formatter.format(txDelta.getEndTx().getId())));
- }
-
- @Override
- public void appendTransactionInfoHtml(StringBuilder sb, ChangeUiData changeUiData) throws OseeCoreException {
- TransactionDelta txDelta = changeUiData.getTxDelta();
- // sb.append("<b>Branch 1 Last Modified</b>:<br/>");
- // ChangeReportInfoPresenter.addTransactionInfo(sb, txDelta.getStartTx());
- // sb.append("<br/><br/>");
- sb.append("<b>Committed: </b><br/>");
- ChangeReportInfoPresenter.addTransactionInfo(sb, txDelta.getEndTx());
- }
+
+public final class SpecificTxsHandler implements IChangeReportUiHandler {
+
+ @Override
+ public String getActionName() {
+ return "Compare two transactions on a branch";
+ }
+
+ @Override
+ public String getActionDescription() {
+ return "Compares two specific transactions on a branch.";
+ }
+
+ @Override
+ public String getName(TransactionDelta txDelta) {
+ String branchName;
+ try {
+ branchName = txDelta.getEndTx().getBranch().getShortName();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex.toString(), ex);
+ branchName = "Unknown";
+ }
+ String toReturn;
+ if (txDelta.getEndTx().getComment() != null) {
+ toReturn = String.format(" - %s", txDelta.getEndTx().getComment());
+ } else {
+ toReturn = String.format("%s - Transactions", branchName);
+ }
+ return toReturn;
+ }
+
+ @Override
+ public KeyedImage getActionImage() {
+ return FrameworkImage.BRANCH_CHANGE;
+ }
+
+ @Override
+ public KeyedImage getScenarioImage(ChangeUiData changeUiData) {
+ return FrameworkImage.DELTAS_TXS_SAME_BRANCH;
+ }
+
+ @Override
+ public String getScenarioDescriptionHtml(ChangeUiData changeUiData) throws OseeCoreException {
+ TransactionDelta txDelta = changeUiData.getTxDelta();
+ NumberFormat formatter = NumberFormat.getInstance();
+ return String.format("Shows changes made to [<b>%s</b>] between transactions [<b>%s</b>] and [<b>%s</b>].",
+ AXml.textToXml(txDelta.getStartTx().getBranch().getName()),
+ AXml.textToXml(formatter.format(txDelta.getStartTx().getId())),
+ AXml.textToXml(formatter.format(txDelta.getEndTx().getId())));
+ }
+
+ @Override
+ public void appendTransactionInfoHtml(StringBuilder sb, ChangeUiData changeUiData) throws OseeCoreException {
+ TransactionDelta txDelta = changeUiData.getTxDelta();
+ // sb.append("<b>Branch 1 Last Modified</b>:<br/>");
+ // ChangeReportInfoPresenter.addTransactionInfo(sb, txDelta.getStartTx());
+ // sb.append("<br/><br/>");
+ sb.append("<b>Committed: </b><br/>");
+ ChangeReportInfoPresenter.addTransactionInfo(sb, txDelta.getEndTx());
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/view/ChangeReportInfo.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/view/ChangeReportInfo.java
index 22a905fb46c..40c75bae1c9 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/view/ChangeReportInfo.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/view/ChangeReportInfo.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change.view;
-
+package org.eclipse.osee.framework.ui.skynet.change.view;
+
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.ui.skynet.change.presenter.ChangeReportInfoPresenter;
import org.eclipse.osee.framework.ui.swt.ALayout;
@@ -24,59 +24,59 @@ import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.widgets.FormText;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
-
-public class ChangeReportInfo implements ChangeReportInfoPresenter.Display {
-
- private FormText formText;
- private Label label;
- private ScrolledForm form;
-
- public ChangeReportInfo() {
- }
-
- @Override
- public void onCreate(IManagedForm managedForm, Composite parent) {
- FormToolkit toolkit = managedForm.getToolkit();
- form = managedForm.getForm();
- form.getBody().setLayout(new GridLayout());
- form.getBody().setBackground(parent.getBackground());
-
- Composite composite = toolkit.createComposite(parent, SWT.WRAP);
- composite.setLayout(ALayout.getZeroMarginLayout(2, false));
- GridData gd = new GridData(SWT.FILL, SWT.TOP, true, false);
- gd.widthHint = 200;
- composite.setLayoutData(gd);
-
- label = toolkit.createLabel(composite, "", SWT.NONE);
- label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false));
-
- formText = toolkit.createFormText(composite, true);
- gd = new GridData(SWT.FILL, SWT.TOP, true, false);
- gd.widthHint = 200;
- formText.setLayoutData(gd);
- formText.layout();
- toolkit.paintBordersFor(form.getBody());
- }
-
- @Override
- public void setImage(KeyedImage imageKey) {
- label.setImage(ImageManager.getImage(imageKey));
- }
-
- @Override
- public void setText(String value) {
- String data = value;
- try {
- formText.setText(data, true, true);
- } catch (Exception ex) {
- data = ex.toString();
- formText.setText(data, false, false);
- }
- int size = Strings.isValid(data) ? data.split("<br/>").length : 0;
- // FormText doesn't size correctly, so determine it's height
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.heightHint = 8 * (2 + size);
- formText.setLayoutData(gridData);
- }
-
-}
+
+public class ChangeReportInfo implements ChangeReportInfoPresenter.Display {
+
+ private FormText formText;
+ private Label label;
+ private ScrolledForm form;
+
+ public ChangeReportInfo() {
+ }
+
+ @Override
+ public void onCreate(IManagedForm managedForm, Composite parent) {
+ FormToolkit toolkit = managedForm.getToolkit();
+ form = managedForm.getForm();
+ form.getBody().setLayout(new GridLayout());
+ form.getBody().setBackground(parent.getBackground());
+
+ Composite composite = toolkit.createComposite(parent, SWT.WRAP);
+ composite.setLayout(ALayout.getZeroMarginLayout(2, false));
+ GridData gd = new GridData(SWT.FILL, SWT.TOP, true, false);
+ gd.widthHint = 200;
+ composite.setLayoutData(gd);
+
+ label = toolkit.createLabel(composite, "", SWT.NONE);
+ label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false));
+
+ formText = toolkit.createFormText(composite, true);
+ gd = new GridData(SWT.FILL, SWT.TOP, true, false);
+ gd.widthHint = 200;
+ formText.setLayoutData(gd);
+ formText.layout();
+ toolkit.paintBordersFor(form.getBody());
+ }
+
+ @Override
+ public void setImage(KeyedImage imageKey) {
+ label.setImage(ImageManager.getImage(imageKey));
+ }
+
+ @Override
+ public void setText(String value) {
+ String data = value;
+ try {
+ formText.setText(data, true, true);
+ } catch (Exception ex) {
+ data = ex.toString();
+ formText.setText(data, false, false);
+ }
+ int size = Strings.isValid(data) ? data.split("<br/>").length : 0;
+ // FormText doesn't size correctly, so determine it's height
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.heightHint = 8 * (2 + size);
+ formText.setLayoutData(gridData);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/view/ChangeReportTable.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/view/ChangeReportTable.java
index 73809880c33..8dd6968b060 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/view/ChangeReportTable.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/view/ChangeReportTable.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change.view;
-
+package org.eclipse.osee.framework.ui.skynet.change.view;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -35,118 +35,118 @@ import org.eclipse.swt.widgets.Tree;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
-
-public class ChangeReportTable implements EditorSection.IWidget {
-
- private ChangeXViewer xChangeViewer;
- private final ChangeUiData changeData;
- private int defaultTableHeightHint = 100;
- private final int paddedTableHeightHint = 2;
-
- public ChangeReportTable(ChangeUiData changeData) {
- this.changeData = changeData;
- }
-
- public ChangeXViewer getXViewer() {
- return xChangeViewer;
- }
-
- @Override
- public void onCreate(IManagedForm managedForm, Composite parent) {
- FormToolkit toolkit = managedForm.getToolkit();
- ScrolledForm form = managedForm.getForm();
- form.getBody().setLayout(new GridLayout());
- form.getBody().setBackground(parent.getBackground());
-
- Composite composite = toolkit.createComposite(parent, SWT.BORDER);
-
- GridLayout layout = new GridLayout();
- layout.marginBottom = 5;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
- gd.widthHint = 300;
- composite.setLayoutData(gd);
- toolkit.paintBordersFor(composite);
-
- int viewerStyle = SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION;
- xChangeViewer = new ChangeXViewer(composite, viewerStyle, new ChangeXViewerFactory());
- xChangeViewer.setContentProvider(new XChangeContentProvider());
- xChangeViewer.setLabelProvider(new XChangeLabelProvider(xChangeViewer));
-
- Tree tree = xChangeViewer.getTree();
- GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- gridData.heightHint = defaultTableHeightHint;
- tree.setLayout(ALayout.getZeroMarginLayout());
- tree.setLayoutData(gridData);
- tree.setHeaderVisible(true);
- tree.setLinesVisible(true);
-
- adaptAll(toolkit, composite);
-
- new ChangeDragAndDrop(tree, ChangeXViewerFactory.NAMESPACE);
- onUpdate();
- }
-
- private void adaptAll(FormToolkit toolkit, Composite composite) {
- toolkit.adapt(composite);
- for (Control control : composite.getChildren()) {
- if (Widgets.isAccessible(control)) {
- toolkit.adapt(control, false, false);
- if (control instanceof Composite) {
- adaptAll(toolkit, (Composite) control);
- }
- }
- }
- }
-
- @Override
- public void onLoading() {
- xChangeViewer.setInput(Arrays.asList("Loading..."));
- }
-
- @Override
- public void onUpdate() {
- Collection<?> input;
- if (changeData.isLoaded()) {
- input = changeData.getChanges();
- } else {
- input = Arrays.asList("Not Loaded");
- }
- xChangeViewer.setInput(input);
- }
-
- private final class ChangeDragAndDrop extends SkynetDragAndDrop {
-
- public ChangeDragAndDrop(Tree tree, String viewId) {
- super(tree, viewId);
- }
-
- @Override
- public void performDragOver(DropTargetEvent event) {
- event.detail = DND.DROP_NONE;
- }
-
- @Override
- public Artifact[] getArtifacts() {
- IStructuredSelection selection = (IStructuredSelection) xChangeViewer.getSelection();
- ArrayList<Artifact> artifacts = new ArrayList<Artifact>();
-
- if (selection != null && !selection.isEmpty()) {
- for (Object object : selection.toArray()) {
-
- if (object instanceof IAdaptable) {
- Artifact artifact = (Artifact) ((IAdaptable) object).getAdapter(Artifact.class);
-
- if (artifact != null) {
- artifacts.add(artifact);
- }
- }
- }
- }
- return artifacts.toArray(new Artifact[artifacts.size()]);
- }
- }
-
-}
+
+public class ChangeReportTable implements EditorSection.IWidget {
+
+ private ChangeXViewer xChangeViewer;
+ private final ChangeUiData changeData;
+ private int defaultTableHeightHint = 100;
+ private final int paddedTableHeightHint = 2;
+
+ public ChangeReportTable(ChangeUiData changeData) {
+ this.changeData = changeData;
+ }
+
+ public ChangeXViewer getXViewer() {
+ return xChangeViewer;
+ }
+
+ @Override
+ public void onCreate(IManagedForm managedForm, Composite parent) {
+ FormToolkit toolkit = managedForm.getToolkit();
+ ScrolledForm form = managedForm.getForm();
+ form.getBody().setLayout(new GridLayout());
+ form.getBody().setBackground(parent.getBackground());
+
+ Composite composite = toolkit.createComposite(parent, SWT.BORDER);
+
+ GridLayout layout = new GridLayout();
+ layout.marginBottom = 5;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ composite.setLayout(layout);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gd.widthHint = 300;
+ composite.setLayoutData(gd);
+ toolkit.paintBordersFor(composite);
+
+ int viewerStyle = SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION;
+ xChangeViewer = new ChangeXViewer(composite, viewerStyle, new ChangeXViewerFactory());
+ xChangeViewer.setContentProvider(new XChangeContentProvider());
+ xChangeViewer.setLabelProvider(new XChangeLabelProvider(xChangeViewer));
+
+ Tree tree = xChangeViewer.getTree();
+ GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gridData.heightHint = defaultTableHeightHint;
+ tree.setLayout(ALayout.getZeroMarginLayout());
+ tree.setLayoutData(gridData);
+ tree.setHeaderVisible(true);
+ tree.setLinesVisible(true);
+
+ adaptAll(toolkit, composite);
+
+ new ChangeDragAndDrop(tree, ChangeXViewerFactory.NAMESPACE);
+ onUpdate();
+ }
+
+ private void adaptAll(FormToolkit toolkit, Composite composite) {
+ toolkit.adapt(composite);
+ for (Control control : composite.getChildren()) {
+ if (Widgets.isAccessible(control)) {
+ toolkit.adapt(control, false, false);
+ if (control instanceof Composite) {
+ adaptAll(toolkit, (Composite) control);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onLoading() {
+ xChangeViewer.setInput(Arrays.asList("Loading..."));
+ }
+
+ @Override
+ public void onUpdate() {
+ Collection<?> input;
+ if (changeData.isLoaded()) {
+ input = changeData.getChanges();
+ } else {
+ input = Arrays.asList("Not Loaded");
+ }
+ xChangeViewer.setInput(input);
+ }
+
+ private final class ChangeDragAndDrop extends SkynetDragAndDrop {
+
+ public ChangeDragAndDrop(Tree tree, String viewId) {
+ super(tree, viewId);
+ }
+
+ @Override
+ public void performDragOver(DropTargetEvent event) {
+ event.detail = DND.DROP_NONE;
+ }
+
+ @Override
+ public Artifact[] getArtifacts() {
+ IStructuredSelection selection = (IStructuredSelection) xChangeViewer.getSelection();
+ ArrayList<Artifact> artifacts = new ArrayList<Artifact>();
+
+ if (selection != null && !selection.isEmpty()) {
+ for (Object object : selection.toArray()) {
+
+ if (object instanceof IAdaptable) {
+ Artifact artifact = (Artifact) ((IAdaptable) object).getAdapter(Artifact.class);
+
+ if (artifact != null) {
+ artifacts.add(artifact);
+ }
+ }
+ }
+ }
+ return artifacts.toArray(new Artifact[artifacts.size()]);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/view/EditorSection.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/view/EditorSection.java
index d9c696d698e..c1a37d58c60 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/view/EditorSection.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/change/view/EditorSection.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.change.view;
-
+package org.eclipse.osee.framework.ui.skynet.change.view;
+
import org.eclipse.osee.framework.ui.swt.Widgets;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@@ -20,73 +20,73 @@ import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.SectionPart;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
-
-public class EditorSection extends SectionPart {
-
- public static interface IWidget {
- public void onUpdate();
-
- public void onCreate(IManagedForm form, Composite parent);
-
- public void onLoading();
- }
-
- private final IWidget widget;
- private final String sectionTitle;
- private final boolean spanVertically;
-
- public EditorSection(IWidget widget, String sectionTitle, Composite parent, FormToolkit toolkit, int style, boolean spanVertically) {
- super(parent, toolkit, style);
- this.widget = widget;
- this.sectionTitle = sectionTitle;
- this.spanVertically = spanVertically;
- }
-
- @Override
- public void initialize(IManagedForm form) {
- super.initialize(form);
- Section section = getSection();
- section.setText(sectionTitle);
- section.setLayout(new GridLayout());
- section.setLayoutData(new GridData(SWT.FILL, spanVertically ? SWT.FILL : SWT.TOP, true, spanVertically));
- updateDataPart(true);
- }
-
- private void updateDataPart(boolean isCreate) {
- final IManagedForm form = getManagedForm();
- if (isCreate) {
- final FormToolkit toolkit = form.getToolkit();
- final Section section = getSection();
-
- Control control = section.getClient();
- if (Widgets.isAccessible(control)) {
- control.dispose();
- }
- Composite sectionBody = toolkit.createComposite(section, toolkit.getBorderStyle());
- sectionBody.setLayout(new GridLayout());
- sectionBody.setLayoutData(new GridData(SWT.FILL, spanVertically ? SWT.FILL : SWT.TOP, true, spanVertically));
-
- widget.onCreate(getManagedForm(), sectionBody);
-
- section.setClient(sectionBody);
- toolkit.paintBordersFor(section);
-
- section.layout(true);
- } else {
- widget.onUpdate();
- }
- form.getForm().getBody().layout(true);
- }
-
- @Override
- public void dispose() {
- super.dispose();
- }
-
- @Override
- public void refresh() {
- super.refresh();
- updateDataPart(false);
- }
-
-}
+
+public class EditorSection extends SectionPart {
+
+ public static interface IWidget {
+ public void onUpdate();
+
+ public void onCreate(IManagedForm form, Composite parent);
+
+ public void onLoading();
+ }
+
+ private final IWidget widget;
+ private final String sectionTitle;
+ private final boolean spanVertically;
+
+ public EditorSection(IWidget widget, String sectionTitle, Composite parent, FormToolkit toolkit, int style, boolean spanVertically) {
+ super(parent, toolkit, style);
+ this.widget = widget;
+ this.sectionTitle = sectionTitle;
+ this.spanVertically = spanVertically;
+ }
+
+ @Override
+ public void initialize(IManagedForm form) {
+ super.initialize(form);
+ Section section = getSection();
+ section.setText(sectionTitle);
+ section.setLayout(new GridLayout());
+ section.setLayoutData(new GridData(SWT.FILL, spanVertically ? SWT.FILL : SWT.TOP, true, spanVertically));
+ updateDataPart(true);
+ }
+
+ private void updateDataPart(boolean isCreate) {
+ final IManagedForm form = getManagedForm();
+ if (isCreate) {
+ final FormToolkit toolkit = form.getToolkit();
+ final Section section = getSection();
+
+ Control control = section.getClient();
+ if (Widgets.isAccessible(control)) {
+ control.dispose();
+ }
+ Composite sectionBody = toolkit.createComposite(section, toolkit.getBorderStyle());
+ sectionBody.setLayout(new GridLayout());
+ sectionBody.setLayoutData(new GridData(SWT.FILL, spanVertically ? SWT.FILL : SWT.TOP, true, spanVertically));
+
+ widget.onCreate(getManagedForm(), sectionBody);
+
+ section.setClient(sectionBody);
+ toolkit.paintBordersFor(section);
+
+ section.layout(true);
+ } else {
+ widget.onUpdate();
+ }
+ form.getForm().getBody().layout(true);
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ }
+
+ @Override
+ public void refresh() {
+ super.refresh();
+ updateDataPart(false);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/AbstractSelectionChangedHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/AbstractSelectionChangedHandler.java
index bff6c26f22d..b80ffe66cf4 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/AbstractSelectionChangedHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/AbstractSelectionChangedHandler.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.HandlerEvent;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.swt.events.MenuDetectEvent;
-import org.eclipse.swt.events.MenuDetectListener;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Paul K. Waldfogel
- * @author Jeff C. Phillips
- */
-public abstract class AbstractSelectionChangedHandler extends AbstractHandler {
- private final HandlerEvent enabledChangedEvent = new HandlerEvent(this, true, false);
- private ViewerMenuDetectListener viewerMenuDetectListener;
-
- public AbstractSelectionChangedHandler() {
- addlistener();
- }
- private class ViewerMenuDetectListener implements MenuDetectListener {
- public void menuDetected(MenuDetectEvent e) {
- fireHandlerChanged(enabledChangedEvent);
- }
- }
-
- private void addlistener() {
- if (!PlatformUI.getWorkbench().isClosing()) {
- viewerMenuDetectListener = new ViewerMenuDetectListener();
- IWorkbenchPart workbenchPart = AWorkbench.getActivePage()
- .getActivePart();
- Object object = workbenchPart.getSite().getSelectionProvider();
-
- if (object instanceof Viewer) {
- ((Viewer) object).getControl().addMenuDetectListener(
- viewerMenuDetectListener);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.HandlerEvent;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.swt.events.MenuDetectEvent;
+import org.eclipse.swt.events.MenuDetectListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Paul K. Waldfogel
+ * @author Jeff C. Phillips
+ */
+public abstract class AbstractSelectionChangedHandler extends AbstractHandler {
+ private final HandlerEvent enabledChangedEvent = new HandlerEvent(this, true, false);
+ private ViewerMenuDetectListener viewerMenuDetectListener;
+
+ public AbstractSelectionChangedHandler() {
+ addlistener();
+ }
+ private class ViewerMenuDetectListener implements MenuDetectListener {
+ public void menuDetected(MenuDetectEvent e) {
+ fireHandlerChanged(enabledChangedEvent);
+ }
+ }
+
+ private void addlistener() {
+ if (!PlatformUI.getWorkbench().isClosing()) {
+ viewerMenuDetectListener = new ViewerMenuDetectListener();
+ IWorkbenchPart workbenchPart = AWorkbench.getActivePage()
+ .getActivePart();
+ Object object = workbenchPart.getSite().getSelectionProvider();
+
+ if (object instanceof Viewer) {
+ ((Viewer) object).getControl().addMenuDetectListener(
+ viewerMenuDetectListener);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/AccessControlHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/AccessControlHandler.java
index 80b89c0096a..bee9deb8384 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/AccessControlHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/AccessControlHandler.java
@@ -1,64 +1,64 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers;
-
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.access.PolicyDialog;
-import org.eclipse.osee.framework.ui.swt.Displays;
-
-/**
- * @author Jeff C. Phillips
- */
-public class AccessControlHandler extends CommandHandler {
- private Object object;
-
- @Override
- public Object execute(ExecutionEvent arg0) throws ExecutionException {
- try {
- PolicyDialog pd = new PolicyDialog(Displays.getActiveShell(), object);
- pd.open();
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
-
- return null;
- }
-
- @Override
- public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- List<Branch> branches = Handlers.getBranchesFromStructuredSelection(structuredSelection);
- List<Artifact> artifacts = Handlers.getArtifactsFromStructuredSelection(structuredSelection);
-
- boolean hasArtifacts = artifacts.size() == 1;
- boolean enabled = hasArtifacts || (branches.size() == 1);
-
- if (enabled) {
- object = hasArtifacts ? artifacts.iterator().next() : branches.iterator().next();
- enabled &=
- (AccessControlManager.isOseeAdmin() || AccessControlManager.hasPermission(object,
- PermissionEnum.FULLACCESS));
- }
-
- return 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.framework.ui.skynet.commandHandlers;
+
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.access.PolicyDialog;
+import org.eclipse.osee.framework.ui.swt.Displays;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class AccessControlHandler extends CommandHandler {
+ private Object object;
+
+ @Override
+ public Object execute(ExecutionEvent arg0) throws ExecutionException {
+ try {
+ PolicyDialog pd = new PolicyDialog(Displays.getActiveShell(), object);
+ pd.open();
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+
+ return null;
+ }
+
+ @Override
+ public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
+ List<Branch> branches = Handlers.getBranchesFromStructuredSelection(structuredSelection);
+ List<Artifact> artifacts = Handlers.getArtifactsFromStructuredSelection(structuredSelection);
+
+ boolean hasArtifacts = artifacts.size() == 1;
+ boolean enabled = hasArtifacts || (branches.size() == 1);
+
+ if (enabled) {
+ object = hasArtifacts ? artifacts.iterator().next() : branches.iterator().next();
+ enabled &=
+ (AccessControlManager.isOseeAdmin() || AccessControlManager.hasPermission(object,
+ PermissionEnum.FULLACCESS));
+ }
+
+ return enabled;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ChangeReportHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ChangeReportHandler.java
index 2149e05fd9c..1f60c5e612c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ChangeReportHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ChangeReportHandler.java
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.commandHandlers;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-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.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.change.ChangeUiUtil;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Jeff C. Phillips
- */
-public class ChangeReportHandler extends AbstractHandler {
-
- @Override
- public Object execute(ExecutionEvent arg0) throws ExecutionException {
- IStructuredSelection selection =
- (IStructuredSelection) AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider().getSelection();
- if (!selection.isEmpty()) {
- Object selectedObject = selection.getFirstElement();
- try {
- if (selectedObject instanceof TransactionRecord) {
- ChangeUiUtil.open((TransactionRecord) selectedObject);
- } else if (selectedObject instanceof Branch) {
- ChangeUiUtil.open((Branch) selectedObject);
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- return null;
- }
-
- @Override
- public boolean isEnabled() {
- if (PlatformUI.getWorkbench().isClosing()) {
- return false;
- }
- boolean enabled = false;
-
- IStructuredSelection selection =
- (IStructuredSelection) AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider().getSelection();
- if (!selection.isEmpty()) {
- Object selectedObject = selection.getFirstElement();
-
- if (selectedObject instanceof TransactionRecord) {
- enabled = ((TransactionRecord) selectedObject).getTxType() != TransactionDetailsType.Baselined;
- } else if (selectedObject instanceof Branch) {
- enabled = true;
- }
- }
-
- return 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.framework.ui.skynet.commandHandlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+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.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.change.ChangeUiUtil;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class ChangeReportHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent arg0) throws ExecutionException {
+ IStructuredSelection selection =
+ (IStructuredSelection) AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider().getSelection();
+ if (!selection.isEmpty()) {
+ Object selectedObject = selection.getFirstElement();
+ try {
+ if (selectedObject instanceof TransactionRecord) {
+ ChangeUiUtil.open((TransactionRecord) selectedObject);
+ } else if (selectedObject instanceof Branch) {
+ ChangeUiUtil.open((Branch) selectedObject);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ if (PlatformUI.getWorkbench().isClosing()) {
+ return false;
+ }
+ boolean enabled = false;
+
+ IStructuredSelection selection =
+ (IStructuredSelection) AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider().getSelection();
+ if (!selection.isEmpty()) {
+ Object selectedObject = selection.getFirstElement();
+
+ if (selectedObject instanceof TransactionRecord) {
+ enabled = ((TransactionRecord) selectedObject).getTxType() != TransactionDetailsType.Baselined;
+ } else if (selectedObject instanceof Branch) {
+ enabled = true;
+ }
+ }
+
+ return enabled;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/CollapseTreeHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/CollapseTreeHandler.java
index d48ca041266..98ee718e0a6 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/CollapseTreeHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/CollapseTreeHandler.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.framework.ui.skynet.commandHandlers;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Theron Virgin
- */
-public class CollapseTreeHandler extends AbstractHandler {
- private TreeViewer treeViewer;
-
- @Override
- public Object execute(ExecutionEvent arg0) throws ExecutionException {
- treeViewer.collapseAll();
- return null;
- }
-
- @Override
- public boolean isEnabled() {
- if (PlatformUI.getWorkbench().isClosing()) {
- return false;
- }
- ISelectionProvider selectionProvider =
- AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
- treeViewer = selectionProvider instanceof TreeViewer ? (TreeViewer) selectionProvider : null;
-
- return treeViewer != 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.framework.ui.skynet.commandHandlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Theron Virgin
+ */
+public class CollapseTreeHandler extends AbstractHandler {
+ private TreeViewer treeViewer;
+
+ @Override
+ public Object execute(ExecutionEvent arg0) throws ExecutionException {
+ treeViewer.collapseAll();
+ return null;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ if (PlatformUI.getWorkbench().isClosing()) {
+ return false;
+ }
+ ISelectionProvider selectionProvider =
+ AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
+ treeViewer = selectionProvider instanceof TreeViewer ? (TreeViewer) selectionProvider : null;
+
+ return treeViewer != null;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/CompressWordAttributesHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/CompressWordAttributesHandler.java
index b365dd2faa2..57949569e93 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/CompressWordAttributesHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/CompressWordAttributesHandler.java
@@ -1,109 +1,109 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers;
-
-import java.util.List;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-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.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-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.word.WordUtil;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Paul K. Waldfogel
- */
-public class CompressWordAttributesHandler extends AbstractHandler {
- private List<Artifact> artifacts;
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- Jobs.startJob(new Job("Compress Word Attributes") {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- int count = 0;
- final int total = artifacts.size();
-
- monitor.beginTask("Analyzing attributes", total);
-
- for (Artifact artifact : artifacts) {
- if (WordUtil.revertNonusefulWordChanges(artifact.getArtId(), artifact.getBranch(),
- "osee_compression_gammas")) count++;
- monitor.worked(1);
- if (monitor.isCanceled()) {
- monitor.done();
- return Status.CANCEL_STATUS;
- }
- }
-
- final int finalCount = count;
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Compression Data", finalCount + " of the " + total + " artifacts need compression");
- }
- });
-
- monitor.done();
- return Status.OK_STATUS;
- } catch (Exception ex) {
- return new Status(Status.ERROR, SkynetGuiPlugin.PLUGIN_ID, Status.OK, ex.getLocalizedMessage(), ex);
- }
- }
-
- });
- return null;
- }
-
- @Override
- public boolean isEnabled() {
- boolean enabled = false;
- if (PlatformUI.getWorkbench().isClosing()) {
- return false;
- }
- try {
- ISelectionProvider selectionProvider =
- AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
-
- if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
- artifacts = Handlers.getArtifactsFromStructuredSelection(structuredSelection);
-
- if (!artifacts.isEmpty()) {
- boolean writePermission =
- AccessControlManager.hasPermission(artifacts.get(0), PermissionEnum.WRITE);
- enabled = writePermission && AccessControlManager.isOseeAdmin();
- }
- }
- } catch (Exception ex) {
- OseeLog.log(getClass(), OseeLevel.SEVERE_POPUP, ex);
- enabled = false;
- }
- return 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.framework.ui.skynet.commandHandlers;
+
+import java.util.List;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+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.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
+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.word.WordUtil;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Paul K. Waldfogel
+ */
+public class CompressWordAttributesHandler extends AbstractHandler {
+ private List<Artifact> artifacts;
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ Jobs.startJob(new Job("Compress Word Attributes") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ int count = 0;
+ final int total = artifacts.size();
+
+ monitor.beginTask("Analyzing attributes", total);
+
+ for (Artifact artifact : artifacts) {
+ if (WordUtil.revertNonusefulWordChanges(artifact.getArtId(), artifact.getBranch(),
+ "osee_compression_gammas")) count++;
+ monitor.worked(1);
+ if (monitor.isCanceled()) {
+ monitor.done();
+ return Status.CANCEL_STATUS;
+ }
+ }
+
+ final int finalCount = count;
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ "Compression Data", finalCount + " of the " + total + " artifacts need compression");
+ }
+ });
+
+ monitor.done();
+ return Status.OK_STATUS;
+ } catch (Exception ex) {
+ return new Status(Status.ERROR, SkynetGuiPlugin.PLUGIN_ID, Status.OK, ex.getLocalizedMessage(), ex);
+ }
+ }
+
+ });
+ return null;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ boolean enabled = false;
+ if (PlatformUI.getWorkbench().isClosing()) {
+ return false;
+ }
+ try {
+ ISelectionProvider selectionProvider =
+ AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
+
+ if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
+ artifacts = Handlers.getArtifactsFromStructuredSelection(structuredSelection);
+
+ if (!artifacts.isEmpty()) {
+ boolean writePermission =
+ AccessControlManager.hasPermission(artifacts.get(0), PermissionEnum.WRITE);
+ enabled = writePermission && AccessControlManager.isOseeAdmin();
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(getClass(), OseeLevel.SEVERE_POPUP, ex);
+ enabled = false;
+ }
+ return enabled;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/CopyHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/CopyHandler.java
index 9a707f78475..40195e8a1c6 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/CopyHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/CopyHandler.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.framework.ui.skynet.commandHandlers;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.util.ArtifactClipboard;
-import org.eclipse.search.ui.text.Match;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * @author Jeff C. Phillips
- */
-public class CopyHandler extends AbstractHandler {
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- if (HandlerUtil.getActivePartChecked(event) instanceof ViewPart) {
- ViewPart view = (ViewPart) HandlerUtil.getActivePartChecked(event);
- IWorkbenchPartSite myIWorkbenchPartSite = view.getSite();
- ISelectionProvider selectionProvider = myIWorkbenchPartSite.getSelectionProvider();
-
- if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
- IStructuredSelection selection = (IStructuredSelection) selectionProvider.getSelection();
-
- List<String> names = new LinkedList<String>();
- List<Artifact> artifacts = new LinkedList<Artifact>();
- ArtifactClipboard clipboard = new ArtifactClipboard(view.getSite().getId());
- Iterator<?> iterator = selection.iterator();
- Object selectionObject = null;
-
- while (iterator.hasNext()) {
- Object object = iterator.next();
-
- if (object instanceof IAdaptable) {
- selectionObject = ((IAdaptable) object).getAdapter(Branch.class);
-
- if (selectionObject == null) {
- selectionObject = ((IAdaptable) object).getAdapter(Artifact.class);
- }
- } else if (object instanceof Match) {
- selectionObject = ((Match) object).getElement();
- }
-
- if (selectionObject instanceof Branch) {
- names.add(((Branch) selectionObject).getName());
- } else if (selectionObject instanceof Artifact) {
- Artifact artifact = (Artifact) selectionObject;
- names.add(artifact.getName());
- artifacts.add(artifact);
- }
- }
-
- if (!names.isEmpty() && artifacts.isEmpty()) {
- clipboard.setTextToClipboard(names);
- } else if (!names.isEmpty() && !artifacts.isEmpty()) {
- clipboard.setArtifactsToClipboard(artifacts, names);
- }
- }
- }
- return null;
- }
-
- @Override
- public boolean isHandled() {
- return true;
- }
-
- @Override
- public boolean isEnabled() {
- 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.framework.ui.skynet.commandHandlers;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.util.ArtifactClipboard;
+import org.eclipse.search.ui.text.Match;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class CopyHandler extends AbstractHandler {
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ if (HandlerUtil.getActivePartChecked(event) instanceof ViewPart) {
+ ViewPart view = (ViewPart) HandlerUtil.getActivePartChecked(event);
+ IWorkbenchPartSite myIWorkbenchPartSite = view.getSite();
+ ISelectionProvider selectionProvider = myIWorkbenchPartSite.getSelectionProvider();
+
+ if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) selectionProvider.getSelection();
+
+ List<String> names = new LinkedList<String>();
+ List<Artifact> artifacts = new LinkedList<Artifact>();
+ ArtifactClipboard clipboard = new ArtifactClipboard(view.getSite().getId());
+ Iterator<?> iterator = selection.iterator();
+ Object selectionObject = null;
+
+ while (iterator.hasNext()) {
+ Object object = iterator.next();
+
+ if (object instanceof IAdaptable) {
+ selectionObject = ((IAdaptable) object).getAdapter(Branch.class);
+
+ if (selectionObject == null) {
+ selectionObject = ((IAdaptable) object).getAdapter(Artifact.class);
+ }
+ } else if (object instanceof Match) {
+ selectionObject = ((Match) object).getElement();
+ }
+
+ if (selectionObject instanceof Branch) {
+ names.add(((Branch) selectionObject).getName());
+ } else if (selectionObject instanceof Artifact) {
+ Artifact artifact = (Artifact) selectionObject;
+ names.add(artifact.getName());
+ artifacts.add(artifact);
+ }
+ }
+
+ if (!names.isEmpty() && artifacts.isEmpty()) {
+ clipboard.setTextToClipboard(names);
+ } else if (!names.isEmpty() && !artifacts.isEmpty()) {
+ clipboard.setArtifactsToClipboard(artifacts, names);
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isHandled() {
+ return true;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/DeleteArtifactHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/DeleteArtifactHandler.java
index d357a73ece6..1b207049658 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/DeleteArtifactHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/DeleteArtifactHandler.java
@@ -1,64 +1,64 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers;
-
-import java.util.List;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-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.ArtifactPersistenceManager;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.swt.Displays;
-
-/**
- * @author Jeff C. Phillips
- */
-public class DeleteArtifactHandler extends CommandHandler {
- private List<Artifact> artifacts;
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- if (!artifacts.isEmpty()) {
- try {
- MessageDialog dialog =
- new MessageDialog(Displays.getActiveShell(), "Confirm Artifact Deletion", null,
- " Are you sure you want to delete this artifact and all of the default hierarchy children?",
- MessageDialog.QUESTION, new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL}, 1);
- if (dialog.open() == 0) {
- Artifact[] artifactsArray = artifacts.toArray(new Artifact[artifacts.size()]);
- SkynetTransaction transaction =
- new SkynetTransaction(artifactsArray[0].getBranch(), "Delete artifact handler");
- ArtifactPersistenceManager.deleteArtifact(transaction, false, artifactsArray);
- transaction.execute();
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- return null;
- }
-
- @Override
- public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- artifacts = Handlers.getArtifactsFromStructuredSelection(structuredSelection);
- return AccessControlManager.checkObjectListPermission(artifacts, PermissionEnum.WRITE);
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers;
+
+import java.util.List;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
+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.ArtifactPersistenceManager;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.swt.Displays;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class DeleteArtifactHandler extends CommandHandler {
+ private List<Artifact> artifacts;
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ if (!artifacts.isEmpty()) {
+ try {
+ MessageDialog dialog =
+ new MessageDialog(Displays.getActiveShell(), "Confirm Artifact Deletion", null,
+ " Are you sure you want to delete this artifact and all of the default hierarchy children?",
+ MessageDialog.QUESTION, new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL}, 1);
+ if (dialog.open() == 0) {
+ Artifact[] artifactsArray = artifacts.toArray(new Artifact[artifacts.size()]);
+ SkynetTransaction transaction =
+ new SkynetTransaction(artifactsArray[0].getBranch(), "Delete artifact handler");
+ ArtifactPersistenceManager.deleteArtifact(transaction, false, artifactsArray);
+ transaction.execute();
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
+ artifacts = Handlers.getArtifactsFromStructuredSelection(structuredSelection);
+ return AccessControlManager.checkObjectListPermission(artifacts, PermissionEnum.WRITE);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ExpandTreeHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ExpandTreeHandler.java
index 8601cf5fa71..478d6d2b3c4 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ExpandTreeHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ExpandTreeHandler.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.framework.ui.skynet.commandHandlers;
-
-import java.util.Iterator;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Theron Virgin
- */
-public class ExpandTreeHandler extends AbstractHandler {
- private TreeViewer treeViewer;
- private IStructuredSelection structuredSelection;
-
- @Override
- public Object execute(ExecutionEvent arg0) throws ExecutionException {
- Iterator<?> iter = structuredSelection.iterator();
- while (iter.hasNext()) {
- treeViewer.expandToLevel(iter.next(), TreeViewer.ALL_LEVELS);
- }
- return null;
- }
-
- @Override
- public boolean isEnabled() {
- if (PlatformUI.getWorkbench().isClosing()) {
- return false;
- }
- structuredSelection = null;
- ISelectionProvider selectionProvider =
- AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
- treeViewer = selectionProvider instanceof TreeViewer ? (TreeViewer) selectionProvider : null;
-
- if (treeViewer != null && treeViewer.getSelection() instanceof IStructuredSelection) {
- structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
- }
- return treeViewer != null && structuredSelection != 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.framework.ui.skynet.commandHandlers;
+
+import java.util.Iterator;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Theron Virgin
+ */
+public class ExpandTreeHandler extends AbstractHandler {
+ private TreeViewer treeViewer;
+ private IStructuredSelection structuredSelection;
+
+ @Override
+ public Object execute(ExecutionEvent arg0) throws ExecutionException {
+ Iterator<?> iter = structuredSelection.iterator();
+ while (iter.hasNext()) {
+ treeViewer.expandToLevel(iter.next(), TreeViewer.ALL_LEVELS);
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ if (PlatformUI.getWorkbench().isClosing()) {
+ return false;
+ }
+ structuredSelection = null;
+ ISelectionProvider selectionProvider =
+ AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
+ treeViewer = selectionProvider instanceof TreeViewer ? (TreeViewer) selectionProvider : null;
+
+ if (treeViewer != null && treeViewer.getSelection() instanceof IStructuredSelection) {
+ structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
+ }
+ return treeViewer != null && structuredSelection != null;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/Handlers.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/Handlers.java
index 8a6c83339bc..986ac9f9dba 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/Handlers.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/Handlers.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.framework.ui.skynet.commandHandlers;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.change.Change;
-import org.eclipse.search.ui.text.Match;
-
-/**
- * This is a utility class for OSEE handlers
- *
- * @author Jeff C. Phillips
- */
-public class Handlers {
-
- /**
- * Populates a list of ArtifactChange from a IStructuredSelection. Returns an empty list if no ArtifactChange were
- * found.
- *
- * @param selection
- */
- public static List<Change> getArtifactChangesFromStructuredSelection(IStructuredSelection structuredSelection) {
- return processSelectionObjects(Change.class, structuredSelection);
- }
-
- /**
- * Populates a list of TransactionIds from a IStructuredSelection. Returns an empty list if no TransactionIds were
- * found.
- *
- * @param selection
- */
- public static List<TransactionRecord> getTransactionsFromStructuredSelection(IStructuredSelection structuredSelection) {
- return processSelectionObjects(TransactionRecord.class, structuredSelection);
- }
-
- /**
- * Populates a list of branches from a IStructuredSelection. Returns an empty list if no branches were found.
- *
- * @param selection
- */
- public static List<Branch> getBranchesFromStructuredSelection(IStructuredSelection structuredSelection) {
- return processSelectionObjects(Branch.class, structuredSelection);
- }
-
- /**
- * Populates a list of artifacts from a IStructuredSelection. Returns an empty list if no artifacts were found.
- *
- * @param selection
- */
- public static List<Artifact> getArtifactsFromStructuredSelection(IStructuredSelection structuredSelection) {
- return processSelectionObjects(Artifact.class, structuredSelection);
- }
-
- /**
- * @param clazz
- * @param structuredSelection
- * @return Returns a list of objects from the sturctruedSelection that are an instance of the Class
- */
- public static <E> List<E> processSelectionObjects(Class<E> clazz, IStructuredSelection structuredSelection) {
- List<E> objects = new LinkedList<E>();
- Iterator<?> iterator = structuredSelection.iterator();
-
- while (iterator.hasNext()) {
- Object object = iterator.next();
- Object targetObject = null;
-
- if (object instanceof IAdaptable) {
- targetObject = ((IAdaptable) object).getAdapter(clazz);
- } else if (object instanceof Match) {
- targetObject = ((Match) object).getElement();
- }
-
- if (clazz.isInstance(targetObject)) {
- objects.add(clazz.cast(targetObject));
- }
- }
- return 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.framework.ui.skynet.commandHandlers;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.change.Change;
+import org.eclipse.search.ui.text.Match;
+
+/**
+ * This is a utility class for OSEE handlers
+ *
+ * @author Jeff C. Phillips
+ */
+public class Handlers {
+
+ /**
+ * Populates a list of ArtifactChange from a IStructuredSelection. Returns an empty list if no ArtifactChange were
+ * found.
+ *
+ * @param selection
+ */
+ public static List<Change> getArtifactChangesFromStructuredSelection(IStructuredSelection structuredSelection) {
+ return processSelectionObjects(Change.class, structuredSelection);
+ }
+
+ /**
+ * Populates a list of TransactionIds from a IStructuredSelection. Returns an empty list if no TransactionIds were
+ * found.
+ *
+ * @param selection
+ */
+ public static List<TransactionRecord> getTransactionsFromStructuredSelection(IStructuredSelection structuredSelection) {
+ return processSelectionObjects(TransactionRecord.class, structuredSelection);
+ }
+
+ /**
+ * Populates a list of branches from a IStructuredSelection. Returns an empty list if no branches were found.
+ *
+ * @param selection
+ */
+ public static List<Branch> getBranchesFromStructuredSelection(IStructuredSelection structuredSelection) {
+ return processSelectionObjects(Branch.class, structuredSelection);
+ }
+
+ /**
+ * Populates a list of artifacts from a IStructuredSelection. Returns an empty list if no artifacts were found.
+ *
+ * @param selection
+ */
+ public static List<Artifact> getArtifactsFromStructuredSelection(IStructuredSelection structuredSelection) {
+ return processSelectionObjects(Artifact.class, structuredSelection);
+ }
+
+ /**
+ * @param clazz
+ * @param structuredSelection
+ * @return Returns a list of objects from the sturctruedSelection that are an instance of the Class
+ */
+ public static <E> List<E> processSelectionObjects(Class<E> clazz, IStructuredSelection structuredSelection) {
+ List<E> objects = new LinkedList<E>();
+ Iterator<?> iterator = structuredSelection.iterator();
+
+ while (iterator.hasNext()) {
+ Object object = iterator.next();
+ Object targetObject = null;
+
+ if (object instanceof IAdaptable) {
+ targetObject = ((IAdaptable) object).getAdapter(clazz);
+ } else if (object instanceof Match) {
+ targetObject = ((Match) object).getElement();
+ }
+
+ if (clazz.isInstance(targetObject)) {
+ objects.add(clazz.cast(targetObject));
+ }
+ }
+ return objects;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/OpenArtifactExplorerHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/OpenArtifactExplorerHandler.java
index a332fa40609..178d80ee4de 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/OpenArtifactExplorerHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/OpenArtifactExplorerHandler.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.framework.ui.skynet.commandHandlers;
-
-import java.util.Collections;
-import java.util.List;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.ArtifactExplorer;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OpenArtifactExplorerHandler extends AbstractHandler {
-
- private List<Branch> getSelectedBranches() {
- ISelectionProvider selectionProvider =
- AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
-
- if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
- return Handlers.getBranchesFromStructuredSelection(structuredSelection);
- }
- return Collections.emptyList();
- }
-
- @Override
- public Object execute(ExecutionEvent arg0) throws ExecutionException {
- List<Branch> branches = getSelectedBranches();
- if (!branches.isEmpty()) {
- ArtifactExplorer.exploreBranch(branches.iterator().next());
- }
- return null;
- }
-
- @Override
- public boolean isEnabled() {
- return !getSelectedBranches().isEmpty();
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers;
+
+import java.util.Collections;
+import java.util.List;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.ArtifactExplorer;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OpenArtifactExplorerHandler extends AbstractHandler {
+
+ private List<Branch> getSelectedBranches() {
+ ISelectionProvider selectionProvider =
+ AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
+
+ if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
+ return Handlers.getBranchesFromStructuredSelection(structuredSelection);
+ }
+ return Collections.emptyList();
+ }
+
+ @Override
+ public Object execute(ExecutionEvent arg0) throws ExecutionException {
+ List<Branch> branches = getSelectedBranches();
+ if (!branches.isEmpty()) {
+ ArtifactExplorer.exploreBranch(branches.iterator().next());
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return !getSelectedBranches().isEmpty();
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/OpenMassArtifactEditorHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/OpenMassArtifactEditorHandler.java
index 107392542e4..facd8b26493 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/OpenMassArtifactEditorHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/OpenMassArtifactEditorHandler.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.framework.ui.skynet.commandHandlers;
-
-import java.util.List;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-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.CommandHandler;
-import org.eclipse.osee.framework.ui.skynet.artifact.massEditor.MassArtifactEditor;
-
-/**
- * @author Jeff C. Phillips
- */
-public class OpenMassArtifactEditorHandler extends CommandHandler {
- private List<Artifact> artifacts;
-
- @Override
- public Object execute(ExecutionEvent arg0) throws ExecutionException {
- MassArtifactEditor.editArtifacts("", artifacts);
- return null;
- }
-
- @Override
- public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- artifacts = Handlers.getArtifactsFromStructuredSelection(structuredSelection);
- return AccessControlManager.checkObjectListPermission(artifacts, PermissionEnum.WRITE);
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers;
+
+import java.util.List;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
+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.CommandHandler;
+import org.eclipse.osee.framework.ui.skynet.artifact.massEditor.MassArtifactEditor;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class OpenMassArtifactEditorHandler extends CommandHandler {
+ private List<Artifact> artifacts;
+
+ @Override
+ public Object execute(ExecutionEvent arg0) throws ExecutionException {
+ MassArtifactEditor.editArtifacts("", artifacts);
+ return null;
+ }
+
+ @Override
+ public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
+ artifacts = Handlers.getArtifactsFromStructuredSelection(structuredSelection);
+ return AccessControlManager.checkObjectListPermission(artifacts, PermissionEnum.WRITE);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/OpenSkywalkerEditorHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/OpenSkywalkerEditorHandler.java
index 817418e24ce..fb6c94ac63c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/OpenSkywalkerEditorHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/OpenSkywalkerEditorHandler.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.framework.ui.skynet.commandHandlers;
-
-import java.util.List;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-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.skywalker.SkyWalkerView;
-
-/**
- * @author Jeff C. Phillips
- */
-public class OpenSkywalkerEditorHandler extends AbstractHandler {
- @Override
- public Object execute(ExecutionEvent arg0) throws ExecutionException {
- ISelectionProvider selectionProvider =
- AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
-
- if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
- List<Artifact> artifacts = Handlers.getArtifactsFromStructuredSelection(structuredSelection);
-
- if (!artifacts.isEmpty()) {
- SkyWalkerView.exploreArtifact(artifacts.iterator().next());
- }
- }
- return null;
- }
-
- @Override
- public boolean isEnabled() {
- 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.framework.ui.skynet.commandHandlers;
+
+import java.util.List;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+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.skywalker.SkyWalkerView;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class OpenSkywalkerEditorHandler extends AbstractHandler {
+ @Override
+ public Object execute(ExecutionEvent arg0) throws ExecutionException {
+ ISelectionProvider selectionProvider =
+ AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
+
+ if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
+ List<Artifact> artifacts = Handlers.getArtifactsFromStructuredSelection(structuredSelection);
+
+ if (!artifacts.isEmpty()) {
+ SkyWalkerView.exploreArtifact(artifacts.iterator().next());
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/PasteHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/PasteHandler.java
index 74ac58db368..d8451225ac8 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/PasteHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/PasteHandler.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.framework.ui.skynet.commandHandlers;
-
-import java.util.Iterator;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.operation.Operations;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactNameConflictHandler;
-import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactPasteOperation;
-import org.eclipse.osee.framework.ui.skynet.util.ArtifactClipboard;
-import org.eclipse.osee.framework.ui.skynet.util.ArtifactPasteConfiguration;
-import org.eclipse.search.ui.text.Match;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * @author Theron Virgin
- */
-public class PasteHandler extends AbstractHandler {
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- if (HandlerUtil.getActivePartChecked(event) instanceof ViewPart) {
- ViewPart view = (ViewPart) HandlerUtil.getActivePartChecked(event);
- IWorkbenchPartSite myIWorkbenchPartSite = view.getSite();
- ISelectionProvider selectionProvider = myIWorkbenchPartSite.getSelectionProvider();
-
- if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
- IStructuredSelection selection = (IStructuredSelection) selectionProvider.getSelection();
-
- ArtifactClipboard clipboard = new ArtifactClipboard(view.getSite().getId());
- Iterator<?> iterator = selection.iterator();
- Object selectionObject = null;
-
- while (iterator.hasNext()) {
- Object object = iterator.next();
-
- if (object instanceof IAdaptable) {
- selectionObject = ((IAdaptable) object).getAdapter(Branch.class);
-
- if (selectionObject == null) {
- selectionObject = ((IAdaptable) object).getAdapter(Artifact.class);
- }
- } else if (object instanceof Match) {
- selectionObject = ((Match) object).getElement();
- }
-
- if (selectionObject instanceof Artifact) {
- ArtifactPasteConfiguration config = new ArtifactPasteConfiguration();
- Operations.executeAsJob(new ArtifactPasteOperation(config, (Artifact) selectionObject,
- clipboard.getCopiedContents(), new ArtifactNameConflictHandler()), true);
- }
- }
-
- }
- }
- return null;
- }
-
- @Override
- public boolean isHandled() {
- return true;
- }
-
- @Override
- public boolean isEnabled() {
- 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.framework.ui.skynet.commandHandlers;
+
+import java.util.Iterator;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.operation.Operations;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactNameConflictHandler;
+import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactPasteOperation;
+import org.eclipse.osee.framework.ui.skynet.util.ArtifactClipboard;
+import org.eclipse.osee.framework.ui.skynet.util.ArtifactPasteConfiguration;
+import org.eclipse.search.ui.text.Match;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * @author Theron Virgin
+ */
+public class PasteHandler extends AbstractHandler {
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ if (HandlerUtil.getActivePartChecked(event) instanceof ViewPart) {
+ ViewPart view = (ViewPart) HandlerUtil.getActivePartChecked(event);
+ IWorkbenchPartSite myIWorkbenchPartSite = view.getSite();
+ ISelectionProvider selectionProvider = myIWorkbenchPartSite.getSelectionProvider();
+
+ if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) selectionProvider.getSelection();
+
+ ArtifactClipboard clipboard = new ArtifactClipboard(view.getSite().getId());
+ Iterator<?> iterator = selection.iterator();
+ Object selectionObject = null;
+
+ while (iterator.hasNext()) {
+ Object object = iterator.next();
+
+ if (object instanceof IAdaptable) {
+ selectionObject = ((IAdaptable) object).getAdapter(Branch.class);
+
+ if (selectionObject == null) {
+ selectionObject = ((IAdaptable) object).getAdapter(Artifact.class);
+ }
+ } else if (object instanceof Match) {
+ selectionObject = ((Match) object).getElement();
+ }
+
+ if (selectionObject instanceof Artifact) {
+ ArtifactPasteConfiguration config = new ArtifactPasteConfiguration();
+ Operations.executeAsJob(new ArtifactPasteOperation(config, (Artifact) selectionObject,
+ clipboard.getCopiedContents(), new ArtifactNameConflictHandler()), true);
+ }
+ }
+
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isHandled() {
+ return true;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/PurgeArtifactHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/PurgeArtifactHandler.java
index 55efb63646f..4aaa99046db 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/PurgeArtifactHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/PurgeArtifactHandler.java
@@ -1,75 +1,75 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers;
-
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-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.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-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.PurgeArtifacts;
-import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Jeff C. Phillips
- */
-public class PurgeArtifactHandler extends CommandHandler {
- private List<Artifact> artifacts;
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- if (MessageDialog.openConfirm(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Confirm Artifact Purge ",
- " Are you sure you want to purge this artifact, all of " + "its children and all history associated with these artifacts from the database ?")) {
- Job job = new Job("Purge artifact") {
-
- @Override
- protected IStatus run(final IProgressMonitor monitor) {
- IStatus toReturn = Status.CANCEL_STATUS;
- monitor.beginTask("Purge artifact", artifacts.size());
- try {
- new PurgeArtifacts(artifacts).execute();
- toReturn = Status.OK_STATUS;
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- toReturn = new Status(Status.ERROR, SkynetGuiPlugin.PLUGIN_ID, -1, ex.getMessage(), ex);
- } finally {
- monitor.done();
- }
- return toReturn;
- }
- };
- Jobs.startJob(job);
- }
- return null;
- }
-
- @Override
- public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- artifacts = Handlers.getArtifactsFromStructuredSelection(structuredSelection);
- return AccessControlManager.isOseeAdmin() && AccessControlManager.checkObjectListPermission(artifacts,
- PermissionEnum.WRITE);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers;
+
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+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.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+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.PurgeArtifacts;
+import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class PurgeArtifactHandler extends CommandHandler {
+ private List<Artifact> artifacts;
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ if (MessageDialog.openConfirm(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ "Confirm Artifact Purge ",
+ " Are you sure you want to purge this artifact, all of " + "its children and all history associated with these artifacts from the database ?")) {
+ Job job = new Job("Purge artifact") {
+
+ @Override
+ protected IStatus run(final IProgressMonitor monitor) {
+ IStatus toReturn = Status.CANCEL_STATUS;
+ monitor.beginTask("Purge artifact", artifacts.size());
+ try {
+ new PurgeArtifacts(artifacts).execute();
+ toReturn = Status.OK_STATUS;
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ toReturn = new Status(Status.ERROR, SkynetGuiPlugin.PLUGIN_ID, -1, ex.getMessage(), ex);
+ } finally {
+ monitor.done();
+ }
+ return toReturn;
+ }
+ };
+ Jobs.startJob(job);
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
+ artifacts = Handlers.getArtifactsFromStructuredSelection(structuredSelection);
+ return AccessControlManager.isOseeAdmin() && AccessControlManager.checkObjectListPermission(artifacts,
+ PermissionEnum.WRITE);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/RevealInArtifactExplorer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/RevealInArtifactExplorer.java
index aadc038d315..deaa1cf9764 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/RevealInArtifactExplorer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/RevealInArtifactExplorer.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.framework.ui.skynet.commandHandlers;
-
-import java.util.List;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-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.ArtifactExplorer;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Jeff C. Phillips
- */
-public class RevealInArtifactExplorer extends AbstractHandler {
- private Artifact artifact;
-
- @Override
- public Object execute(ExecutionEvent arg0) throws ExecutionException {
- ArtifactExplorer.revealArtifact(artifact);
- return null;
- }
-
- @Override
- public boolean isEnabled() {
- boolean isEnabled = false;
-
- if (PlatformUI.getWorkbench().isClosing()) {
- return false;
- }
-
- ISelectionProvider selectionProvider =
- AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
-
- if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
- List<Artifact> artifacts = Handlers.getArtifactsFromStructuredSelection(structuredSelection);
-
- if (artifacts.isEmpty()) {
- return false;
- }
-
- artifact = artifacts.iterator().next();
- isEnabled = true;
- }
- return isEnabled;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.commandHandlers;
+
+import java.util.List;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+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.ArtifactExplorer;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class RevealInArtifactExplorer extends AbstractHandler {
+ private Artifact artifact;
+
+ @Override
+ public Object execute(ExecutionEvent arg0) throws ExecutionException {
+ ArtifactExplorer.revealArtifact(artifact);
+ return null;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ boolean isEnabled = false;
+
+ if (PlatformUI.getWorkbench().isClosing()) {
+ return false;
+ }
+
+ ISelectionProvider selectionProvider =
+ AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
+
+ if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
+ List<Artifact> artifacts = Handlers.getArtifactsFromStructuredSelection(structuredSelection);
+
+ if (artifacts.isEmpty()) {
+ return false;
+ }
+
+ artifact = artifacts.iterator().next();
+ isEnabled = true;
+ }
+ return isEnabled;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/RevertArtifactHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/RevertArtifactHandler.java
index fa11735eae0..a826e9372e9 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/RevertArtifactHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/RevertArtifactHandler.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.framework.ui.skynet.commandHandlers;
-
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.change.Change;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.revert.RevertWizard;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.NonmodalWizardDialog;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Paul K. Waldfogel
- * @author Jeff C. Phillips
- */
-public class RevertArtifactHandler extends AbstractHandler {
- private List<Change> changes;
-
- public RevertArtifactHandler() {
- }
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- // This is serious stuff, make sure the user understands the impact.
-
- List<List<Artifact>> artifacts = new LinkedList<List<Artifact>>();
- Set<Artifact> duplicateCheck = new HashSet<Artifact>();
-
- for (Change change : changes) {
- List<Artifact> artifactList = new LinkedList<Artifact>();
-
- Artifact changeArtifact = change.getChangeArtifact();
- if (!duplicateCheck.contains(changeArtifact)) {
- artifactList.add(changeArtifact);
- artifacts.add(artifactList);
- duplicateCheck.add(changeArtifact);
- }
-
- }
- RevertWizard wizard = new RevertWizard(artifacts);
- NonmodalWizardDialog dialog = new NonmodalWizardDialog(Displays.getActiveShell(), wizard);
- dialog.create();
- dialog.open();
- return null;
- }
-
- @Override
- public boolean isEnabled() {
- if (PlatformUI.getWorkbench().isClosing()) {
- return false;
- }
-
- boolean isEnabled = false;
- try {
- ISelectionProvider selectionProvider =
- AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
-
- if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
- changes = Handlers.getArtifactChangesFromStructuredSelection(structuredSelection);
-
- if (changes.isEmpty()) {
- return false;
- }
-
- for (Change change : changes) {
- isEnabled = AccessControlManager.hasPermission(change.getChangeArtifact(), PermissionEnum.WRITE);
- if (!isEnabled) {
- break;
- }
- }
- }
- } catch (Exception ex) {
- OseeLog.log(getClass(), Level.SEVERE, ex);
- return false;
- }
- return isEnabled;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers;
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.change.Change;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.revert.RevertWizard;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.NonmodalWizardDialog;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Paul K. Waldfogel
+ * @author Jeff C. Phillips
+ */
+public class RevertArtifactHandler extends AbstractHandler {
+ private List<Change> changes;
+
+ public RevertArtifactHandler() {
+ }
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ // This is serious stuff, make sure the user understands the impact.
+
+ List<List<Artifact>> artifacts = new LinkedList<List<Artifact>>();
+ Set<Artifact> duplicateCheck = new HashSet<Artifact>();
+
+ for (Change change : changes) {
+ List<Artifact> artifactList = new LinkedList<Artifact>();
+
+ Artifact changeArtifact = change.getChangeArtifact();
+ if (!duplicateCheck.contains(changeArtifact)) {
+ artifactList.add(changeArtifact);
+ artifacts.add(artifactList);
+ duplicateCheck.add(changeArtifact);
+ }
+
+ }
+ RevertWizard wizard = new RevertWizard(artifacts);
+ NonmodalWizardDialog dialog = new NonmodalWizardDialog(Displays.getActiveShell(), wizard);
+ dialog.create();
+ dialog.open();
+ return null;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ if (PlatformUI.getWorkbench().isClosing()) {
+ return false;
+ }
+
+ boolean isEnabled = false;
+ try {
+ ISelectionProvider selectionProvider =
+ AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
+
+ if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
+ changes = Handlers.getArtifactChangesFromStructuredSelection(structuredSelection);
+
+ if (changes.isEmpty()) {
+ return false;
+ }
+
+ for (Change change : changes) {
+ isEnabled = AccessControlManager.hasPermission(change.getChangeArtifact(), PermissionEnum.WRITE);
+ if (!isEnabled) {
+ break;
+ }
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(getClass(), Level.SEVERE, ex);
+ return false;
+ }
+ return isEnabled;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/RevertAttributeHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/RevertAttributeHandler.java
index aa0be60b8d8..d2eb5180871 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/RevertAttributeHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/RevertAttributeHandler.java
@@ -1,132 +1,132 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers;
-
-import java.util.List;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-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.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.database.core.DbTransaction;
-import org.eclipse.osee.framework.database.core.OseeConnection;
-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.ArtifactPersistenceManager;
-import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Jeff C. Phillips
- * @author Theron Virgin
- */
-public class RevertAttributeHandler extends AbstractHandler {
- private List<Attribute> attributes;
-
- public RevertAttributeHandler() {
- }
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- // This is serious stuff, make sure the user understands the impact.
- if (MessageDialog.openConfirm(
- Displays.getActiveShell(),
- "Confirm Revert of " + attributes.size() + " attributes.",
- "All attribute changes selected will be reverted." + "\n\nTHIS IS IRREVERSIBLE" + "\n\nOSEE must be restarted after all reverting is finished to see the results")) {
-
- Jobs.startJob(new RevertJob());
- }
- return null;
- }
- private class RevertJob extends Job {
-
- public RevertJob() {
- super("Reverting " + attributes.size() + " attributes.");
- }
-
- @Override
- protected IStatus run(final IProgressMonitor monitor) {
- IStatus toReturn;
- try {
- monitor.beginTask("Reverting ...", attributes.size());
-
- DbTransaction dbTransaction = new DbTransaction() {
- @Override
- protected void handleTxWork(OseeConnection connection) throws OseeCoreException {
- for (Attribute<?> attribute : attributes) {
- monitor.setTaskName(attribute.getArtifact().getName() + " : " + attribute.getDisplayableString());
- ArtifactPersistenceManager.revertAttribute(connection, attribute);
- monitor.worked(1);
- }
- }
- };
- dbTransaction.execute();
-
- toReturn = Status.OK_STATUS;
- } catch (Exception ex) {
- toReturn = new Status(Status.ERROR, SkynetGuiPlugin.PLUGIN_ID, -1, ex.getMessage(), ex);
- } finally {
- monitor.done();
- }
- return toReturn;
- }
- }
-
- @Override
- public boolean isEnabled() {
- if (PlatformUI.getWorkbench().isClosing()) {
- return false;
- }
-
- boolean isEnabled = false;
- try {
- ISelectionProvider selectionProvider =
- AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
-
- if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
- List<Attribute> changes = Handlers.processSelectionObjects(Attribute.class, structuredSelection);
-
- if (changes.isEmpty()) {
- return false;
- }
-
- this.attributes = changes;
-
- for (Attribute<?> attribute : attributes) {
- if (attributes == null) {
-
- }
- isEnabled = AccessControlManager.hasPermission(attribute.getArtifact(), PermissionEnum.WRITE);
- if (!isEnabled) {
- break;
- }
- }
- }
- } catch (Exception ex) {
- OseeLog.log(getClass(), OseeLevel.SEVERE_POPUP, ex);
- return false;
- }
- return isEnabled;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers;
+
+import java.util.List;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+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.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.database.core.DbTransaction;
+import org.eclipse.osee.framework.database.core.OseeConnection;
+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.ArtifactPersistenceManager;
+import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Jeff C. Phillips
+ * @author Theron Virgin
+ */
+public class RevertAttributeHandler extends AbstractHandler {
+ private List<Attribute> attributes;
+
+ public RevertAttributeHandler() {
+ }
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ // This is serious stuff, make sure the user understands the impact.
+ if (MessageDialog.openConfirm(
+ Displays.getActiveShell(),
+ "Confirm Revert of " + attributes.size() + " attributes.",
+ "All attribute changes selected will be reverted." + "\n\nTHIS IS IRREVERSIBLE" + "\n\nOSEE must be restarted after all reverting is finished to see the results")) {
+
+ Jobs.startJob(new RevertJob());
+ }
+ return null;
+ }
+ private class RevertJob extends Job {
+
+ public RevertJob() {
+ super("Reverting " + attributes.size() + " attributes.");
+ }
+
+ @Override
+ protected IStatus run(final IProgressMonitor monitor) {
+ IStatus toReturn;
+ try {
+ monitor.beginTask("Reverting ...", attributes.size());
+
+ DbTransaction dbTransaction = new DbTransaction() {
+ @Override
+ protected void handleTxWork(OseeConnection connection) throws OseeCoreException {
+ for (Attribute<?> attribute : attributes) {
+ monitor.setTaskName(attribute.getArtifact().getName() + " : " + attribute.getDisplayableString());
+ ArtifactPersistenceManager.revertAttribute(connection, attribute);
+ monitor.worked(1);
+ }
+ }
+ };
+ dbTransaction.execute();
+
+ toReturn = Status.OK_STATUS;
+ } catch (Exception ex) {
+ toReturn = new Status(Status.ERROR, SkynetGuiPlugin.PLUGIN_ID, -1, ex.getMessage(), ex);
+ } finally {
+ monitor.done();
+ }
+ return toReturn;
+ }
+ }
+
+ @Override
+ public boolean isEnabled() {
+ if (PlatformUI.getWorkbench().isClosing()) {
+ return false;
+ }
+
+ boolean isEnabled = false;
+ try {
+ ISelectionProvider selectionProvider =
+ AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
+
+ if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
+ List<Attribute> changes = Handlers.processSelectionObjects(Attribute.class, structuredSelection);
+
+ if (changes.isEmpty()) {
+ return false;
+ }
+
+ this.attributes = changes;
+
+ for (Attribute<?> attribute : attributes) {
+ if (attributes == null) {
+
+ }
+ isEnabled = AccessControlManager.hasPermission(attribute.getArtifact(), PermissionEnum.WRITE);
+ if (!isEnabled) {
+ break;
+ }
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(getClass(), OseeLevel.SEVERE_POPUP, ex);
+ return false;
+ }
+ return isEnabled;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/RevertJob.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/RevertJob.java
index 446874714e7..447ac76face 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/RevertJob.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/RevertJob.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.framework.ui.skynet.commandHandlers;
-
-import java.util.List;
-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.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.database.core.DbTransaction;
-import org.eclipse.osee.framework.database.core.OseeConnection;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactPersistenceManager;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-
-public class RevertJob extends Job {
- private List<Artifact> artifacts;
-
- public RevertJob(List<Artifact> artifacts) {
- super("Reverting " + artifacts.size() + " artifacts.");
- this.artifacts = artifacts;
- }
-
- @Override
- protected IStatus run(final IProgressMonitor monitor) {
- IStatus toReturn;
- try {
- monitor.beginTask("Reverting ...", artifacts.size());
-
- DbTransaction dbTransaction = new DbTransaction() {
- @Override
- protected void handleTxWork(OseeConnection connection) throws OseeCoreException {
- for (Artifact artifact : artifacts) {
- monitor.setTaskName(artifact.getName());
- ArtifactPersistenceManager.revertArtifact(connection, artifact);
- monitor.worked(1);
- }
- }
- };
- dbTransaction.execute();
-
- toReturn = Status.OK_STATUS;
- } catch (Exception ex) {
- toReturn = new Status(Status.ERROR, SkynetGuiPlugin.PLUGIN_ID, -1, ex.getMessage(), ex);
- } finally {
- monitor.done();
- }
- 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.framework.ui.skynet.commandHandlers;
+
+import java.util.List;
+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.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.database.core.DbTransaction;
+import org.eclipse.osee.framework.database.core.OseeConnection;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactPersistenceManager;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+
+public class RevertJob extends Job {
+ private List<Artifact> artifacts;
+
+ public RevertJob(List<Artifact> artifacts) {
+ super("Reverting " + artifacts.size() + " artifacts.");
+ this.artifacts = artifacts;
+ }
+
+ @Override
+ protected IStatus run(final IProgressMonitor monitor) {
+ IStatus toReturn;
+ try {
+ monitor.beginTask("Reverting ...", artifacts.size());
+
+ DbTransaction dbTransaction = new DbTransaction() {
+ @Override
+ protected void handleTxWork(OseeConnection connection) throws OseeCoreException {
+ for (Artifact artifact : artifacts) {
+ monitor.setTaskName(artifact.getName());
+ ArtifactPersistenceManager.revertArtifact(connection, artifact);
+ monitor.worked(1);
+ }
+ }
+ };
+ dbTransaction.execute();
+
+ toReturn = Status.OK_STATUS;
+ } catch (Exception ex) {
+ toReturn = new Status(Status.ERROR, SkynetGuiPlugin.PLUGIN_ID, -1, ex.getMessage(), ex);
+ } finally {
+ monitor.done();
+ }
+ return toReturn;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ShowArtifactInResourceHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ShowArtifactInResourceHandler.java
index 5e12d234a8e..1e88cfc69af 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ShowArtifactInResourceHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ShowArtifactInResourceHandler.java
@@ -1,60 +1,60 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers;
-
-import java.util.List;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-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.CommandHandler;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.widgets.xHistory.HistoryView;
-
-/**
- * @author Jeff C. Phillips
- */
-public class ShowArtifactInResourceHandler extends CommandHandler {
- private List<Artifact> artifacts;
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- for (Artifact artifact : artifacts) {
- try {
- HistoryView.open(artifact);
-
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- return null;
- }
-
- @Override
- public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- artifacts = Handlers.getArtifactsFromStructuredSelection(structuredSelection);
-
- if (artifacts.isEmpty()) {
- return false;
- }
-
- boolean readPermission = true;
- for (Artifact artifact : artifacts) {
- readPermission &= AccessControlManager.hasPermission(artifact, PermissionEnum.READ);
- }
- return readPermission;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers;
+
+import java.util.List;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
+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.CommandHandler;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.widgets.xHistory.HistoryView;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class ShowArtifactInResourceHandler extends CommandHandler {
+ private List<Artifact> artifacts;
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ for (Artifact artifact : artifacts) {
+ try {
+ HistoryView.open(artifact);
+
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
+ artifacts = Handlers.getArtifactsFromStructuredSelection(structuredSelection);
+
+ if (artifacts.isEmpty()) {
+ return false;
+ }
+
+ boolean readPermission = true;
+ for (Artifact artifact : artifacts) {
+ readPermission &= AccessControlManager.hasPermission(artifact, PermissionEnum.READ);
+ }
+ return readPermission;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ShowPreviewHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ShowPreviewHandler.java
index 4502abafba5..51dfe5af095 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ShowPreviewHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ShowPreviewHandler.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.framework.ui.skynet.commandHandlers;
-
-import java.util.List;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-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.change.Change;
-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;
-
-/**
- * @author Paul K. Waldfogel
- */
-public class ShowPreviewHandler extends AbstractHandler {
- public ShowPreviewHandler() {
- }
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- 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.framework.ui.skynet.commandHandlers;
+
+import java.util.List;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+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.change.Change;
+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;
+
+/**
+ * @author Paul K. Waldfogel
+ */
+public class ShowPreviewHandler extends AbstractHandler {
+ public ShowPreviewHandler() {
+ }
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelectionProvider selectionProvider =
AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
-
- if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
-
- List<Change> mySelectedArtifactChangeList =
+
+ if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
+
+ List<Change> mySelectedArtifactChangeList =
Handlers.getArtifactChangesFromStructuredSelection(structuredSelection);
- for (Change mySelectedArtifactChange : mySelectedArtifactChangeList) {
- try {
- Artifact selectedArtifact = mySelectedArtifactChange.getChangeArtifact();
+ for (Change mySelectedArtifactChange : mySelectedArtifactChangeList) {
+ try {
+ Artifact selectedArtifact = mySelectedArtifactChange.getChangeArtifact();
RendererManager.open(selectedArtifact, PresentationType.GENERALIZED_EDIT);
- } catch (Exception ex) {
- OseeLog.log(getClass(), OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
- return null;
- }
-}
+ } catch (Exception ex) {
+ OseeLog.log(getClass(), OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ViewerReportHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ViewerReportHandler.java
index f0d76c1c6ff..835538a3254 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ViewerReportHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/ViewerReportHandler.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.framework.ui.skynet.commandHandlers;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.nebula.widgets.xviewer.XViewer;
-import org.eclipse.nebula.widgets.xviewer.XViewerTreeReport;
-import org.eclipse.osee.framework.ui.skynet.TableViewerReport;
-import org.eclipse.osee.framework.ui.skynet.TreeViewerReport;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * @author Jeff C. Phillips
- */
-public class ViewerReportHandler extends AbstractHandler {
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- if (HandlerUtil.getActivePartChecked(event) instanceof ViewPart) {
- ViewPart view = (ViewPart) HandlerUtil.getActivePartChecked(event);
- IWorkbenchPartSite myIWorkbenchPartSite = view.getSite();
- Object selectionProvider = myIWorkbenchPartSite.getSelectionProvider();
-
- if (selectionProvider instanceof XViewer) {
- (new XViewerTreeReport((XViewer) selectionProvider)).open();
- } else if (selectionProvider instanceof TableViewer) {
- (new TableViewerReport((TableViewer) selectionProvider)).open();
- } else if (selectionProvider instanceof TreeViewer) {
- (new TreeViewerReport((TreeViewer) selectionProvider)).open();
- }
- }
- 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.framework.ui.skynet.commandHandlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.nebula.widgets.xviewer.XViewer;
+import org.eclipse.nebula.widgets.xviewer.XViewerTreeReport;
+import org.eclipse.osee.framework.ui.skynet.TableViewerReport;
+import org.eclipse.osee.framework.ui.skynet.TreeViewerReport;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class ViewerReportHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ if (HandlerUtil.getActivePartChecked(event) instanceof ViewPart) {
+ ViewPart view = (ViewPart) HandlerUtil.getActivePartChecked(event);
+ IWorkbenchPartSite myIWorkbenchPartSite = view.getSite();
+ Object selectionProvider = myIWorkbenchPartSite.getSelectionProvider();
+
+ if (selectionProvider instanceof XViewer) {
+ (new XViewerTreeReport((XViewer) selectionProvider)).open();
+ } else if (selectionProvider instanceof TableViewer) {
+ (new TableViewerReport((TableViewer) selectionProvider)).open();
+ } else if (selectionProvider instanceof TreeViewer) {
+ (new TreeViewerReport((TreeViewer) selectionProvider)).open();
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ArchiveBranchCompoundContributionItem.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ArchiveBranchCompoundContributionItem.java
index 1b3d48600e7..f7339b966f0 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ArchiveBranchCompoundContributionItem.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ArchiveBranchCompoundContributionItem.java
@@ -1,97 +1,97 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers.branch;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.core.commands.Command;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.core.enums.BranchArchivedState;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.CompoundContributionItem;
-import org.eclipse.ui.commands.ICommandService;
-import org.eclipse.ui.menus.CommandContributionItem;
-import org.eclipse.ui.menus.CommandContributionItemParameter;
-
-/**
- * @author Jeff C. Phillips
- */
-public class ArchiveBranchCompoundContributionItem extends CompoundContributionItem {
- private ICommandService commandService;
-
- public ArchiveBranchCompoundContributionItem() {
- this.commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
- }
-
- public ArchiveBranchCompoundContributionItem(String id) {
- super(id);
- }
-
- @Override
- protected IContributionItem[] getContributionItems() {
- ISelectionProvider selectionProvider =
- AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
- ArrayList<IContributionItem> contributionItems = new ArrayList<IContributionItem>(40);
-
- if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
- List<Branch> branches = Handlers.getBranchesFromStructuredSelection(structuredSelection);
-
- if (!branches.isEmpty()) {
- Branch selectedBranch = branches.iterator().next();
- if (selectedBranch != null) {
- try {
- String commandId = "org.eclipse.osee.framework.ui.skynet.branch.BranchView.archiveBranch";
- Command command = commandService.getCommand(commandId);
- CommandContributionItem contributionItem = null;
- BranchArchivedState archivedState = selectedBranch.getArchiveState();
- String label = (archivedState.isArchived() ? "Unarchive" : "Archive") + " Branch(s)";
- ImageDescriptor descriptor =
- archivedState.isArchived() ? ImageManager.getImageDescriptor(FrameworkImage.UN_ARCHIVE) : ImageManager.getImageDescriptor(FrameworkImage.ARCHIVE);
- contributionItem = createCommand(label, selectedBranch, commandId, descriptor);
-
- if (command != null && command.isEnabled()) {
- contributionItems.add(contributionItem);
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- }
- }
- return contributionItems.toArray(new IContributionItem[0]);
- }
-
- private CommandContributionItem createCommand(String label, Branch branch, String commandId, ImageDescriptor descriptor) throws OseeCoreException {
- CommandContributionItem contributionItem;
-
- contributionItem =
- new CommandContributionItem(new CommandContributionItemParameter(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow(), label, commandId, Collections.EMPTY_MAP,
- descriptor, null, null, label, null, null, SWT.NONE, null, false));
-
- return contributionItem;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers.branch;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.core.commands.Command;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.core.enums.BranchArchivedState;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.CompoundContributionItem;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.menus.CommandContributionItem;
+import org.eclipse.ui.menus.CommandContributionItemParameter;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class ArchiveBranchCompoundContributionItem extends CompoundContributionItem {
+ private ICommandService commandService;
+
+ public ArchiveBranchCompoundContributionItem() {
+ this.commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
+ }
+
+ public ArchiveBranchCompoundContributionItem(String id) {
+ super(id);
+ }
+
+ @Override
+ protected IContributionItem[] getContributionItems() {
+ ISelectionProvider selectionProvider =
+ AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
+ ArrayList<IContributionItem> contributionItems = new ArrayList<IContributionItem>(40);
+
+ if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
+ List<Branch> branches = Handlers.getBranchesFromStructuredSelection(structuredSelection);
+
+ if (!branches.isEmpty()) {
+ Branch selectedBranch = branches.iterator().next();
+ if (selectedBranch != null) {
+ try {
+ String commandId = "org.eclipse.osee.framework.ui.skynet.branch.BranchView.archiveBranch";
+ Command command = commandService.getCommand(commandId);
+ CommandContributionItem contributionItem = null;
+ BranchArchivedState archivedState = selectedBranch.getArchiveState();
+ String label = (archivedState.isArchived() ? "Unarchive" : "Archive") + " Branch(s)";
+ ImageDescriptor descriptor =
+ archivedState.isArchived() ? ImageManager.getImageDescriptor(FrameworkImage.UN_ARCHIVE) : ImageManager.getImageDescriptor(FrameworkImage.ARCHIVE);
+ contributionItem = createCommand(label, selectedBranch, commandId, descriptor);
+
+ if (command != null && command.isEnabled()) {
+ contributionItems.add(contributionItem);
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ }
+ return contributionItems.toArray(new IContributionItem[0]);
+ }
+
+ private CommandContributionItem createCommand(String label, Branch branch, String commandId, ImageDescriptor descriptor) throws OseeCoreException {
+ CommandContributionItem contributionItem;
+
+ contributionItem =
+ new CommandContributionItem(new CommandContributionItemParameter(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow(), label, commandId, Collections.EMPTY_MAP,
+ descriptor, null, null, label, null, null, SWT.NONE, null, false));
+
+ return contributionItem;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ArchiveBranchHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ArchiveBranchHandler.java
index 2cdcc573950..5c7551ef274 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ArchiveBranchHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ArchiveBranchHandler.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.framework.ui.skynet.commandHandlers.branch;
-
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.enums.BranchArchivedState;
-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.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.skynet.core.event.BranchEventType;
-import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
-import org.eclipse.osee.framework.skynet.core.event2.BranchEvent;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
-
-/**
- * @author Jeff C. Phillips
- */
-public class ArchiveBranchHandler extends CommandHandler {
-
- @Override
- public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- List<Branch> branches = Handlers.getBranchesFromStructuredSelection(structuredSelection);
- return !branches.isEmpty() && AccessControlManager.isOseeAdmin();
- }
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IStructuredSelection selection =
- (IStructuredSelection) AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider().getSelection();
- Collection<Branch> branches = Handlers.getBranchesFromStructuredSelection(selection);
-
- for (Branch branch : branches) {
- BranchArchivedState state = branch.getArchiveState();
- branch.setArchived(!state.isArchived());
- }
- try {
- BranchManager.persist(branches);
-
- for (Branch branch : branches) {
- OseeEventManager.kickBranchEvent(this, new BranchEvent(BranchEventType.Committed, branch.getGuid()),
- branch.getId());
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE, ex);
- }
- 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.framework.ui.skynet.commandHandlers.branch;
+
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.core.enums.BranchArchivedState;
+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.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.skynet.core.event.BranchEventType;
+import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
+import org.eclipse.osee.framework.skynet.core.event2.BranchEvent;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class ArchiveBranchHandler extends CommandHandler {
+
+ @Override
+ public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
+ List<Branch> branches = Handlers.getBranchesFromStructuredSelection(structuredSelection);
+ return !branches.isEmpty() && AccessControlManager.isOseeAdmin();
+ }
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IStructuredSelection selection =
+ (IStructuredSelection) AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider().getSelection();
+ Collection<Branch> branches = Handlers.getBranchesFromStructuredSelection(selection);
+
+ for (Branch branch : branches) {
+ BranchArchivedState state = branch.getArchiveState();
+ branch.setArchived(!state.isArchived());
+ }
+ try {
+ BranchManager.persist(branches);
+
+ for (Branch branch : branches) {
+ OseeEventManager.kickBranchEvent(this, new BranchEvent(BranchEventType.Committed, branch.getGuid()),
+ branch.getId());
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE, ex);
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/BranchCreationHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/BranchCreationHandler.java
index 25ef99b8682..0d735399e79 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/BranchCreationHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/BranchCreationHandler.java
@@ -1,117 +1,117 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers.branch;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IProgressMonitor;
-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.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.enums.CoreBranches;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-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.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.transaction.TransactionManager;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.widgets.dialog.EntryDialog;
-import org.eclipse.osee.framework.ui.swt.Displays;
-
-/**
- * @author Jeff C. Phillips
- * @author Ryan D. Brooks
- * @author Robert A. Fisher
- */
-public class BranchCreationHandler extends CommandHandler {
-
- @Override
- public Object execute(ExecutionEvent arg0) throws ExecutionException {
- IStructuredSelection selection =
- (IStructuredSelection) AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider().getSelection();
- Object backingData = selection.getFirstElement();
-
- final TransactionRecord parentTransactionId;
- try {
- if (backingData instanceof Branch) {
- Branch branch = (Branch) backingData;
- parentTransactionId = TransactionManager.getHeadTransaction(branch);
- } else if (backingData instanceof TransactionRecord) {
-
- parentTransactionId = (TransactionRecord) backingData;
-
- } else {
- throw new OseeStateException(
- "Backing data for the jobbed node in the branchview was not of the expected type");
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- return null;
- }
- final EntryDialog dialog =
- new EntryDialog(Displays.getActiveShell(), "Branch", null, "Enter the name of the new Branch:",
- MessageDialog.INFORMATION, new String[] {"OK", "Cancel"}, 0);
- int result = dialog.open();
-
- if (result == 0 && dialog.getEntry() != null) {
-
- IExceptionableRunnable runnable = new IExceptionableRunnable() {
- public IStatus run(IProgressMonitor monitor) throws Exception {
- Branch branch = parentTransactionId.getBranch();
- if (branch.equals(CoreBranches.SYSTEM_ROOT)) {
- BranchManager.createTopLevelBranch(dialog.getEntry());
- } else {
- BranchManager.createWorkingBranch(parentTransactionId, dialog.getEntry(), null, null);
- }
- return Status.OK_STATUS;
- }
- };
-
- Jobs.runInJob("Create Branch", runnable, SkynetGuiPlugin.class, SkynetGuiPlugin.PLUGIN_ID);
- }
-
- return null;
- }
-
- @Override
- public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- boolean enabled;
- if (structuredSelection.size() != 1) {
- return false;
- }
-
- Object object = structuredSelection.getFirstElement();
- Branch branch = null;
-
- if (object instanceof Branch) {
- branch = (Branch) object;
- } else if (object instanceof TransactionRecord) {
- branch = ((TransactionRecord) object).getBranch();
- }
-
- if (branch == null || branch.getArchiveState().isArchived()) {
- return false;
- }
-
- enabled = AccessControlManager.hasPermission(branch, PermissionEnum.READ);
- return 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.framework.ui.skynet.commandHandlers.branch;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+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.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.core.enums.CoreBranches;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
+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.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.transaction.TransactionManager;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.EntryDialog;
+import org.eclipse.osee.framework.ui.swt.Displays;
+
+/**
+ * @author Jeff C. Phillips
+ * @author Ryan D. Brooks
+ * @author Robert A. Fisher
+ */
+public class BranchCreationHandler extends CommandHandler {
+
+ @Override
+ public Object execute(ExecutionEvent arg0) throws ExecutionException {
+ IStructuredSelection selection =
+ (IStructuredSelection) AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider().getSelection();
+ Object backingData = selection.getFirstElement();
+
+ final TransactionRecord parentTransactionId;
+ try {
+ if (backingData instanceof Branch) {
+ Branch branch = (Branch) backingData;
+ parentTransactionId = TransactionManager.getHeadTransaction(branch);
+ } else if (backingData instanceof TransactionRecord) {
+
+ parentTransactionId = (TransactionRecord) backingData;
+
+ } else {
+ throw new OseeStateException(
+ "Backing data for the jobbed node in the branchview was not of the expected type");
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ return null;
+ }
+ final EntryDialog dialog =
+ new EntryDialog(Displays.getActiveShell(), "Branch", null, "Enter the name of the new Branch:",
+ MessageDialog.INFORMATION, new String[] {"OK", "Cancel"}, 0);
+ int result = dialog.open();
+
+ if (result == 0 && dialog.getEntry() != null) {
+
+ IExceptionableRunnable runnable = new IExceptionableRunnable() {
+ public IStatus run(IProgressMonitor monitor) throws Exception {
+ Branch branch = parentTransactionId.getBranch();
+ if (branch.equals(CoreBranches.SYSTEM_ROOT)) {
+ BranchManager.createTopLevelBranch(dialog.getEntry());
+ } else {
+ BranchManager.createWorkingBranch(parentTransactionId, dialog.getEntry(), null, null);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+
+ Jobs.runInJob("Create Branch", runnable, SkynetGuiPlugin.class, SkynetGuiPlugin.PLUGIN_ID);
+ }
+
+ return null;
+ }
+
+ @Override
+ public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
+ boolean enabled;
+ if (structuredSelection.size() != 1) {
+ return false;
+ }
+
+ Object object = structuredSelection.getFirstElement();
+ Branch branch = null;
+
+ if (object instanceof Branch) {
+ branch = (Branch) object;
+ } else if (object instanceof TransactionRecord) {
+ branch = ((TransactionRecord) object).getBranch();
+ }
+
+ if (branch == null || branch.getArchiveState().isArchived()) {
+ return false;
+ }
+
+ enabled = AccessControlManager.hasPermission(branch, PermissionEnum.READ);
+ return enabled;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/FlatPresentationHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/FlatPresentationHandler.java
index ad7f28c26b0..c9ad85a026d 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/FlatPresentationHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/FlatPresentationHandler.java
@@ -1,57 +1,57 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers.branch;
-
-import java.util.Map;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView;
-import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchViewPresentationPreferences;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.commands.ICommandService;
-import org.eclipse.ui.commands.IElementUpdater;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.menus.UIElement;
-
-/**
- * @author Jeff C. Phillips
- * @author Robert A. Fisher
- */
-public class FlatPresentationHandler extends AbstractHandler implements IElementUpdater {
- public static String COMMAND_ID = "org.eclipse.osee.framework.ui.skynet.branch.BranchView.flatCommand";
- private ICommandService service;
-
- public FlatPresentationHandler() {
- this.service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
- }
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ((BranchView) HandlerUtil.getActivePartChecked(event)).changeBranchPresentation(true);
- return null;
- }
-
- @Override
- public void updateElement(UIElement element, Map parameters) {
- element.setChecked(Platform.getPreferencesService().getRootNode().node(InstanceScope.SCOPE).node(
- BranchView.VIEW_ID).getBoolean(BranchViewPresentationPreferences.FLAT_KEY, true));
- }
-
- @Override
- public boolean isEnabled() {
- service.refreshElements(COMMAND_ID, null);
-
- 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.framework.ui.skynet.commandHandlers.branch;
+
+import java.util.Map;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView;
+import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchViewPresentationPreferences;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.commands.IElementUpdater;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.menus.UIElement;
+
+/**
+ * @author Jeff C. Phillips
+ * @author Robert A. Fisher
+ */
+public class FlatPresentationHandler extends AbstractHandler implements IElementUpdater {
+ public static String COMMAND_ID = "org.eclipse.osee.framework.ui.skynet.branch.BranchView.flatCommand";
+ private ICommandService service;
+
+ public FlatPresentationHandler() {
+ this.service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
+ }
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ((BranchView) HandlerUtil.getActivePartChecked(event)).changeBranchPresentation(true);
+ return null;
+ }
+
+ @Override
+ public void updateElement(UIElement element, Map parameters) {
+ element.setChecked(Platform.getPreferencesService().getRootNode().node(InstanceScope.SCOPE).node(
+ BranchView.VIEW_ID).getBoolean(BranchViewPresentationPreferences.FLAT_KEY, true));
+ }
+
+ @Override
+ public boolean isEnabled() {
+ service.refreshElements(COMMAND_ID, null);
+
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/OpenAssociatedArtifactHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/OpenAssociatedArtifactHandler.java
index 7f4885b44c1..c18654d91a4 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/OpenAssociatedArtifactHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/OpenAssociatedArtifactHandler.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.framework.ui.skynet.commandHandlers.branch;
-
-import java.util.List;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-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.skynet.core.UserManager;
-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.IATSArtifact;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.ats.OseeAts;
-import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
-import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
-import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
-
-/**
- * @author Jeff C. Phillips
- */
-public class OpenAssociatedArtifactHandler extends CommandHandler {
-
- @Override
- public Object execute(ExecutionEvent arg0) throws ExecutionException {
- IStructuredSelection selection =
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers.branch;
+
+import java.util.List;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
+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.skynet.core.UserManager;
+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.IATSArtifact;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.ats.OseeAts;
+import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
+import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class OpenAssociatedArtifactHandler extends CommandHandler {
+
+ @Override
+ public Object execute(ExecutionEvent arg0) throws ExecutionException {
+ IStructuredSelection selection =
(IStructuredSelection) AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider().getSelection();
- Branch selectedBranch = Handlers.getBranchesFromStructuredSelection(selection).iterator().next();
-
- try {
- Artifact associatedArtifact = BranchManager.getAssociatedArtifact(selectedBranch);
- if (associatedArtifact == null) {
- AWorkbench.popup("Open Associated Artifact", "No artifact associated with branch " + selectedBranch);
- return null;
- }
- if (AccessControlManager.hasPermission(associatedArtifact, PermissionEnum.READ)) {
- if (associatedArtifact instanceof IATSArtifact) {
- OseeAts.getInstance().openArtifact(associatedArtifact);
- } else {
+ Branch selectedBranch = Handlers.getBranchesFromStructuredSelection(selection).iterator().next();
+
+ try {
+ Artifact associatedArtifact = BranchManager.getAssociatedArtifact(selectedBranch);
+ if (associatedArtifact == null) {
+ AWorkbench.popup("Open Associated Artifact", "No artifact associated with branch " + selectedBranch);
+ return null;
+ }
+ if (AccessControlManager.hasPermission(associatedArtifact, PermissionEnum.READ)) {
+ if (associatedArtifact instanceof IATSArtifact) {
+ OseeAts.getInstance().openArtifact(associatedArtifact);
+ } else {
RendererManager.open(associatedArtifact, PresentationType.GENERALIZED_EDIT);
- }
- } else {
- OseeLog.log(
+ }
+ } else {
+ OseeLog.log(
SkynetGuiPlugin.class,
OseeLevel.SEVERE_POPUP,
"The user " + UserManager.getUser() + " does not have read access to " + selectedBranch.getAssociatedArtifactId());
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
-
- return null;
- }
-
- @Override
- public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- List<Branch> branches = Handlers.getBranchesFromStructuredSelection(structuredSelection);
- return branches.size() == 1;
- }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ return null;
+ }
+
+ @Override
+ public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
+ List<Branch> branches = Handlers.getBranchesFromStructuredSelection(structuredSelection);
+ return branches.size() == 1;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ToggleFavoriteBranchContributionItem.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ToggleFavoriteBranchContributionItem.java
index 6ef4ac99f2d..b12e199b78e 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ToggleFavoriteBranchContributionItem.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/ToggleFavoriteBranchContributionItem.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers.branch;
-
+package org.eclipse.osee.framework.ui.skynet.commandHandlers.branch;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -31,58 +31,58 @@ import org.eclipse.ui.actions.CompoundContributionItem;
import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.menus.CommandContributionItem;
import org.eclipse.ui.menus.CommandContributionItemParameter;
-
-/**
- * @author Jeff C. Phillips
- *
- */
-public class ToggleFavoriteBranchContributionItem extends CompoundContributionItem{
- private ICommandService commandService;
-
- public ToggleFavoriteBranchContributionItem() {
- this.commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
- }
- @Override
- protected IContributionItem[] getContributionItems() {
- ISelectionProvider selectionProvider =
- AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
- ArrayList<IContributionItem> contributionItems = new ArrayList<IContributionItem>(40);
-
- if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
- List<Branch> branches = Handlers.getBranchesFromStructuredSelection(structuredSelection);
-
- if (!branches.isEmpty()) {
- Branch selectedBranch = branches.iterator().next();
- if (selectedBranch != null) {
- try {
- String commandId = ToggleFavoriteBranchHandler.COMMAND_ID;
- Command command = commandService.getCommand(commandId);
- CommandContributionItem contributionItem = null;
- String label = UserManager.getUser().isFavoriteBranch(selectedBranch) ? "Unmark as Favorite" : "Mark as Favorite";
- contributionItem = createCommand(label, selectedBranch, commandId);
-
- if (command != null && command.isEnabled()) {
- contributionItems.add(contributionItem);
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- }
- }
- return contributionItems.toArray(new IContributionItem[0]);
-}
-
-private CommandContributionItem createCommand(String label, Branch branch, String commandId) throws OseeCoreException {
- CommandContributionItem contributionItem;
-
- contributionItem =
- new CommandContributionItem(new CommandContributionItemParameter(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow(), label, commandId, Collections.EMPTY_MAP, null,
- null, null, label, null, null, SWT.NONE, null, false));
-
- return contributionItem;
-}
-
-}
+
+/**
+ * @author Jeff C. Phillips
+ *
+ */
+public class ToggleFavoriteBranchContributionItem extends CompoundContributionItem{
+ private ICommandService commandService;
+
+ public ToggleFavoriteBranchContributionItem() {
+ this.commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
+ }
+ @Override
+ protected IContributionItem[] getContributionItems() {
+ ISelectionProvider selectionProvider =
+ AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
+ ArrayList<IContributionItem> contributionItems = new ArrayList<IContributionItem>(40);
+
+ if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
+ List<Branch> branches = Handlers.getBranchesFromStructuredSelection(structuredSelection);
+
+ if (!branches.isEmpty()) {
+ Branch selectedBranch = branches.iterator().next();
+ if (selectedBranch != null) {
+ try {
+ String commandId = ToggleFavoriteBranchHandler.COMMAND_ID;
+ Command command = commandService.getCommand(commandId);
+ CommandContributionItem contributionItem = null;
+ String label = UserManager.getUser().isFavoriteBranch(selectedBranch) ? "Unmark as Favorite" : "Mark as Favorite";
+ contributionItem = createCommand(label, selectedBranch, commandId);
+
+ if (command != null && command.isEnabled()) {
+ contributionItems.add(contributionItem);
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ }
+ return contributionItems.toArray(new IContributionItem[0]);
+}
+
+private CommandContributionItem createCommand(String label, Branch branch, String commandId) throws OseeCoreException {
+ CommandContributionItem contributionItem;
+
+ contributionItem =
+ new CommandContributionItem(new CommandContributionItemParameter(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow(), label, commandId, Collections.EMPTY_MAP, null,
+ null, null, label, null, null, SWT.NONE, null, false));
+
+ return contributionItem;
+}
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitBranchParameter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitBranchParameter.java
index 8ac6d7e26e7..49271d059e6 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitBranchParameter.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitBranchParameter.java
@@ -8,31 +8,31 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers.branch.commit;
-
+package org.eclipse.osee.framework.ui.skynet.commandHandlers.branch.commit;
+
import org.eclipse.core.commands.IParameter;
import org.eclipse.core.commands.IParameterValues;
import org.eclipse.core.commands.ParameterValuesException;
-
-/**
- * @author Jeff C. Phillips
- *
- */
-public class CommitBranchParameter implements IParameter {
- public static String ARCHIVE_PARENT_BRANCH = "archive_parent_branch";
- public String getId() {
- return ARCHIVE_PARENT_BRANCH;
- }
-
- public String getName() {
- return "Branch Commit parameter";
- }
-
- public IParameterValues getValues() throws ParameterValuesException {
- throw new ParameterValuesException("Branch Commit has no parameters", null);
- }
-
- public boolean isOptional() {
- return false;
- }
-}
+
+/**
+ * @author Jeff C. Phillips
+ *
+ */
+public class CommitBranchParameter implements IParameter {
+ public static String ARCHIVE_PARENT_BRANCH = "archive_parent_branch";
+ public String getId() {
+ return ARCHIVE_PARENT_BRANCH;
+ }
+
+ public String getName() {
+ return "Branch Commit parameter";
+ }
+
+ public IParameterValues getValues() throws ParameterValuesException {
+ throw new ParameterValuesException("Branch Commit has no parameters", null);
+ }
+
+ public boolean isOptional() {
+ return false;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitHandler.java
index ec1b901f048..f16c0471e08 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitHandler.java
@@ -1,199 +1,199 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers.branch.commit;
-
-import java.util.List;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-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.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.access.AccessControlManager;
-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.jdk.core.type.MutableInteger;
-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.BranchManager;
-import org.eclipse.osee.framework.skynet.core.conflict.ConflictManagerExternal;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
-import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchViewPresentationPreferences;
-import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeView;
-import org.eclipse.osee.framework.ui.swt.Displays;
-
-/**
- * @author Jeff C. Phillips
- * @author Ryan D. Brooks
- */
-public abstract class CommitHandler extends CommandHandler {
- protected final boolean useParentBranch;
-
- public CommitHandler(boolean useParentBranch) {
- this.useParentBranch = useParentBranch;
- }
-
- public static boolean commitBranch(final ConflictManagerExternal conflictManager, boolean archiveSourceBranch) throws OseeCoreException {
- final Branch sourceBranch = conflictManager.getSourceBranch();
- final Branch destinationBranch = conflictManager.getDestinationBranch();
- final TransactionRecord transactionId = sourceBranch.getBaseTransaction();
- boolean branchCommitted = false;
-
- if (!conflictManager.getRemainingConflicts().isEmpty()) {
- String message =
- "Commit stopped due to unresolved conflicts\n\nPossible Resolutions:\n Cancel commit and resolve at a later time\n Launch the Merge Manager to resolve conflicts";
- final String fMessage;
- final String[] choices;
- if (AccessControlManager.isOseeAdmin()) {
- fMessage = message + "\n Force the commit";
- choices = new String[] {"Cancel", "Launch Merge Manager", "Force Commit (Admin Only)"};
- } else {
- fMessage = message;
- choices = new String[] {"Cancel", "Launch Merge Manager"};
- }
-
- final MutableInteger dialogResult = new MutableInteger(0);
- Displays.pendInDisplayThread(new Runnable() {
- @Override
- public void run() {
- MessageDialog dialog =
- new MessageDialog(Displays.getActiveShell(), "Unresolved Conflicts", null,
- fMessage, MessageDialog.QUESTION, choices, 0);
- dialogResult.setValue(dialog.open());
- if (dialogResult.getValue() == 1) {
- MergeView.openView(sourceBranch, destinationBranch, transactionId);
- }
- }
- });
-
- if (dialogResult.getValue() == 2) {
- BranchManager.commitBranch(null, conflictManager, archiveSourceBranch, true);
- branchCommitted = true;
- }
- } else {
- final StringBuilder message =
- new StringBuilder(
- "Commit branch\n\n\"" + sourceBranch + "\"\n\n onto destination branch\n\n\"" + destinationBranch + "\"\n");
- int numOriginalConflicts = conflictManager.getOriginalConflicts().size();
- if (numOriginalConflicts > 0) {
- message.append("\nwith " + numOriginalConflicts + " conflicts resolved.\n");
- } else {
- message.append("\n(no conflicts found)\n");
- }
- message.append("\nCommit?");
-
- final MutableInteger dialogResult = new MutableInteger(0);
- Displays.pendInDisplayThread(new Runnable() {
- @Override
- public void run() {
- try {
- if (conflictManager.getOriginalConflicts().isEmpty()) {
- MessageDialog dialog =
- new MessageDialog(Displays.getActiveShell(), "Commit Branch", null,
- message.toString(), MessageDialog.QUESTION, new String[] {"Ok", "Cancel"}, 0);
- dialogResult.setValue(dialog.open());
- } else {
- MessageDialog dialog =
- new MessageDialog(Displays.getActiveShell(), "Commit Branch", null,
- message.toString(), MessageDialog.QUESTION, new String[] {"Ok",
- "Launch Merge Manager", "Cancel"}, 0);
- dialogResult.setValue(dialog.open());
- if (dialogResult.getValue() == 1) {
- MergeView.openView(sourceBranch, destinationBranch, transactionId);
- }
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- });
-
- if (dialogResult.getValue() == 0) {
- BranchManager.commitBranch(null, conflictManager, archiveSourceBranch, false);
- branchCommitted = true;
- }
- }
- return branchCommitted;
- }
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IStructuredSelection selection =
- (IStructuredSelection) AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider().getSelection();
-
- List<Branch> branches = Handlers.getBranchesFromStructuredSelection(selection);
- Branch sourceBranch = branches.iterator().next();
-
- try {
- Branch destinationBranch = null;
- if (useParentBranch) {
- destinationBranch = sourceBranch.getParentBranch();
- } else {
- destinationBranch =
- BranchManager.getBranch(Integer.parseInt(event.getParameter(BranchViewPresentationPreferences.BRANCH_ID)));
- }
- Jobs.startJob(new CommitJob(sourceBranch, destinationBranch,
- Boolean.parseBoolean(event.getParameter(CommitBranchParameter.ARCHIVE_PARENT_BRANCH))));
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return null;
- }
-
- @Override
- public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- List<Branch> branches = Handlers.getBranchesFromStructuredSelection(structuredSelection);
-
- if (branches.size() == 1) {
- Branch branch = branches.iterator().next();
- return useParentBranchValid(branch) || !useParentBranch && AccessControlManager.isOseeAdmin();
- }
- return false;
- }
-
- protected boolean useParentBranchValid(Branch branch) throws OseeCoreException {
- return branch.hasParentBranch() && useParentBranch && !BranchManager.isChangeManaged(branch) && !branch.getArchiveState().isArchived();
- }
- protected class CommitJob extends Job {
- private final Branch sourceBranch;
- private final Branch destinationBranch;
- private final boolean archiveSourceBranch;
-
- /**
- * @param name
- * @param destinationBranch
- * @param sourceBranch
- */
- public CommitJob(Branch sourceBranch, Branch destinationBranch, boolean archiveSourceBranch) {
- super("Commit Branch");
- this.destinationBranch = destinationBranch;
- this.sourceBranch = sourceBranch;
- this.archiveSourceBranch = archiveSourceBranch;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- commitBranch(new ConflictManagerExternal(destinationBranch, sourceBranch), archiveSourceBranch);
- } catch (OseeCoreException ex) {
- return new Status(Status.ERROR, SkynetGuiPlugin.PLUGIN_ID, ex.getLocalizedMessage(), ex);
- }
- return Status.OK_STATUS;
- }
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers.branch.commit;
+
+import java.util.List;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+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.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.access.AccessControlManager;
+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.jdk.core.type.MutableInteger;
+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.BranchManager;
+import org.eclipse.osee.framework.skynet.core.conflict.ConflictManagerExternal;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
+import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchViewPresentationPreferences;
+import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeView;
+import org.eclipse.osee.framework.ui.swt.Displays;
+
+/**
+ * @author Jeff C. Phillips
+ * @author Ryan D. Brooks
+ */
+public abstract class CommitHandler extends CommandHandler {
+ protected final boolean useParentBranch;
+
+ public CommitHandler(boolean useParentBranch) {
+ this.useParentBranch = useParentBranch;
+ }
+
+ public static boolean commitBranch(final ConflictManagerExternal conflictManager, boolean archiveSourceBranch) throws OseeCoreException {
+ final Branch sourceBranch = conflictManager.getSourceBranch();
+ final Branch destinationBranch = conflictManager.getDestinationBranch();
+ final TransactionRecord transactionId = sourceBranch.getBaseTransaction();
+ boolean branchCommitted = false;
+
+ if (!conflictManager.getRemainingConflicts().isEmpty()) {
+ String message =
+ "Commit stopped due to unresolved conflicts\n\nPossible Resolutions:\n Cancel commit and resolve at a later time\n Launch the Merge Manager to resolve conflicts";
+ final String fMessage;
+ final String[] choices;
+ if (AccessControlManager.isOseeAdmin()) {
+ fMessage = message + "\n Force the commit";
+ choices = new String[] {"Cancel", "Launch Merge Manager", "Force Commit (Admin Only)"};
+ } else {
+ fMessage = message;
+ choices = new String[] {"Cancel", "Launch Merge Manager"};
+ }
+
+ final MutableInteger dialogResult = new MutableInteger(0);
+ Displays.pendInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ MessageDialog dialog =
+ new MessageDialog(Displays.getActiveShell(), "Unresolved Conflicts", null,
+ fMessage, MessageDialog.QUESTION, choices, 0);
+ dialogResult.setValue(dialog.open());
+ if (dialogResult.getValue() == 1) {
+ MergeView.openView(sourceBranch, destinationBranch, transactionId);
+ }
+ }
+ });
+
+ if (dialogResult.getValue() == 2) {
+ BranchManager.commitBranch(null, conflictManager, archiveSourceBranch, true);
+ branchCommitted = true;
+ }
+ } else {
+ final StringBuilder message =
+ new StringBuilder(
+ "Commit branch\n\n\"" + sourceBranch + "\"\n\n onto destination branch\n\n\"" + destinationBranch + "\"\n");
+ int numOriginalConflicts = conflictManager.getOriginalConflicts().size();
+ if (numOriginalConflicts > 0) {
+ message.append("\nwith " + numOriginalConflicts + " conflicts resolved.\n");
+ } else {
+ message.append("\n(no conflicts found)\n");
+ }
+ message.append("\nCommit?");
+
+ final MutableInteger dialogResult = new MutableInteger(0);
+ Displays.pendInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ if (conflictManager.getOriginalConflicts().isEmpty()) {
+ MessageDialog dialog =
+ new MessageDialog(Displays.getActiveShell(), "Commit Branch", null,
+ message.toString(), MessageDialog.QUESTION, new String[] {"Ok", "Cancel"}, 0);
+ dialogResult.setValue(dialog.open());
+ } else {
+ MessageDialog dialog =
+ new MessageDialog(Displays.getActiveShell(), "Commit Branch", null,
+ message.toString(), MessageDialog.QUESTION, new String[] {"Ok",
+ "Launch Merge Manager", "Cancel"}, 0);
+ dialogResult.setValue(dialog.open());
+ if (dialogResult.getValue() == 1) {
+ MergeView.openView(sourceBranch, destinationBranch, transactionId);
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ });
+
+ if (dialogResult.getValue() == 0) {
+ BranchManager.commitBranch(null, conflictManager, archiveSourceBranch, false);
+ branchCommitted = true;
+ }
+ }
+ return branchCommitted;
+ }
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IStructuredSelection selection =
+ (IStructuredSelection) AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider().getSelection();
+
+ List<Branch> branches = Handlers.getBranchesFromStructuredSelection(selection);
+ Branch sourceBranch = branches.iterator().next();
+
+ try {
+ Branch destinationBranch = null;
+ if (useParentBranch) {
+ destinationBranch = sourceBranch.getParentBranch();
+ } else {
+ destinationBranch =
+ BranchManager.getBranch(Integer.parseInt(event.getParameter(BranchViewPresentationPreferences.BRANCH_ID)));
+ }
+ Jobs.startJob(new CommitJob(sourceBranch, destinationBranch,
+ Boolean.parseBoolean(event.getParameter(CommitBranchParameter.ARCHIVE_PARENT_BRANCH))));
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
+ List<Branch> branches = Handlers.getBranchesFromStructuredSelection(structuredSelection);
+
+ if (branches.size() == 1) {
+ Branch branch = branches.iterator().next();
+ return useParentBranchValid(branch) || !useParentBranch && AccessControlManager.isOseeAdmin();
+ }
+ return false;
+ }
+
+ protected boolean useParentBranchValid(Branch branch) throws OseeCoreException {
+ return branch.hasParentBranch() && useParentBranch && !BranchManager.isChangeManaged(branch) && !branch.getArchiveState().isArchived();
+ }
+ protected class CommitJob extends Job {
+ private final Branch sourceBranch;
+ private final Branch destinationBranch;
+ private final boolean archiveSourceBranch;
+
+ /**
+ * @param name
+ * @param destinationBranch
+ * @param sourceBranch
+ */
+ public CommitJob(Branch sourceBranch, Branch destinationBranch, boolean archiveSourceBranch) {
+ super("Commit Branch");
+ this.destinationBranch = destinationBranch;
+ this.sourceBranch = sourceBranch;
+ this.archiveSourceBranch = archiveSourceBranch;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ commitBranch(new ConflictManagerExternal(destinationBranch, sourceBranch), archiveSourceBranch);
+ } catch (OseeCoreException ex) {
+ return new Status(Status.ERROR, SkynetGuiPlugin.PLUGIN_ID, ex.getLocalizedMessage(), ex);
+ }
+ return Status.OK_STATUS;
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitIntoParentCompoundContributionItem.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitIntoParentCompoundContributionItem.java
index 942f7d35aaa..caa484d64ba 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitIntoParentCompoundContributionItem.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitIntoParentCompoundContributionItem.java
@@ -1,115 +1,115 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers.branch.commit;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import org.eclipse.core.commands.Command;
-import org.eclipse.core.commands.IParameter;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
-import org.eclipse.osee.framework.ui.skynet.commandHandlers.merge.BranchIdParameter;
-import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView;
-import org.eclipse.swt.SWT;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.CompoundContributionItem;
-import org.eclipse.ui.commands.ICommandService;
-import org.eclipse.ui.menus.CommandContributionItem;
-import org.eclipse.ui.menus.CommandContributionItemParameter;
-
-/**
- * @author Jeff C. Phillips
- */
-public class CommitIntoParentCompoundContributionItem extends CompoundContributionItem {
- private static final IParameter[] BRANCH_COMMIT_PARAMETER_DEF =
- new IParameter[] {new BranchIdParameter(), new CommitBranchParameter()};
-
- private ICommandService commandService;
-
- public CommitIntoParentCompoundContributionItem() {
- this.commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
- }
-
- public CommitIntoParentCompoundContributionItem(String id) {
- super(id);
- }
-
- @Override
- protected IContributionItem[] getContributionItems() {
- ISelectionProvider selectionProvider =
- AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
- ArrayList<IContributionItem> contributionItems = new ArrayList<IContributionItem>(40);
-
- if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
- List<Branch> branches = Handlers.getBranchesFromStructuredSelection(structuredSelection);
-
- if (!branches.isEmpty()) {
- Branch selectedBranch = branches.iterator().next();
- if (selectedBranch != null && !selectedBranch.getBranchType().isSystemRootBranch()) {
- try {
- String commandId = "org.eclipse.osee.framework.ui.skynet.branch.BranchView.commitIntoParent";
- Command command = configCommandParameter(commandId);
- CommandContributionItem contributionItem = null;
-
- contributionItem = createCommand(selectedBranch, commandId);
-
- if (command != null && command.isEnabled()) {
- contributionItems.add(contributionItem);
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- }
- }
- return contributionItems.toArray(new IContributionItem[0]);
- }
-
- private CommandContributionItem createCommand(Branch branch, String commandId) throws OseeCoreException {
-
- Map<String, String> parameters = new HashMap<String, String>();
- parameters.put(BranchView.BRANCH_ID, Integer.toString(branch.getId()));
- parameters.put(CommitBranchParameter.ARCHIVE_PARENT_BRANCH, "true");
- CommandContributionItem contributionItem;
- String label = "Commit into Parent Branch: " + branch.getParentBranch().getName();
-
- contributionItem =
- new CommandContributionItem(new CommandContributionItemParameter(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow(), label, commandId, parameters, null, null, null,
- label, null, null, SWT.NONE, null, false));
-
- return contributionItem;
- }
-
- private Command configCommandParameter(String commandId) {
- Command command = commandService.getCommand(commandId);
-
- try {
- command.define(command.getName(), "", commandService.getCategory("org.eclipse.debug.ui.category.run"),
- BRANCH_COMMIT_PARAMETER_DEF);
- } catch (NotDefinedException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- return command;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers.branch.commit;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.IParameter;
+import org.eclipse.core.commands.common.NotDefinedException;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
+import org.eclipse.osee.framework.ui.skynet.commandHandlers.merge.BranchIdParameter;
+import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView;
+import org.eclipse.swt.SWT;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.CompoundContributionItem;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.menus.CommandContributionItem;
+import org.eclipse.ui.menus.CommandContributionItemParameter;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class CommitIntoParentCompoundContributionItem extends CompoundContributionItem {
+ private static final IParameter[] BRANCH_COMMIT_PARAMETER_DEF =
+ new IParameter[] {new BranchIdParameter(), new CommitBranchParameter()};
+
+ private ICommandService commandService;
+
+ public CommitIntoParentCompoundContributionItem() {
+ this.commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
+ }
+
+ public CommitIntoParentCompoundContributionItem(String id) {
+ super(id);
+ }
+
+ @Override
+ protected IContributionItem[] getContributionItems() {
+ ISelectionProvider selectionProvider =
+ AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
+ ArrayList<IContributionItem> contributionItems = new ArrayList<IContributionItem>(40);
+
+ if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
+ List<Branch> branches = Handlers.getBranchesFromStructuredSelection(structuredSelection);
+
+ if (!branches.isEmpty()) {
+ Branch selectedBranch = branches.iterator().next();
+ if (selectedBranch != null && !selectedBranch.getBranchType().isSystemRootBranch()) {
+ try {
+ String commandId = "org.eclipse.osee.framework.ui.skynet.branch.BranchView.commitIntoParent";
+ Command command = configCommandParameter(commandId);
+ CommandContributionItem contributionItem = null;
+
+ contributionItem = createCommand(selectedBranch, commandId);
+
+ if (command != null && command.isEnabled()) {
+ contributionItems.add(contributionItem);
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ }
+ return contributionItems.toArray(new IContributionItem[0]);
+ }
+
+ private CommandContributionItem createCommand(Branch branch, String commandId) throws OseeCoreException {
+
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put(BranchView.BRANCH_ID, Integer.toString(branch.getId()));
+ parameters.put(CommitBranchParameter.ARCHIVE_PARENT_BRANCH, "true");
+ CommandContributionItem contributionItem;
+ String label = "Commit into Parent Branch: " + branch.getParentBranch().getName();
+
+ contributionItem =
+ new CommandContributionItem(new CommandContributionItemParameter(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow(), label, commandId, parameters, null, null, null,
+ label, null, null, SWT.NONE, null, false));
+
+ return contributionItem;
+ }
+
+ private Command configCommandParameter(String commandId) {
+ Command command = commandService.getCommand(commandId);
+
+ try {
+ command.define(command.getName(), "", commandService.getCategory("org.eclipse.debug.ui.category.run"),
+ BRANCH_COMMIT_PARAMETER_DEF);
+ } catch (NotDefinedException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ return command;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitIntoParentHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitIntoParentHandler.java
index 8e74aa33fc3..a110a1c400b 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitIntoParentHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/CommitIntoParentHandler.java
@@ -8,19 +8,19 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers.branch.commit;
-
-
-
-/**
- * @author Jeff C. Phillips
- *
- */
-public class CommitIntoParentHandler extends CommitHandler{
-
- private static boolean USE_PARENT_BRANCH = true;
-
- public CommitIntoParentHandler() {
- super(USE_PARENT_BRANCH);
- }
-}
+package org.eclipse.osee.framework.ui.skynet.commandHandlers.branch.commit;
+
+
+
+/**
+ * @author Jeff C. Phillips
+ *
+ */
+public class CommitIntoParentHandler extends CommitHandler{
+
+ private static boolean USE_PARENT_BRANCH = true;
+
+ public CommitIntoParentHandler() {
+ super(USE_PARENT_BRANCH);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/UpdateBranchHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/UpdateBranchHandler.java
index 26effabfa40..edd0476f3af 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/UpdateBranchHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/commit/UpdateBranchHandler.java
@@ -1,134 +1,134 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers.branch.commit;
-
-import java.util.List;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-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.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.core.enums.BranchType;
-import org.eclipse.osee.framework.core.enums.CoreBranches;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-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.artifact.update.ConflictResolverOperation;
-import org.eclipse.osee.framework.skynet.core.conflict.ConflictManagerExternal;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
-import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeView;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.progress.UIJob;
-
-/**
- * @author Roberto E. Escobar
- */
-public class UpdateBranchHandler extends CommandHandler {
-
- protected boolean isValid(Branch branch) throws OseeCoreException {
- boolean result = false;
- if (branch.hasParentBranch()) {
- result = !branch.getParentBranch().equals(CoreBranches.SYSTEM_ROOT);
- result &= branch.isEditable() && branch.getBranchType().isOfType(BranchType.WORKING, BranchType.BASELINE);
- result &= branch.getChildBranches().isEmpty();
- }
- return result;
- }
-
- private Branch getSelectedBranch() {
- Branch branch = null;
- if (AWorkbench.getActivePage() == null) {
- return null;
- }
- IStructuredSelection selection =
- (IStructuredSelection) AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider().getSelection();
-
- List<Branch> branches = Handlers.getBranchesFromStructuredSelection(selection);
- if (branches.size() == 1) {
- branch = branches.iterator().next();
- }
- return branch;
- }
-
- @Override
- public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- boolean enabled = false;
- Branch branch = getSelectedBranch();
- if (branch != null) {
- enabled = isValid(branch);
- }
- return enabled;
- }
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- Branch branchToUpdate = getSelectedBranch();
- if (branchToUpdate != null) {
- boolean isUpdateAllowed =
- MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Update Branch", String.format("Are you sure you want to update [%s] branch",
- branchToUpdate.getName()));
- if (isUpdateAllowed) {
- BranchManager.updateBranch(branchToUpdate, new UserConflictResolver());
- }
- }
- return null;
- }
-
- private static final class UserConflictResolver extends ConflictResolverOperation {
-
- public UserConflictResolver() {
- super("Launch Merge Manager", SkynetGuiPlugin.PLUGIN_ID);
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- ConflictManagerExternal conflictManager = getConflictManager();
- Job job = createMergeViewJob(conflictManager.getSourceBranch(), conflictManager.getDestinationBranch());
- Jobs.startJob(job);
- }
-
- private Job createMergeViewJob(final Branch sourceBranch, final Branch destinationBranch) {
- Job job = new UIJob("Launch Merge Manager") {
- @Override
- public IStatus runInUIThread(IProgressMonitor monitor) {
- IStatus status = Status.OK_STATUS;
- try {
- IWorkbenchPage page = AWorkbench.getActivePage();
- IViewPart viewPart =
- page.showView(MergeView.VIEW_ID,
- String.valueOf(sourceBranch.getId() * 100000 + destinationBranch.getId()),
- IWorkbenchPage.VIEW_ACTIVATE);
- if (viewPart instanceof MergeView) {
- MergeView mergeView = (MergeView) viewPart;
- mergeView.explore(sourceBranch, destinationBranch, null, null, true);
- }
- } catch (PartInitException ex) {
- status = new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, "Error launching merge view", ex);
- }
- return status;
- }
- };
- return 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.framework.ui.skynet.commandHandlers.branch.commit;
+
+import java.util.List;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+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.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.core.enums.BranchType;
+import org.eclipse.osee.framework.core.enums.CoreBranches;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+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.artifact.update.ConflictResolverOperation;
+import org.eclipse.osee.framework.skynet.core.conflict.ConflictManagerExternal;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
+import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeView;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.progress.UIJob;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class UpdateBranchHandler extends CommandHandler {
+
+ protected boolean isValid(Branch branch) throws OseeCoreException {
+ boolean result = false;
+ if (branch.hasParentBranch()) {
+ result = !branch.getParentBranch().equals(CoreBranches.SYSTEM_ROOT);
+ result &= branch.isEditable() && branch.getBranchType().isOfType(BranchType.WORKING, BranchType.BASELINE);
+ result &= branch.getChildBranches().isEmpty();
+ }
+ return result;
+ }
+
+ private Branch getSelectedBranch() {
+ Branch branch = null;
+ if (AWorkbench.getActivePage() == null) {
+ return null;
+ }
+ IStructuredSelection selection =
+ (IStructuredSelection) AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider().getSelection();
+
+ List<Branch> branches = Handlers.getBranchesFromStructuredSelection(selection);
+ if (branches.size() == 1) {
+ branch = branches.iterator().next();
+ }
+ return branch;
+ }
+
+ @Override
+ public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
+ boolean enabled = false;
+ Branch branch = getSelectedBranch();
+ if (branch != null) {
+ enabled = isValid(branch);
+ }
+ return enabled;
+ }
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ Branch branchToUpdate = getSelectedBranch();
+ if (branchToUpdate != null) {
+ boolean isUpdateAllowed =
+ MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ "Update Branch", String.format("Are you sure you want to update [%s] branch",
+ branchToUpdate.getName()));
+ if (isUpdateAllowed) {
+ BranchManager.updateBranch(branchToUpdate, new UserConflictResolver());
+ }
+ }
+ return null;
+ }
+
+ private static final class UserConflictResolver extends ConflictResolverOperation {
+
+ public UserConflictResolver() {
+ super("Launch Merge Manager", SkynetGuiPlugin.PLUGIN_ID);
+ }
+
+ @Override
+ protected void doWork(IProgressMonitor monitor) throws Exception {
+ ConflictManagerExternal conflictManager = getConflictManager();
+ Job job = createMergeViewJob(conflictManager.getSourceBranch(), conflictManager.getDestinationBranch());
+ Jobs.startJob(job);
+ }
+
+ private Job createMergeViewJob(final Branch sourceBranch, final Branch destinationBranch) {
+ Job job = new UIJob("Launch Merge Manager") {
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ IStatus status = Status.OK_STATUS;
+ try {
+ IWorkbenchPage page = AWorkbench.getActivePage();
+ IViewPart viewPart =
+ page.showView(MergeView.VIEW_ID,
+ String.valueOf(sourceBranch.getId() * 100000 + destinationBranch.getId()),
+ IWorkbenchPage.VIEW_ACTIVATE);
+ if (viewPart instanceof MergeView) {
+ MergeView mergeView = (MergeView) viewPart;
+ mergeView.explore(sourceBranch, destinationBranch, null, null, true);
+ }
+ } catch (PartInitException ex) {
+ status = new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, "Error launching merge view", ex);
+ }
+ return status;
+ }
+ };
+ return job;
+ }
+
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/change/SingleNativeDiffHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/change/SingleNativeDiffHandler.java
index 8decab5000b..ce55c2a9f2d 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/change/SingleNativeDiffHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/change/SingleNativeDiffHandler.java
@@ -1,60 +1,60 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers.change;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-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.change.ArtifactDelta;
-import org.eclipse.osee.framework.skynet.core.change.Change;
-import org.eclipse.osee.framework.skynet.core.revision.ChangeManager;
-import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
-import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
-
-/**
- * @author Jeff C. Phillips
- */
-public class SingleNativeDiffHandler extends CommandHandler {
- private ArrayList<Change> changes;
-
- @Override
- public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- changes = new ArrayList<Change>(Handlers.getArtifactChangesFromStructuredSelection(structuredSelection));
- if (changes.size() == 1) {
- Artifact sampleArtifact = changes.iterator().next().getChangeArtifact();
- return AccessControlManager.hasPermission(sampleArtifact, PermissionEnum.READ);
- }
- return false;
- }
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- Collection<ArtifactDelta> compareArtifacts = ChangeManager.getCompareArtifacts(changes);
- for (ArtifactDelta delta : compareArtifacts) {
- try {
- RendererManager.diff(delta, true);
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- 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.framework.ui.skynet.commandHandlers.change;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
+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.change.ArtifactDelta;
+import org.eclipse.osee.framework.skynet.core.change.Change;
+import org.eclipse.osee.framework.skynet.core.revision.ChangeManager;
+import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
+import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class SingleNativeDiffHandler extends CommandHandler {
+ private ArrayList<Change> changes;
+
+ @Override
+ public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
+ changes = new ArrayList<Change>(Handlers.getArtifactChangesFromStructuredSelection(structuredSelection));
+ if (changes.size() == 1) {
+ Artifact sampleArtifact = changes.iterator().next().getChangeArtifact();
+ return AccessControlManager.hasPermission(sampleArtifact, PermissionEnum.READ);
+ }
+ return false;
+ }
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ Collection<ArtifactDelta> compareArtifacts = ChangeManager.getCompareArtifacts(changes);
+ for (ArtifactDelta delta : compareArtifacts) {
+ try {
+ RendererManager.diff(delta, true);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ return null;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/change/ViewWordChangeReportHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/change/ViewWordChangeReportHandler.java
index c95d708674a..2f532193893 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/change/ViewWordChangeReportHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/change/ViewWordChangeReportHandler.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.framework.ui.skynet.commandHandlers.change;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.core.operation.IOperation;
-import org.eclipse.osee.framework.core.operation.Operations;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.change.Change;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordChangeReportOperation;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Paul K. Waldfogel
- * @author Jeff C. Phillips
- */
-public class ViewWordChangeReportHandler extends AbstractHandler {
-
- private Collection<Change> changes;
-
- @Override
- public Object execute(ExecutionEvent event) {
- try {
- ISelectionProvider selectionProvider =
- AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
-
- if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
-
- List<Change> localChanges = Handlers.getArtifactChangesFromStructuredSelection(structuredSelection);
-
- changes = new ArrayList<Change>(localChanges.size());
-
- Set<Artifact> artifacts = new HashSet<Artifact>();
- for (Change change : localChanges) {
- Artifact artifact = change.getChangeArtifact();
- if (!artifacts.contains(artifact)) {
- artifacts.add(artifact);
- changes.add(change);
- }
- }
- IOperation operation = new WordChangeReportOperation(changes, false, null);
- Operations.executeAsJob(operation, true);
- }
- } catch (Exception ex) {
- OseeLog.log(getClass(), OseeLevel.SEVERE_POPUP, ex);
- }
-
- return null;
- }
-
- @Override
- public boolean isEnabled() {
- if (PlatformUI.getWorkbench().isClosing()) {
- return false;
- }
- boolean isEnabled = false;
-
- try {
- ISelectionProvider selectionProvider =
- AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
- isEnabled = !selectionProvider.getSelection().isEmpty();
-
- } catch (Exception ex) {
- OseeLog.log(getClass(), OseeLevel.SEVERE_POPUP, ex);
- }
-
- return isEnabled;
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers.change;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.core.operation.IOperation;
+import org.eclipse.osee.framework.core.operation.Operations;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.change.Change;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
+import org.eclipse.osee.framework.ui.skynet.render.word.WordChangeReportOperation;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Paul K. Waldfogel
+ * @author Jeff C. Phillips
+ */
+public class ViewWordChangeReportHandler extends AbstractHandler {
+
+ private Collection<Change> changes;
+
+ @Override
+ public Object execute(ExecutionEvent event) {
+ try {
+ ISelectionProvider selectionProvider =
+ AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
+
+ if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
+
+ List<Change> localChanges = Handlers.getArtifactChangesFromStructuredSelection(structuredSelection);
+
+ changes = new ArrayList<Change>(localChanges.size());
+
+ Set<Artifact> artifacts = new HashSet<Artifact>();
+ for (Change change : localChanges) {
+ Artifact artifact = change.getChangeArtifact();
+ if (!artifacts.contains(artifact)) {
+ artifacts.add(artifact);
+ changes.add(change);
+ }
+ }
+ IOperation operation = new WordChangeReportOperation(changes, false, null);
+ Operations.executeAsJob(operation, true);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(getClass(), OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ return null;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ if (PlatformUI.getWorkbench().isClosing()) {
+ return false;
+ }
+ boolean isEnabled = false;
+
+ try {
+ ISelectionProvider selectionProvider =
+ AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
+ isEnabled = !selectionProvider.getSelection().isEmpty();
+
+ } catch (Exception ex) {
+ OseeLog.log(getClass(), OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ return isEnabled;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/merge/BranchIdParameter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/merge/BranchIdParameter.java
index 50c2577998b..491c4f47ed5 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/merge/BranchIdParameter.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/merge/BranchIdParameter.java
@@ -8,31 +8,31 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers.merge;
-
+package org.eclipse.osee.framework.ui.skynet.commandHandlers.merge;
+
import org.eclipse.core.commands.IParameter;
import org.eclipse.core.commands.IParameterValues;
import org.eclipse.core.commands.ParameterValuesException;
import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView;
-
-/**
- * @author Jeff C. Phillips
- *
- */
-public class BranchIdParameter implements IParameter {
- public String getId() {
- return BranchView.BRANCH_ID;
- }
-
- public String getName() {
- return "Branch Id";
- }
-
- public IParameterValues getValues() throws ParameterValuesException {
- throw new ParameterValuesException("Branch View has no parameters", null);
- }
-
- public boolean isOptional() {
- return false;
- }
-}
+
+/**
+ * @author Jeff C. Phillips
+ *
+ */
+public class BranchIdParameter implements IParameter {
+ public String getId() {
+ return BranchView.BRANCH_ID;
+ }
+
+ public String getName() {
+ return "Branch Id";
+ }
+
+ public IParameterValues getValues() throws ParameterValuesException {
+ throw new ParameterValuesException("Branch View has no parameters", null);
+ }
+
+ public boolean isOptional() {
+ return false;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/merge/MergeCompoundContributionItem.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/merge/MergeCompoundContributionItem.java
index 6e3f8c88849..ca47b10a7c0 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/merge/MergeCompoundContributionItem.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/merge/MergeCompoundContributionItem.java
@@ -1,124 +1,124 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers.merge;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import org.eclipse.core.commands.Command;
-import org.eclipse.core.commands.IParameter;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.skynet.core.revision.ConflictManagerInternal;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
-import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView;
-import org.eclipse.swt.SWT;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.CompoundContributionItem;
-import org.eclipse.ui.commands.ICommandService;
-import org.eclipse.ui.menus.CommandContributionItem;
-import org.eclipse.ui.menus.CommandContributionItemParameter;
-
-/**
- * Dynamically provides a list of merge branches based on a selected branch
- *
- * @author Jeff C. Phillips
- * @author Theron Virgin
- */
-public class MergeCompoundContributionItem extends CompoundContributionItem {
- private static final IParameter[] BRANCH_PARAMETER_DEF = new IParameter[] {new BranchIdParameter()};
- private ICommandService commandService;
-
- public MergeCompoundContributionItem() {
- this.commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
- }
-
- public MergeCompoundContributionItem(String id) {
- super(id);
- }
-
- @Override
- protected IContributionItem[] getContributionItems() {
- ISelectionProvider selectionProvider =
- AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
- ArrayList<IContributionItem> contributionItems = new ArrayList<IContributionItem>(40);
-
- if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
- List<Branch> branches = Handlers.getBranchesFromStructuredSelection(structuredSelection);
-
- if (!branches.isEmpty()) {
- Branch selectedBranch = branches.iterator().next();
- if (selectedBranch != null) {
- try {
- Collection<Integer> destBranches =
- ConflictManagerInternal.getDestinationBranchesMerged(selectedBranch.getId());
- if (selectedBranch.getParentBranch() != null && !destBranches.contains(selectedBranch.getParentBranch().getId())) {
- destBranches.add(selectedBranch.getParentBranch().getId());
- }
-
- String commandId = "org.eclipse.osee.framework.ui.skynet.branch.BranchView.mergeManager";
- Command command = configCommandParameter(commandId);
- CommandContributionItem contributionItem = null;
-
- for (Integer branchId : destBranches) {
- contributionItem = createCommand(branchId, commandId);
-
- if (command != null && command.isEnabled()) {
- contributionItems.add(contributionItem);
- }
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- }
- }
- return contributionItems.toArray(new IContributionItem[0]);
- }
-
- private CommandContributionItem createCommand(Integer branchId, String commandId) throws OseeCoreException {
- Map<String, String> parameters = new HashMap<String, String>();
- parameters.put(BranchView.BRANCH_ID, Integer.toString(branchId));
- CommandContributionItem contributionItem;
- String label = branchId == 0 ? "Can't Merge a Root Branch" : BranchManager.getBranch(branchId).getName();
-
- contributionItem =
- new CommandContributionItem(new CommandContributionItemParameter(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow(), label, commandId, parameters, null, null, null,
- label, null, null, SWT.NONE, null, false));
-
- return contributionItem;
- }
-
- private Command configCommandParameter(String commandId) {
- Command command = commandService.getCommand(commandId);
-
- try {
- command.define(command.getName(), "", commandService.getCategory("org.eclipse.debug.ui.category.run"),
- BRANCH_PARAMETER_DEF);
- } catch (NotDefinedException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- return command;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers.merge;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.IParameter;
+import org.eclipse.core.commands.common.NotDefinedException;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.skynet.core.revision.ConflictManagerInternal;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
+import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView;
+import org.eclipse.swt.SWT;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.CompoundContributionItem;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.menus.CommandContributionItem;
+import org.eclipse.ui.menus.CommandContributionItemParameter;
+
+/**
+ * Dynamically provides a list of merge branches based on a selected branch
+ *
+ * @author Jeff C. Phillips
+ * @author Theron Virgin
+ */
+public class MergeCompoundContributionItem extends CompoundContributionItem {
+ private static final IParameter[] BRANCH_PARAMETER_DEF = new IParameter[] {new BranchIdParameter()};
+ private ICommandService commandService;
+
+ public MergeCompoundContributionItem() {
+ this.commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
+ }
+
+ public MergeCompoundContributionItem(String id) {
+ super(id);
+ }
+
+ @Override
+ protected IContributionItem[] getContributionItems() {
+ ISelectionProvider selectionProvider =
+ AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider();
+ ArrayList<IContributionItem> contributionItems = new ArrayList<IContributionItem>(40);
+
+ if (selectionProvider != null && selectionProvider.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selectionProvider.getSelection();
+ List<Branch> branches = Handlers.getBranchesFromStructuredSelection(structuredSelection);
+
+ if (!branches.isEmpty()) {
+ Branch selectedBranch = branches.iterator().next();
+ if (selectedBranch != null) {
+ try {
+ Collection<Integer> destBranches =
+ ConflictManagerInternal.getDestinationBranchesMerged(selectedBranch.getId());
+ if (selectedBranch.getParentBranch() != null && !destBranches.contains(selectedBranch.getParentBranch().getId())) {
+ destBranches.add(selectedBranch.getParentBranch().getId());
+ }
+
+ String commandId = "org.eclipse.osee.framework.ui.skynet.branch.BranchView.mergeManager";
+ Command command = configCommandParameter(commandId);
+ CommandContributionItem contributionItem = null;
+
+ for (Integer branchId : destBranches) {
+ contributionItem = createCommand(branchId, commandId);
+
+ if (command != null && command.isEnabled()) {
+ contributionItems.add(contributionItem);
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ }
+ return contributionItems.toArray(new IContributionItem[0]);
+ }
+
+ private CommandContributionItem createCommand(Integer branchId, String commandId) throws OseeCoreException {
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put(BranchView.BRANCH_ID, Integer.toString(branchId));
+ CommandContributionItem contributionItem;
+ String label = branchId == 0 ? "Can't Merge a Root Branch" : BranchManager.getBranch(branchId).getName();
+
+ contributionItem =
+ new CommandContributionItem(new CommandContributionItemParameter(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow(), label, commandId, parameters, null, null, null,
+ label, null, null, SWT.NONE, null, false));
+
+ return contributionItem;
+ }
+
+ private Command configCommandParameter(String commandId) {
+ Command command = commandService.getCommand(commandId);
+
+ try {
+ command.define(command.getName(), "", commandService.getCategory("org.eclipse.debug.ui.category.run"),
+ BRANCH_PARAMETER_DEF);
+ } catch (NotDefinedException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ return command;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/merge/MergeManagerHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/merge/MergeManagerHandler.java
index 9ddc3d9e9d1..e289219efb3 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/merge/MergeManagerHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/merge/MergeManagerHandler.java
@@ -1,86 +1,86 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.commandHandlers.merge;
-
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.IStructuredSelection;
-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.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.skynet.core.artifact.IATSArtifact;
-import org.eclipse.osee.framework.skynet.core.revision.ConflictManagerInternal;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
-import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView;
-import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeView;
-
-/**
- * @author Jeff C. Phillips
- * @author Theron Virgin
- */
-public class MergeManagerHandler extends CommandHandler {
-
- @Override
- public Object execute(ExecutionEvent arg0) throws ExecutionException {
- IStructuredSelection selection =
- (IStructuredSelection) AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider().getSelection();
-
- if (!selection.isEmpty()) {
- List<Branch> branches = Handlers.getBranchesFromStructuredSelection(selection);
-
- if (!branches.isEmpty()) {
- Branch selectedBranch = branches.iterator().next();
- try {
- Branch toBranch = BranchManager.getBranch(Integer.parseInt(arg0.getParameter(BranchView.BRANCH_ID)));
- if (selectedBranch != null && toBranch != null) {
- MergeView.openView(selectedBranch, toBranch, selectedBranch.getBaseTransaction());
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- }
- return null;
- }
-
- @Override
- public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- boolean enabled = false;
- if (!structuredSelection.isEmpty()) {
- List<Branch> branches = Handlers.getBranchesFromStructuredSelection(structuredSelection);
-
- if (!branches.isEmpty()) {
- Branch selectedBranch = branches.iterator().next();
- try {
- if (selectedBranch != null && !ConflictManagerInternal.getDestinationBranchesMerged(
- selectedBranch.getId()).isEmpty()) {
- enabled = true;
- } else {
- enabled =
- selectedBranch != null && !(BranchManager.getAssociatedArtifact(selectedBranch) instanceof IATSArtifact) && selectedBranch.hasParentBranch();
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
-
- return 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.framework.ui.skynet.commandHandlers.merge;
+
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+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.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.skynet.core.artifact.IATSArtifact;
+import org.eclipse.osee.framework.skynet.core.revision.ConflictManagerInternal;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.util.CommandHandler;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
+import org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView;
+import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeView;
+
+/**
+ * @author Jeff C. Phillips
+ * @author Theron Virgin
+ */
+public class MergeManagerHandler extends CommandHandler {
+
+ @Override
+ public Object execute(ExecutionEvent arg0) throws ExecutionException {
+ IStructuredSelection selection =
+ (IStructuredSelection) AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider().getSelection();
+
+ if (!selection.isEmpty()) {
+ List<Branch> branches = Handlers.getBranchesFromStructuredSelection(selection);
+
+ if (!branches.isEmpty()) {
+ Branch selectedBranch = branches.iterator().next();
+ try {
+ Branch toBranch = BranchManager.getBranch(Integer.parseInt(arg0.getParameter(BranchView.BRANCH_ID)));
+ if (selectedBranch != null && toBranch != null) {
+ MergeView.openView(selectedBranch, toBranch, selectedBranch.getBaseTransaction());
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
+ boolean enabled = false;
+ if (!structuredSelection.isEmpty()) {
+ List<Branch> branches = Handlers.getBranchesFromStructuredSelection(structuredSelection);
+
+ if (!branches.isEmpty()) {
+ Branch selectedBranch = branches.iterator().next();
+ try {
+ if (selectedBranch != null && !ConflictManagerInternal.getDestinationBranchesMerged(
+ selectedBranch.getId()).isEmpty()) {
+ enabled = true;
+ } else {
+ enabled =
+ selectedBranch != null && !(BranchManager.getAssociatedArtifact(selectedBranch) instanceof IATSArtifact) && selectedBranch.hasParentBranch();
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+
+ return enabled;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/AbstractEditorHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/AbstractEditorHandler.java
index 913ae54c939..6608b58722a 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/AbstractEditorHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/AbstractEditorHandler.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.framework.ui.skynet.commandHandlers.renderer.handlers;
-
-import java.util.List;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-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.CommandHandler;
-import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
-
-/**
- * This abstract class provides the basic functionality for opening renderer editors.
- *
- * @author Jeff C. Phillips
- */
-public abstract class AbstractEditorHandler extends CommandHandler {
- protected List<Artifact> artifacts;
- ISelectionProvider selectionProvider;
-
- protected PermissionEnum getPermissionLevel() {
- return PermissionEnum.READ;
- }
-
- @Override
- public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- artifacts = Handlers.getArtifactsFromStructuredSelection(structuredSelection);
- return !artifacts.isEmpty() && AccessControlManager.checkObjectListPermission(artifacts, getPermissionLevel());
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers.renderer.handlers;
+
+import java.util.List;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
+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.CommandHandler;
+import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
+
+/**
+ * This abstract class provides the basic functionality for opening renderer editors.
+ *
+ * @author Jeff C. Phillips
+ */
+public abstract class AbstractEditorHandler extends CommandHandler {
+ protected List<Artifact> artifacts;
+ ISelectionProvider selectionProvider;
+
+ protected PermissionEnum getPermissionLevel() {
+ return PermissionEnum.READ;
+ }
+
+ @Override
+ public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
+ artifacts = Handlers.getArtifactsFromStructuredSelection(structuredSelection);
+ return !artifacts.isEmpty() && AccessControlManager.checkObjectListPermission(artifacts, getPermissionLevel());
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/ArtifactEditorHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/ArtifactEditorHandler.java
index c65a4337b13..65f2f4baba4 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/ArtifactEditorHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/ArtifactEditorHandler.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.framework.ui.skynet.commandHandlers.renderer.handlers;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
-import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
-
-/**
- * Opens an artifact editor as long as the user has Read permission
- *
- * @author Jeff C. Phillips
- */
-public class ArtifactEditorHandler extends AbstractEditorHandler {
- @Override
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers.renderer.handlers;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
+import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
+
+/**
+ * Opens an artifact editor as long as the user has Read permission
+ *
+ * @author Jeff C. Phillips
+ */
+public class ArtifactEditorHandler extends AbstractEditorHandler {
+ @Override
public Object execute(ExecutionEvent myExecutionEvent) {
RendererManager.openInJob(artifacts, PresentationType.GENERALIZED_EDIT);
- return null;
- }
-}
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/NativeEditorHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/NativeEditorHandler.java
index 68bc36c4677..8c2189b7dc9 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/NativeEditorHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/NativeEditorHandler.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.framework.ui.skynet.commandHandlers.renderer.handlers;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
-import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
-
-/**
- * @author Jeff C. Phillips
- */
-public class NativeEditorHandler extends AbstractEditorHandler {
-
- @Override
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers.renderer.handlers;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
+import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class NativeEditorHandler extends AbstractEditorHandler {
+
+ @Override
public Object execute(ExecutionEvent event) {
RendererManager.openInJob(artifacts, PresentationType.SPECIALIZED_EDIT);
dispose();
- return null;
- }
-
+ return null;
+ }
+
@Override
protected PermissionEnum getPermissionLevel() {
return PermissionEnum.WRITE;
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/NativePreviewEditorHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/NativePreviewEditorHandler.java
index ffa465426a8..573811dd948 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/NativePreviewEditorHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/NativePreviewEditorHandler.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers.renderer.handlers;
-
-import java.util.logging.Level;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.skynet.render.NativeRenderer;
-import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
-
-/**
- * @author Jeff C. Phillips
- */
-public class NativePreviewEditorHandler extends AbstractEditorHandler {
-
- @Override
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers.renderer.handlers;
+
+import java.util.logging.Level;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.skynet.render.NativeRenderer;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class NativePreviewEditorHandler extends AbstractEditorHandler {
+
+ @Override
public Object execute(ExecutionEvent event) {
- if (!artifacts.isEmpty()) {
- try {
- NativeRenderer renderer = new NativeRenderer();
+ if (!artifacts.isEmpty()) {
+ try {
+ NativeRenderer renderer = new NativeRenderer();
renderer.open(artifacts, PresentationType.PREVIEW);
- dispose();
-
- } catch (OseeCoreException ex) {
- OseeLog.log(WordEditorHandler.class, Level.SEVERE, ex);
- }
- }
- return null;
- }
+ dispose();
+
+ } catch (OseeCoreException ex) {
+ OseeLog.log(WordEditorHandler.class, Level.SEVERE, ex);
+ }
+ }
+ return null;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/OpenHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/OpenHandler.java
index 08d0e0b03d5..90d101197ec 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/OpenHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/OpenHandler.java
@@ -1,27 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers.renderer.handlers;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
-import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
-
-/**
- * @author Jeff C. Phillips
- */
-public class OpenHandler extends AbstractEditorHandler {
- @Override
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers.renderer.handlers;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
+import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class OpenHandler extends AbstractEditorHandler {
+ @Override
public Object execute(ExecutionEvent event) {
RendererManager.openInJob(artifacts, PresentationType.DEFAULT_OPEN);
dispose();
- return null;
- }
-}
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/OtherEditorHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/OtherEditorHandler.java
index 72769f1a1f7..93ceaa8226a 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/OtherEditorHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/OtherEditorHandler.java
@@ -1,104 +1,104 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers.renderer.handlers;
-
-import java.util.logging.Level;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.window.Window;
-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.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.render.NativeRenderer;
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorRegistry;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.EditorSelectionDialog;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.internal.WorkbenchPage;
-import org.eclipse.ui.part.FileEditorInput;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OtherEditorHandler extends AbstractEditorHandler {
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- if (!artifacts.isEmpty()) {
- try {
- EditorSelectionDialog dialog =
- new EditorSelectionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
- dialog.setMessage(String.format("Choose the editor for opening %s", artifacts));
-
- NativeRenderer renderer = new NativeRenderer();
-
- // String dummyName = renderer.getAssociatedExtension(artifacts.iterator().next());
- // IEditorDescriptor[] editorDescriptors = getEditorDescriptorFilters(dummyName);
- // if (editorDescriptors != null) {
- // // dialog.setEditorsToFilter(editorDescriptors);
- // }
- if (dialog.open() == Window.OK) {
- IEditorDescriptor editor = dialog.getSelectedEditor();
- if (editor != null) {
- IFile file = renderer.getRenderedFileForOpen(artifacts);
- openEditor(editor, file, editor.isOpenExternal());
- }
- }
- dispose();
- } catch (OseeCoreException ex) {
- OseeLog.log(WordEditorHandler.class, Level.SEVERE, ex);
- }
- }
- return null;
- }
-
- // private IEditorDescriptor[] getEditorDescriptorFilters(String name) {
- // IEditorDescriptor[] toReturn;
- // IEditorDescriptor[] editorDescriptors = PlatformUI.getWorkbench().getEditorRegistry().getEditors(name);
- // if (editorDescriptors != null) {
- // Set<IEditorDescriptor> allEditors = new HashSet<IEditorDescriptor>();
- // EditorRegistry registry = (EditorRegistry) PlatformUI.getWorkbench().getEditorRegistry();
- // allEditors.addAll(Arrays.asList(registry.getSortedEditorsFromPlugins()));
- // allEditors.addAll(Arrays.asList(registry.getSortedEditorsFromOS()));
- // List<IEditorDescriptor> filter = Collections.setComplement(allEditors, Arrays.asList(editorDescriptors));
- // toReturn = filter.toArray(new IEditorDescriptor[filter.size()]);
- // } else {
- // toReturn = new IEditorDescriptor[0];
- // }
- // return toReturn;
- // }
-
- private void openEditor(IEditorDescriptor editor, IFile file, boolean openUsingDescriptor) {
- if (file == null) {
- return;
- }
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- try {
- if (openUsingDescriptor) {
- ((WorkbenchPage) page).openEditorFromDescriptor(new FileEditorInput(file), editor, true, null);
- } else {
- String editorId = editor == null ? IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID : editor.getId();
-
- page.openEditor(new FileEditorInput(file), editorId, true,
- IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID);
- // only remember the default editor if the open succeeds
- IDE.setDefaultEditor(file, editorId);
- }
- } catch (PartInitException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, "Open Editor Error", 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.framework.ui.skynet.commandHandlers.renderer.handlers;
+
+import java.util.logging.Level;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.window.Window;
+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.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.render.NativeRenderer;
+import org.eclipse.ui.IEditorDescriptor;
+import org.eclipse.ui.IEditorRegistry;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.EditorSelectionDialog;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.internal.WorkbenchPage;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OtherEditorHandler extends AbstractEditorHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ if (!artifacts.isEmpty()) {
+ try {
+ EditorSelectionDialog dialog =
+ new EditorSelectionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+ dialog.setMessage(String.format("Choose the editor for opening %s", artifacts));
+
+ NativeRenderer renderer = new NativeRenderer();
+
+ // String dummyName = renderer.getAssociatedExtension(artifacts.iterator().next());
+ // IEditorDescriptor[] editorDescriptors = getEditorDescriptorFilters(dummyName);
+ // if (editorDescriptors != null) {
+ // // dialog.setEditorsToFilter(editorDescriptors);
+ // }
+ if (dialog.open() == Window.OK) {
+ IEditorDescriptor editor = dialog.getSelectedEditor();
+ if (editor != null) {
+ IFile file = renderer.getRenderedFileForOpen(artifacts);
+ openEditor(editor, file, editor.isOpenExternal());
+ }
+ }
+ dispose();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(WordEditorHandler.class, Level.SEVERE, ex);
+ }
+ }
+ return null;
+ }
+
+ // private IEditorDescriptor[] getEditorDescriptorFilters(String name) {
+ // IEditorDescriptor[] toReturn;
+ // IEditorDescriptor[] editorDescriptors = PlatformUI.getWorkbench().getEditorRegistry().getEditors(name);
+ // if (editorDescriptors != null) {
+ // Set<IEditorDescriptor> allEditors = new HashSet<IEditorDescriptor>();
+ // EditorRegistry registry = (EditorRegistry) PlatformUI.getWorkbench().getEditorRegistry();
+ // allEditors.addAll(Arrays.asList(registry.getSortedEditorsFromPlugins()));
+ // allEditors.addAll(Arrays.asList(registry.getSortedEditorsFromOS()));
+ // List<IEditorDescriptor> filter = Collections.setComplement(allEditors, Arrays.asList(editorDescriptors));
+ // toReturn = filter.toArray(new IEditorDescriptor[filter.size()]);
+ // } else {
+ // toReturn = new IEditorDescriptor[0];
+ // }
+ // return toReturn;
+ // }
+
+ private void openEditor(IEditorDescriptor editor, IFile file, boolean openUsingDescriptor) {
+ if (file == null) {
+ return;
+ }
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ try {
+ if (openUsingDescriptor) {
+ ((WorkbenchPage) page).openEditorFromDescriptor(new FileEditorInput(file), editor, true, null);
+ } else {
+ String editorId = editor == null ? IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID : editor.getId();
+
+ page.openEditor(new FileEditorInput(file), editorId, true,
+ IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID);
+ // only remember the default editor if the open succeeds
+ IDE.setDefaultEditor(file, editorId);
+ }
+ } catch (PartInitException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, "Open Editor Error", ex);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/PreviewTisHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/PreviewTisHandler.java
index 89e6d8a3788..c24ccda9da8 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/PreviewTisHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/PreviewTisHandler.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers.renderer.handlers;
-
-import java.util.logging.Level;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
-import org.eclipse.osee.framework.ui.skynet.render.TisRenderer;
-
-/**
- * @author Jeff C. Phillips
- */
-public class PreviewTisHandler extends AbstractEditorHandler {
-
- @Override
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers.renderer.handlers;
+
+import java.util.logging.Level;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
+import org.eclipse.osee.framework.ui.skynet.render.TisRenderer;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class PreviewTisHandler extends AbstractEditorHandler {
+
+ @Override
public Object execute(ExecutionEvent event) {
- if (!artifacts.isEmpty()) {
- try {
- TisRenderer renderer = new TisRenderer();
+ if (!artifacts.isEmpty()) {
+ try {
+ TisRenderer renderer = new TisRenderer();
renderer.open(artifacts, PresentationType.PREVIEW);
- dispose();
-
- } catch (OseeCoreException ex) {
- OseeLog.log(PreviewTisHandler.class, Level.SEVERE, ex);
- }
- }
- return null;
- }
-}
+ dispose();
+
+ } catch (OseeCoreException ex) {
+ OseeLog.log(PreviewTisHandler.class, Level.SEVERE, ex);
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/PreviewWholeWordHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/PreviewWholeWordHandler.java
index 6c69ed05d39..9575fa6ee56 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/PreviewWholeWordHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/PreviewWholeWordHandler.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers.renderer.handlers;
-
-import org.eclipse.core.commands.ExecutionEvent;
-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.skynet.render.PresentationType;
-import org.eclipse.osee.framework.ui.skynet.render.WholeDocumentRenderer;
-
-/**
- * @author Jeff C. Phillips
- */
-public class PreviewWholeWordHandler extends AbstractEditorHandler {
-
- @Override
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers.renderer.handlers;
+
+import org.eclipse.core.commands.ExecutionEvent;
+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.skynet.render.PresentationType;
+import org.eclipse.osee.framework.ui.skynet.render.WholeDocumentRenderer;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class PreviewWholeWordHandler extends AbstractEditorHandler {
+
+ @Override
public Object execute(ExecutionEvent event) {
- if (!artifacts.isEmpty()) {
- try {
- WholeDocumentRenderer renderer = new WholeDocumentRenderer();
+ if (!artifacts.isEmpty()) {
+ try {
+ WholeDocumentRenderer renderer = new WholeDocumentRenderer();
renderer.open(artifacts, PresentationType.PREVIEW);
- dispose();
-
- } catch (OseeCoreException ex) {
- OseeLog.log(PreviewWholeWordHandler.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- return null;
- }
-}
+ dispose();
+
+ } catch (OseeCoreException ex) {
+ OseeLog.log(PreviewWholeWordHandler.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/PreviewWithChildWordHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/PreviewWithChildWordHandler.java
index 16448a17684..936fdc208ad 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/PreviewWithChildWordHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/PreviewWithChildWordHandler.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.commandHandlers.renderer.handlers;
-
-import java.util.logging.Level;
-import org.eclipse.core.commands.ExecutionEvent;
-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.blam.VariableMap;
-import org.eclipse.osee.framework.ui.skynet.render.ITemplateRenderer;
-import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
-import org.eclipse.osee.framework.ui.skynet.render.WordTemplateRenderer;
-
-/**
- * @author Jeff C. Phillips
- */
-public class PreviewWithChildWordHandler extends PreviewWordHandler {
-
- @Override
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers.renderer.handlers;
+
+import java.util.logging.Level;
+import org.eclipse.core.commands.ExecutionEvent;
+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.blam.VariableMap;
+import org.eclipse.osee.framework.ui.skynet.render.ITemplateRenderer;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
+import org.eclipse.osee.framework.ui.skynet.render.WordTemplateRenderer;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class PreviewWithChildWordHandler extends PreviewWordHandler {
+
+ @Override
public Object execute(ExecutionEvent event) {
- if (!artifacts.isEmpty()) {
- try {
- WordTemplateRenderer renderer = new WordTemplateRenderer();
- renderer.setOptions(getOptions());
+ if (!artifacts.isEmpty()) {
+ try {
+ WordTemplateRenderer renderer = new WordTemplateRenderer();
+ renderer.setOptions(getOptions());
renderer.open(artifacts, PresentationType.PREVIEW);
- dispose();
-
- } catch (OseeCoreException ex) {
- OseeLog.log(PreviewWithChildWordHandler.class, Level.SEVERE, ex);
- }
- }
- return null;
- }
-
- /**
- * A subclass may override this method if they would like options to be set on the renderer
- *
- * @return
- * @throws OseeArgumentException
- */
- @Override
- protected VariableMap getOptions() throws OseeArgumentException {
- return new VariableMap(ITemplateRenderer.PREVIEW_WITH_RECURSE_OPTION_PAIR);
- }
-}
+ dispose();
+
+ } catch (OseeCoreException ex) {
+ OseeLog.log(PreviewWithChildWordHandler.class, Level.SEVERE, ex);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * A subclass may override this method if they would like options to be set on the renderer
+ *
+ * @return
+ * @throws OseeArgumentException
+ */
+ @Override
+ protected VariableMap getOptions() throws OseeArgumentException {
+ return new VariableMap(ITemplateRenderer.PREVIEW_WITH_RECURSE_OPTION_PAIR);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/PreviewWordHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/PreviewWordHandler.java
index 2120d1aaccf..a30c71e42c2 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/PreviewWordHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/PreviewWordHandler.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.framework.ui.skynet.commandHandlers.renderer.handlers;
-
-import java.util.logging.Level;
-import org.eclipse.core.commands.ExecutionEvent;
-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.blam.VariableMap;
-import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
-import org.eclipse.osee.framework.ui.skynet.render.WordTemplateRenderer;
-
-/**
- * @author Jeff C. Phillips
- */
-public class PreviewWordHandler extends AbstractEditorHandler {
-
- @Override
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers.renderer.handlers;
+
+import java.util.logging.Level;
+import org.eclipse.core.commands.ExecutionEvent;
+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.blam.VariableMap;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
+import org.eclipse.osee.framework.ui.skynet.render.WordTemplateRenderer;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class PreviewWordHandler extends AbstractEditorHandler {
+
+ @Override
public Object execute(ExecutionEvent event) {
- if (!artifacts.isEmpty()) {
- try {
- WordTemplateRenderer renderer = new WordTemplateRenderer();
- renderer.setOptions(getOptions());
+ if (!artifacts.isEmpty()) {
+ try {
+ WordTemplateRenderer renderer = new WordTemplateRenderer();
+ renderer.setOptions(getOptions());
renderer.open(artifacts, PresentationType.PREVIEW);
- dispose();
-
- } catch (OseeCoreException ex) {
- OseeLog.log(PreviewWordHandler.class, Level.SEVERE, ex);
- }
- }
- return null;
- }
-
- /**
- * A subclass may override this method if they would like options to be set on the renderer
- *
- * @return
- */
- protected VariableMap getOptions() throws OseeArgumentException {
- return null;
- }
-}
+ dispose();
+
+ } catch (OseeCoreException ex) {
+ OseeLog.log(PreviewWordHandler.class, Level.SEVERE, ex);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * A subclass may override this method if they would like options to be set on the renderer
+ *
+ * @return
+ */
+ protected VariableMap getOptions() throws OseeArgumentException {
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/WholeDocumentEditorHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/WholeDocumentEditorHandler.java
index 300ff698d1a..c46dcd7ef88 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/WholeDocumentEditorHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/WholeDocumentEditorHandler.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.framework.ui.skynet.commandHandlers.renderer.handlers;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
-import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
-
-/**
- * @author Jeff C. Phillips
- */
-public class WholeDocumentEditorHandler extends AbstractEditorHandler {
- @Override
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers.renderer.handlers;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
+import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class WholeDocumentEditorHandler extends AbstractEditorHandler {
+ @Override
public Object execute(ExecutionEvent event) {
RendererManager.openInJob(artifacts, PresentationType.SPECIALIZED_EDIT);
dispose();
- return null;
- }
-
- @Override
- protected PermissionEnum getPermissionLevel() {
- return PermissionEnum.WRITE;
- }
-}
+ return null;
+ }
+
+ @Override
+ protected PermissionEnum getPermissionLevel() {
+ return PermissionEnum.WRITE;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/WordEditorHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/WordEditorHandler.java
index f3bdb0af032..6756d57bb3d 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/WordEditorHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/renderer/handlers/WordEditorHandler.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.framework.ui.skynet.commandHandlers.renderer.handlers;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
-import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
-
-/**
- * @author Jeff C. Phillips
- */
-public class WordEditorHandler extends AbstractEditorHandler {
- @Override
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.commandHandlers.renderer.handlers;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
+import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class WordEditorHandler extends AbstractEditorHandler {
+ @Override
public Object execute(ExecutionEvent event) {
RendererManager.openInJob(artifacts, PresentationType.SPECIALIZED_EDIT);
dispose();
- return null;
- }
-
- @Override
- protected PermissionEnum getPermissionLevel() {
- return PermissionEnum.WRITE;
- }
-}
+ return null;
+ }
+
+ @Override
+ protected PermissionEnum getPermissionLevel() {
+ return PermissionEnum.WRITE;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/AttributeCompareItem.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/AttributeCompareItem.java
index 13d3935fdf3..8a9ccf1fd8b 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/AttributeCompareItem.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/AttributeCompareItem.java
@@ -8,32 +8,32 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.compare;
-
+package org.eclipse.osee.framework.ui.skynet.compare;
+
import java.util.logging.Level;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.conflict.AttributeConflict;
import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Jeff C. Phillips
- */
-public class AttributeCompareItem extends CompareItem {
- private final AttributeConflict attributeConflict;
-
- public AttributeCompareItem(AttributeConflict attributeConflict, String name, String contents, boolean isEditable, Image image) {
- super(name, contents, System.currentTimeMillis(), isEditable, image);
-
- this.attributeConflict = attributeConflict;
- }
-
- @Override
- public void persistContent() {
- try {
- attributeConflict.setAttributeValue(getStringContent());
- } catch (OseeCoreException ex) {
- OseeLog.log(AttributeCompareItem.class, Level.SEVERE, ex);
- }
- }
-}
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class AttributeCompareItem extends CompareItem {
+ private final AttributeConflict attributeConflict;
+
+ public AttributeCompareItem(AttributeConflict attributeConflict, String name, String contents, boolean isEditable, Image image) {
+ super(name, contents, System.currentTimeMillis(), isEditable, image);
+
+ this.attributeConflict = attributeConflict;
+ }
+
+ @Override
+ public void persistContent() {
+ try {
+ attributeConflict.setAttributeValue(getStringContent());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AttributeCompareItem.class, Level.SEVERE, ex);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/CompareHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/CompareHandler.java
index 60cf218b6d8..379ec998b04 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/CompareHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/CompareHandler.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.framework.ui.skynet.compare;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareUI;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-
-/**
- * @author Jeff C. Phillips
- *
- */
-public class CompareHandler {
- private final CompareItem leftCompareItem;
- private final CompareItem rightCompareItem;
- private final CompareItem parentCompareItem;
-
- /**
- * The left string is the 'Was' content and the right is the 'Is" content
- */
- public CompareHandler(String left, String right){
- this(new CompareItem("Was", left, System.currentTimeMillis()), new CompareItem("Is", right, System.currentTimeMillis()), null);
- }
-
- public CompareHandler(CompareItem leftCompareItem, CompareItem rightCompareItem, CompareItem parentCompareItem){
- this.leftCompareItem = leftCompareItem;
- this.rightCompareItem = rightCompareItem;
- this.parentCompareItem = parentCompareItem;
- }
-
- public void compare(){
- CompareConfiguration compareConfiguration = new CompareConfiguration();
- compareConfiguration.setLeftEditable(leftCompareItem.isEditable());
- compareConfiguration.setRightEditable(rightCompareItem.isEditable());
-
- CompareUI.openCompareEditorOnPage(new CompareInput(compareConfiguration, leftCompareItem, rightCompareItem, parentCompareItem), AWorkbench.getActivePage());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.compare;
+
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.compare.CompareUI;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+
+/**
+ * @author Jeff C. Phillips
+ *
+ */
+public class CompareHandler {
+ private final CompareItem leftCompareItem;
+ private final CompareItem rightCompareItem;
+ private final CompareItem parentCompareItem;
+
+ /**
+ * The left string is the 'Was' content and the right is the 'Is" content
+ */
+ public CompareHandler(String left, String right){
+ this(new CompareItem("Was", left, System.currentTimeMillis()), new CompareItem("Is", right, System.currentTimeMillis()), null);
+ }
+
+ public CompareHandler(CompareItem leftCompareItem, CompareItem rightCompareItem, CompareItem parentCompareItem){
+ this.leftCompareItem = leftCompareItem;
+ this.rightCompareItem = rightCompareItem;
+ this.parentCompareItem = parentCompareItem;
+ }
+
+ public void compare(){
+ CompareConfiguration compareConfiguration = new CompareConfiguration();
+ compareConfiguration.setLeftEditable(leftCompareItem.isEditable());
+ compareConfiguration.setRightEditable(rightCompareItem.isEditable());
+
+ CompareUI.openCompareEditorOnPage(new CompareInput(compareConfiguration, leftCompareItem, rightCompareItem, parentCompareItem), AWorkbench.getActivePage());
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/CompareInput.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/CompareInput.java
index e6977af0f44..1d8f2096946 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/CompareInput.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/CompareInput.java
@@ -1,77 +1,77 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.compare;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * @author Jeff C. Phillips
- */
-public class CompareInput extends CompareEditorInput {
- private static final String CONFIRM_SAVE_PROPERTY = "org.eclipse.compare.internal.CONFIRM_SAVE_PROPERTY";
- private final CompareItem leftCompareItem;
- private final CompareItem rightCompareItem;
- private final CompareItem parentCompareItem;
- private Object differences;
-
- public CompareInput(CompareConfiguration compareConfiguration, CompareItem leftCompareItem, CompareItem rightCompareItem, CompareItem parentCompareItem) {
- super(compareConfiguration);
-
- this.leftCompareItem = leftCompareItem;
- this.rightCompareItem = rightCompareItem;
- this.parentCompareItem = parentCompareItem;
-
- getCompareConfiguration().setProperty(CONFIRM_SAVE_PROPERTY, Boolean.TRUE);
- getCompareConfiguration().setProperty(CompareConfiguration.USE_OUTLINE_VIEW, Boolean.TRUE);
- }
-
- @Override
- protected Object prepareInput(IProgressMonitor pm) {
- initTitle();
-
- Differencer differencer = new Differencer();
- differences =
- differencer.findDifferences(parentCompareItem != null, pm, null, parentCompareItem, leftCompareItem,
- rightCompareItem);
- return differences;
- }
-
- private void initTitle() {
- CompareConfiguration configuration = getCompareConfiguration();
- String nameLeft = leftCompareItem.getName();
- String nameRight = rightCompareItem.getName();
-
- configuration.setLeftLabel(nameLeft);
- configuration.setLeftImage(leftCompareItem.getImage());
-
- configuration.setRightLabel(nameRight);
- configuration.setRightImage(rightCompareItem.getImage());
- setTitle("Compare (" + nameLeft + " - " + nameRight + ")");
- }
-
- @Override
- public void saveChanges(IProgressMonitor monitor) throws CoreException {
- super.saveChanges(monitor);
- leftCompareItem.persistContent();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof CompareInput) {
- return super.equals(obj);
- }
- 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.framework.ui.skynet.compare;
+
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.compare.CompareEditorInput;
+import org.eclipse.compare.structuremergeviewer.Differencer;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class CompareInput extends CompareEditorInput {
+ private static final String CONFIRM_SAVE_PROPERTY = "org.eclipse.compare.internal.CONFIRM_SAVE_PROPERTY";
+ private final CompareItem leftCompareItem;
+ private final CompareItem rightCompareItem;
+ private final CompareItem parentCompareItem;
+ private Object differences;
+
+ public CompareInput(CompareConfiguration compareConfiguration, CompareItem leftCompareItem, CompareItem rightCompareItem, CompareItem parentCompareItem) {
+ super(compareConfiguration);
+
+ this.leftCompareItem = leftCompareItem;
+ this.rightCompareItem = rightCompareItem;
+ this.parentCompareItem = parentCompareItem;
+
+ getCompareConfiguration().setProperty(CONFIRM_SAVE_PROPERTY, Boolean.TRUE);
+ getCompareConfiguration().setProperty(CompareConfiguration.USE_OUTLINE_VIEW, Boolean.TRUE);
+ }
+
+ @Override
+ protected Object prepareInput(IProgressMonitor pm) {
+ initTitle();
+
+ Differencer differencer = new Differencer();
+ differences =
+ differencer.findDifferences(parentCompareItem != null, pm, null, parentCompareItem, leftCompareItem,
+ rightCompareItem);
+ return differences;
+ }
+
+ private void initTitle() {
+ CompareConfiguration configuration = getCompareConfiguration();
+ String nameLeft = leftCompareItem.getName();
+ String nameRight = rightCompareItem.getName();
+
+ configuration.setLeftLabel(nameLeft);
+ configuration.setLeftImage(leftCompareItem.getImage());
+
+ configuration.setRightLabel(nameRight);
+ configuration.setRightImage(rightCompareItem.getImage());
+ setTitle("Compare (" + nameLeft + " - " + nameRight + ")");
+ }
+
+ @Override
+ public void saveChanges(IProgressMonitor monitor) throws CoreException {
+ super.saveChanges(monitor);
+ leftCompareItem.persistContent();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof CompareInput) {
+ return super.equals(obj);
+ }
+ return false;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/CompareItem.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/CompareItem.java
index f50fa308edb..60f86a77b22 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/CompareItem.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/compare/CompareItem.java
@@ -1,96 +1,96 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.compare;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import org.eclipse.compare.IEditableContent;
-import org.eclipse.compare.IModificationDate;
-import org.eclipse.compare.IStreamContentAccessor;
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Jeff C. Phillips
- */
-public class CompareItem implements IStreamContentAccessor, ITypedElement, IModificationDate, IEditableContent {
- private String contents;
- private final String name;
- private final boolean isEditable;
- private final long time;
- private final Image image;
-
- public CompareItem(String name, String contents, long time) {
- this(name, contents, time, false, null);
- }
-
- CompareItem(String name, String contents, long time, boolean isEditable, Image image) {
- this.name = name;
- this.contents = contents;
- this.time = time;
- this.isEditable = isEditable;
- this.image = image;
- }
-
- public InputStream getContents() throws CoreException {
- try {
- return new ByteArrayInputStream(contents.getBytes("UTF-8"));
- } catch (UnsupportedEncodingException ex) {
- throw new RuntimeException(ex);
- }
- }
-
- public Image getImage() {
- return image;
- }
-
- public boolean isEditable() {
- return isEditable;
- }
-
- public long getModificationDate() {
- return time;
- }
-
- public String getName() {
- return name;
- }
-
- public String getStringContent() {
- return contents;
- }
-
- public String getType() {
- return ITypedElement.TEXT_TYPE;
- }
-
- @Override
- public ITypedElement replace(ITypedElement dest, ITypedElement src) {
- return null;
- }
-
- @Override
- public void setContent(byte[] newContent) {
- try {
- this.contents = new String(newContent, "UTF-8");
- } catch (UnsupportedEncodingException ex) {
- throw new RuntimeException(ex);
- }
- }
-
- /**
- * This method must be overridden by a subclass if they want to be notified when the compare editor has been saved
- */
- public void persistContent() {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.compare;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import org.eclipse.compare.IEditableContent;
+import org.eclipse.compare.IModificationDate;
+import org.eclipse.compare.IStreamContentAccessor;
+import org.eclipse.compare.ITypedElement;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class CompareItem implements IStreamContentAccessor, ITypedElement, IModificationDate, IEditableContent {
+ private String contents;
+ private final String name;
+ private final boolean isEditable;
+ private final long time;
+ private final Image image;
+
+ public CompareItem(String name, String contents, long time) {
+ this(name, contents, time, false, null);
+ }
+
+ CompareItem(String name, String contents, long time, boolean isEditable, Image image) {
+ this.name = name;
+ this.contents = contents;
+ this.time = time;
+ this.isEditable = isEditable;
+ this.image = image;
+ }
+
+ public InputStream getContents() throws CoreException {
+ try {
+ return new ByteArrayInputStream(contents.getBytes("UTF-8"));
+ } catch (UnsupportedEncodingException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ public Image getImage() {
+ return image;
+ }
+
+ public boolean isEditable() {
+ return isEditable;
+ }
+
+ public long getModificationDate() {
+ return time;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getStringContent() {
+ return contents;
+ }
+
+ public String getType() {
+ return ITypedElement.TEXT_TYPE;
+ }
+
+ @Override
+ public ITypedElement replace(ITypedElement dest, ITypedElement src) {
+ return null;
+ }
+
+ @Override
+ public void setContent(byte[] newContent) {
+ try {
+ this.contents = new String(newContent, "UTF-8");
+ } catch (UnsupportedEncodingException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ /**
+ * This method must be overridden by a subclass if they want to be notified when the compare editor has been saved
+ */
+ public void persistContent() {
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AbstractWordAttributeHealthOperation.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AbstractWordAttributeHealthOperation.java
index 4efdfbab525..29a71a6ba66 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AbstractWordAttributeHealthOperation.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AbstractWordAttributeHealthOperation.java
@@ -1,336 +1,336 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.dbHealth;
-
-import static org.eclipse.osee.framework.core.enums.CoreAttributeTypes.WHOLE_WORD_CONTENT;
-import static org.eclipse.osee.framework.core.enums.CoreAttributeTypes.WORD_TEMPLATE_CONTENT;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.client.ClientSessionManager;
-import org.eclipse.osee.framework.core.client.server.HttpUrlBuilderClient;
-import org.eclipse.osee.framework.core.data.IAttributeType;
-import org.eclipse.osee.framework.core.data.OseeServerContext;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.core.exception.OseeTypeDoesNotExist;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
-import org.eclipse.osee.framework.core.operation.IOperation;
-import org.eclipse.osee.framework.core.util.HttpProcessor;
-import org.eclipse.osee.framework.core.util.HttpProcessor.AcquireResult;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.plugin.core.util.OseeData;
-import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
-
-/**
- * @author Roberto E. Escobar
- */
-public abstract class AbstractWordAttributeHealthOperation extends DatabaseHealthOperation {
-
- private final String baseName;
-
- public AbstractWordAttributeHealthOperation(String name) {
- super(name);
- this.baseName = name;
- }
-
- @Override
- protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
- List<AttrData> attributesWithErrors = new ArrayList<AttrData>();
-
- IOperation operation =
- new FindAllWordAttributesNeedingFix(String.format("Find all %s enabled", baseName),
- getStatus().getPlugin(), attributesWithErrors);
- doSubWork(operation, monitor, 0.40);
-
- setItemsToFix(attributesWithErrors.size());
-
- appendToDetails(AHTML.beginMultiColumnTable(100, 1));
- appendToDetails(AHTML.addHeaderRowMultiColumnTable(new String[] {"HRID", "GAMMA ID", "URI"}));
- for (AttrData attrData : attributesWithErrors) {
- appendToDetails(AHTML.addRowMultiColumnTable(new String[] {attrData.getHrid(), attrData.getGammaId(),
- attrData.getUri()}));
- }
- appendToDetails(AHTML.endMultiColumnTable());
- monitor.worked(calculateWork(0.10));
- checkForCancelledStatus(monitor);
-
- if (isFixOperationEnabled() && getItemsToFixCount() > 0) {
- File backupFolder = OseeData.getFile(getBackUpPrefix() + Lib.getDateTimeString() + File.separator);
- backupFolder.mkdirs();
-
- int workAmount = calculateWork(0.40) / getItemsToFixCount();
- for (AttrData attrData : attributesWithErrors) {
- Resource resource = attrData.getResource();
- ResourceUtil.backupResourceLocally(backupFolder, resource);
- applyFix(attrData);
- ResourceUtil.uploadResource(attrData.getGammaId(), resource);
- monitor.worked(workAmount);
- }
- }
-
- getSummary().append(String.format("Found [%s] %s", attributesWithErrors.size(), baseName));
- monitor.worked(calculateWork(0.10));
- }
-
- protected abstract String getBackUpPrefix();
-
- protected abstract void applyFix(AttrData attrData) throws OseeCoreException;
-
- protected abstract boolean isFixRequired(AttrData attrData, Resource resource) throws OseeCoreException;
-
- private final class FindAllWordAttributesNeedingFix extends AbstractOperation {
- private static final String GET_ATTRS =
- "SELECT DISTINCT(art.human_readable_id), attr.gamma_id, attr.uri FROM osee_attribute attr, osee_artifact art WHERE attr.attr_type_id = ? AND attr.art_id = art.art_id AND attr.uri is not null AND attr.uri != '' order by attr.gamma_id asc"; // and t1.attr_id = 1155574";
-
- private final List<AttrData> attributesWithErrors;
-
- public FindAllWordAttributesNeedingFix(String operationName, String pluginId, List<AttrData> attributesWithErrors) {
- super(operationName, pluginId);
- this.attributesWithErrors = attributesWithErrors;
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- IAttributeType[] attributeTypeNames = new IAttributeType[] {WORD_TEMPLATE_CONTENT, WHOLE_WORD_CONTENT};
-
- monitor.setTaskName("Load Attribute Data");
- List<AttrData> attrDatas = new ArrayList<AttrData>();
- for (IAttributeType attributeTypeName : attributeTypeNames) {
- AttributeType attributeType = AttributeTypeManager.getType(attributeTypeName);
- attrDatas.addAll(loadAttributeData(monitor, attributeType));
- }
- monitor.worked(calculateWork(0.20));
-
- if (!attrDatas.isEmpty()) {
- int totalAttrs = attrDatas.size();
- int work = calculateWork(0.80) / totalAttrs;
- for (int index = 0; index < attrDatas.size(); index++) {
- checkForCancelledStatus(monitor);
- AttrData attrData = attrDatas.get(index);
- monitor.setTaskName(String.format("[%s of %s] - hrid[%s]", index, totalAttrs, attrData.getHrid()));
- checkAttributeData(attrData);
- int size = attributesWithErrors.size();
- if (size > 0 && size % 3000 == 0) {
- getSummary().append("Index at break: " + index + " gamma: " + attrData.getGammaId());
- break;
- }
- monitor.worked(work);
- }
- } else {
- monitor.worked(calculateWork(0.80));
- }
- }
-
- private void checkAttributeData(AttrData attrData) throws OseeCoreException {
- Resource resource = ResourceUtil.getResource(attrData.getUri());
- if (isFixRequired(attrData, resource)) {
- attrData.setResource(resource);
- attributesWithErrors.add(attrData);
- }
- }
-
- private List<AttrData> loadAttributeData(IProgressMonitor monitor, AttributeType attributeType) throws OseeDataStoreException, OseeTypeDoesNotExist {
- List<AttrData> attrData = new ArrayList<AttrData>();
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- try {
- chStmt.runPreparedQuery(GET_ATTRS, attributeType.getId());
- while (chStmt.next()) {
- checkForCancelledStatus(monitor);
- String uri = chStmt.getString("uri");
- if (Strings.isValid(uri)) {
- attrData.add(new AttrData(chStmt.getString("gamma_Id"), chStmt.getString("human_readable_id"), uri));
- }
- }
- } finally {
- chStmt.close();
- }
- return attrData;
- }
- }
-
- private final static class ResourceUtil {
- private ResourceUtil() {
- }
-
- public static Resource getResource(String resourcePath) throws OseeCoreException {
- Resource toReturn = null;
- ByteArrayOutputStream sourceOutputStream = new ByteArrayOutputStream();
- try {
- Map<String, String> parameterMap = new HashMap<String, String>();
- parameterMap.put("sessionId", ClientSessionManager.getSessionId());
- parameterMap.put("uri", resourcePath);
- String urlString =
- HttpUrlBuilderClient.getInstance().getOsgiServletServiceUrl(OseeServerContext.RESOURCE_CONTEXT,
- parameterMap);
-
- AcquireResult result = HttpProcessor.acquire(new URL(urlString), sourceOutputStream);
- if (result.getCode() == HttpURLConnection.HTTP_OK) {
- toReturn = new Resource(resourcePath, result, sourceOutputStream.toByteArray());
- }
- } catch (Exception ex) {
- OseeExceptions.wrapAndThrow(ex);
- } finally {
- try {
- sourceOutputStream.close();
- } catch (IOException ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- }
- return toReturn;
- }
-
- public static void uploadResource(String gammaId, Resource resource) throws Exception {
- String fileName = resource.resourceName;
- Map<String, String> parameterMap = new HashMap<String, String>();
- parameterMap.put("sessionId", ClientSessionManager.getSessionId());
- parameterMap.put("is.overwrite.allowed", String.valueOf(true));
- parameterMap.put("protocol", "attr");
- parameterMap.put("seed", gammaId);
-
- String extension = Lib.getExtension(fileName);
- if (Strings.isValid(extension)) {
- parameterMap.put("extension", extension);
- int charToRemove = extension.length() + 1;
- fileName = fileName.substring(0, fileName.length() - charToRemove);
- }
- parameterMap.put("name", fileName);
-
- byte[] toUpload = resource.data.getBytes(resource.encoding);
- if (resource.wasZipped) {
- toUpload = Lib.compressStream(new ByteArrayInputStream(toUpload), resource.entryName);
- }
-
- String urlString =
- HttpUrlBuilderClient.getInstance().getOsgiServletServiceUrl(OseeServerContext.RESOURCE_CONTEXT,
- parameterMap);
- HttpProcessor.put(new URL(urlString), new ByteArrayInputStream(toUpload), resource.result.getContentType(),
- resource.result.getEncoding());
- }
-
- public static void backupResourceLocally(File backupFolder, Resource resource) throws IOException {
- InputStream inputStream = null;
- OutputStream outputStream = null;
- try {
- String path = resource.sourcePath;
- path = path.replaceAll("attr://", "");
- path = path.replaceAll("/", Lib.isWindows() ? "\\\\" : "/");
- File file = new File(backupFolder, path);
- File parent = file.getParentFile();
- if (parent != null) {
- parent.mkdirs();
- }
- outputStream = new FileOutputStream(file);
-
- inputStream = new ByteArrayInputStream(resource.rawBytes);
- Lib.inputStreamToOutputStream(inputStream, outputStream);
- } finally {
- if (inputStream != null) {
- inputStream.close();
- }
- if (outputStream != null) {
- outputStream.close();
- }
- }
- }
- }
-
- protected final static class Resource {
- private final String entryName;
- private final String resourceName;
- private final AcquireResult result;
- private final byte[] rawBytes;
- private final boolean wasZipped;
- private final String sourcePath;
-
- private String data;
- private String encoding;
-
- private Resource(String sourcePath, AcquireResult result, byte[] rawBytes) throws IOException {
- this.rawBytes = rawBytes;
- this.result = result;
- int index = sourcePath.lastIndexOf('/');
- this.sourcePath = sourcePath;
- this.resourceName = sourcePath.substring(index + 1, sourcePath.length());
- this.wasZipped = result.getContentType().contains("zip");
- if (wasZipped) {
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- this.entryName = Lib.decompressStream(new ByteArrayInputStream(rawBytes), outputStream);
- this.encoding = "UTF-8";
- this.data = new String(outputStream.toByteArray(), encoding);
- } else {
- this.data = new String(rawBytes, result.getEncoding());
- this.entryName = null;
- this.encoding = result.getEncoding();
- }
- }
-
- public String getData() {
- return data;
- }
-
- public void setData(String data) {
- this.data = data;
- }
-
- }
-
- protected final static class AttrData {
- private final String gammaId;
- private final String hrid;
- private final String uri;
- private Resource resource;
-
- public AttrData(String gammaId, String hrid, String uri) {
- super();
- this.gammaId = gammaId;
- this.hrid = hrid;
- this.uri = uri;
- }
-
- public void setResource(Resource resource) {
- this.resource = resource;
- }
-
- public Resource getResource() {
- return resource;
- }
-
- public String getGammaId() {
- return gammaId;
- }
-
- public String getHrid() {
- return hrid;
- }
-
- public String getUri() {
- return uri;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.dbHealth;
+
+import static org.eclipse.osee.framework.core.enums.CoreAttributeTypes.WHOLE_WORD_CONTENT;
+import static org.eclipse.osee.framework.core.enums.CoreAttributeTypes.WORD_TEMPLATE_CONTENT;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.client.ClientSessionManager;
+import org.eclipse.osee.framework.core.client.server.HttpUrlBuilderClient;
+import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.core.data.OseeServerContext;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
+import org.eclipse.osee.framework.core.exception.OseeExceptions;
+import org.eclipse.osee.framework.core.exception.OseeTypeDoesNotExist;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.core.operation.AbstractOperation;
+import org.eclipse.osee.framework.core.operation.IOperation;
+import org.eclipse.osee.framework.core.util.HttpProcessor;
+import org.eclipse.osee.framework.core.util.HttpProcessor.AcquireResult;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.plugin.core.util.OseeData;
+import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public abstract class AbstractWordAttributeHealthOperation extends DatabaseHealthOperation {
+
+ private final String baseName;
+
+ public AbstractWordAttributeHealthOperation(String name) {
+ super(name);
+ this.baseName = name;
+ }
+
+ @Override
+ protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
+ List<AttrData> attributesWithErrors = new ArrayList<AttrData>();
+
+ IOperation operation =
+ new FindAllWordAttributesNeedingFix(String.format("Find all %s enabled", baseName),
+ getStatus().getPlugin(), attributesWithErrors);
+ doSubWork(operation, monitor, 0.40);
+
+ setItemsToFix(attributesWithErrors.size());
+
+ appendToDetails(AHTML.beginMultiColumnTable(100, 1));
+ appendToDetails(AHTML.addHeaderRowMultiColumnTable(new String[] {"HRID", "GAMMA ID", "URI"}));
+ for (AttrData attrData : attributesWithErrors) {
+ appendToDetails(AHTML.addRowMultiColumnTable(new String[] {attrData.getHrid(), attrData.getGammaId(),
+ attrData.getUri()}));
+ }
+ appendToDetails(AHTML.endMultiColumnTable());
+ monitor.worked(calculateWork(0.10));
+ checkForCancelledStatus(monitor);
+
+ if (isFixOperationEnabled() && getItemsToFixCount() > 0) {
+ File backupFolder = OseeData.getFile(getBackUpPrefix() + Lib.getDateTimeString() + File.separator);
+ backupFolder.mkdirs();
+
+ int workAmount = calculateWork(0.40) / getItemsToFixCount();
+ for (AttrData attrData : attributesWithErrors) {
+ Resource resource = attrData.getResource();
+ ResourceUtil.backupResourceLocally(backupFolder, resource);
+ applyFix(attrData);
+ ResourceUtil.uploadResource(attrData.getGammaId(), resource);
+ monitor.worked(workAmount);
+ }
+ }
+
+ getSummary().append(String.format("Found [%s] %s", attributesWithErrors.size(), baseName));
+ monitor.worked(calculateWork(0.10));
+ }
+
+ protected abstract String getBackUpPrefix();
+
+ protected abstract void applyFix(AttrData attrData) throws OseeCoreException;
+
+ protected abstract boolean isFixRequired(AttrData attrData, Resource resource) throws OseeCoreException;
+
+ private final class FindAllWordAttributesNeedingFix extends AbstractOperation {
+ private static final String GET_ATTRS =
+ "SELECT DISTINCT(art.human_readable_id), attr.gamma_id, attr.uri FROM osee_attribute attr, osee_artifact art WHERE attr.attr_type_id = ? AND attr.art_id = art.art_id AND attr.uri is not null AND attr.uri != '' order by attr.gamma_id asc"; // and t1.attr_id = 1155574";
+
+ private final List<AttrData> attributesWithErrors;
+
+ public FindAllWordAttributesNeedingFix(String operationName, String pluginId, List<AttrData> attributesWithErrors) {
+ super(operationName, pluginId);
+ this.attributesWithErrors = attributesWithErrors;
+ }
+
+ @Override
+ protected void doWork(IProgressMonitor monitor) throws Exception {
+ IAttributeType[] attributeTypeNames = new IAttributeType[] {WORD_TEMPLATE_CONTENT, WHOLE_WORD_CONTENT};
+
+ monitor.setTaskName("Load Attribute Data");
+ List<AttrData> attrDatas = new ArrayList<AttrData>();
+ for (IAttributeType attributeTypeName : attributeTypeNames) {
+ AttributeType attributeType = AttributeTypeManager.getType(attributeTypeName);
+ attrDatas.addAll(loadAttributeData(monitor, attributeType));
+ }
+ monitor.worked(calculateWork(0.20));
+
+ if (!attrDatas.isEmpty()) {
+ int totalAttrs = attrDatas.size();
+ int work = calculateWork(0.80) / totalAttrs;
+ for (int index = 0; index < attrDatas.size(); index++) {
+ checkForCancelledStatus(monitor);
+ AttrData attrData = attrDatas.get(index);
+ monitor.setTaskName(String.format("[%s of %s] - hrid[%s]", index, totalAttrs, attrData.getHrid()));
+ checkAttributeData(attrData);
+ int size = attributesWithErrors.size();
+ if (size > 0 && size % 3000 == 0) {
+ getSummary().append("Index at break: " + index + " gamma: " + attrData.getGammaId());
+ break;
+ }
+ monitor.worked(work);
+ }
+ } else {
+ monitor.worked(calculateWork(0.80));
+ }
+ }
+
+ private void checkAttributeData(AttrData attrData) throws OseeCoreException {
+ Resource resource = ResourceUtil.getResource(attrData.getUri());
+ if (isFixRequired(attrData, resource)) {
+ attrData.setResource(resource);
+ attributesWithErrors.add(attrData);
+ }
+ }
+
+ private List<AttrData> loadAttributeData(IProgressMonitor monitor, AttributeType attributeType) throws OseeDataStoreException, OseeTypeDoesNotExist {
+ List<AttrData> attrData = new ArrayList<AttrData>();
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+ try {
+ chStmt.runPreparedQuery(GET_ATTRS, attributeType.getId());
+ while (chStmt.next()) {
+ checkForCancelledStatus(monitor);
+ String uri = chStmt.getString("uri");
+ if (Strings.isValid(uri)) {
+ attrData.add(new AttrData(chStmt.getString("gamma_Id"), chStmt.getString("human_readable_id"), uri));
+ }
+ }
+ } finally {
+ chStmt.close();
+ }
+ return attrData;
+ }
+ }
+
+ private final static class ResourceUtil {
+ private ResourceUtil() {
+ }
+
+ public static Resource getResource(String resourcePath) throws OseeCoreException {
+ Resource toReturn = null;
+ ByteArrayOutputStream sourceOutputStream = new ByteArrayOutputStream();
+ try {
+ Map<String, String> parameterMap = new HashMap<String, String>();
+ parameterMap.put("sessionId", ClientSessionManager.getSessionId());
+ parameterMap.put("uri", resourcePath);
+ String urlString =
+ HttpUrlBuilderClient.getInstance().getOsgiServletServiceUrl(OseeServerContext.RESOURCE_CONTEXT,
+ parameterMap);
+
+ AcquireResult result = HttpProcessor.acquire(new URL(urlString), sourceOutputStream);
+ if (result.getCode() == HttpURLConnection.HTTP_OK) {
+ toReturn = new Resource(resourcePath, result, sourceOutputStream.toByteArray());
+ }
+ } catch (Exception ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ } finally {
+ try {
+ sourceOutputStream.close();
+ } catch (IOException ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ }
+ return toReturn;
+ }
+
+ public static void uploadResource(String gammaId, Resource resource) throws Exception {
+ String fileName = resource.resourceName;
+ Map<String, String> parameterMap = new HashMap<String, String>();
+ parameterMap.put("sessionId", ClientSessionManager.getSessionId());
+ parameterMap.put("is.overwrite.allowed", String.valueOf(true));
+ parameterMap.put("protocol", "attr");
+ parameterMap.put("seed", gammaId);
+
+ String extension = Lib.getExtension(fileName);
+ if (Strings.isValid(extension)) {
+ parameterMap.put("extension", extension);
+ int charToRemove = extension.length() + 1;
+ fileName = fileName.substring(0, fileName.length() - charToRemove);
+ }
+ parameterMap.put("name", fileName);
+
+ byte[] toUpload = resource.data.getBytes(resource.encoding);
+ if (resource.wasZipped) {
+ toUpload = Lib.compressStream(new ByteArrayInputStream(toUpload), resource.entryName);
+ }
+
+ String urlString =
+ HttpUrlBuilderClient.getInstance().getOsgiServletServiceUrl(OseeServerContext.RESOURCE_CONTEXT,
+ parameterMap);
+ HttpProcessor.put(new URL(urlString), new ByteArrayInputStream(toUpload), resource.result.getContentType(),
+ resource.result.getEncoding());
+ }
+
+ public static void backupResourceLocally(File backupFolder, Resource resource) throws IOException {
+ InputStream inputStream = null;
+ OutputStream outputStream = null;
+ try {
+ String path = resource.sourcePath;
+ path = path.replaceAll("attr://", "");
+ path = path.replaceAll("/", Lib.isWindows() ? "\\\\" : "/");
+ File file = new File(backupFolder, path);
+ File parent = file.getParentFile();
+ if (parent != null) {
+ parent.mkdirs();
+ }
+ outputStream = new FileOutputStream(file);
+
+ inputStream = new ByteArrayInputStream(resource.rawBytes);
+ Lib.inputStreamToOutputStream(inputStream, outputStream);
+ } finally {
+ if (inputStream != null) {
+ inputStream.close();
+ }
+ if (outputStream != null) {
+ outputStream.close();
+ }
+ }
+ }
+ }
+
+ protected final static class Resource {
+ private final String entryName;
+ private final String resourceName;
+ private final AcquireResult result;
+ private final byte[] rawBytes;
+ private final boolean wasZipped;
+ private final String sourcePath;
+
+ private String data;
+ private String encoding;
+
+ private Resource(String sourcePath, AcquireResult result, byte[] rawBytes) throws IOException {
+ this.rawBytes = rawBytes;
+ this.result = result;
+ int index = sourcePath.lastIndexOf('/');
+ this.sourcePath = sourcePath;
+ this.resourceName = sourcePath.substring(index + 1, sourcePath.length());
+ this.wasZipped = result.getContentType().contains("zip");
+ if (wasZipped) {
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ this.entryName = Lib.decompressStream(new ByteArrayInputStream(rawBytes), outputStream);
+ this.encoding = "UTF-8";
+ this.data = new String(outputStream.toByteArray(), encoding);
+ } else {
+ this.data = new String(rawBytes, result.getEncoding());
+ this.entryName = null;
+ this.encoding = result.getEncoding();
+ }
+ }
+
+ public String getData() {
+ return data;
+ }
+
+ public void setData(String data) {
+ this.data = data;
+ }
+
+ }
+
+ protected final static class AttrData {
+ private final String gammaId;
+ private final String hrid;
+ private final String uri;
+ private Resource resource;
+
+ public AttrData(String gammaId, String hrid, String uri) {
+ super();
+ this.gammaId = gammaId;
+ this.hrid = hrid;
+ this.uri = uri;
+ }
+
+ public void setResource(Resource resource) {
+ this.resource = resource;
+ }
+
+ public Resource getResource() {
+ return resource;
+ }
+
+ public String getGammaId() {
+ return gammaId;
+ }
+
+ public String getHrid() {
+ return hrid;
+ }
+
+ public String getUri() {
+ return uri;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/ArtifactIdWithoutVersionsCheck.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/ArtifactIdWithoutVersionsCheck.java
index 199a1ce2014..3a3657defeb 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/ArtifactIdWithoutVersionsCheck.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/ArtifactIdWithoutVersionsCheck.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.framework.ui.skynet.dbHealth;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ArtifactIdWithoutVersionsCheck extends DatabaseHealthOperation {
-
- private static final String GET_INVALID_A_ART_IDS =
- "select item.a_art_id as artId, item.rel_link_id as itemId from osee_relation_link item where NOT EXISTS (select oav.art_id from osee_artifact oav where oav.art_id = item.a_art_id)";
-
- private static final String GET_INVALID_B_ART_IDS =
- "select item.b_art_id as artId, item.rel_link_id as itemId from osee_relation_link item where NOT EXISTS (select oav.art_id from osee_artifact oav where oav.art_id = item.b_art_id)";
-
- private static final String GET_INVALID_ATTR_IDS_ART_IDS =
- "select item.art_id as artId, item.attr_id as itemId from osee_attribute item where NOT EXISTS (select oav.art_id from osee_artifact oav where oav.art_id = item.art_id)";
-
- private static final String GET_INVALID_ACL_ART_IDS =
- "select item.art_id as artId from osee_artifact_acl item where NOT EXISTS (select oav.art_id from osee_artifact oav where oav.art_id = item.art_id)";
-
- /**
- * @param operationName
- */
- public ArtifactIdWithoutVersionsCheck() {
- super("Artifact Id Without osee_artifact Table Entry");
- }
-
- @Override
- protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
- Set<Integer> allInvalidArtIds = new HashSet<Integer>();
- List<ItemEntry> itemsToDelete = new ArrayList<ItemEntry>();
-
- itemsToDelete.add(new ItemEntry("osee_relation_link", "rel_link_id", "a_art_id", //
- getInvalidEntries(monitor, allInvalidArtIds, GET_INVALID_A_ART_IDS, true)));
-
- itemsToDelete.add(new ItemEntry("osee_relation_link", "rel_link_id", "b_art_id", //
- getInvalidEntries(monitor, allInvalidArtIds, GET_INVALID_B_ART_IDS, true)));
-
- itemsToDelete.add(new ItemEntry("osee_attribute", "attr_id", "art_id", //
- getInvalidEntries(monitor, allInvalidArtIds, GET_INVALID_ATTR_IDS_ART_IDS, true)));
-
- itemsToDelete.add(new ItemEntry("osee_artifact_acl", "art_id", "art_id", //
- getInvalidEntries(monitor, allInvalidArtIds, GET_INVALID_ACL_ART_IDS, false)));
-
- int beforeArtifactCheck = allInvalidArtIds.size();
-
- setItemsToFix(allInvalidArtIds.size());
- createReport(monitor, beforeArtifactCheck, getItemsToFixCount(), itemsToDelete);
-
- if (isFixOperationEnabled() && getItemsToFixCount() > 0) {
- for (ItemEntry entry : itemsToDelete) {
- if (!entry.invalids.isEmpty()) {
- String deleteSql = String.format("delete from %s where %s = ?", entry.table, entry.itemIdName);
- List<Object[]> dataList = new ArrayList<Object[]>();
- for (Integer item : entry.invalids) {
- dataList.add(new Object[] {item});
- }
- ConnectionHandler.runBatchUpdate(deleteSql, dataList);
- }
- }
- }
- getSummary().append(String.format("Found %s invalid artIds referenced\n", getItemsToFixCount()));
- monitor.worked(calculateWork(0.50));
- }
-
- private void createReport(IProgressMonitor monitor, int totalBeforeCheck, int totalArtIds, List<ItemEntry> itemsToDelete) throws IOException {
- appendToDetails(AHTML.beginMultiColumnTable(100, 1));
- appendToDetails(AHTML.beginMultiColumnTable(100, 1));
- appendToDetails(AHTML.addHeaderRowMultiColumnTable(new String[] {"TABLE", "REFERENCED_BY", "TOTAL INVALIDS"}));
- for (ItemEntry entry : itemsToDelete) {
- appendToDetails(AHTML.addRowMultiColumnTable(new String[] {entry.table, entry.invalidField,
- String.valueOf(entry.invalids.size())}));
- }
- appendToDetails(AHTML.endMultiColumnTable());
- monitor.worked(calculateWork(0.10));
- checkForCancelledStatus(monitor);
- }
-
- private Set<Integer> getInvalidEntries(IProgressMonitor monitor, Set<Integer> allInvalidArtIds, String query, boolean hasItemId) throws OseeDataStoreException {
- Set<Integer> toReturn = new HashSet<Integer>();
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- try {
- chStmt.runPreparedQuery(query);
- while (chStmt.next()) {
- if (hasItemId) {
- toReturn.add(chStmt.getInt("itemId"));
- }
- allInvalidArtIds.add(chStmt.getInt("artId"));
- }
- } finally {
- chStmt.close();
- }
- monitor.worked(calculateWork(0.10));
- checkForCancelledStatus(monitor);
- return hasItemId ? toReturn : allInvalidArtIds;
- }
-
- private final class ItemEntry {
- private final String table;
- private final String itemIdName;
- private final String invalidField;
- private final Set<Integer> invalids;
-
- public ItemEntry(String table, String itemIdName, String invalidField, Set<Integer> invalids) {
- super();
- this.table = table;
- this.itemIdName = itemIdName;
- this.invalidField = invalidField;
- this.invalids = invalids;
- }
-
- }
-
- @Override
- public String getCheckDescription() {
- return "Verifies that artifact entries in the relation, attribute and artifact tables have a valid entry in the osee_artifact table.";
- }
-
- @Override
- public String getFixDescription() {
- return "Removes invalid data from the corresponding tables, however does not clean up any addressing that might be left behind.";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.dbHealth;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ArtifactIdWithoutVersionsCheck extends DatabaseHealthOperation {
+
+ private static final String GET_INVALID_A_ART_IDS =
+ "select item.a_art_id as artId, item.rel_link_id as itemId from osee_relation_link item where NOT EXISTS (select oav.art_id from osee_artifact oav where oav.art_id = item.a_art_id)";
+
+ private static final String GET_INVALID_B_ART_IDS =
+ "select item.b_art_id as artId, item.rel_link_id as itemId from osee_relation_link item where NOT EXISTS (select oav.art_id from osee_artifact oav where oav.art_id = item.b_art_id)";
+
+ private static final String GET_INVALID_ATTR_IDS_ART_IDS =
+ "select item.art_id as artId, item.attr_id as itemId from osee_attribute item where NOT EXISTS (select oav.art_id from osee_artifact oav where oav.art_id = item.art_id)";
+
+ private static final String GET_INVALID_ACL_ART_IDS =
+ "select item.art_id as artId from osee_artifact_acl item where NOT EXISTS (select oav.art_id from osee_artifact oav where oav.art_id = item.art_id)";
+
+ /**
+ * @param operationName
+ */
+ public ArtifactIdWithoutVersionsCheck() {
+ super("Artifact Id Without osee_artifact Table Entry");
+ }
+
+ @Override
+ protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
+ Set<Integer> allInvalidArtIds = new HashSet<Integer>();
+ List<ItemEntry> itemsToDelete = new ArrayList<ItemEntry>();
+
+ itemsToDelete.add(new ItemEntry("osee_relation_link", "rel_link_id", "a_art_id", //
+ getInvalidEntries(monitor, allInvalidArtIds, GET_INVALID_A_ART_IDS, true)));
+
+ itemsToDelete.add(new ItemEntry("osee_relation_link", "rel_link_id", "b_art_id", //
+ getInvalidEntries(monitor, allInvalidArtIds, GET_INVALID_B_ART_IDS, true)));
+
+ itemsToDelete.add(new ItemEntry("osee_attribute", "attr_id", "art_id", //
+ getInvalidEntries(monitor, allInvalidArtIds, GET_INVALID_ATTR_IDS_ART_IDS, true)));
+
+ itemsToDelete.add(new ItemEntry("osee_artifact_acl", "art_id", "art_id", //
+ getInvalidEntries(monitor, allInvalidArtIds, GET_INVALID_ACL_ART_IDS, false)));
+
+ int beforeArtifactCheck = allInvalidArtIds.size();
+
+ setItemsToFix(allInvalidArtIds.size());
+ createReport(monitor, beforeArtifactCheck, getItemsToFixCount(), itemsToDelete);
+
+ if (isFixOperationEnabled() && getItemsToFixCount() > 0) {
+ for (ItemEntry entry : itemsToDelete) {
+ if (!entry.invalids.isEmpty()) {
+ String deleteSql = String.format("delete from %s where %s = ?", entry.table, entry.itemIdName);
+ List<Object[]> dataList = new ArrayList<Object[]>();
+ for (Integer item : entry.invalids) {
+ dataList.add(new Object[] {item});
+ }
+ ConnectionHandler.runBatchUpdate(deleteSql, dataList);
+ }
+ }
+ }
+ getSummary().append(String.format("Found %s invalid artIds referenced\n", getItemsToFixCount()));
+ monitor.worked(calculateWork(0.50));
+ }
+
+ private void createReport(IProgressMonitor monitor, int totalBeforeCheck, int totalArtIds, List<ItemEntry> itemsToDelete) throws IOException {
+ appendToDetails(AHTML.beginMultiColumnTable(100, 1));
+ appendToDetails(AHTML.beginMultiColumnTable(100, 1));
+ appendToDetails(AHTML.addHeaderRowMultiColumnTable(new String[] {"TABLE", "REFERENCED_BY", "TOTAL INVALIDS"}));
+ for (ItemEntry entry : itemsToDelete) {
+ appendToDetails(AHTML.addRowMultiColumnTable(new String[] {entry.table, entry.invalidField,
+ String.valueOf(entry.invalids.size())}));
+ }
+ appendToDetails(AHTML.endMultiColumnTable());
+ monitor.worked(calculateWork(0.10));
+ checkForCancelledStatus(monitor);
+ }
+
+ private Set<Integer> getInvalidEntries(IProgressMonitor monitor, Set<Integer> allInvalidArtIds, String query, boolean hasItemId) throws OseeDataStoreException {
+ Set<Integer> toReturn = new HashSet<Integer>();
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+ try {
+ chStmt.runPreparedQuery(query);
+ while (chStmt.next()) {
+ if (hasItemId) {
+ toReturn.add(chStmt.getInt("itemId"));
+ }
+ allInvalidArtIds.add(chStmt.getInt("artId"));
+ }
+ } finally {
+ chStmt.close();
+ }
+ monitor.worked(calculateWork(0.10));
+ checkForCancelledStatus(monitor);
+ return hasItemId ? toReturn : allInvalidArtIds;
+ }
+
+ private final class ItemEntry {
+ private final String table;
+ private final String itemIdName;
+ private final String invalidField;
+ private final Set<Integer> invalids;
+
+ public ItemEntry(String table, String itemIdName, String invalidField, Set<Integer> invalids) {
+ super();
+ this.table = table;
+ this.itemIdName = itemIdName;
+ this.invalidField = invalidField;
+ this.invalids = invalids;
+ }
+
+ }
+
+ @Override
+ public String getCheckDescription() {
+ return "Verifies that artifact entries in the relation, attribute and artifact tables have a valid entry in the osee_artifact table.";
+ }
+
+ @Override
+ public String getFixDescription() {
+ return "Removes invalid data from the corresponding tables, however does not clean up any addressing that might be left behind.";
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AttributeBackingDataCheck.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AttributeBackingDataCheck.java
index 4c1e5281a33..ffb6ea701db 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AttributeBackingDataCheck.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AttributeBackingDataCheck.java
@@ -1,172 +1,172 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.dbHealth;
-
-import java.io.ByteArrayOutputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.osee.framework.core.client.ClientSessionManager;
-import org.eclipse.osee.framework.core.client.server.HttpUrlBuilderClient;
-import org.eclipse.osee.framework.core.data.OseeServerContext;
-import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.framework.core.exception.OseeTypeDoesNotExist;
-import org.eclipse.osee.framework.core.util.HttpProcessor;
-import org.eclipse.osee.framework.core.util.HttpProcessor.AcquireResult;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-
-/**
- * @author Roberto E. Escobar
- */
-public class AttributeBackingDataCheck extends DatabaseHealthOperation {
-
- private static final String DESCRIPTION = "Reads Attribute Table and checks that binary data exists";
- private static final String FIX_DETAILS = "No fix Available";
-
- private static final String READ_VALID_ATTRIBUTES =
- "select oa.attr_id, oa.gamma_id, oa.art_id, oa.uri from osee_attribute oa where oa.uri is not null";
-
- public AttributeBackingDataCheck() {
- super("Attribute Binary Data Availability");
- }
-
- @Override
- public String getFixTaskName() {
- return Strings.emptyString();
- }
-
- @Override
- protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
- List<AttrData> errors = getInvalidAttributeData(monitor);
- setItemsToFix(errors.size());
-
- // Write Report;
- appendToDetails(AHTML.beginMultiColumnTable(100, 1));
- appendToDetails(AHTML.addHeaderRowMultiColumnTable(new String[] {"URI", "GAMMA ID", "ATTR ID", "ART ID", "REASON"}));
- for (AttrData attrData : errors) {
- appendToDetails(AHTML.addRowMultiColumnTable(new String[] {attrData.getUri(),
- String.valueOf(attrData.getGammaId()), String.valueOf(attrData.getAttrId()),
- String.valueOf(attrData.getArtId()), attrData.getReason()}));
- }
- appendToDetails(AHTML.endMultiColumnTable());
- monitor.worked(calculateWork(0.10));
- checkForCancelledStatus(monitor);
-
- getSummary().append(String.format("Found [%s] attributes missing binary data", getItemsToFixCount()));
- monitor.worked(calculateWork(0.10));
- }
-
- private List<AttrData> getInvalidAttributeData(IProgressMonitor monitor) throws OseeDataStoreException, OseeTypeDoesNotExist {
- List<AttrData> data = new ArrayList<AttrData>();
- SubMonitor subMonitor = SubMonitor.convert(monitor, (int) (getTotalWorkUnits() * 0.80));
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- try {
- chStmt.runPreparedQuery(READ_VALID_ATTRIBUTES);
- while (chStmt.next()) {
- checkForCancelledStatus(monitor);
- String uri = chStmt.getString("uri");
- if (Strings.isValid(uri)) {
- AttrData attrData =
- new AttrData(uri, chStmt.getLong("gamma_id"), chStmt.getInt("attr_id"), chStmt.getInt("art_id"));
- if (!isAttrDataValid(attrData)) {
- data.add(attrData);
- }
- }
- subMonitor.worked(1);
- }
- } finally {
- chStmt.close();
- }
- return data;
- }
-
- private boolean isAttrDataValid(AttrData attrData) {
- boolean result = false;
- try {
- Map<String, String> parameters = new HashMap<String, String>();
- parameters.put("sessionId", ClientSessionManager.getSessionId());
- parameters.put("uri", attrData.getUri());
- parameters.put("check.available", "true");
- String url =
- HttpUrlBuilderClient.getInstance().getOsgiServletServiceUrl(OseeServerContext.RESOURCE_CONTEXT, parameters);
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- AcquireResult acquireResult = HttpProcessor.acquire(new URL(url), outputStream);
- if (acquireResult.wasSuccessful()) {
- result = true;
- } else {
- String encoding = acquireResult.getEncoding();
- attrData.setReason(outputStream.toString(Strings.isValid(encoding) ? encoding : "UTF-8"));
- }
- } catch (Exception ex) {
- attrData.setReason(Lib.exceptionToString(ex));
- }
- return result;
- }
-
- @Override
- public String getCheckDescription() {
- return DESCRIPTION;
- }
-
- @Override
- public String getFixDescription() {
- return FIX_DETAILS;
- }
-
- private final class AttrData {
- private final String uri;
- private final long gammaId;
- private final int attrId;
- private final int artId;
- private String reason;
-
- public AttrData(String uri, long gammaId, int attrId, int artId) {
- super();
- this.uri = uri;
- this.gammaId = gammaId;
- this.attrId = attrId;
- this.artId = artId;
- this.reason = null;
- }
-
- public String getUri() {
- return uri;
- }
-
- public long getGammaId() {
- return gammaId;
- }
-
- public int getAttrId() {
- return attrId;
- }
-
- public int getArtId() {
- return artId;
- }
-
- public String getReason() {
- return reason;
- }
-
- public void setReason(String reason) {
- this.reason = reason;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.dbHealth;
+
+import java.io.ByteArrayOutputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.osee.framework.core.client.ClientSessionManager;
+import org.eclipse.osee.framework.core.client.server.HttpUrlBuilderClient;
+import org.eclipse.osee.framework.core.data.OseeServerContext;
+import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
+import org.eclipse.osee.framework.core.exception.OseeTypeDoesNotExist;
+import org.eclipse.osee.framework.core.util.HttpProcessor;
+import org.eclipse.osee.framework.core.util.HttpProcessor.AcquireResult;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AttributeBackingDataCheck extends DatabaseHealthOperation {
+
+ private static final String DESCRIPTION = "Reads Attribute Table and checks that binary data exists";
+ private static final String FIX_DETAILS = "No fix Available";
+
+ private static final String READ_VALID_ATTRIBUTES =
+ "select oa.attr_id, oa.gamma_id, oa.art_id, oa.uri from osee_attribute oa where oa.uri is not null";
+
+ public AttributeBackingDataCheck() {
+ super("Attribute Binary Data Availability");
+ }
+
+ @Override
+ public String getFixTaskName() {
+ return Strings.emptyString();
+ }
+
+ @Override
+ protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
+ List<AttrData> errors = getInvalidAttributeData(monitor);
+ setItemsToFix(errors.size());
+
+ // Write Report;
+ appendToDetails(AHTML.beginMultiColumnTable(100, 1));
+ appendToDetails(AHTML.addHeaderRowMultiColumnTable(new String[] {"URI", "GAMMA ID", "ATTR ID", "ART ID", "REASON"}));
+ for (AttrData attrData : errors) {
+ appendToDetails(AHTML.addRowMultiColumnTable(new String[] {attrData.getUri(),
+ String.valueOf(attrData.getGammaId()), String.valueOf(attrData.getAttrId()),
+ String.valueOf(attrData.getArtId()), attrData.getReason()}));
+ }
+ appendToDetails(AHTML.endMultiColumnTable());
+ monitor.worked(calculateWork(0.10));
+ checkForCancelledStatus(monitor);
+
+ getSummary().append(String.format("Found [%s] attributes missing binary data", getItemsToFixCount()));
+ monitor.worked(calculateWork(0.10));
+ }
+
+ private List<AttrData> getInvalidAttributeData(IProgressMonitor monitor) throws OseeDataStoreException, OseeTypeDoesNotExist {
+ List<AttrData> data = new ArrayList<AttrData>();
+ SubMonitor subMonitor = SubMonitor.convert(monitor, (int) (getTotalWorkUnits() * 0.80));
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+ try {
+ chStmt.runPreparedQuery(READ_VALID_ATTRIBUTES);
+ while (chStmt.next()) {
+ checkForCancelledStatus(monitor);
+ String uri = chStmt.getString("uri");
+ if (Strings.isValid(uri)) {
+ AttrData attrData =
+ new AttrData(uri, chStmt.getLong("gamma_id"), chStmt.getInt("attr_id"), chStmt.getInt("art_id"));
+ if (!isAttrDataValid(attrData)) {
+ data.add(attrData);
+ }
+ }
+ subMonitor.worked(1);
+ }
+ } finally {
+ chStmt.close();
+ }
+ return data;
+ }
+
+ private boolean isAttrDataValid(AttrData attrData) {
+ boolean result = false;
+ try {
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put("sessionId", ClientSessionManager.getSessionId());
+ parameters.put("uri", attrData.getUri());
+ parameters.put("check.available", "true");
+ String url =
+ HttpUrlBuilderClient.getInstance().getOsgiServletServiceUrl(OseeServerContext.RESOURCE_CONTEXT, parameters);
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ AcquireResult acquireResult = HttpProcessor.acquire(new URL(url), outputStream);
+ if (acquireResult.wasSuccessful()) {
+ result = true;
+ } else {
+ String encoding = acquireResult.getEncoding();
+ attrData.setReason(outputStream.toString(Strings.isValid(encoding) ? encoding : "UTF-8"));
+ }
+ } catch (Exception ex) {
+ attrData.setReason(Lib.exceptionToString(ex));
+ }
+ return result;
+ }
+
+ @Override
+ public String getCheckDescription() {
+ return DESCRIPTION;
+ }
+
+ @Override
+ public String getFixDescription() {
+ return FIX_DETAILS;
+ }
+
+ private final class AttrData {
+ private final String uri;
+ private final long gammaId;
+ private final int attrId;
+ private final int artId;
+ private String reason;
+
+ public AttrData(String uri, long gammaId, int attrId, int artId) {
+ super();
+ this.uri = uri;
+ this.gammaId = gammaId;
+ this.attrId = attrId;
+ this.artId = artId;
+ this.reason = null;
+ }
+
+ public String getUri() {
+ return uri;
+ }
+
+ public long getGammaId() {
+ return gammaId;
+ }
+
+ public int getAttrId() {
+ return attrId;
+ }
+
+ public int getArtId() {
+ return artId;
+ }
+
+ public String getReason() {
+ return reason;
+ }
+
+ public void setReason(String reason) {
+ this.reason = reason;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AuthorIdCheck.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AuthorIdCheck.java
index 22212518539..150cd949f6e 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AuthorIdCheck.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/AuthorIdCheck.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.framework.ui.skynet.dbHealth;
-
-import java.util.HashSet;
-import java.util.Set;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.data.SystemUser;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-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.BranchManager;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-
-/**
- * @author Donald G. Dunne
- */
-public class AuthorIdCheck extends DatabaseHealthOperation {
-
- private static final String GET_AUTHOR_IDS = "select distinct (author) from osee_tx_details";
- private static final String UPDATE_AUTHOR_IDS = "update osee_tx_details set author=? where author=?";
-
- public AuthorIdCheck() {
- super("Author Id Check");
- }
-
- @Override
- protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
- monitor.subTask("Querying for AuthorIds");
- displayReport(monitor);
- checkForCancelledStatus(monitor);
- monitor.worked(calculateWork(0.50));
- getSummary().append(String.format("Completed"));
- monitor.worked(calculateWork(0.10));
- }
-
- private void displayReport(IProgressMonitor monitor) throws Exception {
- XResultData rd = new XResultData();
- try {
- String[] columnHeaders = new String[] {"Item", "Author Id", "Results"};
- rd.log("Errors show in red.");
- rd.addRaw(AHTML.beginMultiColumnTable(100, 1));
- rd.addRaw(AHTML.addHeaderRowMultiColumnTable(columnHeaders));
-
- Set<Integer> authors = new HashSet<Integer>();
- IOseeStatement chStmt1 = ConnectionHandler.getStatement();
- try {
- chStmt1.runPreparedQuery(GET_AUTHOR_IDS);
- while (chStmt1.next()) {
- checkForCancelledStatus(monitor);
- int author = chStmt1.getInt("author");
- authors.add(author);
- }
- } finally {
- chStmt1.close();
- }
- int num = 0;
- StringBuffer infoSb = new StringBuffer(500);
- for (Integer author : authors) {
- System.out.println(String.format("Processing [%d] %d/%d...", author, num++, authors.size()));
- if (author == 0) {
- rd.addRaw(AHTML.addRowMultiColumnTable("TX_DETAILS", String.valueOf(author),
- "Warning: Skipping author == 0; this is ok, but may want to change in future"));
- continue;
- }
- try {
- Artifact artifact = ArtifactQuery.getArtifactFromId(author, BranchManager.getCommonBranch());
- if (artifact == null) {
- rd.addRaw(AHTML.addRowMultiColumnTable("TX_DETAILS", String.valueOf(author),
- "Error: Artifact Not Found"));
- if (isFixOperationEnabled()) {
- rd.addRaw("Fix needed here");
- }
- } else if (artifact.isDeleted()) {
- rd.addRaw(AHTML.addRowMultiColumnTable("TX_DETAILS", String.valueOf(author),
- "Error: Artifact marked as deleted"));
- if (isFixOperationEnabled()) {
- rd.addRaw("Fix needed here");
- }
- } else {
- infoSb.append(String.format("Successfully found author [%s] as [%s]\n", String.valueOf(author),
- artifact.getName()));
- }
- } catch (Exception ex) {
- rd.addRaw(AHTML.addRowMultiColumnTable("TX_DETAILS", String.valueOf(author),
- "Error: " + ex.getLocalizedMessage()));
- if (isFixOperationEnabled() && ex.getLocalizedMessage().contains("No artifact found with id")) {
- updateTxAuthor(author);
- rd.addRaw(String.format("Fix: Updated author [%s] to OSEE System", author));
- }
- }
- }
- rd.addRaw(AHTML.endMultiColumnTable());
- rd.addRaw(infoSb.toString());
- getSummary().append("Processed " + authors.size() + " author ids\n");
-
- } finally {
- rd.report(getName());
- }
- }
-
- private static void updateTxAuthor(int author) throws Exception {
- ConnectionHandler.runPreparedUpdate(UPDATE_AUTHOR_IDS, UserManager.getUser(SystemUser.OseeSystem).getArtId(),
- author);
- }
-
- @Override
- public String getCheckDescription() {
- return "Verifies that all author art ids match an un-deleted artifact on Common branch (usually a User artifact)";
- }
-
- @Override
- public String getFixDescription() {
- return "Sets all invalid authors to the \"OSEE System\" user artifact's art_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.framework.ui.skynet.dbHealth;
+
+import java.util.HashSet;
+import java.util.Set;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.data.SystemUser;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+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.BranchManager;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AuthorIdCheck extends DatabaseHealthOperation {
+
+ private static final String GET_AUTHOR_IDS = "select distinct (author) from osee_tx_details";
+ private static final String UPDATE_AUTHOR_IDS = "update osee_tx_details set author=? where author=?";
+
+ public AuthorIdCheck() {
+ super("Author Id Check");
+ }
+
+ @Override
+ protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
+ monitor.subTask("Querying for AuthorIds");
+ displayReport(monitor);
+ checkForCancelledStatus(monitor);
+ monitor.worked(calculateWork(0.50));
+ getSummary().append(String.format("Completed"));
+ monitor.worked(calculateWork(0.10));
+ }
+
+ private void displayReport(IProgressMonitor monitor) throws Exception {
+ XResultData rd = new XResultData();
+ try {
+ String[] columnHeaders = new String[] {"Item", "Author Id", "Results"};
+ rd.log("Errors show in red.");
+ rd.addRaw(AHTML.beginMultiColumnTable(100, 1));
+ rd.addRaw(AHTML.addHeaderRowMultiColumnTable(columnHeaders));
+
+ Set<Integer> authors = new HashSet<Integer>();
+ IOseeStatement chStmt1 = ConnectionHandler.getStatement();
+ try {
+ chStmt1.runPreparedQuery(GET_AUTHOR_IDS);
+ while (chStmt1.next()) {
+ checkForCancelledStatus(monitor);
+ int author = chStmt1.getInt("author");
+ authors.add(author);
+ }
+ } finally {
+ chStmt1.close();
+ }
+ int num = 0;
+ StringBuffer infoSb = new StringBuffer(500);
+ for (Integer author : authors) {
+ System.out.println(String.format("Processing [%d] %d/%d...", author, num++, authors.size()));
+ if (author == 0) {
+ rd.addRaw(AHTML.addRowMultiColumnTable("TX_DETAILS", String.valueOf(author),
+ "Warning: Skipping author == 0; this is ok, but may want to change in future"));
+ continue;
+ }
+ try {
+ Artifact artifact = ArtifactQuery.getArtifactFromId(author, BranchManager.getCommonBranch());
+ if (artifact == null) {
+ rd.addRaw(AHTML.addRowMultiColumnTable("TX_DETAILS", String.valueOf(author),
+ "Error: Artifact Not Found"));
+ if (isFixOperationEnabled()) {
+ rd.addRaw("Fix needed here");
+ }
+ } else if (artifact.isDeleted()) {
+ rd.addRaw(AHTML.addRowMultiColumnTable("TX_DETAILS", String.valueOf(author),
+ "Error: Artifact marked as deleted"));
+ if (isFixOperationEnabled()) {
+ rd.addRaw("Fix needed here");
+ }
+ } else {
+ infoSb.append(String.format("Successfully found author [%s] as [%s]\n", String.valueOf(author),
+ artifact.getName()));
+ }
+ } catch (Exception ex) {
+ rd.addRaw(AHTML.addRowMultiColumnTable("TX_DETAILS", String.valueOf(author),
+ "Error: " + ex.getLocalizedMessage()));
+ if (isFixOperationEnabled() && ex.getLocalizedMessage().contains("No artifact found with id")) {
+ updateTxAuthor(author);
+ rd.addRaw(String.format("Fix: Updated author [%s] to OSEE System", author));
+ }
+ }
+ }
+ rd.addRaw(AHTML.endMultiColumnTable());
+ rd.addRaw(infoSb.toString());
+ getSummary().append("Processed " + authors.size() + " author ids\n");
+
+ } finally {
+ rd.report(getName());
+ }
+ }
+
+ private static void updateTxAuthor(int author) throws Exception {
+ ConnectionHandler.runPreparedUpdate(UPDATE_AUTHOR_IDS, UserManager.getUser(SystemUser.OseeSystem).getArtId(),
+ author);
+ }
+
+ @Override
+ public String getCheckDescription() {
+ return "Verifies that all author art ids match an un-deleted artifact on Common branch (usually a User artifact)";
+ }
+
+ @Override
+ public String getFixDescription() {
+ return "Sets all invalid authors to the \"OSEE System\" user artifact's art_id.";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/BranchStateHealthCheck.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/BranchStateHealthCheck.java
index 2c1a2800a20..ba802c902e2 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/BranchStateHealthCheck.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/BranchStateHealthCheck.java
@@ -1,278 +1,278 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.dbHealth;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.enums.BranchState;
-import org.eclipse.osee.framework.core.enums.BranchType;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-
-/**
- * @author Roberto E. Escobar
- */
-public class BranchStateHealthCheck extends DatabaseHealthOperation {
-
- public BranchStateHealthCheck() {
- super("Branch State Errors");
- }
-
- @Override
- protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
- monitor.setTaskName("Loading Branch information");
- List<BranchData> itemsToFix = new ArrayList<BranchData>();
-
- Collection<BranchData> branchDatas = getAllBranchData();
- monitor.worked(calculateWork(0.25));
- checkForCancelledStatus(monitor);
-
- monitor.setTaskName("Checking Branch State Data");
- for (BranchData branchData : branchDatas) {
- check(branchData);
- if (branchData.hasBranchStateChanged()) {
- itemsToFix.add(branchData);
- }
- }
- monitor.worked(calculateWork(0.25));
- checkForCancelledStatus(monitor);
-
- appendToDetails(AHTML.beginMultiColumnTable(100, 1));
- appendToDetails(AHTML.addHeaderRowMultiColumnTable(new String[] {"Reason", "Was State", "Fixed State",
- "BranchType", "Archived", "Txs", "Commit Tx", "BranchId", "Branch Name"}));
- Collections.sort(itemsToFix, new Comparator<BranchData>() {
-
- @Override
- public int compare(BranchData o1, BranchData o2) {
- int result = 0;
- if (o1 != null && o2 != null) {
- result = o1.getBranchType().compareTo(o2.getBranchType());
- if (result == 0) {
- result = ((Boolean) o1.isArchived()).compareTo(o2.isArchived());
- }
- if (result == 0) {
- result = o1.getNumberOfTxs() - o2.getNumberOfTxs();
- }
- }
- return result;
- }
-
- });
- for (BranchData data : itemsToFix) {
- appendToDetails(AHTML.addRowMultiColumnTable(new String[] {data.getReason(),
- String.valueOf(data.getOriginalBranchState()), String.valueOf(data.getBranchState()),
- String.valueOf(data.getBranchType()), String.valueOf(data.isArchived()),
- String.valueOf(data.getNumberOfTxs()), String.valueOf(data.hasCommitTransactionId()),
- String.valueOf(data.getId()), data.getBranchName()}));
- }
- appendToDetails(AHTML.endMultiColumnTable());
- monitor.worked(calculateWork(0.25));
- checkForCancelledStatus(monitor);
-
- setItemsToFix(itemsToFix.size());
- if (isFixOperationEnabled() && getItemsToFixCount() > 0) {
- monitor.setTaskName("Fixing Branch State data");
- List<Object[]> data = new ArrayList<Object[]>();
- for (BranchData branchData : itemsToFix) {
- data.add(new Object[] {branchData.getBranchState().getValue(), branchData.getId()});
- }
- ConnectionHandler.runBatchUpdate("update osee_branch set branch_state = ? where branch_id = ?", data);
- }
-
- getSummary().append(String.format("Found [%s] branches with invalid branchState\n", getItemsToFixCount()));
- monitor.worked(calculateWork(0.25));
- }
-
- private boolean isRebaselined(BranchData branchData) {
- String name = branchData.getBranchName();
- return name.contains("- moved by update on -") || name.contains("- for update -");
- }
-
- private boolean hasBeenCommitted(BranchData branchData) {
- boolean result = false;
- if (BranchType.MERGE.equals(branchData.getBranchType())) {
- result = branchData.hasCommitTransactionId();
- } else {
- result = branchData.isArchived();
- }
- return result;
- }
-
- private void check(BranchData branchData) {
- BranchState state = branchData.getBranchState();
- BranchType type = branchData.getBranchType();
-
- if (BranchType.SYSTEM_ROOT.equals(type)) {
- if (!BranchState.CREATED.equals(state)) {
- branchData.setBranchState(BranchState.CREATED);
- branchData.setReason("System Root should always be set to created");
- }
- } else if (state != BranchState.DELETED && state != BranchState.COMMIT_IN_PROGRESS && state != BranchState.REBASELINE_IN_PROGRESS) {
- if (BranchType.WORKING.equals(type)) {
- if (isRebaselined(branchData)) {
- branchData.setBranchState(BranchState.REBASELINED);
- branchData.setReason("Rebaselined case - detected from name");
- } else if (hasBeenCommitted(branchData)) {
- branchData.setBranchState(BranchState.COMMITTED);
- branchData.setReason("Committed case - detected");
- } else if (branchData.getNumberOfTxs() > 1) {
- branchData.setBranchState(BranchState.MODIFIED);
- branchData.setReason("Modified case - detected");
- } else {
- branchData.setBranchState(BranchState.CREATED);
- branchData.setReason("Was Created case - detected");
- }
- } else if (BranchType.MERGE.equals(type)) {
- if (hasBeenCommitted(branchData)) {
- branchData.setBranchState(BranchState.COMMITTED);
- branchData.setReason("Committed case - detected");
- } else if (branchData.getNumberOfTxs() > 1) {
- branchData.setBranchState(BranchState.MODIFIED);
- branchData.setReason("Modified case - detected");
- } else {
- branchData.setBranchState(BranchState.CREATED);
- branchData.setReason("Was Created case - detected");
- }
- }
- }
- }
-
- private Collection<BranchData> getAllBranchData() throws OseeDataStoreException, OseeArgumentException {
- Map<Integer, BranchData> data = new HashMap<Integer, BranchData>();
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- try {
- chStmt.runPreparedQuery("select * from osee_branch");
- while (chStmt.next()) {
- int branchId = chStmt.getInt("branch_id");
- int branchType = chStmt.getInt("branch_type");
- int branchState = chStmt.getInt("branch_state");
- boolean isArchived = chStmt.getInt("archived") == 1 ? true : false;
- int numberOfTxs =
- ConnectionHandler.runPreparedQueryFetchInt(0,
- "select count(1) from osee_tx_details where branch_id = ?", branchId);
- data.put(branchId, new BranchData(branchId, chStmt.getString("branch_name"),
- BranchType.valueOf(branchType), BranchState.getBranchState(branchState), isArchived,
- numberOfTxs));
- }
- } finally {
- chStmt.close();
- }
- chStmt = ConnectionHandler.getStatement();
- try {
- chStmt.runPreparedQuery("select * from osee_merge");
- while (chStmt.next()) {
- Integer branchId = chStmt.getInt("merge_branch_id");
- BranchData branchData = data.get(branchId);
- branchData.setHasCommitTransactionId(chStmt.getInt("commit_transaction_id") != -1);
- }
- } finally {
- chStmt.close();
- }
- return data.values();
- }
- private final class BranchData {
- private final int branchId;
- private final String branchName;
- private final BranchType branchType;
- private final BranchState originalBranchState;
- private BranchState branchState;
- private final boolean isArchived;
- private final int numberOfTxs;
- private String reasonForChange;
- private boolean hasCommitTransactionId;
-
- private BranchData(int branchId, String branchName, BranchType branchType, BranchState branchState, boolean isArchived, int numberOfTxs) {
- super();
- this.branchId = branchId;
- this.branchName = branchName;
- this.branchType = branchType;
- this.branchState = branchState;
- this.originalBranchState = branchState;
- this.isArchived = isArchived;
- this.numberOfTxs = numberOfTxs;
- this.reasonForChange = Strings.emptyString();
- this.hasCommitTransactionId = false;
- }
-
- public int getId() {
- return branchId;
- }
-
- public String getBranchName() {
- return branchName;
- }
-
- public BranchType getBranchType() {
- return branchType;
- }
-
- public void setBranchState(BranchState branchState) {
- this.branchState = branchState;
- }
-
- public BranchState getBranchState() {
- return branchState;
- }
-
- public BranchState getOriginalBranchState() {
- return originalBranchState;
- }
-
- public boolean isArchived() {
- return isArchived;
- }
-
- public int getNumberOfTxs() {
- return numberOfTxs;
- }
-
- public boolean hasBranchStateChanged() {
- return branchState != originalBranchState;
- }
-
- public void setReason(String reasonForChange) {
- this.reasonForChange = reasonForChange;
- }
-
- public String getReason() {
- return reasonForChange;
- }
-
- public void setHasCommitTransactionId(boolean hasCommitTransactionId) {
- this.hasCommitTransactionId = hasCommitTransactionId;
- }
-
- public boolean hasCommitTransactionId() {
- return hasCommitTransactionId;
- }
- }
-
- @Override
- public String getCheckDescription() {
- return "Enter Check Description Here";
- }
-
- @Override
- public String getFixDescription() {
- return "Enter Fix Description Here";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.dbHealth;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.enums.BranchState;
+import org.eclipse.osee.framework.core.enums.BranchType;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class BranchStateHealthCheck extends DatabaseHealthOperation {
+
+ public BranchStateHealthCheck() {
+ super("Branch State Errors");
+ }
+
+ @Override
+ protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
+ monitor.setTaskName("Loading Branch information");
+ List<BranchData> itemsToFix = new ArrayList<BranchData>();
+
+ Collection<BranchData> branchDatas = getAllBranchData();
+ monitor.worked(calculateWork(0.25));
+ checkForCancelledStatus(monitor);
+
+ monitor.setTaskName("Checking Branch State Data");
+ for (BranchData branchData : branchDatas) {
+ check(branchData);
+ if (branchData.hasBranchStateChanged()) {
+ itemsToFix.add(branchData);
+ }
+ }
+ monitor.worked(calculateWork(0.25));
+ checkForCancelledStatus(monitor);
+
+ appendToDetails(AHTML.beginMultiColumnTable(100, 1));
+ appendToDetails(AHTML.addHeaderRowMultiColumnTable(new String[] {"Reason", "Was State", "Fixed State",
+ "BranchType", "Archived", "Txs", "Commit Tx", "BranchId", "Branch Name"}));
+ Collections.sort(itemsToFix, new Comparator<BranchData>() {
+
+ @Override
+ public int compare(BranchData o1, BranchData o2) {
+ int result = 0;
+ if (o1 != null && o2 != null) {
+ result = o1.getBranchType().compareTo(o2.getBranchType());
+ if (result == 0) {
+ result = ((Boolean) o1.isArchived()).compareTo(o2.isArchived());
+ }
+ if (result == 0) {
+ result = o1.getNumberOfTxs() - o2.getNumberOfTxs();
+ }
+ }
+ return result;
+ }
+
+ });
+ for (BranchData data : itemsToFix) {
+ appendToDetails(AHTML.addRowMultiColumnTable(new String[] {data.getReason(),
+ String.valueOf(data.getOriginalBranchState()), String.valueOf(data.getBranchState()),
+ String.valueOf(data.getBranchType()), String.valueOf(data.isArchived()),
+ String.valueOf(data.getNumberOfTxs()), String.valueOf(data.hasCommitTransactionId()),
+ String.valueOf(data.getId()), data.getBranchName()}));
+ }
+ appendToDetails(AHTML.endMultiColumnTable());
+ monitor.worked(calculateWork(0.25));
+ checkForCancelledStatus(monitor);
+
+ setItemsToFix(itemsToFix.size());
+ if (isFixOperationEnabled() && getItemsToFixCount() > 0) {
+ monitor.setTaskName("Fixing Branch State data");
+ List<Object[]> data = new ArrayList<Object[]>();
+ for (BranchData branchData : itemsToFix) {
+ data.add(new Object[] {branchData.getBranchState().getValue(), branchData.getId()});
+ }
+ ConnectionHandler.runBatchUpdate("update osee_branch set branch_state = ? where branch_id = ?", data);
+ }
+
+ getSummary().append(String.format("Found [%s] branches with invalid branchState\n", getItemsToFixCount()));
+ monitor.worked(calculateWork(0.25));
+ }
+
+ private boolean isRebaselined(BranchData branchData) {
+ String name = branchData.getBranchName();
+ return name.contains("- moved by update on -") || name.contains("- for update -");
+ }
+
+ private boolean hasBeenCommitted(BranchData branchData) {
+ boolean result = false;
+ if (BranchType.MERGE.equals(branchData.getBranchType())) {
+ result = branchData.hasCommitTransactionId();
+ } else {
+ result = branchData.isArchived();
+ }
+ return result;
+ }
+
+ private void check(BranchData branchData) {
+ BranchState state = branchData.getBranchState();
+ BranchType type = branchData.getBranchType();
+
+ if (BranchType.SYSTEM_ROOT.equals(type)) {
+ if (!BranchState.CREATED.equals(state)) {
+ branchData.setBranchState(BranchState.CREATED);
+ branchData.setReason("System Root should always be set to created");
+ }
+ } else if (state != BranchState.DELETED && state != BranchState.COMMIT_IN_PROGRESS && state != BranchState.REBASELINE_IN_PROGRESS) {
+ if (BranchType.WORKING.equals(type)) {
+ if (isRebaselined(branchData)) {
+ branchData.setBranchState(BranchState.REBASELINED);
+ branchData.setReason("Rebaselined case - detected from name");
+ } else if (hasBeenCommitted(branchData)) {
+ branchData.setBranchState(BranchState.COMMITTED);
+ branchData.setReason("Committed case - detected");
+ } else if (branchData.getNumberOfTxs() > 1) {
+ branchData.setBranchState(BranchState.MODIFIED);
+ branchData.setReason("Modified case - detected");
+ } else {
+ branchData.setBranchState(BranchState.CREATED);
+ branchData.setReason("Was Created case - detected");
+ }
+ } else if (BranchType.MERGE.equals(type)) {
+ if (hasBeenCommitted(branchData)) {
+ branchData.setBranchState(BranchState.COMMITTED);
+ branchData.setReason("Committed case - detected");
+ } else if (branchData.getNumberOfTxs() > 1) {
+ branchData.setBranchState(BranchState.MODIFIED);
+ branchData.setReason("Modified case - detected");
+ } else {
+ branchData.setBranchState(BranchState.CREATED);
+ branchData.setReason("Was Created case - detected");
+ }
+ }
+ }
+ }
+
+ private Collection<BranchData> getAllBranchData() throws OseeDataStoreException, OseeArgumentException {
+ Map<Integer, BranchData> data = new HashMap<Integer, BranchData>();
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+ try {
+ chStmt.runPreparedQuery("select * from osee_branch");
+ while (chStmt.next()) {
+ int branchId = chStmt.getInt("branch_id");
+ int branchType = chStmt.getInt("branch_type");
+ int branchState = chStmt.getInt("branch_state");
+ boolean isArchived = chStmt.getInt("archived") == 1 ? true : false;
+ int numberOfTxs =
+ ConnectionHandler.runPreparedQueryFetchInt(0,
+ "select count(1) from osee_tx_details where branch_id = ?", branchId);
+ data.put(branchId, new BranchData(branchId, chStmt.getString("branch_name"),
+ BranchType.valueOf(branchType), BranchState.getBranchState(branchState), isArchived,
+ numberOfTxs));
+ }
+ } finally {
+ chStmt.close();
+ }
+ chStmt = ConnectionHandler.getStatement();
+ try {
+ chStmt.runPreparedQuery("select * from osee_merge");
+ while (chStmt.next()) {
+ Integer branchId = chStmt.getInt("merge_branch_id");
+ BranchData branchData = data.get(branchId);
+ branchData.setHasCommitTransactionId(chStmt.getInt("commit_transaction_id") != -1);
+ }
+ } finally {
+ chStmt.close();
+ }
+ return data.values();
+ }
+ private final class BranchData {
+ private final int branchId;
+ private final String branchName;
+ private final BranchType branchType;
+ private final BranchState originalBranchState;
+ private BranchState branchState;
+ private final boolean isArchived;
+ private final int numberOfTxs;
+ private String reasonForChange;
+ private boolean hasCommitTransactionId;
+
+ private BranchData(int branchId, String branchName, BranchType branchType, BranchState branchState, boolean isArchived, int numberOfTxs) {
+ super();
+ this.branchId = branchId;
+ this.branchName = branchName;
+ this.branchType = branchType;
+ this.branchState = branchState;
+ this.originalBranchState = branchState;
+ this.isArchived = isArchived;
+ this.numberOfTxs = numberOfTxs;
+ this.reasonForChange = Strings.emptyString();
+ this.hasCommitTransactionId = false;
+ }
+
+ public int getId() {
+ return branchId;
+ }
+
+ public String getBranchName() {
+ return branchName;
+ }
+
+ public BranchType getBranchType() {
+ return branchType;
+ }
+
+ public void setBranchState(BranchState branchState) {
+ this.branchState = branchState;
+ }
+
+ public BranchState getBranchState() {
+ return branchState;
+ }
+
+ public BranchState getOriginalBranchState() {
+ return originalBranchState;
+ }
+
+ public boolean isArchived() {
+ return isArchived;
+ }
+
+ public int getNumberOfTxs() {
+ return numberOfTxs;
+ }
+
+ public boolean hasBranchStateChanged() {
+ return branchState != originalBranchState;
+ }
+
+ public void setReason(String reasonForChange) {
+ this.reasonForChange = reasonForChange;
+ }
+
+ public String getReason() {
+ return reasonForChange;
+ }
+
+ public void setHasCommitTransactionId(boolean hasCommitTransactionId) {
+ this.hasCommitTransactionId = hasCommitTransactionId;
+ }
+
+ public boolean hasCommitTransactionId() {
+ return hasCommitTransactionId;
+ }
+ }
+
+ @Override
+ public String getCheckDescription() {
+ return "Enter Check Description Here";
+ }
+
+ @Override
+ public String getFixDescription() {
+ return "Enter Fix Description Here";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CleanUpAddressingData.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CleanUpAddressingData.java
index f549637de48..365c15f8673 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CleanUpAddressingData.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CleanUpAddressingData.java
@@ -1,107 +1,107 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.dbHealth;
-
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-
-/**
- * Identifies and removes addressing from the transaction table that no longer addresses other tables.
- *
- * @author Theron Virgin
- */
-public class CleanUpAddressingData extends DatabaseHealthOperation {
-
- private static final String NOT_BACKED_GAMMAS =
- "SELECT gamma_id from osee_txs Union Select rem_gamma_id as gamma_id FROM osee_removed_txs %s " + HealthHelper.ALL_BACKING_GAMMAS;
- private static final String NOT_BACKED_TRANSACTIONS =
- "SELECT transaction_id from osee_txs UNION SELECT rem_transaction_id as transaction_id FROM osee_removed_txs UNION SELECT DISTINCT transaction_id FROM osee_removed_txs %s SELECT transaction_id from osee_tx_details";
- private static final String REMOVE_NOT_ADDRESSED_GAMMAS = "DELETE FROM osee_txs WHERE gamma_id = ?";
- private static final String REMOVE_NOT_ADDRESSED_TRANSACTIONS = "DELETE FROM osee_txs WHERE transaction_id = ?";
-
- private List<Object[]> gammas = null;
- private List<Object[]> transactions = null;
-
- public CleanUpAddressingData() {
- super("TXS Entries with no Backing Data");
- }
-
- @Override
- protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
- boolean fix = isFixOperationEnabled();
- boolean verify = !fix;
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- try {
- if (verify || gammas == null) {
- gammas =
- HealthHelper.runSingleResultQuery(String.format(NOT_BACKED_GAMMAS, chStmt.getComplementSql()),
- "gamma_id");
- }
- checkForCancelledStatus(monitor);
- monitor.worked(calculateWork(0.25));
-
- if (verify || transactions == null) {
- transactions =
- HealthHelper.runSingleResultQuery(String.format(NOT_BACKED_TRANSACTIONS, chStmt.getComplementSql()),
- "transaction_id");
- }
- } finally {
- chStmt.close();
- }
- checkForCancelledStatus(monitor);
- monitor.worked(calculateWork(0.25));
-
- appendToDetails(AHTML.beginMultiColumnTable(100, 1));
- HealthHelper.displayForCleanUp("Gamma Id", getDetailedReport(), getSummary(), verify, gammas,
- "'s with no backing data\n");
- HealthHelper.displayForCleanUp("Transaction Id", getDetailedReport(), getSummary(), verify, transactions,
- "'s with no backing data\n");
-
- checkForCancelledStatus(monitor);
- monitor.worked(calculateWork(0.25));
-
- int gammaCount = gammas != null ? gammas.size() : 0;
- int txCount = transactions != null ? transactions.size() : 0;
- setItemsToFix(txCount + gammaCount);
-
- if (fix) {
- if (gammas.size() > 0) {
- ConnectionHandler.runBatchUpdate(REMOVE_NOT_ADDRESSED_GAMMAS, gammas);
- }
- monitor.worked(calculateWork(0.10));
- if (transactions.size() > 0) {
- ConnectionHandler.runBatchUpdate(REMOVE_NOT_ADDRESSED_TRANSACTIONS, transactions);
- }
- monitor.worked(calculateWork(0.10));
- gammas = null;
- transactions = null;
- } else {
- monitor.worked(calculateWork(0.20));
- }
-
- appendToDetails(AHTML.endMultiColumnTable());
- monitor.worked(calculateWork(0.05));
- }
-
- @Override
- public String getCheckDescription() {
- return "Enter Check Description Here";
- }
-
- @Override
- public String getFixDescription() {
- return "Enter Fix Description Here";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.dbHealth;
+
+import java.util.List;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+
+/**
+ * Identifies and removes addressing from the transaction table that no longer addresses other tables.
+ *
+ * @author Theron Virgin
+ */
+public class CleanUpAddressingData extends DatabaseHealthOperation {
+
+ private static final String NOT_BACKED_GAMMAS =
+ "SELECT gamma_id from osee_txs Union Select rem_gamma_id as gamma_id FROM osee_removed_txs %s " + HealthHelper.ALL_BACKING_GAMMAS;
+ private static final String NOT_BACKED_TRANSACTIONS =
+ "SELECT transaction_id from osee_txs UNION SELECT rem_transaction_id as transaction_id FROM osee_removed_txs UNION SELECT DISTINCT transaction_id FROM osee_removed_txs %s SELECT transaction_id from osee_tx_details";
+ private static final String REMOVE_NOT_ADDRESSED_GAMMAS = "DELETE FROM osee_txs WHERE gamma_id = ?";
+ private static final String REMOVE_NOT_ADDRESSED_TRANSACTIONS = "DELETE FROM osee_txs WHERE transaction_id = ?";
+
+ private List<Object[]> gammas = null;
+ private List<Object[]> transactions = null;
+
+ public CleanUpAddressingData() {
+ super("TXS Entries with no Backing Data");
+ }
+
+ @Override
+ protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
+ boolean fix = isFixOperationEnabled();
+ boolean verify = !fix;
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+ try {
+ if (verify || gammas == null) {
+ gammas =
+ HealthHelper.runSingleResultQuery(String.format(NOT_BACKED_GAMMAS, chStmt.getComplementSql()),
+ "gamma_id");
+ }
+ checkForCancelledStatus(monitor);
+ monitor.worked(calculateWork(0.25));
+
+ if (verify || transactions == null) {
+ transactions =
+ HealthHelper.runSingleResultQuery(String.format(NOT_BACKED_TRANSACTIONS, chStmt.getComplementSql()),
+ "transaction_id");
+ }
+ } finally {
+ chStmt.close();
+ }
+ checkForCancelledStatus(monitor);
+ monitor.worked(calculateWork(0.25));
+
+ appendToDetails(AHTML.beginMultiColumnTable(100, 1));
+ HealthHelper.displayForCleanUp("Gamma Id", getDetailedReport(), getSummary(), verify, gammas,
+ "'s with no backing data\n");
+ HealthHelper.displayForCleanUp("Transaction Id", getDetailedReport(), getSummary(), verify, transactions,
+ "'s with no backing data\n");
+
+ checkForCancelledStatus(monitor);
+ monitor.worked(calculateWork(0.25));
+
+ int gammaCount = gammas != null ? gammas.size() : 0;
+ int txCount = transactions != null ? transactions.size() : 0;
+ setItemsToFix(txCount + gammaCount);
+
+ if (fix) {
+ if (gammas.size() > 0) {
+ ConnectionHandler.runBatchUpdate(REMOVE_NOT_ADDRESSED_GAMMAS, gammas);
+ }
+ monitor.worked(calculateWork(0.10));
+ if (transactions.size() > 0) {
+ ConnectionHandler.runBatchUpdate(REMOVE_NOT_ADDRESSED_TRANSACTIONS, transactions);
+ }
+ monitor.worked(calculateWork(0.10));
+ gammas = null;
+ transactions = null;
+ } else {
+ monitor.worked(calculateWork(0.20));
+ }
+
+ appendToDetails(AHTML.endMultiColumnTable());
+ monitor.worked(calculateWork(0.05));
+ }
+
+ @Override
+ public String getCheckDescription() {
+ return "Enter Check Description Here";
+ }
+
+ @Override
+ public String getFixDescription() {
+ return "Enter Fix Description Here";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CleanUpAttrFromDeletedArt.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CleanUpAttrFromDeletedArt.java
index c9acce756d5..f0f40e12b01 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CleanUpAttrFromDeletedArt.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CleanUpAttrFromDeletedArt.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.framework.ui.skynet.dbHealth;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-
-public class CleanUpAttrFromDeletedArt extends DatabaseHealthOperation {
- private static final String INSERT_ATTRS_TO_ART_COMMIT_TRANSACTION =
- "insert into osee_txs (tx_current, mod_type, transaction_id, gamma_id) select 3, 5, tx1.transaction_id, att1.gamma_id from osee_txs tx1, osee_txs tx2, osee_artifact art1, osee_attribute att1 where tx1.gamma_id = art1.gamma_id and tx1.tx_current = 2 and tx1.mod_type = 3 and tx1.branch_id = tx2.branch_id and tx2.gamma_id = att1.gamma_id and art1.art_id = att1.art_id and tx2.tx_current = 1 and tx1.transaction_id <> tx2.transaction_id";
- private static final String UPDATE_OLD_ATTRS_NOT_SAME_TRANSACTION =
- "update osee_txs set tx_current = 0 where (transaction_id, gamma_id) in (select tx2.transaction_id, tx2.gamma_id from osee_txs tx1, osee_txs tx2, osee_artifact art1, osee_attribute att1 where tx1.gamma_id = art1.gamma_id and tx1.tx_current = 2 and tx1.mod_type = 3 and tx1.branch_id = tx2.branch_id and tx2.gamma_id = att1.gamma_id and art1.art_id = att1.art_id and tx2.tx_current = 1 and tx1.transaction_id <> tx2.transaction_id)";
- private static final String UPDATE_OLD_ATTRS_SAME_TRANSACTION =
- "update osee_txs set tx_current = 3, mod_type = 5 where (transaction_id, gamma_id) in (select tx2.transaction_id, tx2.gamma_id from osee_txs tx1, osee_txs tx2, osee_artifact art1, osee_attribute att1 where tx1.gamma_id = art1.gamma_id and tx1.tx_current = 2 and tx1.mod_type = 3 and tx1.branch_id = tx2.branch_id and tx2.gamma_id = att1.gamma_id and art1.art_id = att1.art_id and tx2.tx_current = 1 and tx1.transaction_id = tx2.transaction_id)";
-
- public CleanUpAttrFromDeletedArt() {
- super("attributes from deleted artifacts");
- }
-
- @Override
- public String getVerifyTaskName() {
- return Strings.emptyString();
- }
-
- @Override
- protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
- if (isFixOperationEnabled()) {
- checkForCancelledStatus(monitor);
- monitor.setTaskName("INSERT_ATTRS_TO_ART_COMMIT_TRANSACTION");
- ConnectionHandler.runPreparedUpdate(INSERT_ATTRS_TO_ART_COMMIT_TRANSACTION);
- monitor.worked(calculateWork(0.45));
- monitor.setTaskName("UPDATE_OLD_ATTRS_NOT_SAME_TRANSACTION");
- ConnectionHandler.runPreparedUpdate(UPDATE_OLD_ATTRS_NOT_SAME_TRANSACTION);
- monitor.worked(calculateWork(0.45));
- monitor.setTaskName("UPDATE_OLD_ATTRS_SAME_TRANSACTION");
- ConnectionHandler.runPreparedUpdate(UPDATE_OLD_ATTRS_SAME_TRANSACTION);
- } else {
- checkForCancelledStatus(monitor);
- monitor.worked(calculateWork(0.90));
- }
- monitor.worked(calculateWork(0.10));
- }
-
- @Override
- public String getCheckDescription() {
- return "Enter Check Description Here";
- }
-
- @Override
- public String getFixDescription() {
- return "Enter Fix Description Here";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.dbHealth;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+
+public class CleanUpAttrFromDeletedArt extends DatabaseHealthOperation {
+ private static final String INSERT_ATTRS_TO_ART_COMMIT_TRANSACTION =
+ "insert into osee_txs (tx_current, mod_type, transaction_id, gamma_id) select 3, 5, tx1.transaction_id, att1.gamma_id from osee_txs tx1, osee_txs tx2, osee_artifact art1, osee_attribute att1 where tx1.gamma_id = art1.gamma_id and tx1.tx_current = 2 and tx1.mod_type = 3 and tx1.branch_id = tx2.branch_id and tx2.gamma_id = att1.gamma_id and art1.art_id = att1.art_id and tx2.tx_current = 1 and tx1.transaction_id <> tx2.transaction_id";
+ private static final String UPDATE_OLD_ATTRS_NOT_SAME_TRANSACTION =
+ "update osee_txs set tx_current = 0 where (transaction_id, gamma_id) in (select tx2.transaction_id, tx2.gamma_id from osee_txs tx1, osee_txs tx2, osee_artifact art1, osee_attribute att1 where tx1.gamma_id = art1.gamma_id and tx1.tx_current = 2 and tx1.mod_type = 3 and tx1.branch_id = tx2.branch_id and tx2.gamma_id = att1.gamma_id and art1.art_id = att1.art_id and tx2.tx_current = 1 and tx1.transaction_id <> tx2.transaction_id)";
+ private static final String UPDATE_OLD_ATTRS_SAME_TRANSACTION =
+ "update osee_txs set tx_current = 3, mod_type = 5 where (transaction_id, gamma_id) in (select tx2.transaction_id, tx2.gamma_id from osee_txs tx1, osee_txs tx2, osee_artifact art1, osee_attribute att1 where tx1.gamma_id = art1.gamma_id and tx1.tx_current = 2 and tx1.mod_type = 3 and tx1.branch_id = tx2.branch_id and tx2.gamma_id = att1.gamma_id and art1.art_id = att1.art_id and tx2.tx_current = 1 and tx1.transaction_id = tx2.transaction_id)";
+
+ public CleanUpAttrFromDeletedArt() {
+ super("attributes from deleted artifacts");
+ }
+
+ @Override
+ public String getVerifyTaskName() {
+ return Strings.emptyString();
+ }
+
+ @Override
+ protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
+ if (isFixOperationEnabled()) {
+ checkForCancelledStatus(monitor);
+ monitor.setTaskName("INSERT_ATTRS_TO_ART_COMMIT_TRANSACTION");
+ ConnectionHandler.runPreparedUpdate(INSERT_ATTRS_TO_ART_COMMIT_TRANSACTION);
+ monitor.worked(calculateWork(0.45));
+ monitor.setTaskName("UPDATE_OLD_ATTRS_NOT_SAME_TRANSACTION");
+ ConnectionHandler.runPreparedUpdate(UPDATE_OLD_ATTRS_NOT_SAME_TRANSACTION);
+ monitor.worked(calculateWork(0.45));
+ monitor.setTaskName("UPDATE_OLD_ATTRS_SAME_TRANSACTION");
+ ConnectionHandler.runPreparedUpdate(UPDATE_OLD_ATTRS_SAME_TRANSACTION);
+ } else {
+ checkForCancelledStatus(monitor);
+ monitor.worked(calculateWork(0.90));
+ }
+ monitor.worked(calculateWork(0.10));
+ }
+
+ @Override
+ public String getCheckDescription() {
+ return "Enter Check Description Here";
+ }
+
+ @Override
+ public String getFixDescription() {
+ return "Enter Fix Description Here";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CleanUpBackingData.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CleanUpBackingData.java
index af8b3e9e18d..dbbc9f66f39 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CleanUpBackingData.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CleanUpBackingData.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.framework.ui.skynet.dbHealth;
-
-import java.io.IOException;
-import java.util.LinkedList;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn.SortDataType;
-import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.ui.skynet.results.table.ResultsEditorTableTab;
-import org.eclipse.osee.framework.ui.skynet.results.table.ResultsXViewerRow;
-import org.eclipse.swt.SWT;
-
-/**
- * @author Theron Virgin
- * @author Ryan D. Brooks
- */
-public class CleanUpBackingData extends DatabaseHealthOperation {
- private static final String NOT_ADDRESSESED_GAMMAS =
- "select gamma_id from %s t1 where not exists (select 1 from osee_txs txs1 where t1.gamma_id = txs1.gamma_id) and not exists (select 1 from osee_removed_txs txs2 where t1.gamma_id = txs2.rem_gamma_id) and not exists (select 1 from osee_txs_archived txs3 where t1.gamma_id = txs3.gamma_id)";
- private static final String EMPTY_TRANSACTIONS =
- "select transaction_id from osee_tx_details txd where tx_type = 0 and not exists (select 1 from osee_txs txs1 where txd.transaction_id = txs1.transaction_id) and not exists (select 1 from osee_removed_txs txs2 where txd.transaction_id = txs2.transaction_id or txd.transaction_id = txs2.rem_transaction_id) and not exists (select 1 from osee_txs_archived txs3 where txd.transaction_id = txs3.transaction_id)";
- private static final String DELETE_GAMMAS = "DELETE FROM %s WHERE gamma_id = ?";
- private static final String DELETE_EMPTY_TRANSACTIONS = "DELETE FROM osee_tx_details WHERE transaction_id = ?";
-
- private IProgressMonitor monitor;
-
- public CleanUpBackingData() {
- super("Data with no TXS Addressing and empty transactions");
- }
-
- private void processNotAddressedGammas(String tableName) throws OseeDataStoreException, IOException {
- checkForCancelledStatus(monitor);
-
- List<Object[]> notAddressedGammas = new LinkedList<Object[]>();
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- String sql = String.format(NOT_ADDRESSESED_GAMMAS, tableName);
-
- ResultsEditorTableTab resultsTab = new ResultsEditorTableTab(tableName + " gammas");
- getResultsProvider().addResultsTab(resultsTab);
- resultsTab.addColumn(new XViewerColumn("1", tableName + " gammas", 80, SWT.LEFT, true, SortDataType.Integer,
- false, ""));
-
- try {
- chStmt.runPreparedQuery(sql);
- while (chStmt.next()) {
- notAddressedGammas.add(new Object[] {chStmt.getLong("gamma_id")});
- resultsTab.addRow(new ResultsXViewerRow(new String[] {String.valueOf(chStmt.getLong("gamma_id"))}));
- }
- } finally {
- chStmt.close();
- }
-
- if (isFixOperationEnabled()) {
- sql = String.format(DELETE_GAMMAS, tableName);
- ConnectionHandler.runBatchUpdate(sql, notAddressedGammas);
- }
-
- monitor.worked(calculateWork(0.10));
- }
-
- private void processEmptyTransactions() throws OseeDataStoreException, IOException {
- checkForCancelledStatus(monitor);
-
- List<Object[]> emptyTransactions = new LinkedList<Object[]>();
- IOseeStatement chStmt = ConnectionHandler.getStatement();
-
- ResultsEditorTableTab resultsTab = new ResultsEditorTableTab("Empty transactions");
- getResultsProvider().addResultsTab(resultsTab);
- resultsTab.addColumn(new XViewerColumn("1", "Transaction Id", 80, SWT.LEFT, true, SortDataType.Integer, false, ""));
-
- try {
- chStmt.runPreparedQuery(EMPTY_TRANSACTIONS);
- while (chStmt.next()) {
- emptyTransactions.add(new Object[] {chStmt.getInt("transaction_id")});
- resultsTab.addRow(new ResultsXViewerRow(new String[] {String.valueOf(chStmt.getInt("transaction_id"))}));
- }
- } finally {
- chStmt.close();
- }
-
- if (isFixOperationEnabled()) {
- ConnectionHandler.runBatchUpdate(DELETE_EMPTY_TRANSACTIONS, emptyTransactions);
- }
-
- monitor.worked(calculateWork(0.10));
- }
-
- @Override
- protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
- this.monitor = monitor;
-
- processNotAddressedGammas("osee_attribute");
- processNotAddressedGammas("osee_artifact");
- processNotAddressedGammas("osee_relation_link");
- processEmptyTransactions();
-
- monitor.worked(calculateWork(0.20));
- }
-
- @Override
- public String getCheckDescription() {
- return "Check for artifact, attribute, and relation versions that are not addressed and for empty transactions";
- }
-
- @Override
- public String getFixDescription() {
- return "Purge artifact, attribute, and relation versions that are not addressed and purge empty transactions";
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.dbHealth;
+
+import java.io.IOException;
+import java.util.LinkedList;
+import java.util.List;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn.SortDataType;
+import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.ui.skynet.results.table.ResultsEditorTableTab;
+import org.eclipse.osee.framework.ui.skynet.results.table.ResultsXViewerRow;
+import org.eclipse.swt.SWT;
+
+/**
+ * @author Theron Virgin
+ * @author Ryan D. Brooks
+ */
+public class CleanUpBackingData extends DatabaseHealthOperation {
+ private static final String NOT_ADDRESSESED_GAMMAS =
+ "select gamma_id from %s t1 where not exists (select 1 from osee_txs txs1 where t1.gamma_id = txs1.gamma_id) and not exists (select 1 from osee_removed_txs txs2 where t1.gamma_id = txs2.rem_gamma_id) and not exists (select 1 from osee_txs_archived txs3 where t1.gamma_id = txs3.gamma_id)";
+ private static final String EMPTY_TRANSACTIONS =
+ "select transaction_id from osee_tx_details txd where tx_type = 0 and not exists (select 1 from osee_txs txs1 where txd.transaction_id = txs1.transaction_id) and not exists (select 1 from osee_removed_txs txs2 where txd.transaction_id = txs2.transaction_id or txd.transaction_id = txs2.rem_transaction_id) and not exists (select 1 from osee_txs_archived txs3 where txd.transaction_id = txs3.transaction_id)";
+ private static final String DELETE_GAMMAS = "DELETE FROM %s WHERE gamma_id = ?";
+ private static final String DELETE_EMPTY_TRANSACTIONS = "DELETE FROM osee_tx_details WHERE transaction_id = ?";
+
+ private IProgressMonitor monitor;
+
+ public CleanUpBackingData() {
+ super("Data with no TXS Addressing and empty transactions");
+ }
+
+ private void processNotAddressedGammas(String tableName) throws OseeDataStoreException, IOException {
+ checkForCancelledStatus(monitor);
+
+ List<Object[]> notAddressedGammas = new LinkedList<Object[]>();
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+ String sql = String.format(NOT_ADDRESSESED_GAMMAS, tableName);
+
+ ResultsEditorTableTab resultsTab = new ResultsEditorTableTab(tableName + " gammas");
+ getResultsProvider().addResultsTab(resultsTab);
+ resultsTab.addColumn(new XViewerColumn("1", tableName + " gammas", 80, SWT.LEFT, true, SortDataType.Integer,
+ false, ""));
+
+ try {
+ chStmt.runPreparedQuery(sql);
+ while (chStmt.next()) {
+ notAddressedGammas.add(new Object[] {chStmt.getLong("gamma_id")});
+ resultsTab.addRow(new ResultsXViewerRow(new String[] {String.valueOf(chStmt.getLong("gamma_id"))}));
+ }
+ } finally {
+ chStmt.close();
+ }
+
+ if (isFixOperationEnabled()) {
+ sql = String.format(DELETE_GAMMAS, tableName);
+ ConnectionHandler.runBatchUpdate(sql, notAddressedGammas);
+ }
+
+ monitor.worked(calculateWork(0.10));
+ }
+
+ private void processEmptyTransactions() throws OseeDataStoreException, IOException {
+ checkForCancelledStatus(monitor);
+
+ List<Object[]> emptyTransactions = new LinkedList<Object[]>();
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+
+ ResultsEditorTableTab resultsTab = new ResultsEditorTableTab("Empty transactions");
+ getResultsProvider().addResultsTab(resultsTab);
+ resultsTab.addColumn(new XViewerColumn("1", "Transaction Id", 80, SWT.LEFT, true, SortDataType.Integer, false, ""));
+
+ try {
+ chStmt.runPreparedQuery(EMPTY_TRANSACTIONS);
+ while (chStmt.next()) {
+ emptyTransactions.add(new Object[] {chStmt.getInt("transaction_id")});
+ resultsTab.addRow(new ResultsXViewerRow(new String[] {String.valueOf(chStmt.getInt("transaction_id"))}));
+ }
+ } finally {
+ chStmt.close();
+ }
+
+ if (isFixOperationEnabled()) {
+ ConnectionHandler.runBatchUpdate(DELETE_EMPTY_TRANSACTIONS, emptyTransactions);
+ }
+
+ monitor.worked(calculateWork(0.10));
+ }
+
+ @Override
+ protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
+ this.monitor = monitor;
+
+ processNotAddressedGammas("osee_attribute");
+ processNotAddressedGammas("osee_artifact");
+ processNotAddressedGammas("osee_relation_link");
+ processEmptyTransactions();
+
+ monitor.worked(calculateWork(0.20));
+ }
+
+ @Override
+ public String getCheckDescription() {
+ return "Check for artifact, attribute, and relation versions that are not addressed and for empty transactions";
+ }
+
+ @Override
+ public String getFixDescription() {
+ return "Purge artifact, attribute, and relation versions that are not addressed and purge empty transactions";
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CommitTransactions.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CommitTransactions.java
index d0162593400..1599b0d319c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CommitTransactions.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/CommitTransactions.java
@@ -1,83 +1,83 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.dbHealth;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-
-/**
- * Updates commit transactions so new and then modified objects will be committed with a mod type of new. This BLAM
- * operation also removes attribute from deleted artifacts from committed transactions.
- *
- * @author Jeff C. Phillips
- */
-public class CommitTransactions extends DatabaseHealthOperation {
- private static final String GET_COMMIT_TRANSACTIONS =
- "SELECT transaction_id FROM osee_tx_details WHERE osee_comment LIKE '%Commit%'";
- private static final String UPDATE_NEW_TRANSACTIONS_TO_CURRENT =
- "UPDATE osee_txs SET mod_type = 1 WHERE transaction_id = ? AND mod_type <> 1 AND gamma_id IN (SELECT tx1.gamma_id FROM osee_txs tx1, osee_artifact av1 WHERE tx1.transaction_id = ? AND tx1.gamma_id = av1.gamma_id AND av1.art_id NOT IN (SELECT av2.art_id FROM osee_tx_details td2, osee_txs tx2, osee_artifact av2 WHERE td2.osee_comment like '%Commit%' AND tx2.transaction_id < tx1.transaction_id AND tx2.transaction_id = tx2.transaction_id AND tx2.gamma_id = av2.gamma_id) AND av1.art_id NOT IN (SELECT av3.art_id FROM osee_txs tx3, osee_artifact av3 WHERE tx3.branch_id = tx1.branch_id AND tx3.transaction_id < tx1.transaction_id AND tx3.mod_type = 1 AND tx3.gamma_id = av3.gamma_id))";
- private static final String DELETE_ORPHAN_ATTRIBUTES =
- "DELETE FROM osee_attribute WHERE gamma_id IN (SELECT t3.gamma_id FROM osee_txs t2, osee_attribute t3 WHERE t2.transaction_id = ? AND t2.gamma_id = t3.gamma_id AND t3.art_id NOT IN (SELECT art_id FROM osee_txs t4, osee_artifact t5 WHERE t4.transaction_id = t2.transaction_id AND t4.gamma_id = t5.gamma_id))";
-
- public CommitTransactions() {
- super(
- "commit transactions by deleting orphan attributes and setting new artifacts that have been modified to a mod type of 1");
- }
-
- @Override
- public String getVerifyTaskName() {
- return Strings.emptyString();
- }
-
- @Override
- protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
- if (isFixOperationEnabled()) {
- checkForCancelledStatus(monitor);
-
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- try {
- chStmt.runPreparedQuery(GET_COMMIT_TRANSACTIONS, new Object[0]);
-
- checkForCancelledStatus(monitor);
- monitor.worked(calculateWork(0.50));
-
- while (chStmt.next()) {
- int transactionNumber = chStmt.getInt("transaction_id");
- int updateCount =
- ConnectionHandler.runPreparedUpdate(UPDATE_NEW_TRANSACTIONS_TO_CURRENT, transactionNumber,
- transactionNumber);
- int deleteAttrCount = ConnectionHandler.runPreparedUpdate(DELETE_ORPHAN_ATTRIBUTES, transactionNumber);
-
- getSummary().append(
- "For transaction: " + transactionNumber + " Number of update modTypes to 1:" + updateCount + " Number of deleted attrs: " + deleteAttrCount);
- }
- } finally {
- chStmt.close();
- }
- } else {
- monitor.worked(calculateWork(0.50));
- }
- monitor.worked(calculateWork(0.50));
- }
-
- @Override
- public String getCheckDescription() {
- return "Enter Check Description Here";
- }
-
- @Override
- public String getFixDescription() {
- return "Enter Fix Description Here";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.dbHealth;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+
+/**
+ * Updates commit transactions so new and then modified objects will be committed with a mod type of new. This BLAM
+ * operation also removes attribute from deleted artifacts from committed transactions.
+ *
+ * @author Jeff C. Phillips
+ */
+public class CommitTransactions extends DatabaseHealthOperation {
+ private static final String GET_COMMIT_TRANSACTIONS =
+ "SELECT transaction_id FROM osee_tx_details WHERE osee_comment LIKE '%Commit%'";
+ private static final String UPDATE_NEW_TRANSACTIONS_TO_CURRENT =
+ "UPDATE osee_txs SET mod_type = 1 WHERE transaction_id = ? AND mod_type <> 1 AND gamma_id IN (SELECT tx1.gamma_id FROM osee_txs tx1, osee_artifact av1 WHERE tx1.transaction_id = ? AND tx1.gamma_id = av1.gamma_id AND av1.art_id NOT IN (SELECT av2.art_id FROM osee_tx_details td2, osee_txs tx2, osee_artifact av2 WHERE td2.osee_comment like '%Commit%' AND tx2.transaction_id < tx1.transaction_id AND tx2.transaction_id = tx2.transaction_id AND tx2.gamma_id = av2.gamma_id) AND av1.art_id NOT IN (SELECT av3.art_id FROM osee_txs tx3, osee_artifact av3 WHERE tx3.branch_id = tx1.branch_id AND tx3.transaction_id < tx1.transaction_id AND tx3.mod_type = 1 AND tx3.gamma_id = av3.gamma_id))";
+ private static final String DELETE_ORPHAN_ATTRIBUTES =
+ "DELETE FROM osee_attribute WHERE gamma_id IN (SELECT t3.gamma_id FROM osee_txs t2, osee_attribute t3 WHERE t2.transaction_id = ? AND t2.gamma_id = t3.gamma_id AND t3.art_id NOT IN (SELECT art_id FROM osee_txs t4, osee_artifact t5 WHERE t4.transaction_id = t2.transaction_id AND t4.gamma_id = t5.gamma_id))";
+
+ public CommitTransactions() {
+ super(
+ "commit transactions by deleting orphan attributes and setting new artifacts that have been modified to a mod type of 1");
+ }
+
+ @Override
+ public String getVerifyTaskName() {
+ return Strings.emptyString();
+ }
+
+ @Override
+ protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
+ if (isFixOperationEnabled()) {
+ checkForCancelledStatus(monitor);
+
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+ try {
+ chStmt.runPreparedQuery(GET_COMMIT_TRANSACTIONS, new Object[0]);
+
+ checkForCancelledStatus(monitor);
+ monitor.worked(calculateWork(0.50));
+
+ while (chStmt.next()) {
+ int transactionNumber = chStmt.getInt("transaction_id");
+ int updateCount =
+ ConnectionHandler.runPreparedUpdate(UPDATE_NEW_TRANSACTIONS_TO_CURRENT, transactionNumber,
+ transactionNumber);
+ int deleteAttrCount = ConnectionHandler.runPreparedUpdate(DELETE_ORPHAN_ATTRIBUTES, transactionNumber);
+
+ getSummary().append(
+ "For transaction: " + transactionNumber + " Number of update modTypes to 1:" + updateCount + " Number of deleted attrs: " + deleteAttrCount);
+ }
+ } finally {
+ chStmt.close();
+ }
+ } else {
+ monitor.worked(calculateWork(0.50));
+ }
+ monitor.worked(calculateWork(0.50));
+ }
+
+ @Override
+ public String getCheckDescription() {
+ return "Enter Check Description Here";
+ }
+
+ @Override
+ public String getFixDescription() {
+ return "Enter Fix Description Here";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DatabaseHealthOperation.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DatabaseHealthOperation.java
index 61063cbdd57..27e0b95ce66 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DatabaseHealthOperation.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DatabaseHealthOperation.java
@@ -1,111 +1,111 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.dbHealth;
-
-import java.io.IOException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.results.MultiPageResultsProvider;
-
-/**
- * @author Roberto E. Escobar
- * @author Jeff C. Phillips
- */
-public abstract class DatabaseHealthOperation extends AbstractOperation {
-
- private boolean isFixOperationEnabled;
- private int itemToFixCount;
-
- private Appendable appendableBuffer;
- private final StringBuilder detailedReport;
- private final MultiPageResultsProvider resultsProvider = new MultiPageResultsProvider(this);
-
- protected DatabaseHealthOperation(String operationName) {
- super(operationName, SkynetGuiPlugin.PLUGIN_ID);
- this.isFixOperationEnabled = false;
- this.appendableBuffer = new StringBuilder();
- this.detailedReport = new StringBuilder();
- this.itemToFixCount = 0;
- }
-
- @Override
- public String getName() {
- return isFixOperationEnabled() ? getFixTaskName() : getVerifyTaskName();
- }
-
- public String getVerifyTaskName() {
- return String.format("Check for %s", super.getName());
- }
-
- public String getFixTaskName() {
- return String.format("Fix %s", super.getName());
- }
-
- public void setFixOperationEnabled(boolean isFixOperationEnabled) {
- this.isFixOperationEnabled = isFixOperationEnabled;
- }
-
- public boolean isFixOperationEnabled() {
- return isFixOperationEnabled;
- }
-
- public void setSummary(Appendable appendableBuffer) {
- this.appendableBuffer = appendableBuffer;
- }
-
- public Appendable getSummary() {
- return appendableBuffer;
- }
-
- public void appendToDetails(String value) throws IOException {
- getDetailedReport().append(value);
- }
-
- public Appendable getDetailedReport() {
- return detailedReport;
- }
-
- public MultiPageResultsProvider getResultsProvider() {
- return resultsProvider;
- }
-
- protected void setItemsToFix(int value) {
- this.itemToFixCount = value;
- }
-
- public boolean hadItemsToFix() {
- return getItemsToFixCount() > 0;
- }
-
- public int getItemsToFixCount() {
- return itemToFixCount;
- }
-
- @Override
- protected final void doWork(IProgressMonitor monitor) throws Exception {
- detailedReport.delete(0, detailedReport.length());
- setItemsToFix(0);
- doHealthCheck(monitor);
- }
-
- /**
- * @return Returns description of check and any other useful information i.e. time of execution
- */
- public abstract String getCheckDescription();
-
- /**
- * @return Returns description of what will happen and any consequences to clients
- */
- public abstract String getFixDescription();
-
- protected abstract void doHealthCheck(IProgressMonitor monitor) throws Exception;
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.dbHealth;
+
+import java.io.IOException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.operation.AbstractOperation;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.results.MultiPageResultsProvider;
+
+/**
+ * @author Roberto E. Escobar
+ * @author Jeff C. Phillips
+ */
+public abstract class DatabaseHealthOperation extends AbstractOperation {
+
+ private boolean isFixOperationEnabled;
+ private int itemToFixCount;
+
+ private Appendable appendableBuffer;
+ private final StringBuilder detailedReport;
+ private final MultiPageResultsProvider resultsProvider = new MultiPageResultsProvider(this);
+
+ protected DatabaseHealthOperation(String operationName) {
+ super(operationName, SkynetGuiPlugin.PLUGIN_ID);
+ this.isFixOperationEnabled = false;
+ this.appendableBuffer = new StringBuilder();
+ this.detailedReport = new StringBuilder();
+ this.itemToFixCount = 0;
+ }
+
+ @Override
+ public String getName() {
+ return isFixOperationEnabled() ? getFixTaskName() : getVerifyTaskName();
+ }
+
+ public String getVerifyTaskName() {
+ return String.format("Check for %s", super.getName());
+ }
+
+ public String getFixTaskName() {
+ return String.format("Fix %s", super.getName());
+ }
+
+ public void setFixOperationEnabled(boolean isFixOperationEnabled) {
+ this.isFixOperationEnabled = isFixOperationEnabled;
+ }
+
+ public boolean isFixOperationEnabled() {
+ return isFixOperationEnabled;
+ }
+
+ public void setSummary(Appendable appendableBuffer) {
+ this.appendableBuffer = appendableBuffer;
+ }
+
+ public Appendable getSummary() {
+ return appendableBuffer;
+ }
+
+ public void appendToDetails(String value) throws IOException {
+ getDetailedReport().append(value);
+ }
+
+ public Appendable getDetailedReport() {
+ return detailedReport;
+ }
+
+ public MultiPageResultsProvider getResultsProvider() {
+ return resultsProvider;
+ }
+
+ protected void setItemsToFix(int value) {
+ this.itemToFixCount = value;
+ }
+
+ public boolean hadItemsToFix() {
+ return getItemsToFixCount() > 0;
+ }
+
+ public int getItemsToFixCount() {
+ return itemToFixCount;
+ }
+
+ @Override
+ protected final void doWork(IProgressMonitor monitor) throws Exception {
+ detailedReport.delete(0, detailedReport.length());
+ setItemsToFix(0);
+ doHealthCheck(monitor);
+ }
+
+ /**
+ * @return Returns description of check and any other useful information i.e. time of execution
+ */
+ public abstract String getCheckDescription();
+
+ /**
+ * @return Returns description of what will happen and any consequences to clients
+ */
+ public abstract String getFixDescription();
+
+ protected abstract void doHealthCheck(IProgressMonitor monitor) throws Exception;
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DatabaseHealthOpsExtensionManager.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DatabaseHealthOpsExtensionManager.java
index 39dbe40e6ad..ef15f6eacc8 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DatabaseHealthOpsExtensionManager.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DatabaseHealthOpsExtensionManager.java
@@ -1,89 +1,89 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.dbHealth;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.plugin.core.util.ExtensionDefinedObjects;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-
-/**
- * @author Roberto E. Escobar
- */
-public class DatabaseHealthOpsExtensionManager {
- private static final String EXTENSION_ELEMENT = "DatabaseHealthOperation";
- private static final String CLASS_ATTRIBUTE_NAME = "className";
- private static final String EXTENSION_POINT = SkynetGuiPlugin.PLUGIN_ID + "." + EXTENSION_ELEMENT;
-
- private static final Map<String, DatabaseHealthOperation> fixOps = new TreeMap<String, DatabaseHealthOperation>();
- private static final Map<String, DatabaseHealthOperation> verifyOps = new TreeMap<String, DatabaseHealthOperation>();
-
- private DatabaseHealthOpsExtensionManager() {
- }
-
- public static Set<String> getFixOperationNames() {
- return getOperationNames(true);
- }
-
- public static Set<String> getVerifyOperationNames() {
- return getOperationNames(false);
- }
-
- private static Set<String> getOperationNames(boolean isFix) {
- checkExtensionsLoaded();
- return isFix ? fixOps.keySet() : verifyOps.keySet();
- }
-
- public static Collection<DatabaseHealthOperation> getFixOperations() {
- return getOperations(true);
- }
-
- public static Collection<DatabaseHealthOperation> getVerifyOperations() {
- return getOperations(false);
- }
-
- private static Collection<DatabaseHealthOperation> getOperations(boolean isFix) {
- checkExtensionsLoaded();
- return isFix ? fixOps.values() : verifyOps.values();
- }
-
- public static DatabaseHealthOperation getFixOperationByName(String name) {
- return getOperationByName(name, true);
- }
-
- public static DatabaseHealthOperation getVerifyOperationByName(String name) {
- return getOperationByName(name, false);
- }
-
- private static DatabaseHealthOperation getOperationByName(String name, boolean isFix) {
- checkExtensionsLoaded();
- return isFix ? fixOps.get(name) : verifyOps.get(name);
- }
-
- private static void checkExtensionsLoaded() {
- if (verifyOps.isEmpty() || fixOps.isEmpty()) {
- ExtensionDefinedObjects<DatabaseHealthOperation> extensionDefinedObjects =
- new ExtensionDefinedObjects<DatabaseHealthOperation>(EXTENSION_POINT, EXTENSION_ELEMENT,
- CLASS_ATTRIBUTE_NAME);
- for (DatabaseHealthOperation operation : extensionDefinedObjects.getObjects()) {
- if (Strings.isValid(operation.getVerifyTaskName())) {
- verifyOps.put(operation.getVerifyTaskName(), operation);
- }
- if (Strings.isValid(operation.getFixTaskName())) {
- fixOps.put(operation.getFixTaskName(), operation);
- }
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.dbHealth;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.plugin.core.util.ExtensionDefinedObjects;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DatabaseHealthOpsExtensionManager {
+ private static final String EXTENSION_ELEMENT = "DatabaseHealthOperation";
+ private static final String CLASS_ATTRIBUTE_NAME = "className";
+ private static final String EXTENSION_POINT = SkynetGuiPlugin.PLUGIN_ID + "." + EXTENSION_ELEMENT;
+
+ private static final Map<String, DatabaseHealthOperation> fixOps = new TreeMap<String, DatabaseHealthOperation>();
+ private static final Map<String, DatabaseHealthOperation> verifyOps = new TreeMap<String, DatabaseHealthOperation>();
+
+ private DatabaseHealthOpsExtensionManager() {
+ }
+
+ public static Set<String> getFixOperationNames() {
+ return getOperationNames(true);
+ }
+
+ public static Set<String> getVerifyOperationNames() {
+ return getOperationNames(false);
+ }
+
+ private static Set<String> getOperationNames(boolean isFix) {
+ checkExtensionsLoaded();
+ return isFix ? fixOps.keySet() : verifyOps.keySet();
+ }
+
+ public static Collection<DatabaseHealthOperation> getFixOperations() {
+ return getOperations(true);
+ }
+
+ public static Collection<DatabaseHealthOperation> getVerifyOperations() {
+ return getOperations(false);
+ }
+
+ private static Collection<DatabaseHealthOperation> getOperations(boolean isFix) {
+ checkExtensionsLoaded();
+ return isFix ? fixOps.values() : verifyOps.values();
+ }
+
+ public static DatabaseHealthOperation getFixOperationByName(String name) {
+ return getOperationByName(name, true);
+ }
+
+ public static DatabaseHealthOperation getVerifyOperationByName(String name) {
+ return getOperationByName(name, false);
+ }
+
+ private static DatabaseHealthOperation getOperationByName(String name, boolean isFix) {
+ checkExtensionsLoaded();
+ return isFix ? fixOps.get(name) : verifyOps.get(name);
+ }
+
+ private static void checkExtensionsLoaded() {
+ if (verifyOps.isEmpty() || fixOps.isEmpty()) {
+ ExtensionDefinedObjects<DatabaseHealthOperation> extensionDefinedObjects =
+ new ExtensionDefinedObjects<DatabaseHealthOperation>(EXTENSION_POINT, EXTENSION_ELEMENT,
+ CLASS_ATTRIBUTE_NAME);
+ for (DatabaseHealthOperation operation : extensionDefinedObjects.getObjects()) {
+ if (Strings.isValid(operation.getVerifyTaskName())) {
+ verifyOps.put(operation.getVerifyTaskName(), operation);
+ }
+ if (Strings.isValid(operation.getFixTaskName())) {
+ fixOps.put(operation.getFixTaskName(), operation);
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DatabaseIntegrityCheckApplication.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DatabaseIntegrityCheckApplication.java
index 04e91b71026..a67a193d122 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DatabaseIntegrityCheckApplication.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DatabaseIntegrityCheckApplication.java
@@ -1,193 +1,193 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.dbHealth;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.equinox.app.IApplication;
-import org.eclipse.equinox.app.IApplicationContext;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn.SortDataType;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.operation.Operations;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.ui.skynet.results.IResultsEditorProvider;
-import org.eclipse.osee.framework.ui.skynet.results.IResultsEditorTab;
-import org.eclipse.osee.framework.ui.skynet.results.ResultsEditorConverter;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.framework.ui.skynet.results.html.XResultPage;
-import org.eclipse.osee.framework.ui.skynet.results.html.XResultPage.Manipulations;
-import org.eclipse.osee.framework.ui.skynet.results.table.ResultsEditorTableTab;
-import org.eclipse.osee.framework.ui.skynet.results.table.ResultsXViewerRow;
-import org.eclipse.swt.SWT;
-
-/**
- * @author Roberto E. Escobar
- */
-public class DatabaseIntegrityCheckApplication implements IApplication {
-
- private final ResultsEditorConverter converter;
-
- public DatabaseIntegrityCheckApplication() {
- converter = new ResultsEditorConverter();
- }
-
- @Override
- public Object start(IApplicationContext context) throws Exception {
- UserManager.getUser();
- String currentDir = System.getProperty("user.dir");
- File reportsDirectory = new File(currentDir, "databaseIntegrity_" + Lib.getDateTimeString());
- reportsDirectory.mkdirs();
-
- SummaryTab data = new SummaryTab("Database Integrity Summary");
-
- for (DatabaseHealthOperation op : DatabaseHealthOpsExtensionManager.getVerifyOperations()) {
- try {
- executeCheck(data, op, reportsDirectory);
- } catch (Exception ex) {
- data.addError(op, ex);
- }
- }
-
- String fileName = generateFileName("html", "Summary");
- File reportFile = new File(reportsDirectory, fileName);
- Writer writer = new BufferedWriter(new FileWriter(reportFile));
- try {
- converter.convert("html", writer, data);
- } finally {
- writer.close();
- }
-
- return Status.OK_STATUS;
- }
-
- private void executeCheck(SummaryTab data, DatabaseHealthOperation operation, File reportsDirectory) throws Exception {
- operation.setFixOperationEnabled(false);
- Operations.executeWorkAndCheckStatus(operation, new NullProgressMonitor(), -1);
-
- List<String> summaryLinks = new ArrayList<String>();
- int count = operation.getItemsToFixCount();
- if (count > 0) {
- writeReport(operation, reportsDirectory, summaryLinks);
- }
- data.add(operation, summaryLinks);
- }
-
- private void writeReport(DatabaseHealthOperation operation, File reportsDirectory, List<String> summaryLinks) throws Exception {
- String detailedReport = operation.getDetailedReport().toString();
- if (Strings.isValid(detailedReport)) {
- XResultData result = new XResultData();
- result.addRaw(detailedReport.toString());
- XResultPage page = result.getReport(operation.getName(), Manipulations.RAW_HTML);
-
- String fileName = generateFileName("html", operation);
- summaryLinks.add(fileName);
- File reportFile = new File(reportsDirectory, fileName);
- Lib.writeStringToFile(page.getManipulatedHtml(), reportFile);
- } else {
- String fileName = generateFileName("xml", operation);
- summaryLinks.add(fileName);
- File reportFile = new File(reportsDirectory, fileName);
- Writer writer = new BufferedWriter(new FileWriter(reportFile));
- try {
- converter.convert("Excel", writer, operation.getResultsProvider());
- } finally {
- writer.close();
- }
-
- fileName = generateFileName("html", operation);
- summaryLinks.add(fileName);
- reportFile = new File(reportsDirectory, fileName);
- writer = new BufferedWriter(new FileWriter(reportFile));
- try {
- converter.convert("html", writer, operation.getResultsProvider());
- } finally {
- writer.close();
- }
- }
- }
-
- private String generateFileName(String extension, DatabaseHealthOperation operation) {
- return generateFileName(extension, operation.getName().replaceAll(" ", "_"));
- }
-
- private String generateFileName(String extension, String name) {
- return String.format("%s_%s.%s", name, Lib.getDateTimeString(), extension);
- }
-
- @Override
- public void stop() {
- }
-
- private final class SummaryTab implements IResultsEditorProvider {
-
- private final String title;
- private final List<IResultsEditorTab> tabs;
- private final ResultsEditorTableTab mainTab;
-
- public SummaryTab(String title) {
- this.title = title;
- this.tabs = new ArrayList<IResultsEditorTab>();
-
- mainTab = new ResultsEditorTableTab(title);
- mainTab.addColumn(new XViewerColumn("1", "Operation", 220, SWT.LEFT, true, SortDataType.String, false, ""));
- mainTab.addColumn(new XViewerColumn("2", "Status", 80, SWT.LEFT, true, SortDataType.String, false, ""));
- mainTab.addColumn(new XViewerColumn("3", "Count", 80, SWT.LEFT, true, SortDataType.String, false, ""));
- mainTab.addColumn(new XViewerColumn("4", "Links", 80, SWT.LEFT, true, SortDataType.String, false, ""));
- tabs.add(mainTab);
- }
-
- public void add(DatabaseHealthOperation operation, List<String> links) {
- int count = operation.getItemsToFixCount();
- if (links.isEmpty()) {
- mainTab.addRow(new ResultsXViewerRow(new String[] {operation.getName(), count > 0 ? "Failed" : "Passed",
- String.valueOf(count), ""}));
- } else {
- int index = 0;
- for (String link : links) {
- String value = String.format("<a href=\"%s\">%s</a>", link, link);
- if (index == 0) {
- mainTab.addRow(new ResultsXViewerRow(new String[] {operation.getName(),
- count > 0 ? "Failed" : "Passed", String.valueOf(count), value}));
- } else {
- mainTab.addRow(new ResultsXViewerRow(new String[] {"", "", "", value}));
- }
- index++;
- }
- }
- }
-
- public void addError(DatabaseHealthOperation operation, Throwable th) {
- mainTab.addRow(new ResultsXViewerRow(new String[] {operation.getName(), "Expection", "0",
- Lib.exceptionToString(th), ""}));
- }
-
- @Override
- public String getEditorName() throws OseeCoreException {
- return title;
- }
-
- @Override
- public List<IResultsEditorTab> getResultsEditorTabs() throws OseeCoreException {
- return tabs;
- }
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.dbHealth;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn.SortDataType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.operation.Operations;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+import org.eclipse.osee.framework.ui.skynet.results.IResultsEditorProvider;
+import org.eclipse.osee.framework.ui.skynet.results.IResultsEditorTab;
+import org.eclipse.osee.framework.ui.skynet.results.ResultsEditorConverter;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.framework.ui.skynet.results.html.XResultPage;
+import org.eclipse.osee.framework.ui.skynet.results.html.XResultPage.Manipulations;
+import org.eclipse.osee.framework.ui.skynet.results.table.ResultsEditorTableTab;
+import org.eclipse.osee.framework.ui.skynet.results.table.ResultsXViewerRow;
+import org.eclipse.swt.SWT;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DatabaseIntegrityCheckApplication implements IApplication {
+
+ private final ResultsEditorConverter converter;
+
+ public DatabaseIntegrityCheckApplication() {
+ converter = new ResultsEditorConverter();
+ }
+
+ @Override
+ public Object start(IApplicationContext context) throws Exception {
+ UserManager.getUser();
+ String currentDir = System.getProperty("user.dir");
+ File reportsDirectory = new File(currentDir, "databaseIntegrity_" + Lib.getDateTimeString());
+ reportsDirectory.mkdirs();
+
+ SummaryTab data = new SummaryTab("Database Integrity Summary");
+
+ for (DatabaseHealthOperation op : DatabaseHealthOpsExtensionManager.getVerifyOperations()) {
+ try {
+ executeCheck(data, op, reportsDirectory);
+ } catch (Exception ex) {
+ data.addError(op, ex);
+ }
+ }
+
+ String fileName = generateFileName("html", "Summary");
+ File reportFile = new File(reportsDirectory, fileName);
+ Writer writer = new BufferedWriter(new FileWriter(reportFile));
+ try {
+ converter.convert("html", writer, data);
+ } finally {
+ writer.close();
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ private void executeCheck(SummaryTab data, DatabaseHealthOperation operation, File reportsDirectory) throws Exception {
+ operation.setFixOperationEnabled(false);
+ Operations.executeWorkAndCheckStatus(operation, new NullProgressMonitor(), -1);
+
+ List<String> summaryLinks = new ArrayList<String>();
+ int count = operation.getItemsToFixCount();
+ if (count > 0) {
+ writeReport(operation, reportsDirectory, summaryLinks);
+ }
+ data.add(operation, summaryLinks);
+ }
+
+ private void writeReport(DatabaseHealthOperation operation, File reportsDirectory, List<String> summaryLinks) throws Exception {
+ String detailedReport = operation.getDetailedReport().toString();
+ if (Strings.isValid(detailedReport)) {
+ XResultData result = new XResultData();
+ result.addRaw(detailedReport.toString());
+ XResultPage page = result.getReport(operation.getName(), Manipulations.RAW_HTML);
+
+ String fileName = generateFileName("html", operation);
+ summaryLinks.add(fileName);
+ File reportFile = new File(reportsDirectory, fileName);
+ Lib.writeStringToFile(page.getManipulatedHtml(), reportFile);
+ } else {
+ String fileName = generateFileName("xml", operation);
+ summaryLinks.add(fileName);
+ File reportFile = new File(reportsDirectory, fileName);
+ Writer writer = new BufferedWriter(new FileWriter(reportFile));
+ try {
+ converter.convert("Excel", writer, operation.getResultsProvider());
+ } finally {
+ writer.close();
+ }
+
+ fileName = generateFileName("html", operation);
+ summaryLinks.add(fileName);
+ reportFile = new File(reportsDirectory, fileName);
+ writer = new BufferedWriter(new FileWriter(reportFile));
+ try {
+ converter.convert("html", writer, operation.getResultsProvider());
+ } finally {
+ writer.close();
+ }
+ }
+ }
+
+ private String generateFileName(String extension, DatabaseHealthOperation operation) {
+ return generateFileName(extension, operation.getName().replaceAll(" ", "_"));
+ }
+
+ private String generateFileName(String extension, String name) {
+ return String.format("%s_%s.%s", name, Lib.getDateTimeString(), extension);
+ }
+
+ @Override
+ public void stop() {
+ }
+
+ private final class SummaryTab implements IResultsEditorProvider {
+
+ private final String title;
+ private final List<IResultsEditorTab> tabs;
+ private final ResultsEditorTableTab mainTab;
+
+ public SummaryTab(String title) {
+ this.title = title;
+ this.tabs = new ArrayList<IResultsEditorTab>();
+
+ mainTab = new ResultsEditorTableTab(title);
+ mainTab.addColumn(new XViewerColumn("1", "Operation", 220, SWT.LEFT, true, SortDataType.String, false, ""));
+ mainTab.addColumn(new XViewerColumn("2", "Status", 80, SWT.LEFT, true, SortDataType.String, false, ""));
+ mainTab.addColumn(new XViewerColumn("3", "Count", 80, SWT.LEFT, true, SortDataType.String, false, ""));
+ mainTab.addColumn(new XViewerColumn("4", "Links", 80, SWT.LEFT, true, SortDataType.String, false, ""));
+ tabs.add(mainTab);
+ }
+
+ public void add(DatabaseHealthOperation operation, List<String> links) {
+ int count = operation.getItemsToFixCount();
+ if (links.isEmpty()) {
+ mainTab.addRow(new ResultsXViewerRow(new String[] {operation.getName(), count > 0 ? "Failed" : "Passed",
+ String.valueOf(count), ""}));
+ } else {
+ int index = 0;
+ for (String link : links) {
+ String value = String.format("<a href=\"%s\">%s</a>", link, link);
+ if (index == 0) {
+ mainTab.addRow(new ResultsXViewerRow(new String[] {operation.getName(),
+ count > 0 ? "Failed" : "Passed", String.valueOf(count), value}));
+ } else {
+ mainTab.addRow(new ResultsXViewerRow(new String[] {"", "", "", value}));
+ }
+ index++;
+ }
+ }
+ }
+
+ public void addError(DatabaseHealthOperation operation, Throwable th) {
+ mainTab.addRow(new ResultsXViewerRow(new String[] {operation.getName(), "Expection", "0",
+ Lib.exceptionToString(th), ""}));
+ }
+
+ @Override
+ public String getEditorName() throws OseeCoreException {
+ return title;
+ }
+
+ @Override
+ public List<IResultsEditorTab> getResultsEditorTabs() throws OseeCoreException {
+ return tabs;
+ }
+
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DuplicateAttributes.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DuplicateAttributes.java
index 38bafbc3e6b..39041231c1c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DuplicateAttributes.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DuplicateAttributes.java
@@ -1,279 +1,279 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.dbHealth;
-
-import java.util.LinkedList;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.framework.ui.skynet.results.html.XResultPage.Manipulations;
-
-/**
- * @author Theron Virgin
- */
-public class DuplicateAttributes extends DatabaseHealthOperation {
-
- private static final String GET_DUPLICATE_ATTRIBUTES =
- "SELECT attr1.art_id, aty1.NAME, attr1.attr_id as attr_id_1, attr2.attr_id as attr_id_2, attr1.value as value_1, attr2.value as value_2, attr1.uri as uri_1, attr2.uri as uri_2, attr1.gamma_id as gamma_id_1, attr2.gamma_id as gamma_id_2 FROM osee_attribute attr1, osee_attribute attr2, osee_attribute_type aty1 WHERE attr1.art_id = attr2.art_id AND attr1.attr_id < attr2.attr_id AND attr1.attr_type_id = attr2.attr_type_id AND attr1.attr_type_id = aty1.attr_type_id AND aty1.max_occurence = 1 AND EXISTS (SELECT 'x' FROM osee_txs txs1 WHERE txs1.gamma_id = attr1.gamma_id AND tx_current = 1) AND EXISTS (SELECT 'x' FROM osee_txs txs2 WHERE txs2.gamma_id = attr2.gamma_id and tx_current = 1) order by aty1.NAME, attr1.art_id";
-
- private static final String BRANCHES_WITH_ONLY_ATTR =
- "SELECT DISTINCT txs1.branch_id FROM osee_txs txs1 WHERE EXISTS (SELECT 'x' FROM osee_txs txs2, osee_attribute att2 WHERE txs1.transaction_id = txs2.transaction_id AND txs2.gamma_id = att2.gamma_id AND att2.attr_id = ?) %s (SELECT DISTINCT txs3.branch_id FROM osee_txs txs3 WHERE EXISTS (SELECT 'x' FROM osee_txs txs4, osee_attribute att4 WHERE txs3.transaction_id = txs4.transaction_id AND txs4.gamma_id = att4.gamma_id AND att4.attr_id = ?))";
-
- private static final String DELETE_ATTR = "DELETE FROM osee_attribute WHERE attr_id = ?";
-
- private static final String FILTER_DELTED =
- "SELECT * FROM osee_txs txs, osee_attribute atr WHERE txs.tx_current = 1 AND txs.gamma_id = atr.gamma_id AND atr.attr_id = ?";
-
- public DuplicateAttributes() {
- super("Duplicate Attribute Errors");
- }
-
- private DuplicateAttributeData createAttributeData(IOseeStatement chStmt) throws OseeDataStoreException {
- AttributeData attributeData1 =
- new AttributeData(chStmt.getInt("attr_id_1"), chStmt.getInt("gamma_id_1"), chStmt.getString("value_1"),
- chStmt.getString("uri_1"));
- AttributeData attributeData2 =
- new AttributeData(chStmt.getInt("attr_id_2"), chStmt.getInt("gamma_id_2"), chStmt.getString("value_2"),
- chStmt.getString("uri_2"));
- return new DuplicateAttributeData(chStmt.getInt("art_id"), chStmt.getString("name"), attributeData1,
- attributeData2);
- }
-
- private boolean isAttributeIdSetToCurrent(int attrId) throws OseeDataStoreException {
- return ConnectionHandler.runPreparedQueryFetchInt(-1, FILTER_DELTED, attrId) != -1;
- }
-
- @Override
- protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
- List<DuplicateAttributeData> sameValues = new LinkedList<DuplicateAttributeData>();
- List<DuplicateAttributeData> diffValues = new LinkedList<DuplicateAttributeData>();
-
- monitor.subTask("Querying for Duplicate Attributes");
-
- //--- Test's for two attributes that are on the same artifact but have different attr_ids, when ---//
- //--- the attribute type has a maximum of 1 allowable attributes. ---------------------------------//
-
- IOseeStatement chStmt1 = ConnectionHandler.getStatement();
- try {
- chStmt1.runPreparedQuery(GET_DUPLICATE_ATTRIBUTES);
- monitor.worked(6);
- monitor.subTask("Processing Results");
- checkForCancelledStatus(monitor);
- while (chStmt1.next()) {
- DuplicateAttributeData duplicateAttribute = createAttributeData(chStmt1);
- checkForCancelledStatus(monitor);
-
- boolean isCurrentAtLeastOnceForAttrId1 =
- isAttributeIdSetToCurrent(duplicateAttribute.getAttributeData1().getAttrId());
- checkForCancelledStatus(monitor);
-
- boolean isCurrentAtLeastOnceForAttrId2 =
- isAttributeIdSetToCurrent(duplicateAttribute.getAttributeData2().getAttrId());
- checkForCancelledStatus(monitor);
-
- if (isCurrentAtLeastOnceForAttrId1 && isCurrentAtLeastOnceForAttrId2) {
- if (duplicateAttribute.areAttributeValuesEqual() && duplicateAttribute.areAttributeURIEqual()) {
- sameValues.add(duplicateAttribute);
- } else {
- diffValues.add(duplicateAttribute);
- }
- }
- }
- } finally {
- chStmt1.close();
- }
-
- monitor.worked(2);
- monitor.subTask("Cleaning Up Attrinbutes");
- checkForCancelledStatus(monitor);
- if (sameValues.isEmpty() && diffValues.isEmpty()) {
- getSummary().append("No Duplicate Attributes Found\n");
- } else {
- StringBuffer sbFull = new StringBuffer(AHTML.beginMultiColumnTable(100, 1));
- try {
- String[] columnHeaders =
- new String[] {"Art Id", "Attr id 1", "Attr id 2", "Name", "Value 1", "Value 2", "URI 1", "URI 2",
- "Gamma ID 1", "Gamma Id 2", "ID to Delete"};
- sbFull.append(AHTML.beginMultiColumnTable(100, 1));
- sbFull.append(AHTML.addHeaderRowMultiColumnTable(columnHeaders));
- sbFull.append(AHTML.addRowSpanMultiColumnTable("Attributes with the same values", columnHeaders.length));
- int count = showAttributeCleanUpDecisions(sameValues, true, sbFull);
- sbFull.append(AHTML.addRowSpanMultiColumnTable("Attributes with different values", columnHeaders.length));
- count += showAttributeCleanUpDecisions(diffValues, false, sbFull);
- getSummary().append(String.format("Found %d duplicate attributes\n", count));
- } finally {
- sbFull.append(AHTML.endMultiColumnTable());
- XResultData rd = new XResultData();
- rd.addRaw(sbFull.toString());
- rd.report(getVerifyTaskName(), Manipulations.RAW_HTML);
-
- }
- }
-
- }
-
- private int showAttributeCleanUpDecisions(List<DuplicateAttributeData> values, boolean canFixAutomatically, StringBuffer builder) throws OseeDataStoreException {
- int count = 0;
- for (DuplicateAttributeData duplicate : values) {
- String fixMessage;
- if (canFixAutomatically) {
- AttributeData attributeToDelete = null;
-
- loadBranchesWhereOnlyOneIsUsed(duplicate.getAttributeData1(), duplicate.getAttributeData2().getAttrId());
- loadBranchesWhereOnlyOneIsUsed(duplicate.getAttributeData2(), duplicate.getAttributeData1().getAttrId());
-
- if (duplicate.getAttributeData1().isEmptyBranches()) {
- attributeToDelete = duplicate.getAttributeData1();
- } else if (duplicate.getAttributeData2().isEmptyBranches()) {
- attributeToDelete = duplicate.getAttributeData2();
- }
-
- if (attributeToDelete != null) {
- String prefix;
- if (isFixOperationEnabled()) {
- ConnectionHandler.runPreparedUpdate(DELETE_ATTR, attributeToDelete.getAttrId());
- prefix = "Fixed";
- } else {
- prefix = "Needs Fix";
- }
- fixMessage = String.format("[%s] - %s ", attributeToDelete.getAttrId(), prefix);
- } else {
- fixMessage = "Attributes in Use";
- }
- } else {
- fixMessage = "Requires Hand Analysis";
- }
-
- AttributeData attributeData1 = duplicate.getAttributeData1();
- AttributeData attributeData2 = duplicate.getAttributeData2();
- builder.append(AHTML.addRowMultiColumnTable(new String[] {String.valueOf(duplicate.getArtId()),
- String.valueOf(attributeData1.getAttrId()), String.valueOf(attributeData2.getAttrId()),
- duplicate.getName(), attributeData1.getValue(), attributeData2.getValue(), attributeData1.getUri(),
- attributeData2.getUri(), String.valueOf(attributeData1.getGamma()),
- String.valueOf(attributeData2.getGamma()), fixMessage}));
- count++;
- }
- return count;
- }
-
- //--- Find out if there is an attribute that is on every branch that has either one of the attributes ---//
- private void loadBranchesWhereOnlyOneIsUsed(AttributeData attributeData, int otherAttrId) throws OseeDataStoreException {
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- try {
- chStmt.runPreparedQuery(String.format(BRANCHES_WITH_ONLY_ATTR, chStmt.getComplementSql()),
- attributeData.getAttrId(), otherAttrId);
- while (chStmt.next()) {
- attributeData.addBranchId(chStmt.getInt("branch_id"));
- }
- } finally {
- chStmt.close();
- }
- }
-
- @Override
- public String getCheckDescription() {
- return "Find duplicate attributes which are current and are used in the same branches.";
- }
-
- @Override
- public String getFixDescription() {
- return "Deletes attributes that have been identified as duplicates by attr id.";
- }
-
- private final static class AttributeData {
- private final int attrId;
- private final String value;
- private final String uri;
- private final int gamma;
- private final List<Integer> branches;
-
- public AttributeData(int attrId, int gamma, String value, String uri) {
- super();
- this.attrId = attrId;
- this.value = value;
- this.uri = uri;
- this.gamma = gamma;
- this.branches = new LinkedList<Integer>();
- }
-
- public int getAttrId() {
- return attrId;
- }
-
- public String getValue() {
- return value;
- }
-
- public String getUri() {
- return uri;
- }
-
- public int getGamma() {
- return gamma;
- }
-
- public void addBranchId(Integer branchId) {
- branches.add(branchId);
- }
-
- public boolean isEmptyBranches() {
- return branches.isEmpty();
- }
- }
-
- private final static class DuplicateAttributeData {
- private final AttributeData attributeData1;
- private final AttributeData attributeData2;
-
- private final int artId;
- private final String name;
-
- public DuplicateAttributeData(int artId, String name, AttributeData attributeData1, AttributeData attributeData2) {
- super();
- this.artId = artId;
- this.name = name;
- this.attributeData1 = attributeData1;
- this.attributeData2 = attributeData2;
- }
-
- public AttributeData getAttributeData1() {
- return attributeData1;
- }
-
- public AttributeData getAttributeData2() {
- return attributeData2;
- }
-
- public int getArtId() {
- return artId;
- }
-
- public String getName() {
- return name;
- }
-
- public boolean areAttributeValuesEqual() {
- return areEqual(attributeData1.getValue(), attributeData2.getValue());
- }
-
- public boolean areAttributeURIEqual() {
- return areEqual(attributeData1.getUri(), attributeData2.getUri());
- }
-
- private boolean areEqual(Object object1, Object object2) {
- return object1 != null && object2 != null && object1.equals(object2) || object1 == null && object2 == 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.framework.ui.skynet.dbHealth;
+
+import java.util.LinkedList;
+import java.util.List;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.framework.ui.skynet.results.html.XResultPage.Manipulations;
+
+/**
+ * @author Theron Virgin
+ */
+public class DuplicateAttributes extends DatabaseHealthOperation {
+
+ private static final String GET_DUPLICATE_ATTRIBUTES =
+ "SELECT attr1.art_id, aty1.NAME, attr1.attr_id as attr_id_1, attr2.attr_id as attr_id_2, attr1.value as value_1, attr2.value as value_2, attr1.uri as uri_1, attr2.uri as uri_2, attr1.gamma_id as gamma_id_1, attr2.gamma_id as gamma_id_2 FROM osee_attribute attr1, osee_attribute attr2, osee_attribute_type aty1 WHERE attr1.art_id = attr2.art_id AND attr1.attr_id < attr2.attr_id AND attr1.attr_type_id = attr2.attr_type_id AND attr1.attr_type_id = aty1.attr_type_id AND aty1.max_occurence = 1 AND EXISTS (SELECT 'x' FROM osee_txs txs1 WHERE txs1.gamma_id = attr1.gamma_id AND tx_current = 1) AND EXISTS (SELECT 'x' FROM osee_txs txs2 WHERE txs2.gamma_id = attr2.gamma_id and tx_current = 1) order by aty1.NAME, attr1.art_id";
+
+ private static final String BRANCHES_WITH_ONLY_ATTR =
+ "SELECT DISTINCT txs1.branch_id FROM osee_txs txs1 WHERE EXISTS (SELECT 'x' FROM osee_txs txs2, osee_attribute att2 WHERE txs1.transaction_id = txs2.transaction_id AND txs2.gamma_id = att2.gamma_id AND att2.attr_id = ?) %s (SELECT DISTINCT txs3.branch_id FROM osee_txs txs3 WHERE EXISTS (SELECT 'x' FROM osee_txs txs4, osee_attribute att4 WHERE txs3.transaction_id = txs4.transaction_id AND txs4.gamma_id = att4.gamma_id AND att4.attr_id = ?))";
+
+ private static final String DELETE_ATTR = "DELETE FROM osee_attribute WHERE attr_id = ?";
+
+ private static final String FILTER_DELTED =
+ "SELECT * FROM osee_txs txs, osee_attribute atr WHERE txs.tx_current = 1 AND txs.gamma_id = atr.gamma_id AND atr.attr_id = ?";
+
+ public DuplicateAttributes() {
+ super("Duplicate Attribute Errors");
+ }
+
+ private DuplicateAttributeData createAttributeData(IOseeStatement chStmt) throws OseeDataStoreException {
+ AttributeData attributeData1 =
+ new AttributeData(chStmt.getInt("attr_id_1"), chStmt.getInt("gamma_id_1"), chStmt.getString("value_1"),
+ chStmt.getString("uri_1"));
+ AttributeData attributeData2 =
+ new AttributeData(chStmt.getInt("attr_id_2"), chStmt.getInt("gamma_id_2"), chStmt.getString("value_2"),
+ chStmt.getString("uri_2"));
+ return new DuplicateAttributeData(chStmt.getInt("art_id"), chStmt.getString("name"), attributeData1,
+ attributeData2);
+ }
+
+ private boolean isAttributeIdSetToCurrent(int attrId) throws OseeDataStoreException {
+ return ConnectionHandler.runPreparedQueryFetchInt(-1, FILTER_DELTED, attrId) != -1;
+ }
+
+ @Override
+ protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
+ List<DuplicateAttributeData> sameValues = new LinkedList<DuplicateAttributeData>();
+ List<DuplicateAttributeData> diffValues = new LinkedList<DuplicateAttributeData>();
+
+ monitor.subTask("Querying for Duplicate Attributes");
+
+ //--- Test's for two attributes that are on the same artifact but have different attr_ids, when ---//
+ //--- the attribute type has a maximum of 1 allowable attributes. ---------------------------------//
+
+ IOseeStatement chStmt1 = ConnectionHandler.getStatement();
+ try {
+ chStmt1.runPreparedQuery(GET_DUPLICATE_ATTRIBUTES);
+ monitor.worked(6);
+ monitor.subTask("Processing Results");
+ checkForCancelledStatus(monitor);
+ while (chStmt1.next()) {
+ DuplicateAttributeData duplicateAttribute = createAttributeData(chStmt1);
+ checkForCancelledStatus(monitor);
+
+ boolean isCurrentAtLeastOnceForAttrId1 =
+ isAttributeIdSetToCurrent(duplicateAttribute.getAttributeData1().getAttrId());
+ checkForCancelledStatus(monitor);
+
+ boolean isCurrentAtLeastOnceForAttrId2 =
+ isAttributeIdSetToCurrent(duplicateAttribute.getAttributeData2().getAttrId());
+ checkForCancelledStatus(monitor);
+
+ if (isCurrentAtLeastOnceForAttrId1 && isCurrentAtLeastOnceForAttrId2) {
+ if (duplicateAttribute.areAttributeValuesEqual() && duplicateAttribute.areAttributeURIEqual()) {
+ sameValues.add(duplicateAttribute);
+ } else {
+ diffValues.add(duplicateAttribute);
+ }
+ }
+ }
+ } finally {
+ chStmt1.close();
+ }
+
+ monitor.worked(2);
+ monitor.subTask("Cleaning Up Attrinbutes");
+ checkForCancelledStatus(monitor);
+ if (sameValues.isEmpty() && diffValues.isEmpty()) {
+ getSummary().append("No Duplicate Attributes Found\n");
+ } else {
+ StringBuffer sbFull = new StringBuffer(AHTML.beginMultiColumnTable(100, 1));
+ try {
+ String[] columnHeaders =
+ new String[] {"Art Id", "Attr id 1", "Attr id 2", "Name", "Value 1", "Value 2", "URI 1", "URI 2",
+ "Gamma ID 1", "Gamma Id 2", "ID to Delete"};
+ sbFull.append(AHTML.beginMultiColumnTable(100, 1));
+ sbFull.append(AHTML.addHeaderRowMultiColumnTable(columnHeaders));
+ sbFull.append(AHTML.addRowSpanMultiColumnTable("Attributes with the same values", columnHeaders.length));
+ int count = showAttributeCleanUpDecisions(sameValues, true, sbFull);
+ sbFull.append(AHTML.addRowSpanMultiColumnTable("Attributes with different values", columnHeaders.length));
+ count += showAttributeCleanUpDecisions(diffValues, false, sbFull);
+ getSummary().append(String.format("Found %d duplicate attributes\n", count));
+ } finally {
+ sbFull.append(AHTML.endMultiColumnTable());
+ XResultData rd = new XResultData();
+ rd.addRaw(sbFull.toString());
+ rd.report(getVerifyTaskName(), Manipulations.RAW_HTML);
+
+ }
+ }
+
+ }
+
+ private int showAttributeCleanUpDecisions(List<DuplicateAttributeData> values, boolean canFixAutomatically, StringBuffer builder) throws OseeDataStoreException {
+ int count = 0;
+ for (DuplicateAttributeData duplicate : values) {
+ String fixMessage;
+ if (canFixAutomatically) {
+ AttributeData attributeToDelete = null;
+
+ loadBranchesWhereOnlyOneIsUsed(duplicate.getAttributeData1(), duplicate.getAttributeData2().getAttrId());
+ loadBranchesWhereOnlyOneIsUsed(duplicate.getAttributeData2(), duplicate.getAttributeData1().getAttrId());
+
+ if (duplicate.getAttributeData1().isEmptyBranches()) {
+ attributeToDelete = duplicate.getAttributeData1();
+ } else if (duplicate.getAttributeData2().isEmptyBranches()) {
+ attributeToDelete = duplicate.getAttributeData2();
+ }
+
+ if (attributeToDelete != null) {
+ String prefix;
+ if (isFixOperationEnabled()) {
+ ConnectionHandler.runPreparedUpdate(DELETE_ATTR, attributeToDelete.getAttrId());
+ prefix = "Fixed";
+ } else {
+ prefix = "Needs Fix";
+ }
+ fixMessage = String.format("[%s] - %s ", attributeToDelete.getAttrId(), prefix);
+ } else {
+ fixMessage = "Attributes in Use";
+ }
+ } else {
+ fixMessage = "Requires Hand Analysis";
+ }
+
+ AttributeData attributeData1 = duplicate.getAttributeData1();
+ AttributeData attributeData2 = duplicate.getAttributeData2();
+ builder.append(AHTML.addRowMultiColumnTable(new String[] {String.valueOf(duplicate.getArtId()),
+ String.valueOf(attributeData1.getAttrId()), String.valueOf(attributeData2.getAttrId()),
+ duplicate.getName(), attributeData1.getValue(), attributeData2.getValue(), attributeData1.getUri(),
+ attributeData2.getUri(), String.valueOf(attributeData1.getGamma()),
+ String.valueOf(attributeData2.getGamma()), fixMessage}));
+ count++;
+ }
+ return count;
+ }
+
+ //--- Find out if there is an attribute that is on every branch that has either one of the attributes ---//
+ private void loadBranchesWhereOnlyOneIsUsed(AttributeData attributeData, int otherAttrId) throws OseeDataStoreException {
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+ try {
+ chStmt.runPreparedQuery(String.format(BRANCHES_WITH_ONLY_ATTR, chStmt.getComplementSql()),
+ attributeData.getAttrId(), otherAttrId);
+ while (chStmt.next()) {
+ attributeData.addBranchId(chStmt.getInt("branch_id"));
+ }
+ } finally {
+ chStmt.close();
+ }
+ }
+
+ @Override
+ public String getCheckDescription() {
+ return "Find duplicate attributes which are current and are used in the same branches.";
+ }
+
+ @Override
+ public String getFixDescription() {
+ return "Deletes attributes that have been identified as duplicates by attr id.";
+ }
+
+ private final static class AttributeData {
+ private final int attrId;
+ private final String value;
+ private final String uri;
+ private final int gamma;
+ private final List<Integer> branches;
+
+ public AttributeData(int attrId, int gamma, String value, String uri) {
+ super();
+ this.attrId = attrId;
+ this.value = value;
+ this.uri = uri;
+ this.gamma = gamma;
+ this.branches = new LinkedList<Integer>();
+ }
+
+ public int getAttrId() {
+ return attrId;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public String getUri() {
+ return uri;
+ }
+
+ public int getGamma() {
+ return gamma;
+ }
+
+ public void addBranchId(Integer branchId) {
+ branches.add(branchId);
+ }
+
+ public boolean isEmptyBranches() {
+ return branches.isEmpty();
+ }
+ }
+
+ private final static class DuplicateAttributeData {
+ private final AttributeData attributeData1;
+ private final AttributeData attributeData2;
+
+ private final int artId;
+ private final String name;
+
+ public DuplicateAttributeData(int artId, String name, AttributeData attributeData1, AttributeData attributeData2) {
+ super();
+ this.artId = artId;
+ this.name = name;
+ this.attributeData1 = attributeData1;
+ this.attributeData2 = attributeData2;
+ }
+
+ public AttributeData getAttributeData1() {
+ return attributeData1;
+ }
+
+ public AttributeData getAttributeData2() {
+ return attributeData2;
+ }
+
+ public int getArtId() {
+ return artId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public boolean areAttributeValuesEqual() {
+ return areEqual(attributeData1.getValue(), attributeData2.getValue());
+ }
+
+ public boolean areAttributeURIEqual() {
+ return areEqual(attributeData1.getUri(), attributeData2.getUri());
+ }
+
+ private boolean areEqual(Object object1, Object object2) {
+ return object1 != null && object2 != null && object1.equals(object2) || object1 == null && object2 == null;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DuplicateHRID.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DuplicateHRID.java
index 2733efa6293..c98cf79fab8 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DuplicateHRID.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/DuplicateHRID.java
@@ -1,170 +1,170 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.dbHealth;
-
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import org.eclipse.core.runtime.IProgressMonitor;
-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.IOseeStatement;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-
-/**
- * @author Megumi Telles
- */
-public class DuplicateHRID extends DatabaseHealthOperation {
-
- private class ArtifactData {
- protected String guid;
- protected String hrid;
- protected String artTypeName;
- }
-
- private class DuplicateHridSorter implements Comparator<ArtifactData> {
- public DuplicateHridSorter() {
- super();
- }
-
- @Override
- public int compare(ArtifactData o1, ArtifactData o2) {
- if (o1 == null || o2 == null) {
- return 0;
- }
- String str1 = o1.hrid;
- String str2 = o2.hrid;
- if (str1 == null || str2 == null) {
- return 0;
- }
- return str1.compareTo(str2);
- }
- }
-
- private static final String GET_DUPLICATE_HRIDS =
- "SELECT DISTINCT(t1.art_id), t1.guid, t1.human_readable_id, t3.name FROM osee_artifact t1, osee_artifact_type t3 WHERE t1.human_readable_id IN (SELECT t2.human_readable_id FROM osee_artifact t2 GROUP BY t2.human_readable_id HAVING COUNT(t2.human_readable_id) > 1) AND t3.art_type_id = t1.art_type_id ORDER BY t1.human_readable_id";
-
- private static final String COUNT_ATTRIBUTE_VALUES_CONTAINING =
- "SELECT count(1) from osee_attribute where value like ?"; // TODO value not necessarily in database
- private static final String COUNT_COMMENTS_CONTAINING =
- "SELECT count(1) from osee_tx_details where osee_comment like ?";
- private static final String COUNT_BRANCH_NAMES_CONTAINING =
- "SELECT count(1) from osee_branch where branch_name like ?";
-
- public DuplicateHRID() {
- super("Duplicate HRID Errors");
- }
-
- @Override
- public String getFixTaskName() {
- return Strings.emptyString();
- }
-
- @Override
- protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
- monitor.subTask("Querying for Duplicate Human Readable Ids");
- List<ArtifactData> diffValues = getDuplicateHRIDArtifacts(monitor);
- checkForCancelledStatus(monitor);
- monitor.worked(calculateWork(0.20));
-
- displayReport(monitor, diffValues, 0.20);
-
- checkForCancelledStatus(monitor);
- if (isFixOperationEnabled()) {
- // monitor.worked(calculateWork(0.50));
- } else {
- monitor.worked(calculateWork(0.50));
- }
-
- getSummary().append(String.format("[%s] Duplicate Human Readable Ids found\n", diffValues.size()));
- monitor.worked(calculateWork(0.10));
- }
-
- private void displayReport(IProgressMonitor monitor, List<ArtifactData> duplicateHrids, double percentage) throws OseeCoreException {
- XResultData rd = new XResultData();
- Map<String, String[]> knownValues = new HashMap<String, String[]>();
-
- try {
- String[] columnHeaders =
- new String[] {"GUID", "HRID", "Artifact Type", "Attribute Hits", "Branch Hits", "Comment Hits"};
- rd.addRaw(AHTML.beginMultiColumnTable(100, 1));
- rd.addRaw(AHTML.addHeaderRowMultiColumnTable(columnHeaders));
-
- int totalAmount = calculateWork(percentage);
- if (!duplicateHrids.isEmpty()) {
- int stepAmount = totalAmount / duplicateHrids.size();
- for (ArtifactData dup : duplicateHrids) {
- checkForCancelledStatus(monitor);
-
- String[] results = knownValues.get(dup.hrid);
-
- if (results == null) {
- results =
- new String[] {String.valueOf(getAdditionalCounts(COUNT_ATTRIBUTE_VALUES_CONTAINING, dup.hrid)),
- String.valueOf(getAdditionalCounts(COUNT_COMMENTS_CONTAINING, dup.hrid)),
- String.valueOf(getAdditionalCounts(COUNT_BRANCH_NAMES_CONTAINING, dup.hrid))};
- knownValues.put(dup.hrid, results);
- }
- rd.addRaw(AHTML.addRowMultiColumnTable(new String[] {dup.guid, dup.hrid, dup.artTypeName, results[0],
- results[1], results[2]}));
- monitor.worked(stepAmount);
- }
- } else {
- monitor.worked(totalAmount);
- }
- rd.addRaw(AHTML.endMultiColumnTable());
-
- } finally {
- rd.report(getName());
- }
- }
-
- private List<ArtifactData> getDuplicateHRIDArtifacts(IProgressMonitor monitor) throws OseeDataStoreException {
- List<ArtifactData> duplicateItems = new LinkedList<ArtifactData>();
- IOseeStatement chStmt1 = ConnectionHandler.getStatement();
- try {
- chStmt1.runPreparedQuery(GET_DUPLICATE_HRIDS);
- while (chStmt1.next()) {
- checkForCancelledStatus(monitor);
- ArtifactData duplicateHrid = new ArtifactData();
- duplicateHrid.guid = chStmt1.getString("guid");
- duplicateHrid.hrid = chStmt1.getString("human_readable_id");
- duplicateHrid.artTypeName = chStmt1.getString("name");
- duplicateItems.add(duplicateHrid);
- }
- Collections.sort(duplicateItems, new DuplicateHridSorter());
- } finally {
- chStmt1.close();
- }
- return duplicateItems;
- }
-
- private String getAdditionalCounts(String query, String hrid) throws OseeDataStoreException {
- return String.valueOf(ConnectionHandler.runPreparedQueryFetchInt(-1, query, new Object[] {"%" + hrid + "%"}));
- }
-
- @Override
- public String getCheckDescription() {
- return "Enter Check Description Here";
- }
-
- @Override
- public String getFixDescription() {
- return "Enter Fix Description Here";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.dbHealth;
+
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.core.runtime.IProgressMonitor;
+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.IOseeStatement;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+
+/**
+ * @author Megumi Telles
+ */
+public class DuplicateHRID extends DatabaseHealthOperation {
+
+ private class ArtifactData {
+ protected String guid;
+ protected String hrid;
+ protected String artTypeName;
+ }
+
+ private class DuplicateHridSorter implements Comparator<ArtifactData> {
+ public DuplicateHridSorter() {
+ super();
+ }
+
+ @Override
+ public int compare(ArtifactData o1, ArtifactData o2) {
+ if (o1 == null || o2 == null) {
+ return 0;
+ }
+ String str1 = o1.hrid;
+ String str2 = o2.hrid;
+ if (str1 == null || str2 == null) {
+ return 0;
+ }
+ return str1.compareTo(str2);
+ }
+ }
+
+ private static final String GET_DUPLICATE_HRIDS =
+ "SELECT DISTINCT(t1.art_id), t1.guid, t1.human_readable_id, t3.name FROM osee_artifact t1, osee_artifact_type t3 WHERE t1.human_readable_id IN (SELECT t2.human_readable_id FROM osee_artifact t2 GROUP BY t2.human_readable_id HAVING COUNT(t2.human_readable_id) > 1) AND t3.art_type_id = t1.art_type_id ORDER BY t1.human_readable_id";
+
+ private static final String COUNT_ATTRIBUTE_VALUES_CONTAINING =
+ "SELECT count(1) from osee_attribute where value like ?"; // TODO value not necessarily in database
+ private static final String COUNT_COMMENTS_CONTAINING =
+ "SELECT count(1) from osee_tx_details where osee_comment like ?";
+ private static final String COUNT_BRANCH_NAMES_CONTAINING =
+ "SELECT count(1) from osee_branch where branch_name like ?";
+
+ public DuplicateHRID() {
+ super("Duplicate HRID Errors");
+ }
+
+ @Override
+ public String getFixTaskName() {
+ return Strings.emptyString();
+ }
+
+ @Override
+ protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
+ monitor.subTask("Querying for Duplicate Human Readable Ids");
+ List<ArtifactData> diffValues = getDuplicateHRIDArtifacts(monitor);
+ checkForCancelledStatus(monitor);
+ monitor.worked(calculateWork(0.20));
+
+ displayReport(monitor, diffValues, 0.20);
+
+ checkForCancelledStatus(monitor);
+ if (isFixOperationEnabled()) {
+ // monitor.worked(calculateWork(0.50));
+ } else {
+ monitor.worked(calculateWork(0.50));
+ }
+
+ getSummary().append(String.format("[%s] Duplicate Human Readable Ids found\n", diffValues.size()));
+ monitor.worked(calculateWork(0.10));
+ }
+
+ private void displayReport(IProgressMonitor monitor, List<ArtifactData> duplicateHrids, double percentage) throws OseeCoreException {
+ XResultData rd = new XResultData();
+ Map<String, String[]> knownValues = new HashMap<String, String[]>();
+
+ try {
+ String[] columnHeaders =
+ new String[] {"GUID", "HRID", "Artifact Type", "Attribute Hits", "Branch Hits", "Comment Hits"};
+ rd.addRaw(AHTML.beginMultiColumnTable(100, 1));
+ rd.addRaw(AHTML.addHeaderRowMultiColumnTable(columnHeaders));
+
+ int totalAmount = calculateWork(percentage);
+ if (!duplicateHrids.isEmpty()) {
+ int stepAmount = totalAmount / duplicateHrids.size();
+ for (ArtifactData dup : duplicateHrids) {
+ checkForCancelledStatus(monitor);
+
+ String[] results = knownValues.get(dup.hrid);
+
+ if (results == null) {
+ results =
+ new String[] {String.valueOf(getAdditionalCounts(COUNT_ATTRIBUTE_VALUES_CONTAINING, dup.hrid)),
+ String.valueOf(getAdditionalCounts(COUNT_COMMENTS_CONTAINING, dup.hrid)),
+ String.valueOf(getAdditionalCounts(COUNT_BRANCH_NAMES_CONTAINING, dup.hrid))};
+ knownValues.put(dup.hrid, results);
+ }
+ rd.addRaw(AHTML.addRowMultiColumnTable(new String[] {dup.guid, dup.hrid, dup.artTypeName, results[0],
+ results[1], results[2]}));
+ monitor.worked(stepAmount);
+ }
+ } else {
+ monitor.worked(totalAmount);
+ }
+ rd.addRaw(AHTML.endMultiColumnTable());
+
+ } finally {
+ rd.report(getName());
+ }
+ }
+
+ private List<ArtifactData> getDuplicateHRIDArtifacts(IProgressMonitor monitor) throws OseeDataStoreException {
+ List<ArtifactData> duplicateItems = new LinkedList<ArtifactData>();
+ IOseeStatement chStmt1 = ConnectionHandler.getStatement();
+ try {
+ chStmt1.runPreparedQuery(GET_DUPLICATE_HRIDS);
+ while (chStmt1.next()) {
+ checkForCancelledStatus(monitor);
+ ArtifactData duplicateHrid = new ArtifactData();
+ duplicateHrid.guid = chStmt1.getString("guid");
+ duplicateHrid.hrid = chStmt1.getString("human_readable_id");
+ duplicateHrid.artTypeName = chStmt1.getString("name");
+ duplicateItems.add(duplicateHrid);
+ }
+ Collections.sort(duplicateItems, new DuplicateHridSorter());
+ } finally {
+ chStmt1.close();
+ }
+ return duplicateItems;
+ }
+
+ private String getAdditionalCounts(String query, String hrid) throws OseeDataStoreException {
+ return String.valueOf(ConnectionHandler.runPreparedQueryFetchInt(-1, query, new Object[] {"%" + hrid + "%"}));
+ }
+
+ @Override
+ public String getCheckDescription() {
+ return "Enter Check Description Here";
+ }
+
+ @Override
+ public String getFixDescription() {
+ return "Enter Fix Description Here";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/HealthHelper.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/HealthHelper.java
index daad062ffce..a89c21805b4 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/HealthHelper.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/HealthHelper.java
@@ -1,186 +1,186 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.dbHealth;
-
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.jdk.core.type.Pair;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.ui.skynet.results.table.ResultsEditorTableTab;
-import org.eclipse.osee.framework.ui.skynet.results.table.ResultsXViewerRow;
-
-/**
- * @author Theron Virgin
- */
-public class HealthHelper {
- public static final String ALL_BACKING_GAMMAS =
- "(SELECT gamma_id FROM osee_artifact UNION SELECT gamma_id FROM osee_attribute UNION SELECT gamma_id FROM osee_relation_link)";
-
- private static final String[] NO_TX_CURRENT_SET =
- {
- "SELECT distinct t1.",
- ", txs1.branch_id FROM osee_txs txs1, ",
- " t1 WHERE txs1.gamma_id = t1.gamma_id AND txs1.tx_current = 0 %s SELECT distinct t2.",
- ", txs2.branch_id FROM osee_txs txs2, ",
- " t2 WHERE txs2.gamma_id = t2.gamma_id AND txs2.tx_current != 0"};
-
- private static final String[] MULTIPLE_TX_CURRENT_SET =
- {
- "SELECT resulttable.branch_id, resulttable.",
- ", COUNT(resulttable.branch_id) AS numoccurrences FROM (SELECT txs1.branch_id, t1.",
- " FROM osee_txs txs1, ",
- " t1 WHERE txs1.gamma_id = t1.gamma_id AND txs1.tx_current != 0) resulttable GROUP BY resulttable.branch_id, resulttable.",
- " HAVING(COUNT(resulttable.branch_id) > 1) order by branch_id"};
-
- private static final String[] NO_TX_CURRENT_CLEANUP =
- {
- "UPDATE osee_txs SET tx_current = CASE WHEN mod_type = 3 THEN 2 WHEN mod_type = 5 THEN 3 ELSE 1 END WHERE (gamma_id, transaction_id) = (SELECT txs1.gamma_id, txs1.transaction_id FROM osee_txs txs1, ",
- " t1 WHERE t1.",
- " = ? AND t1.gamma_id = txs1.gamma_id AND txs1.transaction_id = (SELECT max(txs.transaction_id) FROM osee_txs txs, ",
- " t2 WHERE txs.branch_id = ? AND txs.gamma_id = t2.gamma_id AND t2.",
- " = ?))"};
-
- private static final String[] DUPLICATE_TX_CURRENT_CLEANUP =
- {
- "UPDATE osee_txs SET tx_current = 0 WHERE (gamma_id, transaction_id) in (SELECT txs1.gamma_id, txs1.transaction_id FROM osee_txs txs1, ",
- " t1 WHERE t1.",
- " = ? AND t1.gamma_id = txs1.gamma_id AND txs1.transaction_id != (SELECT max(txs.transaction_id) FROM osee_txs txs, ",
- " t2 WHERE txs.branch_id = ? AND txs.tx_current != 0 AND txs.gamma_id = t2.gamma_id AND t2.",
- " = ?)AND txs1.branch_id = ?)"};
-
- private static final boolean DEBUG =
- "TRUE".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.osee.framework.ui.skynet/debug/Blam"));
-
- public static void displayForCleanUp(String header, Appendable detailedReport, Appendable summary, boolean verify, List<Object[]> set, String toPrint) throws IOException {
- int count = 0;
- detailedReport.append(AHTML.addHeaderRowMultiColumnTable(new String[] {header}));
- detailedReport.append(AHTML.addRowSpanMultiColumnTable(header + toPrint, 1));
- for (Object[] value : set) {
- count++;
- detailedReport.append(AHTML.addRowMultiColumnTable(new String[] {value[0].toString()}));
- }
- summary.append(verify ? "Found " : "Fixed ");
- summary.append(String.valueOf(count));
- summary.append(" ");
- summary.append(header);
- summary.append(toPrint);
- }
-
- public static List<Object[]> runSingleResultQuery(String sql, String dbColumn) throws OseeCoreException {
- List<Object[]> foundItems = new LinkedList<Object[]>();
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- try {
- chStmt.runPreparedQuery(sql);
- while (chStmt.next()) {
- foundItems.add(new Object[] {chStmt.getInt(dbColumn)});
- }
- } finally {
- chStmt.close();
- }
- return foundItems;
- }
-
- public static HashSet<Pair<Integer, Integer>> getNoTxCurrentSet(String dataColumnName, String tableName, ResultsEditorTableTab resultsTab) throws Exception {
- HashSet<Pair<Integer, Integer>> noneSet = new HashSet<Pair<Integer, Integer>>();
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- String sql =
- NO_TX_CURRENT_SET[0] + dataColumnName + NO_TX_CURRENT_SET[1] + tableName + String.format(
- NO_TX_CURRENT_SET[2], chStmt.getComplementSql()) + dataColumnName + NO_TX_CURRENT_SET[3] + tableName + NO_TX_CURRENT_SET[4];
-
- try {
- chStmt.runPreparedQuery(sql);
- int counter = 0;
- while (chStmt.next()) {
- noneSet.add(new Pair<Integer, Integer>(chStmt.getInt(dataColumnName), chStmt.getInt("branch_id")));
-
- resultsTab.addRow(new ResultsXViewerRow(new String[] {String.valueOf(counter++),
- String.valueOf(chStmt.getInt(dataColumnName)), String.valueOf(chStmt.getInt("branch_id"))}));
- }
- } finally {
- chStmt.close();
- }
- return noneSet;
- }
-
- public static HashSet<LocalTxData> getMultipleTxCurrentSet(String dataId, String dataTable, Appendable builder, String data) throws Exception {
- String sql =
- MULTIPLE_TX_CURRENT_SET[0] + dataId + MULTIPLE_TX_CURRENT_SET[1] + dataId + MULTIPLE_TX_CURRENT_SET[2] + dataTable + MULTIPLE_TX_CURRENT_SET[3] + dataId + MULTIPLE_TX_CURRENT_SET[4];
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- HashSet<LocalTxData> multipleSet = new HashSet<LocalTxData>();
-
- long time = System.currentTimeMillis();
- try {
- chStmt.runPreparedQuery(sql);
- while (chStmt.next()) {
- multipleSet.add(new LocalTxData(chStmt.getInt(dataId), chStmt.getInt("branch_id"),
- chStmt.getInt("numoccurrences")));
- }
- builder.append("Found ");
- builder.append(String.valueOf(multipleSet.size()));
- builder.append(data);
- builder.append(" that have multiple tx_current values set\n");
-
- } finally {
- chStmt.close();
- }
- if (DEBUG) {
- System.out.println(String.format("%sTxCurrent: The get%s Query took %s", data, data, Lib.getElapseString(time)));
- }
- return multipleSet;
- }
-
- public static void cleanMultipleTxCurrent(String dataId, String dataTable, Appendable builder, HashSet<LocalTxData> multipleSet) throws Exception {
- String sql =
- DUPLICATE_TX_CURRENT_CLEANUP[0] + dataTable + DUPLICATE_TX_CURRENT_CLEANUP[1] + dataId + DUPLICATE_TX_CURRENT_CLEANUP[2] + dataTable + DUPLICATE_TX_CURRENT_CLEANUP[3] + dataId + DUPLICATE_TX_CURRENT_CLEANUP[4];
-
- List<Object[]> insertParameters = new LinkedList<Object[]>();
-
- for (LocalTxData link : multipleSet) {
- insertParameters.add(new Object[] {link.dataId, link.branchId, link.dataId, link.branchId});
- }
- int total = 0;
- if (insertParameters.size() > 0) {
- total = ConnectionHandler.runBatchUpdate(sql, insertParameters);
- }
- builder.append("Fixed " + total + " Tx_Current duplication errors\n");
- }
-
- public static void cleanNoTxCurrent(String dataId, String dataTable, Appendable builder, HashSet<Pair<Integer, Integer>> noneSet) throws Exception {
- String sql =
- NO_TX_CURRENT_CLEANUP[0] + dataTable + NO_TX_CURRENT_CLEANUP[1] + dataId + NO_TX_CURRENT_CLEANUP[2] + dataTable + NO_TX_CURRENT_CLEANUP[3] + dataId + NO_TX_CURRENT_CLEANUP[4];
-
- List<Object[]> insertParameters = new LinkedList<Object[]>();
-
- for (Pair<Integer, Integer> pair : noneSet) {
- insertParameters.add(new Object[] {pair.getFirst(), pair.getSecond(), pair.getFirst()});
- }
- int total = 0;
- if (insertParameters.size() > 0) {
- total = ConnectionHandler.runBatchUpdate(sql, insertParameters);
- }
- builder.append("Fixed " + total + " Tx_Current not set errors\n");
- }
-
- public static void dumpDataMultiple(Appendable sbFull, HashSet<LocalTxData> multipleSet) throws IOException {
- int counter = 0;
- for (LocalTxData link : multipleSet) {
- sbFull.append(AHTML.addRowMultiColumnTable(new String[] {String.valueOf(counter++),
- String.valueOf(link.dataId), String.valueOf(link.branchId), String.valueOf(link.number)}));
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.dbHealth;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.jdk.core.type.Pair;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.ui.skynet.results.table.ResultsEditorTableTab;
+import org.eclipse.osee.framework.ui.skynet.results.table.ResultsXViewerRow;
+
+/**
+ * @author Theron Virgin
+ */
+public class HealthHelper {
+ public static final String ALL_BACKING_GAMMAS =
+ "(SELECT gamma_id FROM osee_artifact UNION SELECT gamma_id FROM osee_attribute UNION SELECT gamma_id FROM osee_relation_link)";
+
+ private static final String[] NO_TX_CURRENT_SET =
+ {
+ "SELECT distinct t1.",
+ ", txs1.branch_id FROM osee_txs txs1, ",
+ " t1 WHERE txs1.gamma_id = t1.gamma_id AND txs1.tx_current = 0 %s SELECT distinct t2.",
+ ", txs2.branch_id FROM osee_txs txs2, ",
+ " t2 WHERE txs2.gamma_id = t2.gamma_id AND txs2.tx_current != 0"};
+
+ private static final String[] MULTIPLE_TX_CURRENT_SET =
+ {
+ "SELECT resulttable.branch_id, resulttable.",
+ ", COUNT(resulttable.branch_id) AS numoccurrences FROM (SELECT txs1.branch_id, t1.",
+ " FROM osee_txs txs1, ",
+ " t1 WHERE txs1.gamma_id = t1.gamma_id AND txs1.tx_current != 0) resulttable GROUP BY resulttable.branch_id, resulttable.",
+ " HAVING(COUNT(resulttable.branch_id) > 1) order by branch_id"};
+
+ private static final String[] NO_TX_CURRENT_CLEANUP =
+ {
+ "UPDATE osee_txs SET tx_current = CASE WHEN mod_type = 3 THEN 2 WHEN mod_type = 5 THEN 3 ELSE 1 END WHERE (gamma_id, transaction_id) = (SELECT txs1.gamma_id, txs1.transaction_id FROM osee_txs txs1, ",
+ " t1 WHERE t1.",
+ " = ? AND t1.gamma_id = txs1.gamma_id AND txs1.transaction_id = (SELECT max(txs.transaction_id) FROM osee_txs txs, ",
+ " t2 WHERE txs.branch_id = ? AND txs.gamma_id = t2.gamma_id AND t2.",
+ " = ?))"};
+
+ private static final String[] DUPLICATE_TX_CURRENT_CLEANUP =
+ {
+ "UPDATE osee_txs SET tx_current = 0 WHERE (gamma_id, transaction_id) in (SELECT txs1.gamma_id, txs1.transaction_id FROM osee_txs txs1, ",
+ " t1 WHERE t1.",
+ " = ? AND t1.gamma_id = txs1.gamma_id AND txs1.transaction_id != (SELECT max(txs.transaction_id) FROM osee_txs txs, ",
+ " t2 WHERE txs.branch_id = ? AND txs.tx_current != 0 AND txs.gamma_id = t2.gamma_id AND t2.",
+ " = ?)AND txs1.branch_id = ?)"};
+
+ private static final boolean DEBUG =
+ "TRUE".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.osee.framework.ui.skynet/debug/Blam"));
+
+ public static void displayForCleanUp(String header, Appendable detailedReport, Appendable summary, boolean verify, List<Object[]> set, String toPrint) throws IOException {
+ int count = 0;
+ detailedReport.append(AHTML.addHeaderRowMultiColumnTable(new String[] {header}));
+ detailedReport.append(AHTML.addRowSpanMultiColumnTable(header + toPrint, 1));
+ for (Object[] value : set) {
+ count++;
+ detailedReport.append(AHTML.addRowMultiColumnTable(new String[] {value[0].toString()}));
+ }
+ summary.append(verify ? "Found " : "Fixed ");
+ summary.append(String.valueOf(count));
+ summary.append(" ");
+ summary.append(header);
+ summary.append(toPrint);
+ }
+
+ public static List<Object[]> runSingleResultQuery(String sql, String dbColumn) throws OseeCoreException {
+ List<Object[]> foundItems = new LinkedList<Object[]>();
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+ try {
+ chStmt.runPreparedQuery(sql);
+ while (chStmt.next()) {
+ foundItems.add(new Object[] {chStmt.getInt(dbColumn)});
+ }
+ } finally {
+ chStmt.close();
+ }
+ return foundItems;
+ }
+
+ public static HashSet<Pair<Integer, Integer>> getNoTxCurrentSet(String dataColumnName, String tableName, ResultsEditorTableTab resultsTab) throws Exception {
+ HashSet<Pair<Integer, Integer>> noneSet = new HashSet<Pair<Integer, Integer>>();
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+ String sql =
+ NO_TX_CURRENT_SET[0] + dataColumnName + NO_TX_CURRENT_SET[1] + tableName + String.format(
+ NO_TX_CURRENT_SET[2], chStmt.getComplementSql()) + dataColumnName + NO_TX_CURRENT_SET[3] + tableName + NO_TX_CURRENT_SET[4];
+
+ try {
+ chStmt.runPreparedQuery(sql);
+ int counter = 0;
+ while (chStmt.next()) {
+ noneSet.add(new Pair<Integer, Integer>(chStmt.getInt(dataColumnName), chStmt.getInt("branch_id")));
+
+ resultsTab.addRow(new ResultsXViewerRow(new String[] {String.valueOf(counter++),
+ String.valueOf(chStmt.getInt(dataColumnName)), String.valueOf(chStmt.getInt("branch_id"))}));
+ }
+ } finally {
+ chStmt.close();
+ }
+ return noneSet;
+ }
+
+ public static HashSet<LocalTxData> getMultipleTxCurrentSet(String dataId, String dataTable, Appendable builder, String data) throws Exception {
+ String sql =
+ MULTIPLE_TX_CURRENT_SET[0] + dataId + MULTIPLE_TX_CURRENT_SET[1] + dataId + MULTIPLE_TX_CURRENT_SET[2] + dataTable + MULTIPLE_TX_CURRENT_SET[3] + dataId + MULTIPLE_TX_CURRENT_SET[4];
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+ HashSet<LocalTxData> multipleSet = new HashSet<LocalTxData>();
+
+ long time = System.currentTimeMillis();
+ try {
+ chStmt.runPreparedQuery(sql);
+ while (chStmt.next()) {
+ multipleSet.add(new LocalTxData(chStmt.getInt(dataId), chStmt.getInt("branch_id"),
+ chStmt.getInt("numoccurrences")));
+ }
+ builder.append("Found ");
+ builder.append(String.valueOf(multipleSet.size()));
+ builder.append(data);
+ builder.append(" that have multiple tx_current values set\n");
+
+ } finally {
+ chStmt.close();
+ }
+ if (DEBUG) {
+ System.out.println(String.format("%sTxCurrent: The get%s Query took %s", data, data, Lib.getElapseString(time)));
+ }
+ return multipleSet;
+ }
+
+ public static void cleanMultipleTxCurrent(String dataId, String dataTable, Appendable builder, HashSet<LocalTxData> multipleSet) throws Exception {
+ String sql =
+ DUPLICATE_TX_CURRENT_CLEANUP[0] + dataTable + DUPLICATE_TX_CURRENT_CLEANUP[1] + dataId + DUPLICATE_TX_CURRENT_CLEANUP[2] + dataTable + DUPLICATE_TX_CURRENT_CLEANUP[3] + dataId + DUPLICATE_TX_CURRENT_CLEANUP[4];
+
+ List<Object[]> insertParameters = new LinkedList<Object[]>();
+
+ for (LocalTxData link : multipleSet) {
+ insertParameters.add(new Object[] {link.dataId, link.branchId, link.dataId, link.branchId});
+ }
+ int total = 0;
+ if (insertParameters.size() > 0) {
+ total = ConnectionHandler.runBatchUpdate(sql, insertParameters);
+ }
+ builder.append("Fixed " + total + " Tx_Current duplication errors\n");
+ }
+
+ public static void cleanNoTxCurrent(String dataId, String dataTable, Appendable builder, HashSet<Pair<Integer, Integer>> noneSet) throws Exception {
+ String sql =
+ NO_TX_CURRENT_CLEANUP[0] + dataTable + NO_TX_CURRENT_CLEANUP[1] + dataId + NO_TX_CURRENT_CLEANUP[2] + dataTable + NO_TX_CURRENT_CLEANUP[3] + dataId + NO_TX_CURRENT_CLEANUP[4];
+
+ List<Object[]> insertParameters = new LinkedList<Object[]>();
+
+ for (Pair<Integer, Integer> pair : noneSet) {
+ insertParameters.add(new Object[] {pair.getFirst(), pair.getSecond(), pair.getFirst()});
+ }
+ int total = 0;
+ if (insertParameters.size() > 0) {
+ total = ConnectionHandler.runBatchUpdate(sql, insertParameters);
+ }
+ builder.append("Fixed " + total + " Tx_Current not set errors\n");
+ }
+
+ public static void dumpDataMultiple(Appendable sbFull, HashSet<LocalTxData> multipleSet) throws IOException {
+ int counter = 0;
+ for (LocalTxData link : multipleSet) {
+ sbFull.append(AHTML.addRowMultiColumnTable(new String[] {String.valueOf(counter++),
+ String.valueOf(link.dataId), String.valueOf(link.branchId), String.valueOf(link.number)}));
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/ItemsDeletedWithNoOtherModification.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/ItemsDeletedWithNoOtherModification.java
index 8dc21e19156..c4aaf2a52c8 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/ItemsDeletedWithNoOtherModification.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/ItemsDeletedWithNoOtherModification.java
@@ -1,180 +1,180 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.dbHealth;
-
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.enums.BranchType;
-import org.eclipse.osee.framework.core.enums.ModificationType;
-import org.eclipse.osee.framework.core.enums.TxChange;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.framework.ui.skynet.results.html.XResultPage.Manipulations;
-
-/**
- * @author Theron Virgin
- */
-public class ItemsDeletedWithNoOtherModification extends DatabaseHealthOperation {
- private class LocalValues {
- public int relLinkId;
- public int artId;
- public int attributeId;
- public int gammaId;
- public int transactionId;
- public int branchId;
-
- public LocalValues(int artId, int attributeId, int branchId, int gammaId, int relLinkId, int transactionId) {
- super();
- this.artId = artId;
- this.attributeId = attributeId;
- this.branchId = branchId;
- this.gammaId = gammaId;
- this.relLinkId = relLinkId;
- this.transactionId = transactionId;
- }
- }
- private static final String COMMITTED_NEW_AND_DELETED_ARTIFACTS =
- "SELECT txs1.gamma_id, txs1.transaction_id, txs1.branch_id, art1.art_id, 0 as attr_id, 0 as rel_link_id FROM osee_txs txs1, osee_artifact art1 WHERE txs1.tx_current = ? AND txs1.mod_type = ? AND txs1.gamma_id = art1.gamma_id AND NOT EXISTS (SELECT ('x') FROM osee_txs txs2, osee_artifact art2 WHERE txs2.mod_type != ? AND txs1.branch_id = txs2.branch_id AND txs2.gamma_id = art2.gamma_id AND art2.art_id = art1.art_id)";
- private static final String COMMITTED_NEW_AND_DELETED_ATTRIBUTES =
- "SELECT txs1.gamma_id, txs1.transaction_id, txs1.branch_id, 0 as art_id, att1.attr_id, 0 as rel_link_id FROM osee_txs txs1, osee_attribute att1, osee_branch brn WHERE txs1.tx_current = ? AND txs1.mod_type = ? AND txs1.gamma_id = att1.gamma_id AND txs1.branch_id = brn.branch_id AND brn.branch_type != " + BranchType.MERGE.getValue() + " AND NOT EXISTS (SELECT ('x') FROM osee_txs txs2, osee_attribute att2 WHERE txs2.mod_type != ? AND txs1.branch_id = txs2.branch_id AND txs2.gamma_id = att2.gamma_id AND att2.attr_id = att1.attr_id)";
- private static final String COMMITTED_NEW_AND_DELETED_RELATIONS =
- "SELECT txs1.gamma_id, txs1.transaction_id, txs1.branch_id, 0 as art_id, 0 as attr_id, rel1.rel_link_id FROM osee_txs txs1, osee_relation_link rel1 WHERE txs1.tx_current = ? AND txs1.mod_type = ? AND txs1.gamma_id = rel1.gamma_id AND NOT EXISTS (SELECT ('x') FROM osee_txs txs2, osee_relation_link rel2 WHERE txs2.mod_type != ? AND txs1.branch_id = txs2.branch_id AND txs2.gamma_id = rel2.gamma_id AND rel2.rel_link_id = rel1.rel_link_id)";
-
- private static final String REMOVE_NOT_ADDRESSED_GAMMAS =
- "DELETE FROM osee_txs WHERE gamma_id = ? AND transaction_id = ?";
-
- private static final String[] COLUMN_HEADER =
- {"Gamma Id", "Transaction Id", "Branch Id", "Art id", "Attribute Id", "Rel Link Id"};
-
- private Set<LocalValues> addressing = null;
-
- public ItemsDeletedWithNoOtherModification() {
- super("Items marked as deleted or artifact deleted without other entries in txs");
- }
-
- private void loadData(String sql, TxChange txChange, ModificationType modificationType) throws OseeCoreException {
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- try {
- chStmt.runPreparedQuery(sql, txChange.getValue(), modificationType.getValue(), modificationType.getValue());
- while (chStmt.next()) {
- addressing.add(new LocalValues(chStmt.getInt("art_id"), chStmt.getInt("attr_id"),
- chStmt.getInt("branch_id"), chStmt.getInt("gamma_id"), chStmt.getInt("rel_link_id"),
- chStmt.getInt("transaction_id")));
- }
- } finally {
- chStmt.close();
- }
- }
-
- private void detectAndCollectErrors(IProgressMonitor monitor, TxChange txChange, ModificationType modificationType) throws OseeCoreException {
- monitor.setTaskName("Loading Artifacts that were Introduced as Deleted");
- loadData(COMMITTED_NEW_AND_DELETED_ARTIFACTS, txChange, modificationType);
- checkForCancelledStatus(monitor);
- monitor.worked(calculateWork(0.20));
-
- monitor.setTaskName("Loading Attributes that were Introduced as Deleted");
- loadData(COMMITTED_NEW_AND_DELETED_ATTRIBUTES, txChange, modificationType);
- checkForCancelledStatus(monitor);
- monitor.worked(calculateWork(0.20));
-
- monitor.setTaskName("Loading Relation Links that were Introduced as Deleted");
- loadData(COMMITTED_NEW_AND_DELETED_RELATIONS, txChange, modificationType);
- }
-
- @Override
- protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
- boolean verify = !isFixOperationEnabled();
-
- if (verify || addressing == null) {
- addressing = new HashSet<LocalValues>();
- detectAndCollectErrors(monitor, TxChange.DELETED, ModificationType.DELETED);
- detectAndCollectErrors(monitor, TxChange.ARTIFACT_DELETED, ModificationType.ARTIFACT_DELETED);
- } else {
- monitor.worked(calculateWork(0.40));
- }
- checkForCancelledStatus(monitor);
- monitor.worked(calculateWork(0.10));
-
- StringBuffer sbFull = new StringBuffer(AHTML.beginMultiColumnTable(100, 1));
- sbFull.append(AHTML.addRowMultiColumnTable(COLUMN_HEADER));
- displayData(sbFull, getSummary(), verify);
-
- checkForCancelledStatus(monitor);
- monitor.worked(calculateWork(0.10));
-
- setItemsToFix(addressing != null ? addressing.size() : 0);
-
- if (isFixOperationEnabled() && getItemsToFixCount() > 0) {
- List<Object[]> insertParameters = new LinkedList<Object[]>();
- for (LocalValues value : addressing) {
- insertParameters.add(new Object[] {value.gammaId, value.transactionId});
- }
- if (insertParameters.size() > 0) {
- ConnectionHandler.runBatchUpdate(REMOVE_NOT_ADDRESSED_GAMMAS, insertParameters);
- }
- monitor.worked(calculateWork(0.30));
- addressing = null;
- } else {
- monitor.worked(calculateWork(0.30));
- }
-
- sbFull.append(AHTML.endMultiColumnTable());
- XResultData rd = new XResultData();
- rd.addRaw(sbFull.toString());
- rd.report(getVerifyTaskName(), Manipulations.RAW_HTML);
- monitor.worked(calculateWork(0.10));
- }
-
- private void displayData(StringBuffer sbFull, Appendable builder, boolean verify) throws IOException {
- int attributeCount = 0, artifactCount = 0, relLinkCount = 0;
- for (LocalValues value : addressing) {
- if (value.artId != 0) {
- artifactCount++;
- }
- if (value.attributeId != 0) {
- attributeCount++;
- }
- if (value.relLinkId != 0) {
- relLinkCount++;
- }
- sbFull.append(AHTML.addRowMultiColumnTable(new String[] {String.valueOf(value.gammaId),
- String.valueOf(value.transactionId), String.valueOf(value.branchId), String.valueOf(value.artId),
- String.valueOf(value.attributeId), String.valueOf(value.relLinkId)}));
- }
- builder.append(verify ? "Found " : "Fixed ");
- builder.append(String.valueOf(artifactCount));
- builder.append(" Artifacts that were Introduced as Deleted\n");
- builder.append(verify ? "Found " : "Fixed ");
- builder.append(String.valueOf(attributeCount));
- builder.append(" Attributes that were Introduced as Deleted\n");
- builder.append(verify ? "Found " : "Fixed ");
- builder.append(String.valueOf(relLinkCount));
- builder.append(" Relation Links that were Introduced as Deleted\n");
- }
-
- @Override
- public String getCheckDescription() {
- return "Detects items from txs table with tx_current of (deleted or artifact deleted) having no other entries in the txs not equal to mod type (deleted or artifact deleted), respectively.";
- }
-
- @Override
- public String getFixDescription() {
- return "Remove addressing with delete errors.";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.dbHealth;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.enums.BranchType;
+import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.core.enums.TxChange;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.framework.ui.skynet.results.html.XResultPage.Manipulations;
+
+/**
+ * @author Theron Virgin
+ */
+public class ItemsDeletedWithNoOtherModification extends DatabaseHealthOperation {
+ private class LocalValues {
+ public int relLinkId;
+ public int artId;
+ public int attributeId;
+ public int gammaId;
+ public int transactionId;
+ public int branchId;
+
+ public LocalValues(int artId, int attributeId, int branchId, int gammaId, int relLinkId, int transactionId) {
+ super();
+ this.artId = artId;
+ this.attributeId = attributeId;
+ this.branchId = branchId;
+ this.gammaId = gammaId;
+ this.relLinkId = relLinkId;
+ this.transactionId = transactionId;
+ }
+ }
+ private static final String COMMITTED_NEW_AND_DELETED_ARTIFACTS =
+ "SELECT txs1.gamma_id, txs1.transaction_id, txs1.branch_id, art1.art_id, 0 as attr_id, 0 as rel_link_id FROM osee_txs txs1, osee_artifact art1 WHERE txs1.tx_current = ? AND txs1.mod_type = ? AND txs1.gamma_id = art1.gamma_id AND NOT EXISTS (SELECT ('x') FROM osee_txs txs2, osee_artifact art2 WHERE txs2.mod_type != ? AND txs1.branch_id = txs2.branch_id AND txs2.gamma_id = art2.gamma_id AND art2.art_id = art1.art_id)";
+ private static final String COMMITTED_NEW_AND_DELETED_ATTRIBUTES =
+ "SELECT txs1.gamma_id, txs1.transaction_id, txs1.branch_id, 0 as art_id, att1.attr_id, 0 as rel_link_id FROM osee_txs txs1, osee_attribute att1, osee_branch brn WHERE txs1.tx_current = ? AND txs1.mod_type = ? AND txs1.gamma_id = att1.gamma_id AND txs1.branch_id = brn.branch_id AND brn.branch_type != " + BranchType.MERGE.getValue() + " AND NOT EXISTS (SELECT ('x') FROM osee_txs txs2, osee_attribute att2 WHERE txs2.mod_type != ? AND txs1.branch_id = txs2.branch_id AND txs2.gamma_id = att2.gamma_id AND att2.attr_id = att1.attr_id)";
+ private static final String COMMITTED_NEW_AND_DELETED_RELATIONS =
+ "SELECT txs1.gamma_id, txs1.transaction_id, txs1.branch_id, 0 as art_id, 0 as attr_id, rel1.rel_link_id FROM osee_txs txs1, osee_relation_link rel1 WHERE txs1.tx_current = ? AND txs1.mod_type = ? AND txs1.gamma_id = rel1.gamma_id AND NOT EXISTS (SELECT ('x') FROM osee_txs txs2, osee_relation_link rel2 WHERE txs2.mod_type != ? AND txs1.branch_id = txs2.branch_id AND txs2.gamma_id = rel2.gamma_id AND rel2.rel_link_id = rel1.rel_link_id)";
+
+ private static final String REMOVE_NOT_ADDRESSED_GAMMAS =
+ "DELETE FROM osee_txs WHERE gamma_id = ? AND transaction_id = ?";
+
+ private static final String[] COLUMN_HEADER =
+ {"Gamma Id", "Transaction Id", "Branch Id", "Art id", "Attribute Id", "Rel Link Id"};
+
+ private Set<LocalValues> addressing = null;
+
+ public ItemsDeletedWithNoOtherModification() {
+ super("Items marked as deleted or artifact deleted without other entries in txs");
+ }
+
+ private void loadData(String sql, TxChange txChange, ModificationType modificationType) throws OseeCoreException {
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+ try {
+ chStmt.runPreparedQuery(sql, txChange.getValue(), modificationType.getValue(), modificationType.getValue());
+ while (chStmt.next()) {
+ addressing.add(new LocalValues(chStmt.getInt("art_id"), chStmt.getInt("attr_id"),
+ chStmt.getInt("branch_id"), chStmt.getInt("gamma_id"), chStmt.getInt("rel_link_id"),
+ chStmt.getInt("transaction_id")));
+ }
+ } finally {
+ chStmt.close();
+ }
+ }
+
+ private void detectAndCollectErrors(IProgressMonitor monitor, TxChange txChange, ModificationType modificationType) throws OseeCoreException {
+ monitor.setTaskName("Loading Artifacts that were Introduced as Deleted");
+ loadData(COMMITTED_NEW_AND_DELETED_ARTIFACTS, txChange, modificationType);
+ checkForCancelledStatus(monitor);
+ monitor.worked(calculateWork(0.20));
+
+ monitor.setTaskName("Loading Attributes that were Introduced as Deleted");
+ loadData(COMMITTED_NEW_AND_DELETED_ATTRIBUTES, txChange, modificationType);
+ checkForCancelledStatus(monitor);
+ monitor.worked(calculateWork(0.20));
+
+ monitor.setTaskName("Loading Relation Links that were Introduced as Deleted");
+ loadData(COMMITTED_NEW_AND_DELETED_RELATIONS, txChange, modificationType);
+ }
+
+ @Override
+ protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
+ boolean verify = !isFixOperationEnabled();
+
+ if (verify || addressing == null) {
+ addressing = new HashSet<LocalValues>();
+ detectAndCollectErrors(monitor, TxChange.DELETED, ModificationType.DELETED);
+ detectAndCollectErrors(monitor, TxChange.ARTIFACT_DELETED, ModificationType.ARTIFACT_DELETED);
+ } else {
+ monitor.worked(calculateWork(0.40));
+ }
+ checkForCancelledStatus(monitor);
+ monitor.worked(calculateWork(0.10));
+
+ StringBuffer sbFull = new StringBuffer(AHTML.beginMultiColumnTable(100, 1));
+ sbFull.append(AHTML.addRowMultiColumnTable(COLUMN_HEADER));
+ displayData(sbFull, getSummary(), verify);
+
+ checkForCancelledStatus(monitor);
+ monitor.worked(calculateWork(0.10));
+
+ setItemsToFix(addressing != null ? addressing.size() : 0);
+
+ if (isFixOperationEnabled() && getItemsToFixCount() > 0) {
+ List<Object[]> insertParameters = new LinkedList<Object[]>();
+ for (LocalValues value : addressing) {
+ insertParameters.add(new Object[] {value.gammaId, value.transactionId});
+ }
+ if (insertParameters.size() > 0) {
+ ConnectionHandler.runBatchUpdate(REMOVE_NOT_ADDRESSED_GAMMAS, insertParameters);
+ }
+ monitor.worked(calculateWork(0.30));
+ addressing = null;
+ } else {
+ monitor.worked(calculateWork(0.30));
+ }
+
+ sbFull.append(AHTML.endMultiColumnTable());
+ XResultData rd = new XResultData();
+ rd.addRaw(sbFull.toString());
+ rd.report(getVerifyTaskName(), Manipulations.RAW_HTML);
+ monitor.worked(calculateWork(0.10));
+ }
+
+ private void displayData(StringBuffer sbFull, Appendable builder, boolean verify) throws IOException {
+ int attributeCount = 0, artifactCount = 0, relLinkCount = 0;
+ for (LocalValues value : addressing) {
+ if (value.artId != 0) {
+ artifactCount++;
+ }
+ if (value.attributeId != 0) {
+ attributeCount++;
+ }
+ if (value.relLinkId != 0) {
+ relLinkCount++;
+ }
+ sbFull.append(AHTML.addRowMultiColumnTable(new String[] {String.valueOf(value.gammaId),
+ String.valueOf(value.transactionId), String.valueOf(value.branchId), String.valueOf(value.artId),
+ String.valueOf(value.attributeId), String.valueOf(value.relLinkId)}));
+ }
+ builder.append(verify ? "Found " : "Fixed ");
+ builder.append(String.valueOf(artifactCount));
+ builder.append(" Artifacts that were Introduced as Deleted\n");
+ builder.append(verify ? "Found " : "Fixed ");
+ builder.append(String.valueOf(attributeCount));
+ builder.append(" Attributes that were Introduced as Deleted\n");
+ builder.append(verify ? "Found " : "Fixed ");
+ builder.append(String.valueOf(relLinkCount));
+ builder.append(" Relation Links that were Introduced as Deleted\n");
+ }
+
+ @Override
+ public String getCheckDescription() {
+ return "Detects items from txs table with tx_current of (deleted or artifact deleted) having no other entries in the txs not equal to mod type (deleted or artifact deleted), respectively.";
+ }
+
+ @Override
+ public String getFixDescription() {
+ return "Remove addressing with delete errors.";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/LocalTxData.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/LocalTxData.java
index 94b195c0c77..713085ed936 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/LocalTxData.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/LocalTxData.java
@@ -1,27 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.dbHealth;
-
-/**
- * @author Theron Virgin
- */
-public class LocalTxData {
- public int dataId;
- public int branchId;
- public int number;
-
- public LocalTxData(int dataId, int branchId, int number) {
- super();
- this.branchId = branchId;
- this.dataId = dataId;
- this.number = number;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.dbHealth;
+
+/**
+ * @author Theron Virgin
+ */
+public class LocalTxData {
+ public int dataId;
+ public int branchId;
+ public int number;
+
+ public LocalTxData(int dataId, int branchId, int number) {
+ super();
+ this.branchId = branchId;
+ this.dataId = dataId;
+ this.number = number;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/MultipleParentRelations.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/MultipleParentRelations.java
index 22173b79b05..a7551349974 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/MultipleParentRelations.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/MultipleParentRelations.java
@@ -1,283 +1,283 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.dbHealth;
-
-import java.sql.Timestamp;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import org.eclipse.core.runtime.IProgressMonitor;
-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.IOseeStatement;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.framework.ui.skynet.results.html.XResultPage.Manipulations;
-
-/**
- * Check only, no fix.
- *
- * @author Theron Virgin
- */
-public class MultipleParentRelations extends DatabaseHealthOperation {
- private class LocalRelationLink {
- public int relLinkId1;
- public int relLinkId2;
- public int transactionId1;
- public int transactionId2;
- public int gammaId1;
- public int gammaId2;
- public int branchId;
- public String branch;
- public int parentArtId1;
- public int parentArtId2;
- public int childArtId;
- public String parentArt1;
- public String parentArt2;
- public String childArt;
- public Timestamp time1;
- public Timestamp time2;
- public int archived;
- public boolean deleteByTimeStamp;
- public String author1;
- public String author2;
-
- public LocalRelationLink(int branchId, int childArtId, int gammaId1, int gammaId2, int parentArtId1, int parentArtId2, int relLinkId1, int relLinkId2, Timestamp time1, Timestamp time2, int transactionId1, int transactionId2, int archived) {
- super();
- this.branchId = branchId;
- this.childArtId = childArtId;
- this.gammaId1 = gammaId1;
- this.gammaId2 = gammaId2;
- this.parentArtId1 = parentArtId1;
- this.parentArtId2 = parentArtId2;
- this.relLinkId1 = relLinkId1;
- this.relLinkId2 = relLinkId2;
- this.time1 = time1;
- this.time2 = time2;
- this.transactionId1 = transactionId1;
- this.transactionId2 = transactionId2;
- this.archived = archived;
- this.deleteByTimeStamp = true;
- author1 = "";
- author2 = "";
- }
- }
-
- private static final String GET_DUPLICATE_DEFAULT_HIER_LINKS =
- "SELECT rel1.rel_link_id as Link_ID_1, rel2.rel_link_id as Link_ID_2, rel1.a_art_id As Parent_Id_1, rel2.a_art_id As Parent_Id_2, rel2.b_art_id As Child_ID, det1.branch_id, det1.time as Time_1 , det2.time as Time_2, bra.archived, txs1.gamma_id as Gamma1, txs2.gamma_id as Gamma2, txs1.transaction_id as transaction_1, txs2.transaction_id as transaction_2 FROM osee_branch bra, osee_relation_link rel1, osee_relation_link rel2, osee_txs txs1, osee_txs txs2, osee_tx_details det1, osee_tx_details det2, osee_relation_link_type typ where typ.type_name = 'Default Hierarchical' AND rel1.rel_link_type_id = typ.rel_link_type_id AND rel2.rel_link_type_id = typ.rel_link_type_id AND rel1.a_art_id < rel2.a_art_id AND rel1.b_art_id = rel2.b_art_id AND rel1.gamma_id = txs1.gamma_id AND txs1.tx_current = 1 AND txs2.tx_current = 1 AND txs1.transaction_id = det1.transaction_id AND det1.branch_id = det2.branch_id AND det2.transaction_id = txs2.transaction_id AND txs2.gamma_id = rel2.gamma_id AND bra.branch_id = det1.branch_id order by rel1.b_art_id, txs1.transaction_id";
-
- private static final String GET_AUTHOR =
- "Select attr.Value FROM osee_attribute attr, osee_tx_details det, osee_attribute_type typ, osee_txs txs WHERE det.transaction_id = ? AND det.author = attr.art_id AND attr.attr_type_id = typ.attr_type_id AND typ.name = 'Name' AND attr.gamma_id = txs.gamma_id and txs.tx_current = 1";
-
- private static final String GET_ARTIFACT_NAME =
- "Select attr.Value FROM osee_attribute attr, osee_attribute_type typ, osee_txs txs WHERE attr.art_id = ? AND attr.attr_type_id = typ.attr_type_id AND typ.name = 'Name' AND attr.gamma_id = txs.gamma_id and txs.tx_current = 1";
-
- private static final String GET_BRANCH_NAME = "Select branch_name from osee_branch where branch_id = ?";
-
- private static final String[] columnHeaders =
- new String[] {"Rel Link ID 1", "Rel Link ID 2", "Parent Art ID 1", "P1 Art Name", "Parent Art ID 2",
- "P2 Art Name", "Child Art ID", "Child Art Name", "Branch Ids", "Branch Name", "Archived", "Author 1",
- "Author 2"};
-
- private static final String HEADER = "Artifacts that have multiple Parents";
-
- private List<LocalRelationLink> relations = null;
-
- public MultipleParentRelations() {
- super("Multiple Parent Relations");
- }
-
- @Override
- public String getFixTaskName() {
- return Strings.emptyString();
- }
-
- @Override
- protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
- if (relations == null) {
- relations = new LinkedList<LocalRelationLink>();
- monitor.subTask("Finding Artifacts with Multiple Parents");
- loadData();
- }
- checkForCancelledStatus(monitor);
- monitor.worked(calculateWork(0.20));
-
- Map<Integer, List<Integer>> branches = new HashMap<Integer, List<Integer>>();
- createAndDisplayReport(monitor, !isFixOperationEnabled(), branches);
- checkForCancelledStatus(monitor);
- monitor.worked(calculateWork(0.20));
-
- setItemsToFix(relations != null ? relations.size() : 0);
-
- monitor.worked(calculateWork(0.50));
-
- getSummary().append(
- String.format("%s %d Artifacts with multiple Parents on %d total branches.\n",
- isFixOperationEnabled() ? "Fixed" : "Found", branches.size(), relations.size()));
- monitor.worked(calculateWork(0.10));
- }
-
- private void createAndDisplayReport(IProgressMonitor monitor, boolean isVerify, Map<Integer, List<Integer>> branches) throws OseeCoreException {
- List<Integer> linksfound = new LinkedList<Integer>();
- monitor.subTask("Finding Authors");
- for (LocalRelationLink link : relations) {
- List<Integer> branchs = branches.get(link.relLinkId1);
- if (branchs == null) {
- branchs = new LinkedList<Integer>();
- branches.put(link.relLinkId1, branchs);
- }
- branchs.add(link.branchId);
- if (!link.time1.equals(link.time2)) {
- linksfound.add(link.relLinkId1);
- linksfound.add(link.relLinkId2);
- setAuthors(link);
- setData(link);
- }
- }
- for (LocalRelationLink link : relations) {
- if (link.time1.equals(link.time2)) {
- if (!(linksfound.contains(link.relLinkId1) && linksfound.contains(link.relLinkId2))) {
- link.author1 = "baseline not found";
- link.author2 = "baseline not found";
- setData(link);
- linksfound.add(link.relLinkId1);
- linksfound.add(link.relLinkId2);
- }
-
- }
- }
- StringBuffer sbFull = new StringBuffer(AHTML.beginMultiColumnTable(100, 1));
- sbFull.append(AHTML.beginMultiColumnTable(100, 1));
- sbFull.append(AHTML.addHeaderRowMultiColumnTable(columnHeaders));
- displayData(sbFull, getSummary(), isVerify, false, branches);
- sbFull.append(AHTML.endMultiColumnTable());
- XResultData rd = new XResultData();
- rd.addRaw(sbFull.toString());
- rd.report(getVerifyTaskName(), Manipulations.RAW_HTML);
-
- sbFull = new StringBuffer(AHTML.beginMultiColumnTable(100, 1));
- sbFull.append(AHTML.beginMultiColumnTable(100, 1));
- sbFull.append(AHTML.addHeaderRowMultiColumnTable(columnHeaders));
- displayData(sbFull, getSummary(), isVerify, true, branches);
- sbFull.append(AHTML.endMultiColumnTable());
- rd = new XResultData();
- rd.addRaw(sbFull.toString());
- rd.report(getVerifyTaskName() + " Verbose", Manipulations.RAW_HTML);
- }
-
- //{"Rel Link ID 1", "Rel Link ID 2", "Parent Art ID 1", "Parent Art ID 2", "Child Art ID",
- // "Branch_id", "Archived"};
- private void displayData(StringBuffer sbFull, Appendable builder, boolean verify, boolean displayAll, Map<Integer, List<Integer>> branches) {
- int count = 0;
- sbFull.append(AHTML.addRowSpanMultiColumnTable(HEADER, columnHeaders.length));
- for (LocalRelationLink relLink : relations) {
- if (!relLink.author1.equals("")) {
- count++;
- sbFull.append(AHTML.addRowMultiColumnTable(new String[] {Integer.toString(relLink.relLinkId1),
- Integer.toString(relLink.relLinkId2), Integer.toString(relLink.parentArtId1), relLink.parentArt1,
- Integer.toString(relLink.parentArtId2), relLink.parentArt2, Integer.toString(relLink.childArtId),
- relLink.childArt,
- displayAll ? branches.get(relLink.relLinkId1).toString() : Integer.toString(relLink.branchId),
- relLink.branch, Integer.toString(relLink.archived), relLink.author1, relLink.author2}));
- }
- }
- }
-
- //public LocalRelationLink(int branchId, int childArtId, int gammaId1, int gammaId2, int parentArtId1, int parentArtId2,
- //int relLinkId1, int relLinkId2, Timestamp time1, Timestamp time2, int transactionId1, int transactionId2) {
-
- private void loadData() throws OseeDataStoreException {
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- try {
- chStmt.runPreparedQuery(GET_DUPLICATE_DEFAULT_HIER_LINKS);
- while (chStmt.next()) {
- relations.add(new LocalRelationLink(chStmt.getInt("branch_id"), chStmt.getInt("child_id"),
- chStmt.getInt("gamma1"), chStmt.getInt("gamma2"), chStmt.getInt("parent_id_1"),
- chStmt.getInt("parent_id_2"), chStmt.getInt("link_id_1"), chStmt.getInt("link_id_2"),
- chStmt.getTimestamp("time_1"), chStmt.getTimestamp("time_2"), chStmt.getInt("transaction_1"),
- chStmt.getInt("transaction_2"), chStmt.getInt("archived")));
- }
- } finally {
- chStmt.close();
- }
- }
-
- private void setAuthors(LocalRelationLink link) throws OseeDataStoreException {
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- try {
- chStmt.runPreparedQuery(GET_AUTHOR, link.transactionId1);
- if (chStmt.next()) {
- link.author1 = chStmt.getString("value");
- }
- } finally {
- chStmt.close();
- }
- try {
- chStmt.runPreparedQuery(GET_AUTHOR, link.transactionId2);
- if (chStmt.next()) {
- link.author2 = chStmt.getString("value");
- }
- } finally {
- chStmt.close();
- }
- }
-
- private void setData(LocalRelationLink link) throws OseeDataStoreException {
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- try {
- chStmt.runPreparedQuery(GET_ARTIFACT_NAME, link.parentArtId1);
- if (chStmt.next()) {
- link.parentArt1 = chStmt.getString("value");
- }
- } finally {
- chStmt.close();
- }
- try {
- chStmt.runPreparedQuery(GET_ARTIFACT_NAME, link.parentArtId2);
- if (chStmt.next()) {
- link.parentArt2 = chStmt.getString("value");
- }
- } finally {
- chStmt.close();
- }
- try {
- chStmt.runPreparedQuery(GET_ARTIFACT_NAME, link.childArtId);
- if (chStmt.next()) {
- link.childArt = chStmt.getString("value");
- }
- } finally {
- chStmt.close();
- }
- try {
- chStmt.runPreparedQuery(GET_BRANCH_NAME, link.branchId);
- if (chStmt.next()) {
- link.branch = chStmt.getString("branch_name");
- }
-
- } finally {
- chStmt.close();
- }
- }
-
- @Override
- public String getCheckDescription() {
- return "Verfies that artifact has only a single default hierarchical related parent.";
- }
-
- @Override
- public String getFixDescription() {
- return "";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.dbHealth;
+
+import java.sql.Timestamp;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.core.runtime.IProgressMonitor;
+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.IOseeStatement;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.framework.ui.skynet.results.html.XResultPage.Manipulations;
+
+/**
+ * Check only, no fix.
+ *
+ * @author Theron Virgin
+ */
+public class MultipleParentRelations extends DatabaseHealthOperation {
+ private class LocalRelationLink {
+ public int relLinkId1;
+ public int relLinkId2;
+ public int transactionId1;
+ public int transactionId2;
+ public int gammaId1;
+ public int gammaId2;
+ public int branchId;
+ public String branch;
+ public int parentArtId1;
+ public int parentArtId2;
+ public int childArtId;
+ public String parentArt1;
+ public String parentArt2;
+ public String childArt;
+ public Timestamp time1;
+ public Timestamp time2;
+ public int archived;
+ public boolean deleteByTimeStamp;
+ public String author1;
+ public String author2;
+
+ public LocalRelationLink(int branchId, int childArtId, int gammaId1, int gammaId2, int parentArtId1, int parentArtId2, int relLinkId1, int relLinkId2, Timestamp time1, Timestamp time2, int transactionId1, int transactionId2, int archived) {
+ super();
+ this.branchId = branchId;
+ this.childArtId = childArtId;
+ this.gammaId1 = gammaId1;
+ this.gammaId2 = gammaId2;
+ this.parentArtId1 = parentArtId1;
+ this.parentArtId2 = parentArtId2;
+ this.relLinkId1 = relLinkId1;
+ this.relLinkId2 = relLinkId2;
+ this.time1 = time1;
+ this.time2 = time2;
+ this.transactionId1 = transactionId1;
+ this.transactionId2 = transactionId2;
+ this.archived = archived;
+ this.deleteByTimeStamp = true;
+ author1 = "";
+ author2 = "";
+ }
+ }
+
+ private static final String GET_DUPLICATE_DEFAULT_HIER_LINKS =
+ "SELECT rel1.rel_link_id as Link_ID_1, rel2.rel_link_id as Link_ID_2, rel1.a_art_id As Parent_Id_1, rel2.a_art_id As Parent_Id_2, rel2.b_art_id As Child_ID, det1.branch_id, det1.time as Time_1 , det2.time as Time_2, bra.archived, txs1.gamma_id as Gamma1, txs2.gamma_id as Gamma2, txs1.transaction_id as transaction_1, txs2.transaction_id as transaction_2 FROM osee_branch bra, osee_relation_link rel1, osee_relation_link rel2, osee_txs txs1, osee_txs txs2, osee_tx_details det1, osee_tx_details det2, osee_relation_link_type typ where typ.type_name = 'Default Hierarchical' AND rel1.rel_link_type_id = typ.rel_link_type_id AND rel2.rel_link_type_id = typ.rel_link_type_id AND rel1.a_art_id < rel2.a_art_id AND rel1.b_art_id = rel2.b_art_id AND rel1.gamma_id = txs1.gamma_id AND txs1.tx_current = 1 AND txs2.tx_current = 1 AND txs1.transaction_id = det1.transaction_id AND det1.branch_id = det2.branch_id AND det2.transaction_id = txs2.transaction_id AND txs2.gamma_id = rel2.gamma_id AND bra.branch_id = det1.branch_id order by rel1.b_art_id, txs1.transaction_id";
+
+ private static final String GET_AUTHOR =
+ "Select attr.Value FROM osee_attribute attr, osee_tx_details det, osee_attribute_type typ, osee_txs txs WHERE det.transaction_id = ? AND det.author = attr.art_id AND attr.attr_type_id = typ.attr_type_id AND typ.name = 'Name' AND attr.gamma_id = txs.gamma_id and txs.tx_current = 1";
+
+ private static final String GET_ARTIFACT_NAME =
+ "Select attr.Value FROM osee_attribute attr, osee_attribute_type typ, osee_txs txs WHERE attr.art_id = ? AND attr.attr_type_id = typ.attr_type_id AND typ.name = 'Name' AND attr.gamma_id = txs.gamma_id and txs.tx_current = 1";
+
+ private static final String GET_BRANCH_NAME = "Select branch_name from osee_branch where branch_id = ?";
+
+ private static final String[] columnHeaders =
+ new String[] {"Rel Link ID 1", "Rel Link ID 2", "Parent Art ID 1", "P1 Art Name", "Parent Art ID 2",
+ "P2 Art Name", "Child Art ID", "Child Art Name", "Branch Ids", "Branch Name", "Archived", "Author 1",
+ "Author 2"};
+
+ private static final String HEADER = "Artifacts that have multiple Parents";
+
+ private List<LocalRelationLink> relations = null;
+
+ public MultipleParentRelations() {
+ super("Multiple Parent Relations");
+ }
+
+ @Override
+ public String getFixTaskName() {
+ return Strings.emptyString();
+ }
+
+ @Override
+ protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
+ if (relations == null) {
+ relations = new LinkedList<LocalRelationLink>();
+ monitor.subTask("Finding Artifacts with Multiple Parents");
+ loadData();
+ }
+ checkForCancelledStatus(monitor);
+ monitor.worked(calculateWork(0.20));
+
+ Map<Integer, List<Integer>> branches = new HashMap<Integer, List<Integer>>();
+ createAndDisplayReport(monitor, !isFixOperationEnabled(), branches);
+ checkForCancelledStatus(monitor);
+ monitor.worked(calculateWork(0.20));
+
+ setItemsToFix(relations != null ? relations.size() : 0);
+
+ monitor.worked(calculateWork(0.50));
+
+ getSummary().append(
+ String.format("%s %d Artifacts with multiple Parents on %d total branches.\n",
+ isFixOperationEnabled() ? "Fixed" : "Found", branches.size(), relations.size()));
+ monitor.worked(calculateWork(0.10));
+ }
+
+ private void createAndDisplayReport(IProgressMonitor monitor, boolean isVerify, Map<Integer, List<Integer>> branches) throws OseeCoreException {
+ List<Integer> linksfound = new LinkedList<Integer>();
+ monitor.subTask("Finding Authors");
+ for (LocalRelationLink link : relations) {
+ List<Integer> branchs = branches.get(link.relLinkId1);
+ if (branchs == null) {
+ branchs = new LinkedList<Integer>();
+ branches.put(link.relLinkId1, branchs);
+ }
+ branchs.add(link.branchId);
+ if (!link.time1.equals(link.time2)) {
+ linksfound.add(link.relLinkId1);
+ linksfound.add(link.relLinkId2);
+ setAuthors(link);
+ setData(link);
+ }
+ }
+ for (LocalRelationLink link : relations) {
+ if (link.time1.equals(link.time2)) {
+ if (!(linksfound.contains(link.relLinkId1) && linksfound.contains(link.relLinkId2))) {
+ link.author1 = "baseline not found";
+ link.author2 = "baseline not found";
+ setData(link);
+ linksfound.add(link.relLinkId1);
+ linksfound.add(link.relLinkId2);
+ }
+
+ }
+ }
+ StringBuffer sbFull = new StringBuffer(AHTML.beginMultiColumnTable(100, 1));
+ sbFull.append(AHTML.beginMultiColumnTable(100, 1));
+ sbFull.append(AHTML.addHeaderRowMultiColumnTable(columnHeaders));
+ displayData(sbFull, getSummary(), isVerify, false, branches);
+ sbFull.append(AHTML.endMultiColumnTable());
+ XResultData rd = new XResultData();
+ rd.addRaw(sbFull.toString());
+ rd.report(getVerifyTaskName(), Manipulations.RAW_HTML);
+
+ sbFull = new StringBuffer(AHTML.beginMultiColumnTable(100, 1));
+ sbFull.append(AHTML.beginMultiColumnTable(100, 1));
+ sbFull.append(AHTML.addHeaderRowMultiColumnTable(columnHeaders));
+ displayData(sbFull, getSummary(), isVerify, true, branches);
+ sbFull.append(AHTML.endMultiColumnTable());
+ rd = new XResultData();
+ rd.addRaw(sbFull.toString());
+ rd.report(getVerifyTaskName() + " Verbose", Manipulations.RAW_HTML);
+ }
+
+ //{"Rel Link ID 1", "Rel Link ID 2", "Parent Art ID 1", "Parent Art ID 2", "Child Art ID",
+ // "Branch_id", "Archived"};
+ private void displayData(StringBuffer sbFull, Appendable builder, boolean verify, boolean displayAll, Map<Integer, List<Integer>> branches) {
+ int count = 0;
+ sbFull.append(AHTML.addRowSpanMultiColumnTable(HEADER, columnHeaders.length));
+ for (LocalRelationLink relLink : relations) {
+ if (!relLink.author1.equals("")) {
+ count++;
+ sbFull.append(AHTML.addRowMultiColumnTable(new String[] {Integer.toString(relLink.relLinkId1),
+ Integer.toString(relLink.relLinkId2), Integer.toString(relLink.parentArtId1), relLink.parentArt1,
+ Integer.toString(relLink.parentArtId2), relLink.parentArt2, Integer.toString(relLink.childArtId),
+ relLink.childArt,
+ displayAll ? branches.get(relLink.relLinkId1).toString() : Integer.toString(relLink.branchId),
+ relLink.branch, Integer.toString(relLink.archived), relLink.author1, relLink.author2}));
+ }
+ }
+ }
+
+ //public LocalRelationLink(int branchId, int childArtId, int gammaId1, int gammaId2, int parentArtId1, int parentArtId2,
+ //int relLinkId1, int relLinkId2, Timestamp time1, Timestamp time2, int transactionId1, int transactionId2) {
+
+ private void loadData() throws OseeDataStoreException {
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+ try {
+ chStmt.runPreparedQuery(GET_DUPLICATE_DEFAULT_HIER_LINKS);
+ while (chStmt.next()) {
+ relations.add(new LocalRelationLink(chStmt.getInt("branch_id"), chStmt.getInt("child_id"),
+ chStmt.getInt("gamma1"), chStmt.getInt("gamma2"), chStmt.getInt("parent_id_1"),
+ chStmt.getInt("parent_id_2"), chStmt.getInt("link_id_1"), chStmt.getInt("link_id_2"),
+ chStmt.getTimestamp("time_1"), chStmt.getTimestamp("time_2"), chStmt.getInt("transaction_1"),
+ chStmt.getInt("transaction_2"), chStmt.getInt("archived")));
+ }
+ } finally {
+ chStmt.close();
+ }
+ }
+
+ private void setAuthors(LocalRelationLink link) throws OseeDataStoreException {
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+ try {
+ chStmt.runPreparedQuery(GET_AUTHOR, link.transactionId1);
+ if (chStmt.next()) {
+ link.author1 = chStmt.getString("value");
+ }
+ } finally {
+ chStmt.close();
+ }
+ try {
+ chStmt.runPreparedQuery(GET_AUTHOR, link.transactionId2);
+ if (chStmt.next()) {
+ link.author2 = chStmt.getString("value");
+ }
+ } finally {
+ chStmt.close();
+ }
+ }
+
+ private void setData(LocalRelationLink link) throws OseeDataStoreException {
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+ try {
+ chStmt.runPreparedQuery(GET_ARTIFACT_NAME, link.parentArtId1);
+ if (chStmt.next()) {
+ link.parentArt1 = chStmt.getString("value");
+ }
+ } finally {
+ chStmt.close();
+ }
+ try {
+ chStmt.runPreparedQuery(GET_ARTIFACT_NAME, link.parentArtId2);
+ if (chStmt.next()) {
+ link.parentArt2 = chStmt.getString("value");
+ }
+ } finally {
+ chStmt.close();
+ }
+ try {
+ chStmt.runPreparedQuery(GET_ARTIFACT_NAME, link.childArtId);
+ if (chStmt.next()) {
+ link.childArt = chStmt.getString("value");
+ }
+ } finally {
+ chStmt.close();
+ }
+ try {
+ chStmt.runPreparedQuery(GET_BRANCH_NAME, link.branchId);
+ if (chStmt.next()) {
+ link.branch = chStmt.getString("branch_name");
+ }
+
+ } finally {
+ chStmt.close();
+ }
+ }
+
+ @Override
+ public String getCheckDescription() {
+ return "Verfies that artifact has only a single default hierarchical related parent.";
+ }
+
+ @Override
+ public String getFixDescription() {
+ return "";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RelationIntegrityCheck.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RelationIntegrityCheck.java
index b9bd7bba2ff..8aee4d5f29e 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RelationIntegrityCheck.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RelationIntegrityCheck.java
@@ -1,264 +1,264 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.dbHealth;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.enums.ModificationType;
-import org.eclipse.osee.framework.core.enums.TxChange;
-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.IOseeStatement;
-import org.eclipse.osee.framework.jdk.core.type.DoubleKeyHashMap;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.framework.ui.skynet.results.html.XResultPage.Manipulations;
-
-/**
- * @author Theron Virgin
- */
-public class RelationIntegrityCheck extends DatabaseHealthOperation {
- private static class LocalRelationLink {
- public int relLinkId;
- public int gammaId;
- public int relTransId;
- public int branchId;
- public int aArtId;
- public int bArtId;
- public int transIdForArtifactDeletion;
-
- public LocalRelationLink(int relLinkId, int gammaId, int transactionId, int branchId, int aArtId, int bArtId, int transIdForArtifactDeletion) {
- super();
- this.aArtId = aArtId;
- this.bArtId = bArtId;
- this.branchId = branchId;
- this.gammaId = gammaId;
- this.relLinkId = relLinkId;
- this.relTransId = transactionId;
- this.transIdForArtifactDeletion = transIdForArtifactDeletion;
- }
- }
-
- private static final String NO_ADDRESSING_ARTIFACTS_A =
- "SELECT tx1.gamma_id, tx1.transaction_id, rel1.rel_link_id, tx1.branch_id, rel1.a_art_id, rel1.b_art_id, 0 AS deleted_tran FROM osee_txs tx1, osee_relation_link rel1 WHERE tx1.gamma_id = rel1.gamma_id AND NOT EXISTS (SELECT 'x' FROM osee_txs tx2, osee_artifact av1 WHERE tx1.branch_id = tx2.branch_id AND tx2.gamma_id = av1.gamma_id AND av1.art_id = rel1.a_art_id)";
-
- private static final String NO_ADDRESSING_ARTIFACTS_B =
- "SELECT tx1.gamma_id, tx1.transaction_id, rel1.rel_link_id, tx1.branch_id, rel1.a_art_id, rel1.b_art_id, 0 AS deleted_tran FROM osee_txs tx1, osee_relation_link rel1 WHERE tx1.gamma_id = rel1.gamma_id AND NOT EXISTS (SELECT 'x' FROM osee_txs tx2, osee_artifact av1 WHERE tx1.branch_id = tx2.branch_id AND tx2.gamma_id = av1.gamma_id AND av1.art_id = rel1.b_art_id)";
-
- private static final String DELETED_A_ARTIFACTS =
- "SELECT tx1.gamma_id, tx1.transaction_id, rel1.rel_link_id, tx1.branch_id, rel1.a_art_id, rel1.b_art_id, tx2.transaction_id AS deleted_tran FROM osee_txs tx1, osee_txs tx2, osee_relation_link rel1, osee_artifact av1 WHERE tx1.gamma_id = rel1.gamma_id AND tx1.tx_current = 1 AND tx1.branch_id = tx2.branch_id AND tx2.gamma_id = av1.gamma_id AND tx2.tx_current = 2 AND av1.art_id = rel1.a_art_id";
-
- private static final String DELETED_B_ARTIFACTS =
- "SELECT tx1.gamma_id, tx1.transaction_id, rel1.rel_link_id, tx1.branch_id, rel1.a_art_id, rel1.b_art_id, tx2.transaction_id AS deleted_tran FROM osee_txs tx1, osee_txs tx2, osee_relation_link rel1, osee_artifact av1 WHERE tx1.gamma_id = rel1.gamma_id AND tx1.tx_current = 1 AND tx1.branch_id = tx2.branch_id AND tx2.gamma_id = av1.gamma_id AND tx2.tx_current = 2 AND av1.art_id = rel1.b_art_id";
-
- private static final String DELETE_FROM_TXS = "DELETE FROM osee_txs where gamma_id = ? AND transaction_id = ?";
-
- private static final String UPDATE_TXS_PREVIOUS =
- "UPDATE osee_txs SET tx_current = 0 WHERE gamma_id = ? AND transaction_id = ?";
-
- private static final String UPDATE_TXS_CURRENT =
- "UPDATE osee_txs SET tx_current = " + TxChange.ARTIFACT_DELETED.getValue() + ", mod_type = " + ModificationType.ARTIFACT_DELETED.getValue() + " WHERE gamma_id = ? AND transaction_id = ?";
-
- private static final String INSERT_TXS =
- "INSERT INTO osee_txs (gamma_id, transaction_id, tx_current, mod_type, branch_id) VALUES (?, ?, " + TxChange.ARTIFACT_DELETED.getValue() + ", " + ModificationType.ARTIFACT_DELETED.getValue() + ", ?)";
-
- private static final String[] columnHeaders =
- new String[] {"Rel Link ID", "Gamma Id", "Transaction Id", "Branch_id", "A Art Id", "B Art Id",
- "Transaction ID of Deleted Artifact"};
-
- private static final String[] DESCRIPTION =
- {"Relation Links with non existent Artifacts on the Branch\n",
- "Relation Links with deleted Artifacts on the Branch\n"};
-
- private static final String[] HEADER =
- {"%S Relation Links that have artifacts that don't exist on the branch",
- "%s Relation Links that have artifacts that are deleted on the branch"};
-
- private DoubleKeyHashMap<Integer, Integer, LocalRelationLink> deleteMap = null;
- private DoubleKeyHashMap<Integer, Integer, LocalRelationLink> updateMap = null;
- private IProgressMonitor monitor;
- private StringBuffer sbFull = null;
- private boolean fix;
- private boolean verify;
-
- @Override
- protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
- init(monitor);
- loadBrokenRelations();
- createReport();
- setItemsToFix(updateMap.size() + deleteMap.size());
-
- if (fix) {
- fix();
- } else {
- monitor.worked(calculateWork(0.40));
- }
-
- endReport();
- }
-
- private void init(IProgressMonitor monitor) {
- this.monitor = monitor;
- sbFull = new StringBuffer(AHTML.beginMultiColumnTable(100, 1));
- fix = isFixOperationEnabled();
- verify = !fix;
- }
-
- public RelationIntegrityCheck() {
- super("Relation Integrity Errors");
- }
-
- private void loadBrokenRelations() throws OseeCoreException {
- if (isLoadingBrokenRelationsNecessary()) {
- deleteMap = new DoubleKeyHashMap<Integer, Integer, LocalRelationLink>();
- updateMap = new DoubleKeyHashMap<Integer, Integer, LocalRelationLink>();
-
- loadData("Loading Relations with nonexistent artifacts on the A side", NO_ADDRESSING_ARTIFACTS_A, true);
- loadData("Loading Relations with nonexistent artifacts on the B side", NO_ADDRESSING_ARTIFACTS_B, true);
- loadData("Loading Relations with Deleted artifacts on the A side", DELETED_A_ARTIFACTS, false);
- loadData("Loading Relations with Deleted artifacts on the B side", DELETED_B_ARTIFACTS, false);
- } else {
- checkForCancelledStatus(monitor);
- monitor.worked(calculateWork(0.40));
- }
- }
-
- private boolean isLoadingBrokenRelationsNecessary() {
- return verify || isFirstRun();
- }
-
- private boolean isFirstRun() {
- return updateMap == null || deleteMap == null;
- }
-
- private void createReport() throws IOException {
- sbFull.append(AHTML.beginMultiColumnTable(100, 1));
- sbFull.append(AHTML.addHeaderRowMultiColumnTable(columnHeaders));
- displayData(0, sbFull, getSummary(), verify, deleteMap);
- displayData(1, sbFull, getSummary(), verify, updateMap);
- monitor.worked(calculateWork(0.10));
- checkForCancelledStatus(monitor);
- }
-
- private void deleteInvalidRelationAddressing() throws OseeDataStoreException {
- List<Object[]> rowsToDelete = new LinkedList<Object[]>();
- for (LocalRelationLink relLink : deleteMap.allValues()) {
- rowsToDelete.add(new Object[] {relLink.gammaId, relLink.relTransId});
- }
-
- monitor.subTask("Deleting Relation Addressing with non existent Artifacts");
- if (rowsToDelete.size() != 0) {
- ConnectionHandler.runBatchUpdate(DELETE_FROM_TXS, rowsToDelete);
- }
- deleteMap = null;
-
- monitor.worked(calculateWork(0.10));
- }
-
- private void fix() throws OseeCoreException {
- deleteInvalidRelationAddressing();
-
- List<Object[]> insertArtifactDeleted = new LinkedList<Object[]>();
- List<Object[]> updatePreviousAddressing = new LinkedList<Object[]>();
- List<Object[]> updateCurrentAddressing = new LinkedList<Object[]>();
- List<LocalRelationLink> pathologicalCases = new ArrayList<LocalRelationLink>();
- for (LocalRelationLink relLink : updateMap.allValues()) {
- if (relLink.relTransId > relLink.transIdForArtifactDeletion) {
- pathologicalCases.add(relLink);
- } else if (relLink.relTransId == relLink.transIdForArtifactDeletion) {
- updateCurrentAddressing.add(new Object[] {relLink.gammaId, relLink.relTransId});
- } else {
- updatePreviousAddressing.add(new Object[] {relLink.gammaId, relLink.relTransId});
- insertArtifactDeleted.add(new Object[] {relLink.gammaId, relLink.transIdForArtifactDeletion,
- relLink.branchId});
- }
- }
-
- runInsert(insertArtifactDeleted, INSERT_TXS, "Inserting Addressing for Deleted Artifacts");
- runInsert(updatePreviousAddressing, UPDATE_TXS_PREVIOUS, "Updating Addressing for Deleted Artifacts");
- runInsert(updateCurrentAddressing, UPDATE_TXS_CURRENT, "Updating Addressing for Deleted Artifacts");
- updateMap = null;
- }
-
- private void runInsert(List<Object[]> insertParameters, String sql, String taskName) throws OseeDataStoreException {
- monitor.subTask(taskName);
- if (insertParameters.size() != 0) {
- ConnectionHandler.runBatchUpdate(sql, insertParameters);
- }
- monitor.worked(calculateWork(0.10));
-
- }
-
- private void endReport() throws OseeCoreException {
- sbFull.append(AHTML.endMultiColumnTable());
- XResultData rd = new XResultData();
- rd.addRaw(sbFull.toString());
- rd.report(getVerifyTaskName(), Manipulations.RAW_HTML);
- monitor.worked(calculateWork(0.10));
- }
-
- private void displayData(int x, StringBuffer sbFull, Appendable builder, boolean verify, DoubleKeyHashMap<Integer, Integer, LocalRelationLink> map) throws IOException {
- int count = 0;
- String header = String.format(HEADER[x], map.allValues().size());
- sbFull.append(AHTML.addRowSpanMultiColumnTable(header, columnHeaders.length));
- for (LocalRelationLink relLink : map.allValues()) {
- count++;
- sbFull.append(AHTML.addRowMultiColumnTable(new String[] {Integer.toString(relLink.relLinkId),
- Integer.toString(relLink.gammaId), Integer.toString(relLink.relTransId),
- Integer.toString(relLink.branchId), Integer.toString(relLink.aArtId), Integer.toString(relLink.bArtId),
- Integer.toString(relLink.transIdForArtifactDeletion)}));
- }
-
- builder.append(verify ? "Found " : "Fixed ");
- builder.append(String.valueOf(count));
- builder.append(" ");
- builder.append(DESCRIPTION[x]);
- }
-
- private void loadData(String description, String sql, boolean forDelete) throws OseeDataStoreException {
- monitor.subTask(description);
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- DoubleKeyHashMap<Integer, Integer, LocalRelationLink> map = forDelete ? deleteMap : updateMap;
- try {
- chStmt.runPreparedQuery(sql);
- while (chStmt.next()) {
- if (!map.containsKey(chStmt.getInt("gamma_id"), chStmt.getInt("transaction_id")) && (forDelete || !deleteMap.containsKey(
- chStmt.getInt("gamma_id"), chStmt.getInt("transaction_id")))) {
- map.put(chStmt.getInt("gamma_id"), chStmt.getInt("transaction_id"), new LocalRelationLink(
- chStmt.getInt("rel_link_id"), chStmt.getInt("gamma_id"), chStmt.getInt("transaction_id"),
- chStmt.getInt("branch_id"), chStmt.getInt("a_art_id"), chStmt.getInt("b_art_id"),
- chStmt.getInt("deleted_tran")));
- } else {
- System.out.print("");
- }
- }
- } finally {
- chStmt.close();
- }
- checkForCancelledStatus(monitor);
- monitor.worked(calculateWork(0.10));
- }
-
- @Override
- public String getCheckDescription() {
- return "Enter Check Description Here";
- }
-
- @Override
- public String getFixDescription() {
- return "Enter Fix Description Here";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.dbHealth;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.core.enums.TxChange;
+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.IOseeStatement;
+import org.eclipse.osee.framework.jdk.core.type.DoubleKeyHashMap;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.framework.ui.skynet.results.html.XResultPage.Manipulations;
+
+/**
+ * @author Theron Virgin
+ */
+public class RelationIntegrityCheck extends DatabaseHealthOperation {
+ private static class LocalRelationLink {
+ public int relLinkId;
+ public int gammaId;
+ public int relTransId;
+ public int branchId;
+ public int aArtId;
+ public int bArtId;
+ public int transIdForArtifactDeletion;
+
+ public LocalRelationLink(int relLinkId, int gammaId, int transactionId, int branchId, int aArtId, int bArtId, int transIdForArtifactDeletion) {
+ super();
+ this.aArtId = aArtId;
+ this.bArtId = bArtId;
+ this.branchId = branchId;
+ this.gammaId = gammaId;
+ this.relLinkId = relLinkId;
+ this.relTransId = transactionId;
+ this.transIdForArtifactDeletion = transIdForArtifactDeletion;
+ }
+ }
+
+ private static final String NO_ADDRESSING_ARTIFACTS_A =
+ "SELECT tx1.gamma_id, tx1.transaction_id, rel1.rel_link_id, tx1.branch_id, rel1.a_art_id, rel1.b_art_id, 0 AS deleted_tran FROM osee_txs tx1, osee_relation_link rel1 WHERE tx1.gamma_id = rel1.gamma_id AND NOT EXISTS (SELECT 'x' FROM osee_txs tx2, osee_artifact av1 WHERE tx1.branch_id = tx2.branch_id AND tx2.gamma_id = av1.gamma_id AND av1.art_id = rel1.a_art_id)";
+
+ private static final String NO_ADDRESSING_ARTIFACTS_B =
+ "SELECT tx1.gamma_id, tx1.transaction_id, rel1.rel_link_id, tx1.branch_id, rel1.a_art_id, rel1.b_art_id, 0 AS deleted_tran FROM osee_txs tx1, osee_relation_link rel1 WHERE tx1.gamma_id = rel1.gamma_id AND NOT EXISTS (SELECT 'x' FROM osee_txs tx2, osee_artifact av1 WHERE tx1.branch_id = tx2.branch_id AND tx2.gamma_id = av1.gamma_id AND av1.art_id = rel1.b_art_id)";
+
+ private static final String DELETED_A_ARTIFACTS =
+ "SELECT tx1.gamma_id, tx1.transaction_id, rel1.rel_link_id, tx1.branch_id, rel1.a_art_id, rel1.b_art_id, tx2.transaction_id AS deleted_tran FROM osee_txs tx1, osee_txs tx2, osee_relation_link rel1, osee_artifact av1 WHERE tx1.gamma_id = rel1.gamma_id AND tx1.tx_current = 1 AND tx1.branch_id = tx2.branch_id AND tx2.gamma_id = av1.gamma_id AND tx2.tx_current = 2 AND av1.art_id = rel1.a_art_id";
+
+ private static final String DELETED_B_ARTIFACTS =
+ "SELECT tx1.gamma_id, tx1.transaction_id, rel1.rel_link_id, tx1.branch_id, rel1.a_art_id, rel1.b_art_id, tx2.transaction_id AS deleted_tran FROM osee_txs tx1, osee_txs tx2, osee_relation_link rel1, osee_artifact av1 WHERE tx1.gamma_id = rel1.gamma_id AND tx1.tx_current = 1 AND tx1.branch_id = tx2.branch_id AND tx2.gamma_id = av1.gamma_id AND tx2.tx_current = 2 AND av1.art_id = rel1.b_art_id";
+
+ private static final String DELETE_FROM_TXS = "DELETE FROM osee_txs where gamma_id = ? AND transaction_id = ?";
+
+ private static final String UPDATE_TXS_PREVIOUS =
+ "UPDATE osee_txs SET tx_current = 0 WHERE gamma_id = ? AND transaction_id = ?";
+
+ private static final String UPDATE_TXS_CURRENT =
+ "UPDATE osee_txs SET tx_current = " + TxChange.ARTIFACT_DELETED.getValue() + ", mod_type = " + ModificationType.ARTIFACT_DELETED.getValue() + " WHERE gamma_id = ? AND transaction_id = ?";
+
+ private static final String INSERT_TXS =
+ "INSERT INTO osee_txs (gamma_id, transaction_id, tx_current, mod_type, branch_id) VALUES (?, ?, " + TxChange.ARTIFACT_DELETED.getValue() + ", " + ModificationType.ARTIFACT_DELETED.getValue() + ", ?)";
+
+ private static final String[] columnHeaders =
+ new String[] {"Rel Link ID", "Gamma Id", "Transaction Id", "Branch_id", "A Art Id", "B Art Id",
+ "Transaction ID of Deleted Artifact"};
+
+ private static final String[] DESCRIPTION =
+ {"Relation Links with non existent Artifacts on the Branch\n",
+ "Relation Links with deleted Artifacts on the Branch\n"};
+
+ private static final String[] HEADER =
+ {"%S Relation Links that have artifacts that don't exist on the branch",
+ "%s Relation Links that have artifacts that are deleted on the branch"};
+
+ private DoubleKeyHashMap<Integer, Integer, LocalRelationLink> deleteMap = null;
+ private DoubleKeyHashMap<Integer, Integer, LocalRelationLink> updateMap = null;
+ private IProgressMonitor monitor;
+ private StringBuffer sbFull = null;
+ private boolean fix;
+ private boolean verify;
+
+ @Override
+ protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
+ init(monitor);
+ loadBrokenRelations();
+ createReport();
+ setItemsToFix(updateMap.size() + deleteMap.size());
+
+ if (fix) {
+ fix();
+ } else {
+ monitor.worked(calculateWork(0.40));
+ }
+
+ endReport();
+ }
+
+ private void init(IProgressMonitor monitor) {
+ this.monitor = monitor;
+ sbFull = new StringBuffer(AHTML.beginMultiColumnTable(100, 1));
+ fix = isFixOperationEnabled();
+ verify = !fix;
+ }
+
+ public RelationIntegrityCheck() {
+ super("Relation Integrity Errors");
+ }
+
+ private void loadBrokenRelations() throws OseeCoreException {
+ if (isLoadingBrokenRelationsNecessary()) {
+ deleteMap = new DoubleKeyHashMap<Integer, Integer, LocalRelationLink>();
+ updateMap = new DoubleKeyHashMap<Integer, Integer, LocalRelationLink>();
+
+ loadData("Loading Relations with nonexistent artifacts on the A side", NO_ADDRESSING_ARTIFACTS_A, true);
+ loadData("Loading Relations with nonexistent artifacts on the B side", NO_ADDRESSING_ARTIFACTS_B, true);
+ loadData("Loading Relations with Deleted artifacts on the A side", DELETED_A_ARTIFACTS, false);
+ loadData("Loading Relations with Deleted artifacts on the B side", DELETED_B_ARTIFACTS, false);
+ } else {
+ checkForCancelledStatus(monitor);
+ monitor.worked(calculateWork(0.40));
+ }
+ }
+
+ private boolean isLoadingBrokenRelationsNecessary() {
+ return verify || isFirstRun();
+ }
+
+ private boolean isFirstRun() {
+ return updateMap == null || deleteMap == null;
+ }
+
+ private void createReport() throws IOException {
+ sbFull.append(AHTML.beginMultiColumnTable(100, 1));
+ sbFull.append(AHTML.addHeaderRowMultiColumnTable(columnHeaders));
+ displayData(0, sbFull, getSummary(), verify, deleteMap);
+ displayData(1, sbFull, getSummary(), verify, updateMap);
+ monitor.worked(calculateWork(0.10));
+ checkForCancelledStatus(monitor);
+ }
+
+ private void deleteInvalidRelationAddressing() throws OseeDataStoreException {
+ List<Object[]> rowsToDelete = new LinkedList<Object[]>();
+ for (LocalRelationLink relLink : deleteMap.allValues()) {
+ rowsToDelete.add(new Object[] {relLink.gammaId, relLink.relTransId});
+ }
+
+ monitor.subTask("Deleting Relation Addressing with non existent Artifacts");
+ if (rowsToDelete.size() != 0) {
+ ConnectionHandler.runBatchUpdate(DELETE_FROM_TXS, rowsToDelete);
+ }
+ deleteMap = null;
+
+ monitor.worked(calculateWork(0.10));
+ }
+
+ private void fix() throws OseeCoreException {
+ deleteInvalidRelationAddressing();
+
+ List<Object[]> insertArtifactDeleted = new LinkedList<Object[]>();
+ List<Object[]> updatePreviousAddressing = new LinkedList<Object[]>();
+ List<Object[]> updateCurrentAddressing = new LinkedList<Object[]>();
+ List<LocalRelationLink> pathologicalCases = new ArrayList<LocalRelationLink>();
+ for (LocalRelationLink relLink : updateMap.allValues()) {
+ if (relLink.relTransId > relLink.transIdForArtifactDeletion) {
+ pathologicalCases.add(relLink);
+ } else if (relLink.relTransId == relLink.transIdForArtifactDeletion) {
+ updateCurrentAddressing.add(new Object[] {relLink.gammaId, relLink.relTransId});
+ } else {
+ updatePreviousAddressing.add(new Object[] {relLink.gammaId, relLink.relTransId});
+ insertArtifactDeleted.add(new Object[] {relLink.gammaId, relLink.transIdForArtifactDeletion,
+ relLink.branchId});
+ }
+ }
+
+ runInsert(insertArtifactDeleted, INSERT_TXS, "Inserting Addressing for Deleted Artifacts");
+ runInsert(updatePreviousAddressing, UPDATE_TXS_PREVIOUS, "Updating Addressing for Deleted Artifacts");
+ runInsert(updateCurrentAddressing, UPDATE_TXS_CURRENT, "Updating Addressing for Deleted Artifacts");
+ updateMap = null;
+ }
+
+ private void runInsert(List<Object[]> insertParameters, String sql, String taskName) throws OseeDataStoreException {
+ monitor.subTask(taskName);
+ if (insertParameters.size() != 0) {
+ ConnectionHandler.runBatchUpdate(sql, insertParameters);
+ }
+ monitor.worked(calculateWork(0.10));
+
+ }
+
+ private void endReport() throws OseeCoreException {
+ sbFull.append(AHTML.endMultiColumnTable());
+ XResultData rd = new XResultData();
+ rd.addRaw(sbFull.toString());
+ rd.report(getVerifyTaskName(), Manipulations.RAW_HTML);
+ monitor.worked(calculateWork(0.10));
+ }
+
+ private void displayData(int x, StringBuffer sbFull, Appendable builder, boolean verify, DoubleKeyHashMap<Integer, Integer, LocalRelationLink> map) throws IOException {
+ int count = 0;
+ String header = String.format(HEADER[x], map.allValues().size());
+ sbFull.append(AHTML.addRowSpanMultiColumnTable(header, columnHeaders.length));
+ for (LocalRelationLink relLink : map.allValues()) {
+ count++;
+ sbFull.append(AHTML.addRowMultiColumnTable(new String[] {Integer.toString(relLink.relLinkId),
+ Integer.toString(relLink.gammaId), Integer.toString(relLink.relTransId),
+ Integer.toString(relLink.branchId), Integer.toString(relLink.aArtId), Integer.toString(relLink.bArtId),
+ Integer.toString(relLink.transIdForArtifactDeletion)}));
+ }
+
+ builder.append(verify ? "Found " : "Fixed ");
+ builder.append(String.valueOf(count));
+ builder.append(" ");
+ builder.append(DESCRIPTION[x]);
+ }
+
+ private void loadData(String description, String sql, boolean forDelete) throws OseeDataStoreException {
+ monitor.subTask(description);
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+ DoubleKeyHashMap<Integer, Integer, LocalRelationLink> map = forDelete ? deleteMap : updateMap;
+ try {
+ chStmt.runPreparedQuery(sql);
+ while (chStmt.next()) {
+ if (!map.containsKey(chStmt.getInt("gamma_id"), chStmt.getInt("transaction_id")) && (forDelete || !deleteMap.containsKey(
+ chStmt.getInt("gamma_id"), chStmt.getInt("transaction_id")))) {
+ map.put(chStmt.getInt("gamma_id"), chStmt.getInt("transaction_id"), new LocalRelationLink(
+ chStmt.getInt("rel_link_id"), chStmt.getInt("gamma_id"), chStmt.getInt("transaction_id"),
+ chStmt.getInt("branch_id"), chStmt.getInt("a_art_id"), chStmt.getInt("b_art_id"),
+ chStmt.getInt("deleted_tran")));
+ } else {
+ System.out.print("");
+ }
+ }
+ } finally {
+ chStmt.close();
+ }
+ checkForCancelledStatus(monitor);
+ monitor.worked(calculateWork(0.10));
+ }
+
+ @Override
+ public String getCheckDescription() {
+ return "Enter Check Description Here";
+ }
+
+ @Override
+ public String getFixDescription() {
+ return "Enter Fix Description Here";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RepeatEnumerationAttributeValues.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RepeatEnumerationAttributeValues.java
index 1b7d31b7797..6e7eb1da639 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RepeatEnumerationAttributeValues.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/RepeatEnumerationAttributeValues.java
@@ -1,199 +1,199 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.dbHealth;
-
-import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.EXCLUDE_DELETED;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.enums.TxChange;
-import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.core.exception.OseeTypeDoesNotExist;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.jdk.core.type.HashCollection;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-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.search.ArtifactQuery;
-import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-
-/**
- * @author Ryan D. Brooks
- * @author Roberto E. Escobar
- */
-public class RepeatEnumerationAttributeValues extends DatabaseHealthOperation {
-
- private final static String FIND_REPEAT_ENUMS =
- "select DISTINCT(art1.guid), att1.art_id, att1.value, att1.attr_type_id from osee_attribute att1, osee_attribute att2, osee_txs txs1, osee_txs txs2, osee_artifact art1 where att1.gamma_id = txs1.gamma_id and txs1.branch_id = ? and att2.gamma_id = txs2.gamma_id and txs2.branch_id = ? and att1.art_id = att2.art_id and att1.attr_id <> att2.attr_id and att1.value = att2.value and txs1.tx_current = " + TxChange.CURRENT.getValue() + " and txs2.tx_current = " + TxChange.CURRENT.getValue() + " and att1.attr_type_id = att2.attr_type_id and art1.art_id = att1.art_id order by att1.art_id, att1.attr_type_id, att1.value";
-
- public RepeatEnumerationAttributeValues() {
- super("Repeat Enumeration Attribute Values");
- }
-
- @Override
- public String getFixTaskName() {
- return "Delete Repeat Enumeration Attribute Values";
- }
-
- @Override
- protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
- HashCollection<Branch, AttrData> attributesWithErrors = new HashCollection<Branch, AttrData>();
- List<Branch> branches = BranchManager.getBaselineBranches();
- if (branches.isEmpty()) {
- throw new OseeStateException("no branches found");
- }
- for (Branch branch : branches) {
- Collection<AttrData> datas = getRepeatEnumeratedAttrs(monitor, branch);
- if (!datas.isEmpty()) {
- attributesWithErrors.put(branch, datas);
- }
- }
- monitor.worked(calculateWork(0.40));
-
- appendToDetails(AHTML.beginMultiColumnTable(100, 1));
- appendToDetails(AHTML.addHeaderRowMultiColumnTable(new String[] {"GUID", "ATTR TYPE ID", "VALUE"}));
- for (Branch branch : attributesWithErrors.keySet()) {
- appendToDetails(AHTML.addRowSpanMultiColumnTable(branch.getName(), 3));
- for (AttrData attrData : attributesWithErrors.getValues(branch)) {
- appendToDetails(AHTML.addRowMultiColumnTable(new String[] {attrData.getArtifactGuid(),
- AttributeTypeManager.getType(attrData.getAttributeTypeId()).getName(), attrData.getValue()}));
- }
- }
- appendToDetails(AHTML.endMultiColumnTable());
-
- monitor.worked(calculateWork(0.10));
- checkForCancelledStatus(monitor);
-
- setItemsToFix(attributesWithErrors.size());
- checkForCancelledStatus(monitor);
- if (isFixOperationEnabled() && hadItemsToFix()) {
- for (Branch branch : attributesWithErrors.keySet()) {
- Collection<AttrData> attributeData = attributesWithErrors.getValues(branch);
- List<String> artifactGuids = new ArrayList<String>(attributeData.size());
- for (AttrData attrData : attributeData) {
- artifactGuids.add(attrData.getArtifactGuid());
- }
-
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.dbHealth;
+
+import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.EXCLUDE_DELETED;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.enums.TxChange;
+import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.core.exception.OseeTypeDoesNotExist;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.jdk.core.type.HashCollection;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+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.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+
+/**
+ * @author Ryan D. Brooks
+ * @author Roberto E. Escobar
+ */
+public class RepeatEnumerationAttributeValues extends DatabaseHealthOperation {
+
+ private final static String FIND_REPEAT_ENUMS =
+ "select DISTINCT(art1.guid), att1.art_id, att1.value, att1.attr_type_id from osee_attribute att1, osee_attribute att2, osee_txs txs1, osee_txs txs2, osee_artifact art1 where att1.gamma_id = txs1.gamma_id and txs1.branch_id = ? and att2.gamma_id = txs2.gamma_id and txs2.branch_id = ? and att1.art_id = att2.art_id and att1.attr_id <> att2.attr_id and att1.value = att2.value and txs1.tx_current = " + TxChange.CURRENT.getValue() + " and txs2.tx_current = " + TxChange.CURRENT.getValue() + " and att1.attr_type_id = att2.attr_type_id and art1.art_id = att1.art_id order by att1.art_id, att1.attr_type_id, att1.value";
+
+ public RepeatEnumerationAttributeValues() {
+ super("Repeat Enumeration Attribute Values");
+ }
+
+ @Override
+ public String getFixTaskName() {
+ return "Delete Repeat Enumeration Attribute Values";
+ }
+
+ @Override
+ protected void doHealthCheck(IProgressMonitor monitor) throws Exception {
+ HashCollection<Branch, AttrData> attributesWithErrors = new HashCollection<Branch, AttrData>();
+ List<Branch> branches = BranchManager.getBaselineBranches();
+ if (branches.isEmpty()) {
+ throw new OseeStateException("no branches found");
+ }
+ for (Branch branch : branches) {
+ Collection<AttrData> datas = getRepeatEnumeratedAttrs(monitor, branch);
+ if (!datas.isEmpty()) {
+ attributesWithErrors.put(branch, datas);
+ }
+ }
+ monitor.worked(calculateWork(0.40));
+
+ appendToDetails(AHTML.beginMultiColumnTable(100, 1));
+ appendToDetails(AHTML.addHeaderRowMultiColumnTable(new String[] {"GUID", "ATTR TYPE ID", "VALUE"}));
+ for (Branch branch : attributesWithErrors.keySet()) {
+ appendToDetails(AHTML.addRowSpanMultiColumnTable(branch.getName(), 3));
+ for (AttrData attrData : attributesWithErrors.getValues(branch)) {
+ appendToDetails(AHTML.addRowMultiColumnTable(new String[] {attrData.getArtifactGuid(),
+ AttributeTypeManager.getType(attrData.getAttributeTypeId()).getName(), attrData.getValue()}));
+ }
+ }
+ appendToDetails(AHTML.endMultiColumnTable());
+
+ monitor.worked(calculateWork(0.10));
+ checkForCancelledStatus(monitor);
+
+ setItemsToFix(attributesWithErrors.size());
+ checkForCancelledStatus(monitor);
+ if (isFixOperationEnabled() && hadItemsToFix()) {
+ for (Branch branch : attributesWithErrors.keySet()) {
+ Collection<AttrData> attributeData = attributesWithErrors.getValues(branch);
+ List<String> artifactGuids = new ArrayList<String>(attributeData.size());
+ for (AttrData attrData : attributeData) {
+ artifactGuids.add(attrData.getArtifactGuid());
+ }
+
ArtifactQuery.getArtifactListFromIds(artifactGuids, branch, EXCLUDE_DELETED); // bulk load for speed
- SkynetTransaction transaction =
- new SkynetTransaction(branch, "Delete Repeat Attribute Values for" + branch.getShortName());
- for (AttrData attrData : attributeData) {
- Artifact artifact = ArtifactQuery.getArtifactFromId(attrData.getArtifactGuid(), branch);
- AttributeType attributeType = AttributeTypeManager.getType(attrData.getAttributeTypeId());
- if (attributeType.isEnumerated()) {
- artifact.setAttributeValues(attributeType, artifact.getAttributesToStringList(attributeType));
- transaction.addArtifactAndAttributes(artifact);
- }
- }
- transaction.execute();
- }
- }
- monitor.worked(calculateWork(0.40));
-
- getSummary().append(String.format("[%s] Repeat Enumeration Attribute Values found\n", getItemsToFixCount()));
- monitor.worked(calculateWork(0.10));
- }
-
- @Override
- public String getCheckDescription() {
- return "Searches for attributes of the same artifact having the same values in top level branches";
- }
-
- @Override
- public String getFixDescription() {
- return "Deletes the repeat attribute values using a transaction directly on the branch";
- }
-
- private Set<AttrData> getRepeatEnumeratedAttrs(IProgressMonitor monitor, Branch branch) throws OseeDataStoreException, OseeTypeDoesNotExist {
- Set<AttrData> attrData = new HashSet<AttrData>();
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- try {
- chStmt.runPreparedQuery(FIND_REPEAT_ENUMS, branch.getId(), branch.getId());
- while (chStmt.next()) {
- checkForCancelledStatus(monitor);
- attrData.add(new AttrData(chStmt.getString("guid"), chStmt.getInt("attr_type_id"),
- chStmt.getString("value")));
- }
- } finally {
- chStmt.close();
- }
- return attrData;
- }
-
- private final class AttrData {
- private final String artifactGuid;
- private final int attributeTypeId;
- private final String value;
-
- public AttrData(String artifactGuid, int attributeTypeId, String value) {
- super();
- this.artifactGuid = artifactGuid;
- this.attributeTypeId = attributeTypeId;
- this.value = value;
- }
-
- public String getArtifactGuid() {
- return artifactGuid;
- }
-
- public int getAttributeTypeId() {
- return attributeTypeId;
- }
-
- public String getValue() {
- return value;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (artifactGuid == null ? 0 : artifactGuid.hashCode());
- result = prime * result + attributeTypeId;
- result = prime * result + (value == null ? 0 : value.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- AttrData other = (AttrData) obj;
- if (artifactGuid == null) {
- if (other.artifactGuid != null) {
- return false;
- }
- } else if (!artifactGuid.equals(other.artifactGuid)) {
- return false;
- }
- if (attributeTypeId != other.attributeTypeId) {
- return false;
- }
- if (value == null) {
- if (other.value != null) {
- return false;
- }
- } else if (!value.equals(other.value)) {
- return false;
- }
- return true;
- }
- }
+ SkynetTransaction transaction =
+ new SkynetTransaction(branch, "Delete Repeat Attribute Values for" + branch.getShortName());
+ for (AttrData attrData : attributeData) {
+ Artifact artifact = ArtifactQuery.getArtifactFromId(attrData.getArtifactGuid(), branch);
+ AttributeType attributeType = AttributeTypeManager.getType(attrData.getAttributeTypeId());
+ if (attributeType.isEnumerated()) {
+ artifact.setAttributeValues(attributeType, artifact.getAttributesToStringList(attributeType));
+ transaction.addArtifactAndAttributes(artifact);
+ }
+ }
+ transaction.execute();
+ }
+ }
+ monitor.worked(calculateWork(0.40));
+
+ getSummary().append(String.format("[%s] Repeat Enumeration Attribute Values found\n", getItemsToFixCount()));
+ monitor.worked(calculateWork(0.10));
+ }
+
+ @Override
+ public String getCheckDescription() {
+ return "Searches for attributes of the same artifact having the same values in top level branches";
+ }
+
+ @Override
+ public String getFixDescription() {
+ return "Deletes the repeat attribute values using a transaction directly on the branch";
+ }
+
+ private Set<AttrData> getRepeatEnumeratedAttrs(IProgressMonitor monitor, Branch branch) throws OseeDataStoreException, OseeTypeDoesNotExist {
+ Set<AttrData> attrData = new HashSet<AttrData>();
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+ try {
+ chStmt.runPreparedQuery(FIND_REPEAT_ENUMS, branch.getId(), branch.getId());
+ while (chStmt.next()) {
+ checkForCancelledStatus(monitor);
+ attrData.add(new AttrData(chStmt.getString("guid"), chStmt.getInt("attr_type_id"),
+ chStmt.getString("value")));
+ }
+ } finally {
+ chStmt.close();
+ }
+ return attrData;
+ }
+
+ private final class AttrData {
+ private final String artifactGuid;
+ private final int attributeTypeId;
+ private final String value;
+
+ public AttrData(String artifactGuid, int attributeTypeId, String value) {
+ super();
+ this.artifactGuid = artifactGuid;
+ this.attributeTypeId = attributeTypeId;
+ this.value = value;
+ }
+
+ public String getArtifactGuid() {
+ return artifactGuid;
+ }
+
+ public int getAttributeTypeId() {
+ return attributeTypeId;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (artifactGuid == null ? 0 : artifactGuid.hashCode());
+ result = prime * result + attributeTypeId;
+ result = prime * result + (value == null ? 0 : value.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ AttrData other = (AttrData) obj;
+ if (artifactGuid == null) {
+ if (other.artifactGuid != null) {
+ return false;
+ }
+ } else if (!artifactGuid.equals(other.artifactGuid)) {
+ return false;
+ }
+ if (attributeTypeId != other.attributeTypeId) {
+ return false;
+ }
+ if (value == null) {
+ if (other.value != null) {
+ return false;
+ }
+ } else if (!value.equals(other.value)) {
+ return false;
+ }
+ return true;
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/WordAttributeSmartTagsRemovedHealthOperation.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/WordAttributeSmartTagsRemovedHealthOperation.java
index bb4602d8528..3604973888c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/WordAttributeSmartTagsRemovedHealthOperation.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/WordAttributeSmartTagsRemovedHealthOperation.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.framework.ui.skynet.dbHealth;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.skynet.core.word.WordUtil;
-
-/**
- * @author Roberto E. Escobar
- */
-public class WordAttributeSmartTagsRemovedHealthOperation extends AbstractWordAttributeHealthOperation {
-
- public WordAttributeSmartTagsRemovedHealthOperation() {
- super("Word Attribute with Smart Tags");
- }
-
- @Override
- protected void applyFix(AttrData attrData) throws OseeCoreException {
- String fixedData = WordUtil.removeWordMarkupSmartTags(attrData.getResource().getData());
- attrData.getResource().setData(fixedData);
- }
-
- @Override
- protected boolean isFixRequired(AttrData attrData, Resource resource) throws OseeCoreException {
- boolean result = false;
- String wordMarkup = resource.getData();
- if (Strings.isValid(wordMarkup)) {
- String[] splitsOnSmartTagStart = wordMarkup.split("<[/]{0,1}st\\d{1,22}");// example smart (cough, cough) tags <st1:place>|</st1:place>
- result = splitsOnSmartTagStart.length > 1;
- }
- return result;
- }
-
- @Override
- public String getCheckDescription() {
- return "Checks Word Attribute data to detect Smart Tags";
- }
-
- @Override
- public String getFixDescription() {
- return "Removes smart tags from word attributes";
- }
-
- @Override
- protected String getBackUpPrefix() {
- return "SmartTagsFix_";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.dbHealth;
+
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.skynet.core.word.WordUtil;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class WordAttributeSmartTagsRemovedHealthOperation extends AbstractWordAttributeHealthOperation {
+
+ public WordAttributeSmartTagsRemovedHealthOperation() {
+ super("Word Attribute with Smart Tags");
+ }
+
+ @Override
+ protected void applyFix(AttrData attrData) throws OseeCoreException {
+ String fixedData = WordUtil.removeWordMarkupSmartTags(attrData.getResource().getData());
+ attrData.getResource().setData(fixedData);
+ }
+
+ @Override
+ protected boolean isFixRequired(AttrData attrData, Resource resource) throws OseeCoreException {
+ boolean result = false;
+ String wordMarkup = resource.getData();
+ if (Strings.isValid(wordMarkup)) {
+ String[] splitsOnSmartTagStart = wordMarkup.split("<[/]{0,1}st\\d{1,22}");// example smart (cough, cough) tags <st1:place>|</st1:place>
+ result = splitsOnSmartTagStart.length > 1;
+ }
+ return result;
+ }
+
+ @Override
+ public String getCheckDescription() {
+ return "Checks Word Attribute data to detect Smart Tags";
+ }
+
+ @Override
+ public String getFixDescription() {
+ return "Removes smart tags from word attributes";
+ }
+
+ @Override
+ protected String getBackUpPrefix() {
+ return "SmartTagsFix_";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/WordAttributeTrackChangeHealthOperation.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/WordAttributeTrackChangeHealthOperation.java
index d12f10a362c..5044dbeebd4 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/WordAttributeTrackChangeHealthOperation.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/WordAttributeTrackChangeHealthOperation.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.framework.ui.skynet.dbHealth;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.skynet.core.word.WordAnnotationHandler;
-
-/**
- * @author Roberto E. Escobar
- */
-public class WordAttributeTrackChangeHealthOperation extends AbstractWordAttributeHealthOperation {
-
- public WordAttributeTrackChangeHealthOperation() {
- super("Word Attribute Track Change Enabled");
- }
-
- @Override
- public String getCheckDescription() {
- return "Checks Word Attribute data to detect word track changes";
- }
-
- @Override
- public String getFixDescription() {
- return "Removes track changes from word attributes";
- }
-
- @Override
- protected void applyFix(AttrData attrData) throws OseeCoreException {
- String fixedData = WordAnnotationHandler.removeAnnotations(attrData.getResource().getData());
- attrData.getResource().setData(fixedData);
- }
-
- @Override
- protected String getBackUpPrefix() {
- return "TrackChangesFix_";
- }
-
- @Override
- protected boolean isFixRequired(AttrData attrData, Resource resource) throws OseeCoreException {
- boolean result = false;
- String data = resource.getData();
- if (Strings.isValid(data)) {
- result = WordAnnotationHandler.containsWordAnnotations(data);
- }
- return result;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.dbHealth;
+
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.skynet.core.word.WordAnnotationHandler;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class WordAttributeTrackChangeHealthOperation extends AbstractWordAttributeHealthOperation {
+
+ public WordAttributeTrackChangeHealthOperation() {
+ super("Word Attribute Track Change Enabled");
+ }
+
+ @Override
+ public String getCheckDescription() {
+ return "Checks Word Attribute data to detect word track changes";
+ }
+
+ @Override
+ public String getFixDescription() {
+ return "Removes track changes from word attributes";
+ }
+
+ @Override
+ protected void applyFix(AttrData attrData) throws OseeCoreException {
+ String fixedData = WordAnnotationHandler.removeAnnotations(attrData.getResource().getData());
+ attrData.getResource().setData(fixedData);
+ }
+
+ @Override
+ protected String getBackUpPrefix() {
+ return "TrackChangesFix_";
+ }
+
+ @Override
+ protected boolean isFixRequired(AttrData attrData, Resource resource) throws OseeCoreException {
+ boolean result = false;
+ String data = resource.getData();
+ if (Strings.isValid(data)) {
+ result = WordAnnotationHandler.containsWordAnnotations(data);
+ }
+ return result;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/WordAttributeUpdateHyperlinksHealthOperation.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/WordAttributeUpdateHyperlinksHealthOperation.java
index b9e7f151fef..22ce4451400 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/WordAttributeUpdateHyperlinksHealthOperation.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dbHealth/WordAttributeUpdateHyperlinksHealthOperation.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.framework.ui.skynet.dbHealth;
-
-import java.util.Collection;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.text.change.ChangeSet;
-import org.eclipse.osee.framework.jdk.core.type.HashCollection;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.skynet.core.linking.OseeLinkBuilder;
-import org.eclipse.osee.framework.skynet.core.linking.WordMlLinkHandler;
-import org.eclipse.osee.framework.skynet.core.linking.WordMlLinkHandler.MatchRange;
-
-/**
- * @author Roberto E. Escobar
- */
-public class WordAttributeUpdateHyperlinksHealthOperation extends AbstractWordAttributeHealthOperation {
-
- private final OseeLinkBuilder linkBuilder;
-
- public WordAttributeUpdateHyperlinksHealthOperation() {
- super("Word Attribute Old style hyperlinks");
- linkBuilder = new OseeLinkBuilder();
- }
-
- @Override
- protected void applyFix(AttrData attrData) throws OseeCoreException {
- String original = attrData.getResource().getData();
- HashCollection<String, MatchRange> matches = WordMlLinkHandler.parseOseeWordMLLinks(original);
- String converted = convertWordMlLinks(original, matches);
- attrData.getResource().setData(converted);
- }
-
- @Override
- protected boolean isFixRequired(AttrData attrData, Resource resource) throws OseeCoreException {
- boolean result = false;
- String content = resource.getData();
- if (Strings.isValid(content)) {
- result = !WordMlLinkHandler.parseOseeWordMLLinks(content).isEmpty();
- }
- return result;
- }
-
- private String convertWordMlLinks(String original, HashCollection<String, MatchRange> matches) {
- ChangeSet changeSet = new ChangeSet(original);
- for (String guid : matches.keySet()) {
- Collection<MatchRange> matchRanges = matches.getValues(guid);
- if (matchRanges != null) {
- for (MatchRange match : matchRanges) {
- String replaceWith = linkBuilder.getOseeLinkMarker(guid);
- changeSet.replace(match.start(), match.end(), replaceWith);
- }
- }
- }
- return changeSet.applyChangesToSelf().toString();
- }
-
- @Override
- public String getCheckDescription() {
- return "Checks Word Attribute data to detect old style hyperlinks";
- }
-
- @Override
- public String getFixDescription() {
- return "Converts old style hyperlinks to new style";
- }
-
- @Override
- protected String getBackUpPrefix() {
- return "HyperlinkFix_";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.dbHealth;
+
+import java.util.Collection;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.text.change.ChangeSet;
+import org.eclipse.osee.framework.jdk.core.type.HashCollection;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.skynet.core.linking.OseeLinkBuilder;
+import org.eclipse.osee.framework.skynet.core.linking.WordMlLinkHandler;
+import org.eclipse.osee.framework.skynet.core.linking.WordMlLinkHandler.MatchRange;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class WordAttributeUpdateHyperlinksHealthOperation extends AbstractWordAttributeHealthOperation {
+
+ private final OseeLinkBuilder linkBuilder;
+
+ public WordAttributeUpdateHyperlinksHealthOperation() {
+ super("Word Attribute Old style hyperlinks");
+ linkBuilder = new OseeLinkBuilder();
+ }
+
+ @Override
+ protected void applyFix(AttrData attrData) throws OseeCoreException {
+ String original = attrData.getResource().getData();
+ HashCollection<String, MatchRange> matches = WordMlLinkHandler.parseOseeWordMLLinks(original);
+ String converted = convertWordMlLinks(original, matches);
+ attrData.getResource().setData(converted);
+ }
+
+ @Override
+ protected boolean isFixRequired(AttrData attrData, Resource resource) throws OseeCoreException {
+ boolean result = false;
+ String content = resource.getData();
+ if (Strings.isValid(content)) {
+ result = !WordMlLinkHandler.parseOseeWordMLLinks(content).isEmpty();
+ }
+ return result;
+ }
+
+ private String convertWordMlLinks(String original, HashCollection<String, MatchRange> matches) {
+ ChangeSet changeSet = new ChangeSet(original);
+ for (String guid : matches.keySet()) {
+ Collection<MatchRange> matchRanges = matches.getValues(guid);
+ if (matchRanges != null) {
+ for (MatchRange match : matchRanges) {
+ String replaceWith = linkBuilder.getOseeLinkMarker(guid);
+ changeSet.replace(match.start(), match.end(), replaceWith);
+ }
+ }
+ }
+ return changeSet.applyChangesToSelf().toString();
+ }
+
+ @Override
+ public String getCheckDescription() {
+ return "Checks Word Attribute data to detect old style hyperlinks";
+ }
+
+ @Override
+ public String getFixDescription() {
+ return "Converts old style hyperlinks to new style";
+ }
+
+ @Override
+ protected String getBackUpPrefix() {
+ return "HyperlinkFix_";
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dialogs/ArtifactPasteSpecialDialog.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dialogs/ArtifactPasteSpecialDialog.java
index efc6d52c22c..2f3dd9ab59b 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dialogs/ArtifactPasteSpecialDialog.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dialogs/ArtifactPasteSpecialDialog.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.framework.ui.skynet.dialogs;
-
-import java.util.Collection;
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.util.ArtifactPasteConfiguration;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ArtifactPasteSpecialDialog extends TitleAreaDialog {
-
- private final Artifact destinationArtifact;
- private final Collection<Artifact> copiedArtifacts;
- private final ArtifactPasteConfiguration config;
-
- public ArtifactPasteSpecialDialog(Shell parentShell, ArtifactPasteConfiguration config, Artifact destinationArtifact, Collection<Artifact> copiedArtifacts) {
- super(parentShell);
- this.config = config;
- this.destinationArtifact = destinationArtifact;
- this.copiedArtifacts = copiedArtifacts;
- setShellStyle(SWT.RESIZE | getShellStyle());
- setTitle("Artifact Paste Special");
- setTitleImage(ImageManager.getImage(FrameworkImage.PASTE_SPECIAL_WIZ));
- setDefaultImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_PASTE));
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
- getShell().setText("Artifact Paste Special");
- setMessage("Select from artifact paste options below.\nSelect \"Ok\" to perform the paste operation.");
-
- Composite mainComposite = new Composite(composite, SWT.NONE);
- mainComposite.setLayout(new GridLayout());
- mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- Group group = new Group(mainComposite, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 10;
-
- group.setLayout(layout);
- group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- group.setText("Paste Options");
-
- Button button = new Button(group, SWT.CHECK);
- button.setText("Include children of copied artifacts");
- button.setSelection(config.isIncludeChildrenOfCopiedElements());
- button.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- Object source = e.getSource();
- if (source instanceof Button) {
- Button button = (Button) source;
- config.setIncludeChildrenOfCopiedElements(button.getSelection());
- }
- }
- });
- button = new Button(group, SWT.CHECK);
- button.setText("Keep relation order settings");
- button.setSelection(config.isKeepRelationOrderSettings());
- button.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- Object source = e.getSource();
- if (source instanceof Button) {
- Button button = (Button) source;
- config.setKeepRelationOrderSettings(button.getSelection());
- }
- }
- });
- return composite;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.dialogs;
+
+import java.util.Collection;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.util.ArtifactPasteConfiguration;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ArtifactPasteSpecialDialog extends TitleAreaDialog {
+
+ private final Artifact destinationArtifact;
+ private final Collection<Artifact> copiedArtifacts;
+ private final ArtifactPasteConfiguration config;
+
+ public ArtifactPasteSpecialDialog(Shell parentShell, ArtifactPasteConfiguration config, Artifact destinationArtifact, Collection<Artifact> copiedArtifacts) {
+ super(parentShell);
+ this.config = config;
+ this.destinationArtifact = destinationArtifact;
+ this.copiedArtifacts = copiedArtifacts;
+ setShellStyle(SWT.RESIZE | getShellStyle());
+ setTitle("Artifact Paste Special");
+ setTitleImage(ImageManager.getImage(FrameworkImage.PASTE_SPECIAL_WIZ));
+ setDefaultImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_PASTE));
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+ getShell().setText("Artifact Paste Special");
+ setMessage("Select from artifact paste options below.\nSelect \"Ok\" to perform the paste operation.");
+
+ Composite mainComposite = new Composite(composite, SWT.NONE);
+ mainComposite.setLayout(new GridLayout());
+ mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ Group group = new Group(mainComposite, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 10;
+
+ group.setLayout(layout);
+ group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ group.setText("Paste Options");
+
+ Button button = new Button(group, SWT.CHECK);
+ button.setText("Include children of copied artifacts");
+ button.setSelection(config.isIncludeChildrenOfCopiedElements());
+ button.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Object source = e.getSource();
+ if (source instanceof Button) {
+ Button button = (Button) source;
+ config.setIncludeChildrenOfCopiedElements(button.getSelection());
+ }
+ }
+ });
+ button = new Button(group, SWT.CHECK);
+ button.setText("Keep relation order settings");
+ button.setSelection(config.isKeepRelationOrderSettings());
+ button.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Object source = e.getSource();
+ if (source instanceof Button) {
+ Button button = (Button) source;
+ config.setKeepRelationOrderSettings(button.getSelection());
+ }
+ }
+ });
+ return composite;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dialogs/ArtifactSelectionDialog.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dialogs/ArtifactSelectionDialog.java
index e7323541d2b..ec16c0612e3 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dialogs/ArtifactSelectionDialog.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dialogs/ArtifactSelectionDialog.java
@@ -1,273 +1,273 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.dialogs;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-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.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.OseeSystemArtifacts;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.ArtifactContentProvider;
-import org.eclipse.osee.framework.ui.skynet.ArtifactLabelProvider;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.widgets.XBranchSelectWidget;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-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.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.ISelectionStatusValidator;
-import org.eclipse.ui.dialogs.SelectionStatusDialog;
-
-/**
- * @author Roberto E. Escobar
- * @author Ryan C. Schmitt
- */
-public class ArtifactSelectionDialog extends SelectionStatusDialog {
-
- private final XBranchSelectWidget branchSelect;
- private TreeViewer treeViewer;
- private Object input;
- private int fWidth = 60;
- private int fHeight = 18;
- private boolean fIsEmpty;
- private IStatus currentStatus = new Status(IStatus.OK, SkynetGuiPlugin.PLUGIN_ID, 0, "", null);
- private ISelectionStatusValidator validator;
- private final ITreeContentProvider contentProvider;
- private final ILabelProvider labelProvider;
-
- public ArtifactSelectionDialog(Shell parent) {
- super(parent);
- branchSelect = new XBranchSelectWidget("");
- contentProvider = new ArtifactContentProvider();
- labelProvider = new ArtifactLabelProvider();
- }
-
- public void setValidator(ISelectionStatusValidator validator) {
- this.validator = validator;
- }
-
- public void setBranch(Branch branch) {
- branchSelect.setSelection(branch);
- }
-
- public Branch getBranch() {
- return branchSelect.getData();
- }
-
- @Override
- public int open() {
- fIsEmpty = evaluateIfTreeEmpty(input);
- super.open();
- return getReturnCode();
- }
-
- @Override
- protected void computeResult() {
- setResult(Arrays.asList(getTreeSelectedItems()));
- }
-
- @Override
- public Artifact getFirstResult() {
- return (Artifact) super.getFirstResult();
- }
-
- private void updateOKStatus() {
- if (!fIsEmpty) {
- if (validator != null) {
- currentStatus = validator.validate(getTreeSelectedItems());
- updateStatus(currentStatus);
- } else if (!currentStatus.isOK()) {
- currentStatus = new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK, "", null);
- }
- } else {
- currentStatus = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, "No entries available", null);
- }
- updateStatus(currentStatus);
- }
-
- public void setSize(int width, int height) {
- fWidth = width;
- fHeight = height;
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
-
- Label messageLabel = createMessageArea(composite);
- createBranchSelectArea(composite);
- treeViewer = createTreeArea(composite);
-
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = convertWidthInCharsToPixels(fWidth);
- data.heightHint = convertHeightInCharsToPixels(fHeight);
- Tree treeWidget = treeViewer.getTree();
- treeWidget.setLayoutData(data);
- treeWidget.setFont(parent.getFont());
- if (fIsEmpty) {
- messageLabel.setEnabled(false);
- treeWidget.setEnabled(false);
- // buttonComposite.setEnabled(false);
- }
-
- return composite;
- }
-
- private void access$superCreate() {
- super.create();
- }
-
- @Override
- public void create() {
- BusyIndicator.showWhile(null, new Runnable() {
- public void run() {
- access$superCreate();
- treeViewer.setSelection(new IStructuredSelection() {
- @Override
- public boolean isEmpty() {
- return getInitialElementSelections().isEmpty();
- }
-
- @Override
- public Object getFirstElement() {
- return getInitialElementSelections().get(0);
- }
-
- @Override
- public Iterator<?> iterator() {
- return getInitialElementSelections().iterator();
- }
-
- @Override
- public int size() {
- return getInitialElementSelections().size();
- }
-
- @Override
- public Object[] toArray() {
- return getInitialElementSelections().toArray();
- }
-
- @Override
- public List<?> toList() {
- return getInitialElementSelections();
- }
-
- }, true);
-
- /*
- * treeViewer.setCheckedElements(getInitialElementSelections().toArray());
- * if (fExpandedElements != null) {
- * fViewer.setExpandedElements(fExpandedElements);
- * }
- */
- updateOKStatus();
- }
- });
- }
-
- private void createBranchSelectArea(Composite parent) {
- branchSelect.setDisplayLabel(false);
- branchSelect.createWidgets(parent, 1);
- branchSelect.addListener(new Listener() {
- @Override
- public void handleEvent(Event event) {
- refreshItems();
- }
-
- });
- }
-
- private TreeViewer createTreeArea(Composite parent) {
- TreeViewer treeViewer = new TreeViewer(parent, SWT.BORDER | SWT.SINGLE);
- treeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- treeViewer.setContentProvider(contentProvider);
- treeViewer.setLabelProvider(labelProvider);
- treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
-
- updateOKStatus();
- }
- });
- List<Object> data = new ArrayList<Object>(1);
- data.add(input);
- treeViewer.setInput(data);
- return treeViewer;
- }
-
- private Object[] getTreeSelectedItems() {
- IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
- Object[] selected;
- if (selection != null) {
- selected = selection.toArray();
- } else {
- selected = new Object[0];
- }
- return selected;
- }
-
- private boolean evaluateIfTreeEmpty(Object input) {
- boolean results = true;
- if (contentProvider != null) {
- Object[] elements = contentProvider.getElements(input);
- results = elements.length == 0;
- }
- return results;
- }
-
- @SuppressWarnings("unchecked")
- private void refreshItems() {
- Branch branch = getBranch();
- if (branch != null) {
- List<Object> data = (List<Object>) treeViewer.getInput();
- data.clear();
- data.add(getBaseArtifact(branch));
- treeViewer.refresh();
- }
- }
-
- private Artifact getBaseArtifact(Branch branch) {
- Artifact toReturn = null;
- try {
- toReturn = OseeSystemArtifacts.getDefaultHierarchyRootArtifact(branch);
- } catch (Exception ex) {
- OseeLog.log(getClass(), Level.SEVERE, ex);
- }
- return toReturn;
- }
-
- public void setInput(Object input) {
- Branch branch = (Branch) input;
- setBranch(branch);
- this.input = getBaseArtifact(branch);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.dialogs;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+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.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.OseeSystemArtifacts;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.ArtifactContentProvider;
+import org.eclipse.osee.framework.ui.skynet.ArtifactLabelProvider;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.widgets.XBranchSelectWidget;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.BusyIndicator;
+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.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ISelectionStatusValidator;
+import org.eclipse.ui.dialogs.SelectionStatusDialog;
+
+/**
+ * @author Roberto E. Escobar
+ * @author Ryan C. Schmitt
+ */
+public class ArtifactSelectionDialog extends SelectionStatusDialog {
+
+ private final XBranchSelectWidget branchSelect;
+ private TreeViewer treeViewer;
+ private Object input;
+ private int fWidth = 60;
+ private int fHeight = 18;
+ private boolean fIsEmpty;
+ private IStatus currentStatus = new Status(IStatus.OK, SkynetGuiPlugin.PLUGIN_ID, 0, "", null);
+ private ISelectionStatusValidator validator;
+ private final ITreeContentProvider contentProvider;
+ private final ILabelProvider labelProvider;
+
+ public ArtifactSelectionDialog(Shell parent) {
+ super(parent);
+ branchSelect = new XBranchSelectWidget("");
+ contentProvider = new ArtifactContentProvider();
+ labelProvider = new ArtifactLabelProvider();
+ }
+
+ public void setValidator(ISelectionStatusValidator validator) {
+ this.validator = validator;
+ }
+
+ public void setBranch(Branch branch) {
+ branchSelect.setSelection(branch);
+ }
+
+ public Branch getBranch() {
+ return branchSelect.getData();
+ }
+
+ @Override
+ public int open() {
+ fIsEmpty = evaluateIfTreeEmpty(input);
+ super.open();
+ return getReturnCode();
+ }
+
+ @Override
+ protected void computeResult() {
+ setResult(Arrays.asList(getTreeSelectedItems()));
+ }
+
+ @Override
+ public Artifact getFirstResult() {
+ return (Artifact) super.getFirstResult();
+ }
+
+ private void updateOKStatus() {
+ if (!fIsEmpty) {
+ if (validator != null) {
+ currentStatus = validator.validate(getTreeSelectedItems());
+ updateStatus(currentStatus);
+ } else if (!currentStatus.isOK()) {
+ currentStatus = new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK, "", null);
+ }
+ } else {
+ currentStatus = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, "No entries available", null);
+ }
+ updateStatus(currentStatus);
+ }
+
+ public void setSize(int width, int height) {
+ fWidth = width;
+ fHeight = height;
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+
+ Label messageLabel = createMessageArea(composite);
+ createBranchSelectArea(composite);
+ treeViewer = createTreeArea(composite);
+
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.widthHint = convertWidthInCharsToPixels(fWidth);
+ data.heightHint = convertHeightInCharsToPixels(fHeight);
+ Tree treeWidget = treeViewer.getTree();
+ treeWidget.setLayoutData(data);
+ treeWidget.setFont(parent.getFont());
+ if (fIsEmpty) {
+ messageLabel.setEnabled(false);
+ treeWidget.setEnabled(false);
+ // buttonComposite.setEnabled(false);
+ }
+
+ return composite;
+ }
+
+ private void access$superCreate() {
+ super.create();
+ }
+
+ @Override
+ public void create() {
+ BusyIndicator.showWhile(null, new Runnable() {
+ public void run() {
+ access$superCreate();
+ treeViewer.setSelection(new IStructuredSelection() {
+ @Override
+ public boolean isEmpty() {
+ return getInitialElementSelections().isEmpty();
+ }
+
+ @Override
+ public Object getFirstElement() {
+ return getInitialElementSelections().get(0);
+ }
+
+ @Override
+ public Iterator<?> iterator() {
+ return getInitialElementSelections().iterator();
+ }
+
+ @Override
+ public int size() {
+ return getInitialElementSelections().size();
+ }
+
+ @Override
+ public Object[] toArray() {
+ return getInitialElementSelections().toArray();
+ }
+
+ @Override
+ public List<?> toList() {
+ return getInitialElementSelections();
+ }
+
+ }, true);
+
+ /*
+ * treeViewer.setCheckedElements(getInitialElementSelections().toArray());
+ * if (fExpandedElements != null) {
+ * fViewer.setExpandedElements(fExpandedElements);
+ * }
+ */
+ updateOKStatus();
+ }
+ });
+ }
+
+ private void createBranchSelectArea(Composite parent) {
+ branchSelect.setDisplayLabel(false);
+ branchSelect.createWidgets(parent, 1);
+ branchSelect.addListener(new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ refreshItems();
+ }
+
+ });
+ }
+
+ private TreeViewer createTreeArea(Composite parent) {
+ TreeViewer treeViewer = new TreeViewer(parent, SWT.BORDER | SWT.SINGLE);
+ treeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ treeViewer.setContentProvider(contentProvider);
+ treeViewer.setLabelProvider(labelProvider);
+ treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+
+ updateOKStatus();
+ }
+ });
+ List<Object> data = new ArrayList<Object>(1);
+ data.add(input);
+ treeViewer.setInput(data);
+ return treeViewer;
+ }
+
+ private Object[] getTreeSelectedItems() {
+ IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
+ Object[] selected;
+ if (selection != null) {
+ selected = selection.toArray();
+ } else {
+ selected = new Object[0];
+ }
+ return selected;
+ }
+
+ private boolean evaluateIfTreeEmpty(Object input) {
+ boolean results = true;
+ if (contentProvider != null) {
+ Object[] elements = contentProvider.getElements(input);
+ results = elements.length == 0;
+ }
+ return results;
+ }
+
+ @SuppressWarnings("unchecked")
+ private void refreshItems() {
+ Branch branch = getBranch();
+ if (branch != null) {
+ List<Object> data = (List<Object>) treeViewer.getInput();
+ data.clear();
+ data.add(getBaseArtifact(branch));
+ treeViewer.refresh();
+ }
+ }
+
+ private Artifact getBaseArtifact(Branch branch) {
+ Artifact toReturn = null;
+ try {
+ toReturn = OseeSystemArtifacts.getDefaultHierarchyRootArtifact(branch);
+ } catch (Exception ex) {
+ OseeLog.log(getClass(), Level.SEVERE, ex);
+ }
+ return toReturn;
+ }
+
+ public void setInput(Object input) {
+ Branch branch = (Branch) input;
+ setBranch(branch);
+ this.input = getBaseArtifact(branch);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dialogs/ListDialogSortable.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dialogs/ListDialogSortable.java
index 1d4b7ebf324..75510911331 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dialogs/ListDialogSortable.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/dialogs/ListDialogSortable.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.framework.ui.skynet.dialogs;
-
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumnSorter;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.ListDialog;
-
-/**
- * @author Donald G. Dunne
- */
-public class ListDialogSortable extends ListDialog {
-
- private ViewerSorter viewerSorter;
-
- /**
- * @param parent
- */
- public ListDialogSortable(Shell parent) {
- super(parent);
- }
-
- /**
- * @param parent
- */
- public ListDialogSortable(ViewerSorter viewerSorter, Shell parent) {
- super(parent);
- this.viewerSorter = viewerSorter;
- }
-
- public void setSorter(ViewerSorter viewerSorter) {
- this.viewerSorter = viewerSorter;
- }
-
- @Override
- protected Control createDialogArea(Composite container) {
- Control control = super.createDialogArea(container);
- if (viewerSorter != null) {
- getTableViewer().setSorter(new XViewerColumnSorter());
- }
- return control;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.dialogs;
+
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumnSorter;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.ListDialog;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ListDialogSortable extends ListDialog {
+
+ private ViewerSorter viewerSorter;
+
+ /**
+ * @param parent
+ */
+ public ListDialogSortable(Shell parent) {
+ super(parent);
+ }
+
+ /**
+ * @param parent
+ */
+ public ListDialogSortable(ViewerSorter viewerSorter, Shell parent) {
+ super(parent);
+ this.viewerSorter = viewerSorter;
+ }
+
+ public void setSorter(ViewerSorter viewerSorter) {
+ this.viewerSorter = viewerSorter;
+ }
+
+ @Override
+ protected Control createDialogArea(Composite container) {
+ Control control = super.createDialogArea(container);
+ if (viewerSorter != null) {
+ getTableViewer().setSorter(new XViewerColumnSorter());
+ }
+ return control;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/diffWizard/DiffWizard.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/diffWizard/DiffWizard.java
index 9581f76c1a0..ca844ae2819 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/diffWizard/DiffWizard.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/diffWizard/DiffWizard.java
@@ -1,87 +1,87 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.diffWizard;
-
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.conflict.Conflict;
-import org.eclipse.osee.framework.ui.skynet.mergeWizard.EditWFCAttributeWizardPage;
-import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.XMergeLabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Theron Virgin
- */
-public class DiffWizard extends Wizard {
- public static final String TITLE = "How would you like to resolve this conflict?";
- public static final String INDENT = " ";
- public static final String SOURCE_TITLE = "Source Value:";
- public static final String DEST_TITLE = "Destination value:";
- public static final String ART_TEXT = "Artifact: ";
- public static final String TYPE_TEXT = "Attribute type: ";
-
- private DiffWizardPage diffWizardPage;
- private final Conflict conflict;
-
- public DiffWizard(Conflict conflict) {
- this.conflict = conflict;
- }
-
- @Override
- public void addPages() {
- diffWizardPage = new DiffWizardPage(conflict);
- addPage(diffWizardPage);
- }
-
- @Override
- public boolean performFinish() {
- return diffWizardPage.closingPage();
- }
-
- @Override
- public boolean canFinish() {
- return true;
- }
-
- public boolean getResolved() {
- return true;
- }
-
- @Override
- public IWizardPage getStartingPage() {
- return getPage(DiffWizardPage.TITLE);
- }
-
- @Override
- public IWizardPage getPreviousPage(IWizardPage page) {
- return null;
- }
-
- @Override
- public boolean performCancel() {
- return super.performCancel();
- }
-
- public void setResolution() throws OseeCoreException {
- if (getContainer() != null) {
- IWizardPage page = getContainer().getCurrentPage();
- Image image = XMergeLabelProvider.getMergeImage(conflict);
- if (page instanceof DiffWizardPage) {
- ((DiffWizardPage) page).setResolution(image);
- } else if (page instanceof EditWFCAttributeWizardPage) {
- ((EditWFCAttributeWizardPage) page).setResolution(image);
- }
- }
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.diffWizard;
+
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.conflict.Conflict;
+import org.eclipse.osee.framework.ui.skynet.mergeWizard.EditWFCAttributeWizardPage;
+import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.XMergeLabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Theron Virgin
+ */
+public class DiffWizard extends Wizard {
+ public static final String TITLE = "How would you like to resolve this conflict?";
+ public static final String INDENT = " ";
+ public static final String SOURCE_TITLE = "Source Value:";
+ public static final String DEST_TITLE = "Destination value:";
+ public static final String ART_TEXT = "Artifact: ";
+ public static final String TYPE_TEXT = "Attribute type: ";
+
+ private DiffWizardPage diffWizardPage;
+ private final Conflict conflict;
+
+ public DiffWizard(Conflict conflict) {
+ this.conflict = conflict;
+ }
+
+ @Override
+ public void addPages() {
+ diffWizardPage = new DiffWizardPage(conflict);
+ addPage(diffWizardPage);
+ }
+
+ @Override
+ public boolean performFinish() {
+ return diffWizardPage.closingPage();
+ }
+
+ @Override
+ public boolean canFinish() {
+ return true;
+ }
+
+ public boolean getResolved() {
+ return true;
+ }
+
+ @Override
+ public IWizardPage getStartingPage() {
+ return getPage(DiffWizardPage.TITLE);
+ }
+
+ @Override
+ public IWizardPage getPreviousPage(IWizardPage page) {
+ return null;
+ }
+
+ @Override
+ public boolean performCancel() {
+ return super.performCancel();
+ }
+
+ public void setResolution() throws OseeCoreException {
+ if (getContainer() != null) {
+ IWizardPage page = getContainer().getCurrentPage();
+ Image image = XMergeLabelProvider.getMergeImage(conflict);
+ if (page instanceof DiffWizardPage) {
+ ((DiffWizardPage) page).setResolution(image);
+ } else if (page instanceof EditWFCAttributeWizardPage) {
+ ((EditWFCAttributeWizardPage) page).setResolution(image);
+ }
+ }
+
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/diffWizard/DiffWizardPage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/diffWizard/DiffWizardPage.java
index 2aeecb7839b..9c621b1ae44 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/diffWizard/DiffWizardPage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/diffWizard/DiffWizardPage.java
@@ -1,231 +1,231 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.diffWizard;
-
-import java.util.Date;
-import java.util.logging.Level;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.conflict.Conflict;
-import org.eclipse.osee.framework.ui.skynet.mergeWizard.ConflictResolutionWizard;
-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.xmerge.MergeUtility;
-import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.XMergeLabelProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-
-/**
- * @author Theron Virgin
- */
-public class DiffWizardPage extends WizardPage {
-
- public static final String TITLE = "WFC Editor Page";
- private Conflict conflict;
- private String changeType = "";
- private Button editButton;
- private Button mergeButton;
- private Button clearButton;
- private Button sourceButton;
- private Button destButton;
- private Button sourceDiffButton;
- private Button destDiffButton;
- private Button sourceDestDiffButton;
- private Button sourceMergeDiffButton;
- private Button destMergeDiffButton;
- private Label imageLabel;
- private static final String SOURCE_VALUE = "Current Source(%s) Artifact";
- private static final String DESTINATION_VALUE = "Current Destination(%s) Artifact";
- private static final String BASELINE_VALUE = "Common Artifact Version (Baseline)";
- private static final String MERGE_VALUE = "Current Merge Artifact";
- private static final String EDIT_TEXT = "Edit Merge Artifact";
- private static final String EDIT_TOOLTIP = "Make additional changes using the Document/Merge Editor";
- private static final String MERGE_TEXT = "Generate Three Way Merge (Developmental)";
- private static final String MERGE_TOOLTIP = "Use the new inline merging";
- private static final String CLEAR_TEXT = "Clear the Merge Artifact";
- private static final String CLEAR_TOOLTIP = "Reinitializes the merge for this Document";
- private static final String SOURCE_TEXT = "Populate with Source Data";
- private static final String SOURCE_TOOLTIP = "Initialize the Document with Source Values";
- private static final String DEST_TEXT = "Populate with Destination Data";
- private static final String DEST_TOOLTIP = "Initialize the Document with Destination Values";
- private static final String SDIFF_TEXT = "Show Source Diff";
- private static final String SDIFF_TOOLTIP =
- "Show the differences between the current Source" + " artifact and the artifact at the time the Source Branch was created";
- private static final String DDIFF_TEXT = "Show Destination Diff";
- private static final String DDIFF_TOOLTIP =
- "Show the differences between the current Destination" + " artifact and the artifact at the time the Source Branch was created";
- private static final String SDDIFF_TEXT = "Show Source/Destination Diff";
- private static final String SDDIFF_TOOLTIP =
- "Show the differences between the current Source" + " artifact and the current Merge artifact";
- private static final String SMDIFF_TEXT = "Show Source/Merge Diff";
- private static final String SMDIFF_TOOLTIP =
- "Show the differences between the current Destination" + " artifact and the current Merge artifact";
- private static final String DMDIFF_TEXT = "Show Destination/Merge Diff";
- private static final String DMDIFF_TOOLTIP =
- "Show the differences between the current Destination" + " artifact and the current Source artifact";
- private static final int NUM_COLUMNS = 2;
-
- private final Listener listener = new Listener() {
- public void handleEvent(Event event) {
- // ...
-
- try {
- if (event.widget == editButton) {
- RendererManager.openInJob(conflict.getArtifact(), PresentationType.SPECIALIZED_EDIT);
- // conflict.markStatusToReflectEdit();
- } else if (event.widget == clearButton) {
- MergeUtility.clearValue(conflict, getShell(), true);
- } else if (event.widget == sourceButton) {
- MergeUtility.setToSource(conflict, getShell(), true);
- } else if (event.widget == destButton) {
- MergeUtility.setToDest(conflict, getShell(), true);
- } else if (event.widget == sourceDiffButton) {
- MergeUtility.showCompareFile(MergeUtility.getStartArtifact(conflict), conflict.getSourceArtifact(),
- "Source_Diff_For_" + conflict.getArtifact().getSafeName() + (new Date()).toString().replaceAll(
- ":", ";") + ".xml");
- } else if (event.widget == destDiffButton) {
- MergeUtility.showCompareFile(
- MergeUtility.getStartArtifact(conflict),
- conflict.getDestArtifact(),
- "Destination_Diff_For_" + conflict.getArtifact().getSafeName() + (new Date()).toString().replaceAll(
- ":", ";") + ".xml");
- } else if (event.widget == sourceDestDiffButton) {
- MergeUtility.showCompareFile(
- conflict.getSourceArtifact(),
- conflict.getDestArtifact(),
- "Source_Destination_Diff_For_" + conflict.getArtifact().getSafeName() + (new Date()).toString().replaceAll(
- ":", ";") + ".xml");
- } else if (event.widget == sourceMergeDiffButton) {
- // if (conflict.wordMarkupPresent()) {
- // throw new OseeCoreException(AttributeConflict.DIFF_MERGE_MARKUP);
- // }
- MergeUtility.showCompareFile(
- conflict.getSourceArtifact(),
- conflict.getArtifact(),
- "Source_Merge_Diff_For_" + conflict.getArtifact().getSafeName() + (new Date()).toString().replaceAll(
- ":", ";") + ".xml");
- } else if (event.widget == destMergeDiffButton) {
- // if (conflict.wordMarkupPresent()) {
- // throw new OseeCoreException(AttributeConflict.DIFF_MERGE_MARKUP);
- // }
- MergeUtility.showCompareFile(
- conflict.getDestArtifact(),
- conflict.getArtifact(),
- "Destination_Merge_Diff_For_" + conflict.getArtifact().getSafeName() + (new Date()).toString().replaceAll(
- ":", ";") + ".xml");
- } else if (event.widget == mergeButton) {
- // MergeUtility.launchMerge(conflict, getShell());
- }
- } catch (Exception ex) {
- OseeLog.log(DiffWizardPage.class, Level.WARNING, ex);
- }
- getWizard().getContainer().updateButtons();
- }
- };
-
- /**
- * @param pageName
- */
-
- public DiffWizardPage(Conflict conflict) {
- super(TITLE);
- this.conflict = conflict;
- }
-
- @Override
- public void createControl(Composite parent) {
- setTitle("Select a Difference Report to Generate");
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout gl = new GridLayout();
- gl.numColumns = NUM_COLUMNS;
- composite.setLayout(gl);
- GridData gd = new GridData(SWT.BEGINNING);
- composite.setLayoutData(gd);
- gd.horizontalSpan = NUM_COLUMNS;
-
- imageLabel = new Label(composite, SWT.NONE);
- imageLabel.setImage(null);
-
- try {
- new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.ART_TEXT);
- new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.INDENT + conflict.getArtifactName());
- new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.TYPE_TEXT);
- new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.INDENT + changeType);
- } catch (Exception ex) {
- OseeLog.log(DiffWizardPage.class, Level.WARNING, ex);
- }
-
- new Label(composite, SWT.NONE);
-
- editButton = createButton(EDIT_TEXT, EDIT_TOOLTIP, composite);
- mergeButton = createButton(MERGE_TEXT, MERGE_TOOLTIP, composite);
- new Label(composite, SWT.NONE);
- sourceButton = createButton(SOURCE_TEXT, SOURCE_TOOLTIP, composite);
- destButton = createButton(DEST_TEXT, DEST_TOOLTIP, composite);
- clearButton = createButton(CLEAR_TEXT, CLEAR_TOOLTIP, composite);
- new Label(composite, SWT.NONE);
-
- Composite buttonComp = new Composite(composite, SWT.NONE);
- GridLayout glay = new GridLayout();
- glay.numColumns = 3;
- buttonComp.setLayout(glay);
- GridData gdata = new GridData(SWT.FILL);
- buttonComp.setLayoutData(gdata);
- gdata.horizontalSpan = 1;
-
- sourceDiffButton = createButton(SDIFF_TEXT, SDIFF_TOOLTIP, buttonComp);
- destDiffButton = createButton(DDIFF_TEXT, DDIFF_TOOLTIP, buttonComp);
- sourceDestDiffButton = createButton(SDDIFF_TEXT, SDDIFF_TOOLTIP, buttonComp);
- sourceMergeDiffButton = createButton(SMDIFF_TEXT, SMDIFF_TOOLTIP, buttonComp);
- destMergeDiffButton = createButton(DMDIFF_TEXT, DMDIFF_TOOLTIP, buttonComp);
- if (MergeUtility.getStartArtifact(conflict) == null) {
- sourceDiffButton.setEnabled(false);
- destDiffButton.setEnabled(false);
- }
-
- try {
- setResolution(XMergeLabelProvider.getMergeImage(conflict));
- } catch (Exception ex) {
- OseeLog.log(DiffWizardPage.class, Level.WARNING, ex);
- }
-
- setControl(composite);
- }
-
- private Button createButton(String text, String tooltip, Composite composite) {
- Button button = new Button(composite, SWT.PUSH);
- button.addListener(SWT.Selection, listener);
- button.setText(text);
- button.setToolTipText(tooltip);
- return button;
- }
-
- public boolean canFinish() {
- return true;
- }
-
- public boolean closingPage() {
- //generate the diff report
- return true;
- }
-
- public void setResolution(Image image) {
- imageLabel.setImage(image);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.diffWizard;
+
+import java.util.Date;
+import java.util.logging.Level;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.conflict.Conflict;
+import org.eclipse.osee.framework.ui.skynet.mergeWizard.ConflictResolutionWizard;
+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.xmerge.MergeUtility;
+import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.XMergeLabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+
+/**
+ * @author Theron Virgin
+ */
+public class DiffWizardPage extends WizardPage {
+
+ public static final String TITLE = "WFC Editor Page";
+ private Conflict conflict;
+ private String changeType = "";
+ private Button editButton;
+ private Button mergeButton;
+ private Button clearButton;
+ private Button sourceButton;
+ private Button destButton;
+ private Button sourceDiffButton;
+ private Button destDiffButton;
+ private Button sourceDestDiffButton;
+ private Button sourceMergeDiffButton;
+ private Button destMergeDiffButton;
+ private Label imageLabel;
+ private static final String SOURCE_VALUE = "Current Source(%s) Artifact";
+ private static final String DESTINATION_VALUE = "Current Destination(%s) Artifact";
+ private static final String BASELINE_VALUE = "Common Artifact Version (Baseline)";
+ private static final String MERGE_VALUE = "Current Merge Artifact";
+ private static final String EDIT_TEXT = "Edit Merge Artifact";
+ private static final String EDIT_TOOLTIP = "Make additional changes using the Document/Merge Editor";
+ private static final String MERGE_TEXT = "Generate Three Way Merge (Developmental)";
+ private static final String MERGE_TOOLTIP = "Use the new inline merging";
+ private static final String CLEAR_TEXT = "Clear the Merge Artifact";
+ private static final String CLEAR_TOOLTIP = "Reinitializes the merge for this Document";
+ private static final String SOURCE_TEXT = "Populate with Source Data";
+ private static final String SOURCE_TOOLTIP = "Initialize the Document with Source Values";
+ private static final String DEST_TEXT = "Populate with Destination Data";
+ private static final String DEST_TOOLTIP = "Initialize the Document with Destination Values";
+ private static final String SDIFF_TEXT = "Show Source Diff";
+ private static final String SDIFF_TOOLTIP =
+ "Show the differences between the current Source" + " artifact and the artifact at the time the Source Branch was created";
+ private static final String DDIFF_TEXT = "Show Destination Diff";
+ private static final String DDIFF_TOOLTIP =
+ "Show the differences between the current Destination" + " artifact and the artifact at the time the Source Branch was created";
+ private static final String SDDIFF_TEXT = "Show Source/Destination Diff";
+ private static final String SDDIFF_TOOLTIP =
+ "Show the differences between the current Source" + " artifact and the current Merge artifact";
+ private static final String SMDIFF_TEXT = "Show Source/Merge Diff";
+ private static final String SMDIFF_TOOLTIP =
+ "Show the differences between the current Destination" + " artifact and the current Merge artifact";
+ private static final String DMDIFF_TEXT = "Show Destination/Merge Diff";
+ private static final String DMDIFF_TOOLTIP =
+ "Show the differences between the current Destination" + " artifact and the current Source artifact";
+ private static final int NUM_COLUMNS = 2;
+
+ private final Listener listener = new Listener() {
+ public void handleEvent(Event event) {
+ // ...
+
+ try {
+ if (event.widget == editButton) {
+ RendererManager.openInJob(conflict.getArtifact(), PresentationType.SPECIALIZED_EDIT);
+ // conflict.markStatusToReflectEdit();
+ } else if (event.widget == clearButton) {
+ MergeUtility.clearValue(conflict, getShell(), true);
+ } else if (event.widget == sourceButton) {
+ MergeUtility.setToSource(conflict, getShell(), true);
+ } else if (event.widget == destButton) {
+ MergeUtility.setToDest(conflict, getShell(), true);
+ } else if (event.widget == sourceDiffButton) {
+ MergeUtility.showCompareFile(MergeUtility.getStartArtifact(conflict), conflict.getSourceArtifact(),
+ "Source_Diff_For_" + conflict.getArtifact().getSafeName() + (new Date()).toString().replaceAll(
+ ":", ";") + ".xml");
+ } else if (event.widget == destDiffButton) {
+ MergeUtility.showCompareFile(
+ MergeUtility.getStartArtifact(conflict),
+ conflict.getDestArtifact(),
+ "Destination_Diff_For_" + conflict.getArtifact().getSafeName() + (new Date()).toString().replaceAll(
+ ":", ";") + ".xml");
+ } else if (event.widget == sourceDestDiffButton) {
+ MergeUtility.showCompareFile(
+ conflict.getSourceArtifact(),
+ conflict.getDestArtifact(),
+ "Source_Destination_Diff_For_" + conflict.getArtifact().getSafeName() + (new Date()).toString().replaceAll(
+ ":", ";") + ".xml");
+ } else if (event.widget == sourceMergeDiffButton) {
+ // if (conflict.wordMarkupPresent()) {
+ // throw new OseeCoreException(AttributeConflict.DIFF_MERGE_MARKUP);
+ // }
+ MergeUtility.showCompareFile(
+ conflict.getSourceArtifact(),
+ conflict.getArtifact(),
+ "Source_Merge_Diff_For_" + conflict.getArtifact().getSafeName() + (new Date()).toString().replaceAll(
+ ":", ";") + ".xml");
+ } else if (event.widget == destMergeDiffButton) {
+ // if (conflict.wordMarkupPresent()) {
+ // throw new OseeCoreException(AttributeConflict.DIFF_MERGE_MARKUP);
+ // }
+ MergeUtility.showCompareFile(
+ conflict.getDestArtifact(),
+ conflict.getArtifact(),
+ "Destination_Merge_Diff_For_" + conflict.getArtifact().getSafeName() + (new Date()).toString().replaceAll(
+ ":", ";") + ".xml");
+ } else if (event.widget == mergeButton) {
+ // MergeUtility.launchMerge(conflict, getShell());
+ }
+ } catch (Exception ex) {
+ OseeLog.log(DiffWizardPage.class, Level.WARNING, ex);
+ }
+ getWizard().getContainer().updateButtons();
+ }
+ };
+
+ /**
+ * @param pageName
+ */
+
+ public DiffWizardPage(Conflict conflict) {
+ super(TITLE);
+ this.conflict = conflict;
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ setTitle("Select a Difference Report to Generate");
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout gl = new GridLayout();
+ gl.numColumns = NUM_COLUMNS;
+ composite.setLayout(gl);
+ GridData gd = new GridData(SWT.BEGINNING);
+ composite.setLayoutData(gd);
+ gd.horizontalSpan = NUM_COLUMNS;
+
+ imageLabel = new Label(composite, SWT.NONE);
+ imageLabel.setImage(null);
+
+ try {
+ new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.ART_TEXT);
+ new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.INDENT + conflict.getArtifactName());
+ new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.TYPE_TEXT);
+ new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.INDENT + changeType);
+ } catch (Exception ex) {
+ OseeLog.log(DiffWizardPage.class, Level.WARNING, ex);
+ }
+
+ new Label(composite, SWT.NONE);
+
+ editButton = createButton(EDIT_TEXT, EDIT_TOOLTIP, composite);
+ mergeButton = createButton(MERGE_TEXT, MERGE_TOOLTIP, composite);
+ new Label(composite, SWT.NONE);
+ sourceButton = createButton(SOURCE_TEXT, SOURCE_TOOLTIP, composite);
+ destButton = createButton(DEST_TEXT, DEST_TOOLTIP, composite);
+ clearButton = createButton(CLEAR_TEXT, CLEAR_TOOLTIP, composite);
+ new Label(composite, SWT.NONE);
+
+ Composite buttonComp = new Composite(composite, SWT.NONE);
+ GridLayout glay = new GridLayout();
+ glay.numColumns = 3;
+ buttonComp.setLayout(glay);
+ GridData gdata = new GridData(SWT.FILL);
+ buttonComp.setLayoutData(gdata);
+ gdata.horizontalSpan = 1;
+
+ sourceDiffButton = createButton(SDIFF_TEXT, SDIFF_TOOLTIP, buttonComp);
+ destDiffButton = createButton(DDIFF_TEXT, DDIFF_TOOLTIP, buttonComp);
+ sourceDestDiffButton = createButton(SDDIFF_TEXT, SDDIFF_TOOLTIP, buttonComp);
+ sourceMergeDiffButton = createButton(SMDIFF_TEXT, SMDIFF_TOOLTIP, buttonComp);
+ destMergeDiffButton = createButton(DMDIFF_TEXT, DMDIFF_TOOLTIP, buttonComp);
+ if (MergeUtility.getStartArtifact(conflict) == null) {
+ sourceDiffButton.setEnabled(false);
+ destDiffButton.setEnabled(false);
+ }
+
+ try {
+ setResolution(XMergeLabelProvider.getMergeImage(conflict));
+ } catch (Exception ex) {
+ OseeLog.log(DiffWizardPage.class, Level.WARNING, ex);
+ }
+
+ setControl(composite);
+ }
+
+ private Button createButton(String text, String tooltip, Composite composite) {
+ Button button = new Button(composite, SWT.PUSH);
+ button.addListener(SWT.Selection, listener);
+ button.setText(text);
+ button.setToolTipText(tooltip);
+ return button;
+ }
+
+ public boolean canFinish() {
+ return true;
+ }
+
+ public boolean closingPage() {
+ //generate the diff report
+ return true;
+ }
+
+ public void setResolution(Image image) {
+ imageLabel.setImage(image);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/export/ArtifactExportJob.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/export/ArtifactExportJob.java
index 02f165dc0a3..e9d19ad1ece 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/export/ArtifactExportJob.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/export/ArtifactExportJob.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.framework.ui.skynet.export;
-
-import java.io.File;
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.Collections;
-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.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.jdk.core.util.Lib;
-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.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.render.FileSystemRenderer;
-import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
-import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
-
-/**
- * @author Ryan D. Brooks
- */
-public class ArtifactExportJob extends Job {
- private final File rootExportPath;
- private final Collection<Artifact> exportArtifacts;
-
- /**
- * @param name
- */
- public ArtifactExportJob(File exportPath, Collection<Artifact> exportArtifacts) {
- super("Artifact Export");
- this.rootExportPath = exportPath;
- this.exportArtifacts = exportArtifacts;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- IStatus toReturn;
- try {
- monitor.beginTask("Exporting Artifacts", countDescendents());
-
- for (Artifact artifact : exportArtifacts) {
- if (monitor.isCanceled()) {
- return new Status(Status.CANCEL, SkynetGuiPlugin.PLUGIN_ID, "User Cancled the operation.");
- }
- writeArtifactPreview(rootExportPath, monitor, artifact, PresentationType.PREVIEW);
- }
-
- toReturn = Status.OK_STATUS;
- } catch (Exception ex) {
- toReturn = new Status(Status.ERROR, SkynetGuiPlugin.PLUGIN_ID, -1, ex.getLocalizedMessage(), ex);
- } finally {
- monitor.done();
- }
- return toReturn;
- }
-
- private int countDescendents() throws OseeCoreException {
- int total = 0;
- for (Artifact artifact : exportArtifacts) {
- total += artifact.getDescendants().size() + 1;
- }
- return total;
- }
-
- private void writeArtifactPreview(File exportPath, IProgressMonitor monitor, Artifact artifact, PresentationType presentationType) throws Exception {
- if (artifact.isOfType(CoreArtifactTypes.Folder)) {
- File folder = new File(exportPath, artifact.getName());
- folder.mkdir();
- for (Artifact child : artifact.getChildren()) {
- writeArtifactPreview(folder, monitor, child, presentationType);
- }
- } else {
- try {
- FileSystemRenderer fileRenderer = RendererManager.getBestFileRenderer(presentationType, artifact, null);
- String fileName = artifact.getSafeName() + "." + fileRenderer.getAssociatedExtension(artifact);
- InputStream inputStream =
- fileRenderer.getRenderInputStream(presentationType, Collections.singletonList(artifact));
- Lib.inputStreamToFile(inputStream, new File(exportPath, fileName));
- } catch (OseeArgumentException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- monitor.worked(1);
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.export;
+
+import java.io.File;
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.Collections;
+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.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.jdk.core.util.Lib;
+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.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.render.FileSystemRenderer;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
+import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public class ArtifactExportJob extends Job {
+ private final File rootExportPath;
+ private final Collection<Artifact> exportArtifacts;
+
+ /**
+ * @param name
+ */
+ public ArtifactExportJob(File exportPath, Collection<Artifact> exportArtifacts) {
+ super("Artifact Export");
+ this.rootExportPath = exportPath;
+ this.exportArtifacts = exportArtifacts;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ IStatus toReturn;
+ try {
+ monitor.beginTask("Exporting Artifacts", countDescendents());
+
+ for (Artifact artifact : exportArtifacts) {
+ if (monitor.isCanceled()) {
+ return new Status(Status.CANCEL, SkynetGuiPlugin.PLUGIN_ID, "User Cancled the operation.");
+ }
+ writeArtifactPreview(rootExportPath, monitor, artifact, PresentationType.PREVIEW);
+ }
+
+ toReturn = Status.OK_STATUS;
+ } catch (Exception ex) {
+ toReturn = new Status(Status.ERROR, SkynetGuiPlugin.PLUGIN_ID, -1, ex.getLocalizedMessage(), ex);
+ } finally {
+ monitor.done();
+ }
+ return toReturn;
+ }
+
+ private int countDescendents() throws OseeCoreException {
+ int total = 0;
+ for (Artifact artifact : exportArtifacts) {
+ total += artifact.getDescendants().size() + 1;
+ }
+ return total;
+ }
+
+ private void writeArtifactPreview(File exportPath, IProgressMonitor monitor, Artifact artifact, PresentationType presentationType) throws Exception {
+ if (artifact.isOfType(CoreArtifactTypes.Folder)) {
+ File folder = new File(exportPath, artifact.getName());
+ folder.mkdir();
+ for (Artifact child : artifact.getChildren()) {
+ writeArtifactPreview(folder, monitor, child, presentationType);
+ }
+ } else {
+ try {
+ FileSystemRenderer fileRenderer = RendererManager.getBestFileRenderer(presentationType, artifact, null);
+ String fileName = artifact.getSafeName() + "." + fileRenderer.getAssociatedExtension(artifact);
+ InputStream inputStream =
+ fileRenderer.getRenderInputStream(presentationType, Collections.singletonList(artifact));
+ Lib.inputStreamToFile(inputStream, new File(exportPath, fileName));
+ } catch (OseeArgumentException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ monitor.worked(1);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/export/ArtifactExportPage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/export/ArtifactExportPage.java
index e1209afc1f1..fcef509c0e0 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/export/ArtifactExportPage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/export/ArtifactExportPage.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.framework.ui.skynet.export;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.plugin.core.util.OseeData;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.search.ui.text.Match;
-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.Event;
-import org.eclipse.ui.dialogs.WizardDataTransferPage;
-
-/**
- * @author Ryan D. Brooks
- */
-public class ArtifactExportPage extends WizardDataTransferPage {
- private final File exportPath;
- private final Collection<Artifact> selectedArtifacts;
-
- /**
- * @param pageName
- */
- public ArtifactExportPage(IStructuredSelection selection) {
- super("Main");
-
- this.exportPath = OseeData.getPath().toFile();
- selectedArtifacts = new ArrayList<Artifact>();
- if (selection != null) {
- Iterator<?> selectionIterator = selection.iterator();
- while (selectionIterator.hasNext()) {
- Object selectedObject = selectionIterator.next();
-
- if (selectedObject instanceof Match) {
- selectedObject = ((Match) selectedObject).getElement();
- } else if (selectedObject instanceof IAdaptable) {
- selectedObject = ((IAdaptable) selectedObject).getAdapter(Artifact.class);
- }
-
- if (selectedObject instanceof Artifact) {
- selectedArtifacts.add((Artifact) selectedObject);
- } else {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, "Expected selection to be of type Artifact");
- }
- }
- }
- }
-
- @Override
- protected boolean allowNewContainerName() {
- return false;
- }
-
- @Override
- public void handleEvent(Event event) {
-
- }
-
- @Override
- public void createControl(Composite parent) {
- initializeDialogUnits(parent);
-
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout(1, false));
- composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
- composite.setFont(parent.getFont());
-
- //createSourceGroup(composite);
-
- createOptionsGroup(composite);
-
- setPageComplete(determinePageCompletion());
- setControl(composite);
- }
-
- public Collection<Artifact> getExportArtifacts() {
- return selectedArtifacts;
- }
-
- public File getExportPath() {
- return exportPath;
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.export;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.plugin.core.util.OseeData;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.search.ui.text.Match;
+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.Event;
+import org.eclipse.ui.dialogs.WizardDataTransferPage;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public class ArtifactExportPage extends WizardDataTransferPage {
+ private final File exportPath;
+ private final Collection<Artifact> selectedArtifacts;
+
+ /**
+ * @param pageName
+ */
+ public ArtifactExportPage(IStructuredSelection selection) {
+ super("Main");
+
+ this.exportPath = OseeData.getPath().toFile();
+ selectedArtifacts = new ArrayList<Artifact>();
+ if (selection != null) {
+ Iterator<?> selectionIterator = selection.iterator();
+ while (selectionIterator.hasNext()) {
+ Object selectedObject = selectionIterator.next();
+
+ if (selectedObject instanceof Match) {
+ selectedObject = ((Match) selectedObject).getElement();
+ } else if (selectedObject instanceof IAdaptable) {
+ selectedObject = ((IAdaptable) selectedObject).getAdapter(Artifact.class);
+ }
+
+ if (selectedObject instanceof Artifact) {
+ selectedArtifacts.add((Artifact) selectedObject);
+ } else {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, "Expected selection to be of type Artifact");
+ }
+ }
+ }
+ }
+
+ @Override
+ protected boolean allowNewContainerName() {
+ return false;
+ }
+
+ @Override
+ public void handleEvent(Event event) {
+
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ initializeDialogUnits(parent);
+
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setLayout(new GridLayout(1, false));
+ composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
+ composite.setFont(parent.getFont());
+
+ //createSourceGroup(composite);
+
+ createOptionsGroup(composite);
+
+ setPageComplete(determinePageCompletion());
+ setControl(composite);
+ }
+
+ public Collection<Artifact> getExportArtifacts() {
+ return selectedArtifacts;
+ }
+
+ public File getExportPath() {
+ return exportPath;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/export/ArtifactExportWizard.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/export/ArtifactExportWizard.java
index af0d52bfbb7..7b1b32d7a76 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/export/ArtifactExportWizard.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/export/ArtifactExportWizard.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.export;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.osee.framework.plugin.core.util.Jobs;
-import org.eclipse.ui.IExportWizard;
-import org.eclipse.ui.IWorkbench;
-
-/**
- * @author Ryan D. Brooks
- */
-public class ArtifactExportWizard extends Wizard implements IExportWizard {
- private ArtifactExportPage mainPage;
-
- public ArtifactExportWizard() {
- }
-
- @Override
- public boolean performFinish() {
- try {
- Jobs.startJob(new ArtifactExportJob(mainPage.getExportPath(), mainPage.getExportArtifacts()));
- } catch (Exception ex) {
- ErrorDialog.openError(getShell(), "Define Export Error", ex.getLocalizedMessage(), new Status(IStatus.ERROR,
- "org.eclipse.osee.framework.jdk.core", IStatus.ERROR, ex.getLocalizedMessage(), ex));
- }
- return true;
- }
-
- @Override
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- mainPage = new ArtifactExportPage(selection);
- }
-
- @Override
- public void addPages() {
- addPage(mainPage);
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.export;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.osee.framework.plugin.core.util.Jobs;
+import org.eclipse.ui.IExportWizard;
+import org.eclipse.ui.IWorkbench;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public class ArtifactExportWizard extends Wizard implements IExportWizard {
+ private ArtifactExportPage mainPage;
+
+ public ArtifactExportWizard() {
+ }
+
+ @Override
+ public boolean performFinish() {
+ try {
+ Jobs.startJob(new ArtifactExportJob(mainPage.getExportPath(), mainPage.getExportArtifacts()));
+ } catch (Exception ex) {
+ ErrorDialog.openError(getShell(), "Define Export Error", ex.getLocalizedMessage(), new Status(IStatus.ERROR,
+ "org.eclipse.osee.framework.jdk.core", IStatus.ERROR, ex.getLocalizedMessage(), ex));
+ }
+ return true;
+ }
+
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ mainPage = new ArtifactExportPage(selection);
+ }
+
+ @Override
+ public void addPages() {
+ addPage(mainPage);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/export/ExportBranchPage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/export/ExportBranchPage.java
index 946cec555f3..513ecce3769 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/export/ExportBranchPage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/export/ExportBranchPage.java
@@ -1,118 +1,118 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.export;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.ui.plugin.util.DirectoryOrFileSelector;
-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.Event;
-import org.eclipse.ui.dialogs.WizardDataTransferPage;
-
-/**
- * @author Robert A. Fisher
- */
-public class ExportBranchPage extends WizardDataTransferPage {
- private DirectoryOrFileSelector directoryFileSelector;
-
- public ExportBranchPage(String name, Branch branch) {
- super(name);
-
- setTitle("Import OSEE Types");
- setDescription("Import OSEE Types");
- }
-
- public void createControl(Composite parent) {
-
- initializeDialogUnits(parent);
-
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
- composite.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- composite.setFont(parent.getFont());
-
- createSourceGroup(composite);
-
- restoreWidgetValues();
- updateWidgetEnablements();
- setPageComplete(determinePageCompletion());
-
- setControl(composite);
- }
-
- /**
- * The <code>WizardResourceImportPage</code> implementation of this <code>Listener</code> method handles all events
- * and enablements for controls on this page. Subclasses may extend.
- *
- * @param event Event
- */
- public void handleEvent(Event event) {
- setPageComplete(determinePageCompletion());
- }
-
- protected void createSourceGroup(Composite parent) {
- directoryFileSelector = new DirectoryOrFileSelector(parent, SWT.NONE, "Export Destination", this);
-
- // if (currentResourceSelection == null) {
- // Select directory as the default
- directoryFileSelector.setDirectorySelected(true);
- // }
- // else {
- // directoryFileSelector.setDirectorySelected(currentResourceSelection.getType() != IResource.FILE);
- // directoryFileSelector.setText(currentResourceSelection.getLocation().toString());
- // }
-
- setPageComplete(determinePageCompletion());
- }
-
- @Override
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- // policy: wizards are not allowed to come up with an error message
- if (visible) {
- setErrorMessage(null);
- }
- }
-
- @Override
- protected boolean validateSourceGroup() {
- return directoryFileSelector.validate(this);
- }
-
- public boolean finish() {
- try {
- // getSpecifiedContainer().getProject();
-
- // File file = directoryFileSelector.getFile();
- // Job job = new ImportMetaJob(file);
- // job.setUser(true);
- // job.setPriority(Job.LONG);
- // job.schedule();
- } catch (Exception ex) {
- ex.printStackTrace();
- ErrorDialog.openError(getShell(), "OSEE Import Error", "An error has occured while importing a document.",
- new Status(IStatus.ERROR, "org.eclipse.osee.framework.jdk.core", IStatus.ERROR,
- "Unknown exception occurred in the import", ex));
- }
- return true;
- }
-
- @Override
- protected boolean allowNewContainerName() {
- 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.framework.ui.skynet.export;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.ui.plugin.util.DirectoryOrFileSelector;
+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.Event;
+import org.eclipse.ui.dialogs.WizardDataTransferPage;
+
+/**
+ * @author Robert A. Fisher
+ */
+public class ExportBranchPage extends WizardDataTransferPage {
+ private DirectoryOrFileSelector directoryFileSelector;
+
+ public ExportBranchPage(String name, Branch branch) {
+ super(name);
+
+ setTitle("Import OSEE Types");
+ setDescription("Import OSEE Types");
+ }
+
+ public void createControl(Composite parent) {
+
+ initializeDialogUnits(parent);
+
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
+ composite.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+ composite.setFont(parent.getFont());
+
+ createSourceGroup(composite);
+
+ restoreWidgetValues();
+ updateWidgetEnablements();
+ setPageComplete(determinePageCompletion());
+
+ setControl(composite);
+ }
+
+ /**
+ * The <code>WizardResourceImportPage</code> implementation of this <code>Listener</code> method handles all events
+ * and enablements for controls on this page. Subclasses may extend.
+ *
+ * @param event Event
+ */
+ public void handleEvent(Event event) {
+ setPageComplete(determinePageCompletion());
+ }
+
+ protected void createSourceGroup(Composite parent) {
+ directoryFileSelector = new DirectoryOrFileSelector(parent, SWT.NONE, "Export Destination", this);
+
+ // if (currentResourceSelection == null) {
+ // Select directory as the default
+ directoryFileSelector.setDirectorySelected(true);
+ // }
+ // else {
+ // directoryFileSelector.setDirectorySelected(currentResourceSelection.getType() != IResource.FILE);
+ // directoryFileSelector.setText(currentResourceSelection.getLocation().toString());
+ // }
+
+ setPageComplete(determinePageCompletion());
+ }
+
+ @Override
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
+ // policy: wizards are not allowed to come up with an error message
+ if (visible) {
+ setErrorMessage(null);
+ }
+ }
+
+ @Override
+ protected boolean validateSourceGroup() {
+ return directoryFileSelector.validate(this);
+ }
+
+ public boolean finish() {
+ try {
+ // getSpecifiedContainer().getProject();
+
+ // File file = directoryFileSelector.getFile();
+ // Job job = new ImportMetaJob(file);
+ // job.setUser(true);
+ // job.setPriority(Job.LONG);
+ // job.schedule();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ ErrorDialog.openError(getShell(), "OSEE Import Error", "An error has occured while importing a document.",
+ new Status(IStatus.ERROR, "org.eclipse.osee.framework.jdk.core", IStatus.ERROR,
+ "Unknown exception occurred in the import", ex));
+ }
+ return true;
+ }
+
+ @Override
+ protected boolean allowNewContainerName() {
+ return false;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/group/GroupExplorer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/group/GroupExplorer.java
index 030c17dcf68..9a140bdd0e2 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/group/GroupExplorer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/group/GroupExplorer.java
@@ -1,605 +1,605 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.group;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-import org.eclipse.osee.framework.core.exception.BranchDoesNotExist;
-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.plugin.core.IActionable;
-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.UniversalGroup;
-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.OseeUiActions;
-import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.OpenWithMenuListener;
-import org.eclipse.osee.framework.ui.skynet.OseeContributionItem;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.listener.IRebuildMenuListener;
-import org.eclipse.osee.framework.ui.skynet.menu.ArtifactTreeViewerGlobalMenuHelper;
-import org.eclipse.osee.framework.ui.skynet.menu.GlobalMenuPermissions;
-import org.eclipse.osee.framework.ui.skynet.menu.IGlobalMenuHelper;
-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.XBranchSelectWidget;
-import org.eclipse.osee.framework.ui.skynet.widgets.dialog.EntryDialog;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MenuEvent;
-import org.eclipse.swt.events.MenuListener;
-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.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * @author Donald G. Dunne
- */
-public class GroupExplorer extends ViewPart implements IArtifactEventListener, IFrameworkTransactionEventListener, IActionable, IRebuildMenuListener {
- public static final String VIEW_ID = "org.eclipse.osee.framework.ui.skynet.group.GroupExplorer";
- private GroupTreeViewer treeViewer;
- private Artifact rootArt;
- private GroupExplorerItem rootItem;
- private Collection<GroupExplorerItem> selected;
- private Object[] expanded = new Object[] {};
- private XBranchSelectWidget branchSelect;
- private Branch branch;
- private GroupExplorerDragAndDrop groupExpDnd;
-
- private NeedProjectMenuListener needProjectListener;
- private MenuItem openWithMenuItem;
- private MenuItem openMenuItem;
- IGlobalMenuHelper globalMenuHelper;
-
- public GroupExplorer() {
- }
-
- @Override
- public void createPartControl(Composite parent) {
-
- if (!DbConnectionExceptionComposite.dbConnectionIsOk(parent)) {
- return;
- }
-
- GridData gridData = new GridData();
- gridData.verticalAlignment = GridData.FILL;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessVerticalSpace = true;
- gridData.grabExcessHorizontalSpace = true;
-
- GridLayout gridLayout = new GridLayout(1, false);
- gridData.heightHint = 1000;
- gridData.widthHint = 1000;
-
- parent.setLayout(gridLayout);
- parent.setLayoutData(gridData);
-
- branchSelect = new XBranchSelectWidget("");
- branchSelect.setDisplayLabel(false);
- branchSelect.setSelection(branch);
- branchSelect.createWidgets(parent, 1);
-
- branchSelect.addListener(new Listener() {
- @Override
- public void handleEvent(Event event) {
- try {
- branch = branchSelect.getData();
- refresh();
- groupExpDnd.setBranch(branch);
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
-
- });
-
- treeViewer = new GroupTreeViewer(this, parent);
- treeViewer.setContentProvider(new GroupContentProvider(this));
- treeViewer.setLabelProvider(new GroupLabelProvider());
- treeViewer.setUseHashlookup(true);
- treeViewer.getTree().addListener(SWT.MouseDoubleClick, new Listener() {
- public void handleEvent(org.eclipse.swt.widgets.Event event) {
- handleDoubleClick();
- }
- });
- treeViewer.getControl().setLayoutData(gridData);
-
- globalMenuHelper = new ArtifactTreeViewerGlobalMenuHelper(treeViewer);
- OseeContributionItem.addTo(this, true);
-
- OseeEventManager.addListener(this);
-
- groupExpDnd = new GroupExplorerDragAndDrop(treeViewer, VIEW_ID, branch);
-
- getSite().setSelectionProvider(treeViewer);
- parent.layout();
- createActions();
- getViewSite().getActionBars().updateActionBars();
- setupPopupMenu();
- refresh();
- }
-
- @Override
- public void rebuildMenu() {
- setupPopupMenu();
- }
-
- public void setupPopupMenu() {
-
- Menu popupMenu = new Menu(treeViewer.getTree().getParent());
- needProjectListener = new NeedProjectMenuListener();
- popupMenu.addMenuListener(needProjectListener);
-
- createOpenMenuItem(popupMenu);
- createOpenWithMenuItem(popupMenu);
- new MenuItem(popupMenu, SWT.SEPARATOR);
-
- MenuItem item = new MenuItem(popupMenu, SWT.PUSH);
- item.setText("&Remove from Group");
- item.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- handleRemoveFromGroup();
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- });
-
- item = new MenuItem(popupMenu, SWT.PUSH);
- item.setText("&Delete Group");
- item.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- handleDeleteGroup();
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- });
-
- item = new MenuItem(popupMenu, SWT.PUSH);
- item.setText("&New Group");
- item.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleNewGroup();
- }
- });
-
- new MenuItem(popupMenu, SWT.SEPARATOR);
-
- item = new MenuItem(popupMenu, SWT.PUSH);
- item.setText("&Select All\tCtrl+A");
- item.addListener(SWT.Selection, new Listener() {
- public void handleEvent(org.eclipse.swt.widgets.Event event) {
- treeViewer.getTree().selectAll();
- }
- });
-
- item = new MenuItem(popupMenu, SWT.PUSH);
- item.setText("Expand All\tCtrl+X");
- item.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- expandAll((IStructuredSelection) treeViewer.getSelection());
- }
- });
-
- treeViewer.getTree().setMenu(popupMenu);
- }
-
- private void createOpenMenuItem(Menu parentMenu) {
- openMenuItem = new MenuItem(parentMenu, SWT.PUSH);
- openMenuItem.setText("&Open");
-
- ArtifactMenuListener listener = new ArtifactMenuListener();
- parentMenu.addMenuListener(listener);
- openMenuItem.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent ev) {
- for (Artifact art : getSelectedArtifacts()) {
- RendererManager.openInJob(art, PresentationType.GENERALIZED_EDIT);
- }
- }
- });
- }
-
- private void createOpenWithMenuItem(Menu parentMenu) {
- openWithMenuItem = new MenuItem(parentMenu, SWT.CASCADE);
- openWithMenuItem.setText("&Open With");
- final Menu submenu = new Menu(openWithMenuItem);
- openWithMenuItem.setMenu(submenu);
- parentMenu.addMenuListener(new OpenWithMenuListener(submenu, treeViewer, this));
- }
- /**
- * @author Jeff C. Phillips
- */
- public class ArtifactMenuListener implements MenuListener {
-
- public void menuHidden(MenuEvent e) {
- }
-
- public void menuShown(MenuEvent e) {
- // Use this menu listener until all menu items can be moved to
- // GlobaMenu
- try {
- GlobalMenuPermissions permiss = new GlobalMenuPermissions(globalMenuHelper);
- openMenuItem.setEnabled(permiss.isReadPermission());
- openWithMenuItem.setEnabled(permiss.isReadPermission());
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
-
- }
- }
-
- private void handleDoubleClick() {
- GroupExplorerItem item = getSelectedItem();
- if (item != null) {
- RendererManager.openInJob(item.getArtifact(), PresentationType.GENERALIZED_EDIT);
- }
- }
-
- protected void createActions() {
- Action refreshAction = new Action("Refresh", Action.AS_PUSH_BUTTON) {
-
- @Override
- public void run() {
- refresh();
- }
- };
- refreshAction.setImageDescriptor(ImageManager.getImageDescriptor(PluginUiImage.REFRESH));
- refreshAction.setToolTipText("Refresh");
-
- IToolBarManager toolbarManager = getViewSite().getActionBars().getToolBarManager();
- toolbarManager.add(refreshAction);
-
- OseeUiActions.addBugToViewToolbar(this, this, SkynetGuiPlugin.getInstance(), VIEW_ID, "Group Explorer");
- }
-
- private void handleNewGroup() {
- EntryDialog ed =
- new EntryDialog(Displays.getActiveShell(), "Create New Group", null, "Enter Group Name",
- MessageDialog.QUESTION, new String[] {"OK", "Cancel"}, 0);
- if (ed.open() == 0) {
- try {
- UniversalGroup.addGroup(ed.getEntry(), branch);
- treeViewer.refresh();
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
-
- private void handleRemoveFromGroup() throws OseeCoreException {
- if (getSelectedUniversalGroupItems().size() > 0) {
- AWorkbench.popup("ERROR", "Can't remove Group, use \"Delete Group\".");
- return;
- }
- final List<GroupExplorerItem> items = getSelectedItems();
- if (items.isEmpty()) {
- AWorkbench.popup("ERROR", "No Items Selected");
- return;
- }
- if (MessageDialog.openConfirm(Displays.getActiveShell(), "Remove From Group",
- "Remove From Group - (Artifacts will not be deleted)\n\nAre you sure?")) {
- try {
- SkynetTransaction transaction = new SkynetTransaction(branch, "Artifacts removed from group");
- for (GroupExplorerItem item : items) {
- item.getArtifact().deleteRelation(CoreRelationTypes.Universal_Grouping__Group,
- item.getParentItem().getArtifact());
- item.getArtifact().persist(transaction);
- }
- transaction.execute();
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
-
- private void handleDeleteGroup() throws OseeCoreException {
- final ArrayList<GroupExplorerItem> items = getSelectedUniversalGroupItems();
- if (items.isEmpty()) {
- AWorkbench.popup("ERROR", "No groups selected.");
- return;
- }
- if (getSelectedItems().size() != items.size()) {
- AWorkbench.popup("ERROR", "Only select groups to be deleted.");
- return;
- }
-
- try {
- String names = "";
- for (GroupExplorerItem item : items) {
- if (item.isUniversalGroup()) {
- names += String.format("%s\n", item.getArtifact().getName());
- }
- }
- if (MessageDialog.openConfirm(Displays.getActiveShell(), "Delete Groups",
- "Delete Groups - (Contained Artifacts will not be deleted)\n\n" + names + "\nAre you sure?")) {
-
- SkynetTransaction transaction = new SkynetTransaction(branch, "Delete Groups: " + names);
- for (GroupExplorerItem item : items) {
- item.getArtifact().deleteAndPersist(transaction);
- }
- transaction.execute();
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- public void storeExpandedAndSelection() {
- // System.out.println("GE: storeExpandedAndSelection");
- // Store selected so can re-select after event re-draw
- selected = getSelectedItems();
- if (treeViewer != null && !treeViewer.getTree().isDisposed()) {
- expanded = treeViewer.getExpandedElements();
- }
- }
-
- public void restoreExpandedAndSelection() {
- // System.out.println("GE: restoreExpandedAndSelection");
- if (expanded != null && expanded.length > 0 && rootArt != null) {
- treeViewer.setExpandedElements(expanded);
- }
- if (selected != null && selected.size() > 0 && rootArt != null) {
- treeViewer.setSelection(new StructuredSelection(selected.toArray(new Object[selected.size()])));
- }
- }
-
- public GroupExplorerItem getSelectedItem() {
- IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
- Iterator<?> itemsIter = selection.iterator();
- if (itemsIter.hasNext()) {
- return (GroupExplorerItem) itemsIter.next();
- }
- return null;
- }
-
- private Collection<Artifact> getSelectedArtifacts() {
- Set<Artifact> arts = new HashSet<Artifact>();
- for (GroupExplorerItem item : getSelectedItems()) {
- arts.add(item.getArtifact());
- }
- return arts;
- }
-
- private ArrayList<GroupExplorerItem> getSelectedItems() {
- ArrayList<GroupExplorerItem> arts = new ArrayList<GroupExplorerItem>();
- Iterator<?> i = ((IStructuredSelection) treeViewer.getSelection()).iterator();
- while (i.hasNext()) {
- Object obj = i.next();
- if (obj instanceof GroupExplorerItem) {
- arts.add((GroupExplorerItem) obj);
- }
- }
- return arts;
- }
-
- private ArrayList<GroupExplorerItem> getSelectedUniversalGroupItems() throws OseeCoreException {
- ArrayList<GroupExplorerItem> arts = new ArrayList<GroupExplorerItem>();
- Iterator<?> i = ((IStructuredSelection) treeViewer.getSelection()).iterator();
- while (i.hasNext()) {
- Object obj = i.next();
- if (obj instanceof GroupExplorerItem && ((GroupExplorerItem) obj).isUniversalGroup()) {
- arts.add((GroupExplorerItem) obj);
- }
- }
- return arts;
- }
-
- private void expandAll(IStructuredSelection selection) {
- Iterator<?> iter = selection.iterator();
- while (iter.hasNext()) {
- treeViewer.expandToLevel(iter.next(), TreeViewer.ALL_LEVELS);
- }
- }
-
- @Override
- public void setFocus() {
- }
-
- public void refresh() {
- // System.out.println("GE: refresh");
- if (rootItem != null) {
- rootItem.dispose();
- }
-
- Artifact topArt = null;
- if (branch != null) {
- try {
- topArt = UniversalGroup.getTopUniversalGroupArtifact(branch);
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- if (topArt == null) {
- rootArt = null;
- rootItem = null;
- } else {
- rootArt = topArt;
- rootItem = new GroupExplorerItem(treeViewer, rootArt, null, this);
- // rootItem.getGroupItems();
- }
-
- if (treeViewer != null) {
- treeViewer.setInput(rootItem);
- }
-
- }
-
- @Override
- public void dispose() {
- OseeEventManager.removeListener(this);
- super.dispose();
- }
-
- public String getActionDescription() {
- return "";
- }
-
- @Override
- public void handleFrameworkTransactionEvent(Sender sender, FrameworkTransactionData transData) throws OseeCoreException {
- if (rootArt != null && transData.branchId != rootArt.getBranch().getId()) {
- return;
- }
- try {
- Artifact topArt = UniversalGroup.getTopUniversalGroupArtifact(branch);
- if (topArt != null) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- storeExpandedAndSelection();
- refresh();
- restoreExpandedAndSelection();
- }
- });
- return;
- }
- } catch (Exception ex) {
- // do nothing
- }
- }
- private class NeedProjectMenuListener implements MenuListener {
- Collection<MenuItem> items;
-
- public NeedProjectMenuListener() {
- this.items = new LinkedList<MenuItem>();
- }
-
- public void menuHidden(MenuEvent e) {
- }
-
- public void menuShown(MenuEvent e) {
- boolean valid = treeViewer.getInput() != null;
- for (MenuItem item : items) {
- if (!(item.getData() instanceof Exception)) {
- // Only modify
- // enabling if no
- // error is
- // associated
- item.setEnabled(valid);
- }
- }
- }
- }
-
- private static final String INPUT = "input";
- private static final String BRANCH_ID = "branchId";
-
- @Override
- public void saveState(IMemento memento) {
- super.saveState(memento);
- memento = memento.createChild(INPUT);
- if (branch != null) {
- memento.putInteger(BRANCH_ID, branch.getId());
- }
- }
-
- @Override
- public void init(IViewSite site, IMemento memento) throws PartInitException {
- super.init(site, memento);
- try {
- Integer branchId = null;
-
- if (memento != null) {
- memento = memento.getChild(INPUT);
- if (memento != null) {
- branchId = memento.getInteger(BRANCH_ID);
- if (branchId != null) {
- try {
- branch = BranchManager.getBranch(branchId);
- if (branch.getBranchState().isDeleted() || branch.getArchiveState().isArchived()) {
- branch = null;
- }
- } catch (BranchDoesNotExist ex) {
- branch = null;
- }
- }
- }
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.WARNING, "Group Explorer exception on init", ex);
- }
- }
-
- @Override
- public List<? extends IEventFilter> getEventFilters() {
- return null;
- }
-
- @Override
- public void handleArtifactEvent(ArtifactEvent artifactEvent, Sender sender) {
- if (rootArt == null || branch == null || artifactEvent.getBranchGuid().equals(branch.getGuid())) {
- return;
- }
- try {
- Artifact topArt = UniversalGroup.getTopUniversalGroupArtifact(branch);
- if (topArt != null) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- storeExpandedAndSelection();
- refresh();
- restoreExpandedAndSelection();
- }
- });
- return;
- }
- } catch (Exception ex) {
- // do nothing
- }
-
- }
-
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.group;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
+import org.eclipse.osee.framework.core.exception.BranchDoesNotExist;
+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.plugin.core.IActionable;
+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.UniversalGroup;
+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.OseeUiActions;
+import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.OpenWithMenuListener;
+import org.eclipse.osee.framework.ui.skynet.OseeContributionItem;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.listener.IRebuildMenuListener;
+import org.eclipse.osee.framework.ui.skynet.menu.ArtifactTreeViewerGlobalMenuHelper;
+import org.eclipse.osee.framework.ui.skynet.menu.GlobalMenuPermissions;
+import org.eclipse.osee.framework.ui.skynet.menu.IGlobalMenuHelper;
+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.XBranchSelectWidget;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.EntryDialog;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.events.MenuListener;
+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.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class GroupExplorer extends ViewPart implements IArtifactEventListener, IFrameworkTransactionEventListener, IActionable, IRebuildMenuListener {
+ public static final String VIEW_ID = "org.eclipse.osee.framework.ui.skynet.group.GroupExplorer";
+ private GroupTreeViewer treeViewer;
+ private Artifact rootArt;
+ private GroupExplorerItem rootItem;
+ private Collection<GroupExplorerItem> selected;
+ private Object[] expanded = new Object[] {};
+ private XBranchSelectWidget branchSelect;
+ private Branch branch;
+ private GroupExplorerDragAndDrop groupExpDnd;
+
+ private NeedProjectMenuListener needProjectListener;
+ private MenuItem openWithMenuItem;
+ private MenuItem openMenuItem;
+ IGlobalMenuHelper globalMenuHelper;
+
+ public GroupExplorer() {
+ }
+
+ @Override
+ public void createPartControl(Composite parent) {
+
+ if (!DbConnectionExceptionComposite.dbConnectionIsOk(parent)) {
+ return;
+ }
+
+ GridData gridData = new GridData();
+ gridData.verticalAlignment = GridData.FILL;
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.grabExcessVerticalSpace = true;
+ gridData.grabExcessHorizontalSpace = true;
+
+ GridLayout gridLayout = new GridLayout(1, false);
+ gridData.heightHint = 1000;
+ gridData.widthHint = 1000;
+
+ parent.setLayout(gridLayout);
+ parent.setLayoutData(gridData);
+
+ branchSelect = new XBranchSelectWidget("");
+ branchSelect.setDisplayLabel(false);
+ branchSelect.setSelection(branch);
+ branchSelect.createWidgets(parent, 1);
+
+ branchSelect.addListener(new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ try {
+ branch = branchSelect.getData();
+ refresh();
+ groupExpDnd.setBranch(branch);
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ });
+
+ treeViewer = new GroupTreeViewer(this, parent);
+ treeViewer.setContentProvider(new GroupContentProvider(this));
+ treeViewer.setLabelProvider(new GroupLabelProvider());
+ treeViewer.setUseHashlookup(true);
+ treeViewer.getTree().addListener(SWT.MouseDoubleClick, new Listener() {
+ public void handleEvent(org.eclipse.swt.widgets.Event event) {
+ handleDoubleClick();
+ }
+ });
+ treeViewer.getControl().setLayoutData(gridData);
+
+ globalMenuHelper = new ArtifactTreeViewerGlobalMenuHelper(treeViewer);
+ OseeContributionItem.addTo(this, true);
+
+ OseeEventManager.addListener(this);
+
+ groupExpDnd = new GroupExplorerDragAndDrop(treeViewer, VIEW_ID, branch);
+
+ getSite().setSelectionProvider(treeViewer);
+ parent.layout();
+ createActions();
+ getViewSite().getActionBars().updateActionBars();
+ setupPopupMenu();
+ refresh();
+ }
+
+ @Override
+ public void rebuildMenu() {
+ setupPopupMenu();
+ }
+
+ public void setupPopupMenu() {
+
+ Menu popupMenu = new Menu(treeViewer.getTree().getParent());
+ needProjectListener = new NeedProjectMenuListener();
+ popupMenu.addMenuListener(needProjectListener);
+
+ createOpenMenuItem(popupMenu);
+ createOpenWithMenuItem(popupMenu);
+ new MenuItem(popupMenu, SWT.SEPARATOR);
+
+ MenuItem item = new MenuItem(popupMenu, SWT.PUSH);
+ item.setText("&Remove from Group");
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ handleRemoveFromGroup();
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ });
+
+ item = new MenuItem(popupMenu, SWT.PUSH);
+ item.setText("&Delete Group");
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ handleDeleteGroup();
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ });
+
+ item = new MenuItem(popupMenu, SWT.PUSH);
+ item.setText("&New Group");
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleNewGroup();
+ }
+ });
+
+ new MenuItem(popupMenu, SWT.SEPARATOR);
+
+ item = new MenuItem(popupMenu, SWT.PUSH);
+ item.setText("&Select All\tCtrl+A");
+ item.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(org.eclipse.swt.widgets.Event event) {
+ treeViewer.getTree().selectAll();
+ }
+ });
+
+ item = new MenuItem(popupMenu, SWT.PUSH);
+ item.setText("Expand All\tCtrl+X");
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ expandAll((IStructuredSelection) treeViewer.getSelection());
+ }
+ });
+
+ treeViewer.getTree().setMenu(popupMenu);
+ }
+
+ private void createOpenMenuItem(Menu parentMenu) {
+ openMenuItem = new MenuItem(parentMenu, SWT.PUSH);
+ openMenuItem.setText("&Open");
+
+ ArtifactMenuListener listener = new ArtifactMenuListener();
+ parentMenu.addMenuListener(listener);
+ openMenuItem.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent ev) {
+ for (Artifact art : getSelectedArtifacts()) {
+ RendererManager.openInJob(art, PresentationType.GENERALIZED_EDIT);
+ }
+ }
+ });
+ }
+
+ private void createOpenWithMenuItem(Menu parentMenu) {
+ openWithMenuItem = new MenuItem(parentMenu, SWT.CASCADE);
+ openWithMenuItem.setText("&Open With");
+ final Menu submenu = new Menu(openWithMenuItem);
+ openWithMenuItem.setMenu(submenu);
+ parentMenu.addMenuListener(new OpenWithMenuListener(submenu, treeViewer, this));
+ }
+ /**
+ * @author Jeff C. Phillips
+ */
+ public class ArtifactMenuListener implements MenuListener {
+
+ public void menuHidden(MenuEvent e) {
+ }
+
+ public void menuShown(MenuEvent e) {
+ // Use this menu listener until all menu items can be moved to
+ // GlobaMenu
+ try {
+ GlobalMenuPermissions permiss = new GlobalMenuPermissions(globalMenuHelper);
+ openMenuItem.setEnabled(permiss.isReadPermission());
+ openWithMenuItem.setEnabled(permiss.isReadPermission());
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ }
+ }
+
+ private void handleDoubleClick() {
+ GroupExplorerItem item = getSelectedItem();
+ if (item != null) {
+ RendererManager.openInJob(item.getArtifact(), PresentationType.GENERALIZED_EDIT);
+ }
+ }
+
+ protected void createActions() {
+ Action refreshAction = new Action("Refresh", Action.AS_PUSH_BUTTON) {
+
+ @Override
+ public void run() {
+ refresh();
+ }
+ };
+ refreshAction.setImageDescriptor(ImageManager.getImageDescriptor(PluginUiImage.REFRESH));
+ refreshAction.setToolTipText("Refresh");
+
+ IToolBarManager toolbarManager = getViewSite().getActionBars().getToolBarManager();
+ toolbarManager.add(refreshAction);
+
+ OseeUiActions.addBugToViewToolbar(this, this, SkynetGuiPlugin.getInstance(), VIEW_ID, "Group Explorer");
+ }
+
+ private void handleNewGroup() {
+ EntryDialog ed =
+ new EntryDialog(Displays.getActiveShell(), "Create New Group", null, "Enter Group Name",
+ MessageDialog.QUESTION, new String[] {"OK", "Cancel"}, 0);
+ if (ed.open() == 0) {
+ try {
+ UniversalGroup.addGroup(ed.getEntry(), branch);
+ treeViewer.refresh();
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+
+ private void handleRemoveFromGroup() throws OseeCoreException {
+ if (getSelectedUniversalGroupItems().size() > 0) {
+ AWorkbench.popup("ERROR", "Can't remove Group, use \"Delete Group\".");
+ return;
+ }
+ final List<GroupExplorerItem> items = getSelectedItems();
+ if (items.isEmpty()) {
+ AWorkbench.popup("ERROR", "No Items Selected");
+ return;
+ }
+ if (MessageDialog.openConfirm(Displays.getActiveShell(), "Remove From Group",
+ "Remove From Group - (Artifacts will not be deleted)\n\nAre you sure?")) {
+ try {
+ SkynetTransaction transaction = new SkynetTransaction(branch, "Artifacts removed from group");
+ for (GroupExplorerItem item : items) {
+ item.getArtifact().deleteRelation(CoreRelationTypes.Universal_Grouping__Group,
+ item.getParentItem().getArtifact());
+ item.getArtifact().persist(transaction);
+ }
+ transaction.execute();
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+
+ private void handleDeleteGroup() throws OseeCoreException {
+ final ArrayList<GroupExplorerItem> items = getSelectedUniversalGroupItems();
+ if (items.isEmpty()) {
+ AWorkbench.popup("ERROR", "No groups selected.");
+ return;
+ }
+ if (getSelectedItems().size() != items.size()) {
+ AWorkbench.popup("ERROR", "Only select groups to be deleted.");
+ return;
+ }
+
+ try {
+ String names = "";
+ for (GroupExplorerItem item : items) {
+ if (item.isUniversalGroup()) {
+ names += String.format("%s\n", item.getArtifact().getName());
+ }
+ }
+ if (MessageDialog.openConfirm(Displays.getActiveShell(), "Delete Groups",
+ "Delete Groups - (Contained Artifacts will not be deleted)\n\n" + names + "\nAre you sure?")) {
+
+ SkynetTransaction transaction = new SkynetTransaction(branch, "Delete Groups: " + names);
+ for (GroupExplorerItem item : items) {
+ item.getArtifact().deleteAndPersist(transaction);
+ }
+ transaction.execute();
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ public void storeExpandedAndSelection() {
+ // System.out.println("GE: storeExpandedAndSelection");
+ // Store selected so can re-select after event re-draw
+ selected = getSelectedItems();
+ if (treeViewer != null && !treeViewer.getTree().isDisposed()) {
+ expanded = treeViewer.getExpandedElements();
+ }
+ }
+
+ public void restoreExpandedAndSelection() {
+ // System.out.println("GE: restoreExpandedAndSelection");
+ if (expanded != null && expanded.length > 0 && rootArt != null) {
+ treeViewer.setExpandedElements(expanded);
+ }
+ if (selected != null && selected.size() > 0 && rootArt != null) {
+ treeViewer.setSelection(new StructuredSelection(selected.toArray(new Object[selected.size()])));
+ }
+ }
+
+ public GroupExplorerItem getSelectedItem() {
+ IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
+ Iterator<?> itemsIter = selection.iterator();
+ if (itemsIter.hasNext()) {
+ return (GroupExplorerItem) itemsIter.next();
+ }
+ return null;
+ }
+
+ private Collection<Artifact> getSelectedArtifacts() {
+ Set<Artifact> arts = new HashSet<Artifact>();
+ for (GroupExplorerItem item : getSelectedItems()) {
+ arts.add(item.getArtifact());
+ }
+ return arts;
+ }
+
+ private ArrayList<GroupExplorerItem> getSelectedItems() {
+ ArrayList<GroupExplorerItem> arts = new ArrayList<GroupExplorerItem>();
+ Iterator<?> i = ((IStructuredSelection) treeViewer.getSelection()).iterator();
+ while (i.hasNext()) {
+ Object obj = i.next();
+ if (obj instanceof GroupExplorerItem) {
+ arts.add((GroupExplorerItem) obj);
+ }
+ }
+ return arts;
+ }
+
+ private ArrayList<GroupExplorerItem> getSelectedUniversalGroupItems() throws OseeCoreException {
+ ArrayList<GroupExplorerItem> arts = new ArrayList<GroupExplorerItem>();
+ Iterator<?> i = ((IStructuredSelection) treeViewer.getSelection()).iterator();
+ while (i.hasNext()) {
+ Object obj = i.next();
+ if (obj instanceof GroupExplorerItem && ((GroupExplorerItem) obj).isUniversalGroup()) {
+ arts.add((GroupExplorerItem) obj);
+ }
+ }
+ return arts;
+ }
+
+ private void expandAll(IStructuredSelection selection) {
+ Iterator<?> iter = selection.iterator();
+ while (iter.hasNext()) {
+ treeViewer.expandToLevel(iter.next(), TreeViewer.ALL_LEVELS);
+ }
+ }
+
+ @Override
+ public void setFocus() {
+ }
+
+ public void refresh() {
+ // System.out.println("GE: refresh");
+ if (rootItem != null) {
+ rootItem.dispose();
+ }
+
+ Artifact topArt = null;
+ if (branch != null) {
+ try {
+ topArt = UniversalGroup.getTopUniversalGroupArtifact(branch);
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ if (topArt == null) {
+ rootArt = null;
+ rootItem = null;
+ } else {
+ rootArt = topArt;
+ rootItem = new GroupExplorerItem(treeViewer, rootArt, null, this);
+ // rootItem.getGroupItems();
+ }
+
+ if (treeViewer != null) {
+ treeViewer.setInput(rootItem);
+ }
+
+ }
+
+ @Override
+ public void dispose() {
+ OseeEventManager.removeListener(this);
+ super.dispose();
+ }
+
+ public String getActionDescription() {
+ return "";
+ }
+
+ @Override
+ public void handleFrameworkTransactionEvent(Sender sender, FrameworkTransactionData transData) throws OseeCoreException {
+ if (rootArt != null && transData.branchId != rootArt.getBranch().getId()) {
+ return;
+ }
+ try {
+ Artifact topArt = UniversalGroup.getTopUniversalGroupArtifact(branch);
+ if (topArt != null) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ storeExpandedAndSelection();
+ refresh();
+ restoreExpandedAndSelection();
+ }
+ });
+ return;
+ }
+ } catch (Exception ex) {
+ // do nothing
+ }
+ }
+ private class NeedProjectMenuListener implements MenuListener {
+ Collection<MenuItem> items;
+
+ public NeedProjectMenuListener() {
+ this.items = new LinkedList<MenuItem>();
+ }
+
+ public void menuHidden(MenuEvent e) {
+ }
+
+ public void menuShown(MenuEvent e) {
+ boolean valid = treeViewer.getInput() != null;
+ for (MenuItem item : items) {
+ if (!(item.getData() instanceof Exception)) {
+ // Only modify
+ // enabling if no
+ // error is
+ // associated
+ item.setEnabled(valid);
+ }
+ }
+ }
+ }
+
+ private static final String INPUT = "input";
+ private static final String BRANCH_ID = "branchId";
+
+ @Override
+ public void saveState(IMemento memento) {
+ super.saveState(memento);
+ memento = memento.createChild(INPUT);
+ if (branch != null) {
+ memento.putInteger(BRANCH_ID, branch.getId());
+ }
+ }
+
+ @Override
+ public void init(IViewSite site, IMemento memento) throws PartInitException {
+ super.init(site, memento);
+ try {
+ Integer branchId = null;
+
+ if (memento != null) {
+ memento = memento.getChild(INPUT);
+ if (memento != null) {
+ branchId = memento.getInteger(BRANCH_ID);
+ if (branchId != null) {
+ try {
+ branch = BranchManager.getBranch(branchId);
+ if (branch.getBranchState().isDeleted() || branch.getArchiveState().isArchived()) {
+ branch = null;
+ }
+ } catch (BranchDoesNotExist ex) {
+ branch = null;
+ }
+ }
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.WARNING, "Group Explorer exception on init", ex);
+ }
+ }
+
+ @Override
+ public List<? extends IEventFilter> getEventFilters() {
+ return null;
+ }
+
+ @Override
+ public void handleArtifactEvent(ArtifactEvent artifactEvent, Sender sender) {
+ if (rootArt == null || branch == null || artifactEvent.getBranchGuid().equals(branch.getGuid())) {
+ return;
+ }
+ try {
+ Artifact topArt = UniversalGroup.getTopUniversalGroupArtifact(branch);
+ if (topArt != null) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ storeExpandedAndSelection();
+ refresh();
+ restoreExpandedAndSelection();
+ }
+ });
+ return;
+ }
+ } catch (Exception ex) {
+ // do nothing
+ }
+
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/group/GroupExplorerDragAndDrop.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/group/GroupExplorerDragAndDrop.java
index 3698913ddc7..0d5b0a108ed 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/group/GroupExplorerDragAndDrop.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/group/GroupExplorerDragAndDrop.java
@@ -1,315 +1,315 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.group;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-import org.eclipse.osee.framework.core.enums.RelationOrderBaseTypes;
-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.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactData;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactTransfer;
-import org.eclipse.osee.framework.ui.skynet.util.SkynetDragAndDrop;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-
-/**
- * @author Donald G. Dunne
- */
-public class GroupExplorerDragAndDrop extends SkynetDragAndDrop {
-
- boolean isFeedbackAfter = false;
- private final TreeViewer treeViewer;
- private final String viewId;
- private boolean isCtrlPressed = false;
- private Branch branch;
-
- public GroupExplorerDragAndDrop(TreeViewer treeViewer, String viewId, Branch branch) {
- super(treeViewer.getTree(), viewId);
- this.treeViewer = treeViewer;
- this.viewId = viewId;
- this.branch = branch;
- treeViewer.getTree().addKeyListener(new keySelectedListener());
- }
- private class keySelectedListener implements KeyListener {
- public void keyPressed(KeyEvent e) {
- isCtrlPressed = e.keyCode == SWT.CONTROL;
- }
-
- public void keyReleased(KeyEvent e) {
- if (e.keyCode == 'a' && e.stateMask == SWT.CONTROL) {
- treeViewer.getTree().selectAll();
- }
- if (e.keyCode == 'x' && e.stateMask == SWT.CONTROL) {
- expandAll((IStructuredSelection) treeViewer.getSelection());
- }
- isCtrlPressed = !(e.keyCode == SWT.CONTROL);
- }
- }
-
- private void expandAll(IStructuredSelection selection) {
- Iterator<?> iter = selection.iterator();
- while (iter.hasNext()) {
- treeViewer.expandToLevel(iter.next(), TreeViewer.ALL_LEVELS);
- }
- }
-
- @Override
- public Artifact[] getArtifacts() {
- IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
- Iterator<?> i = selection.iterator();
- List<Artifact> artifacts = new ArrayList<Artifact>();
- while (i.hasNext()) {
- Object object = i.next();
- if (object instanceof GroupExplorerItem) {
- artifacts.add(((GroupExplorerItem) object).getArtifact());
- }
- }
- return artifacts.toArray(new Artifact[artifacts.size()]);
- }
-
- @Override
- public void performDragOver(DropTargetEvent event) throws OseeCoreException {
- if (!ArtifactTransfer.getInstance().isSupportedType(event.currentDataType)) {
- event.detail = DND.DROP_NONE;
- return;
- }
- final ArtifactData artData = ArtifactTransfer.getInstance().nativeToJava(event.currentDataType);
- if (artData == null) {
- event.detail = DND.DROP_NONE;
- return;
- }
- for (Artifact art : artData.getArtifacts()) {
- if (art.isOfType(CoreArtifactTypes.UniversalGroup)) {
- event.detail = DND.DROP_NONE;
- return;
- }
- }
- Tree tree = treeViewer.getTree();
- TreeItem dragOverTreeItem = tree.getItem(treeViewer.getTree().toControl(event.x, event.y));
-
- event.feedback = DND.FEEDBACK_EXPAND;
- event.detail = DND.DROP_NONE;
-
- // Set as COPY if drag item over group (copy versus move will be determined on drop
- if (dragOverTreeItem != null && ((GroupExplorerItem) dragOverTreeItem.getData()).isUniversalGroup()) {
- event.detail = DND.DROP_COPY;
- tree.setInsertMark(null, false);
- }
- // Handle re-ordering within same group
- else if (dragOverTreeItem != null && !((GroupExplorerItem) dragOverTreeItem.getData()).isUniversalGroup()) {
- GroupExplorerItem dragOverGroupItem = (GroupExplorerItem) dragOverTreeItem.getData();
- IStructuredSelection selectedItem = (IStructuredSelection) treeViewer.getSelection();
- Object obj = selectedItem.getFirstElement();
- if (obj instanceof GroupExplorerItem) {
- GroupExplorerItem droppingGroupItem = (GroupExplorerItem) obj;
-
- // the group to move must belong to the same group as the member to insert before/after
- if (dragOverGroupItem.getParentItem().equals(droppingGroupItem.getParentItem())) {
- if (isFeedbackAfter) {
- event.feedback = DND.FEEDBACK_INSERT_AFTER;
- } else {
- event.feedback = DND.FEEDBACK_INSERT_BEFORE;
- }
- event.detail = DND.DROP_MOVE;
- }
- } else {
- if (isFeedbackAfter) {
- event.feedback = DND.FEEDBACK_INSERT_AFTER;
- } else {
- event.feedback = DND.FEEDBACK_INSERT_BEFORE;
- }
- event.detail = DND.DROP_COPY;
- }
- } else {
- tree.setInsertMark(null, false);
- }
- }
-
- @Override
- public void operationChanged(DropTargetEvent event) {
- if (!isCtrlPressed(event)) {
- isFeedbackAfter = false;
- }
- }
-
- private boolean isCtrlPressed(DropTargetEvent event) {
- boolean ctrPressed = event.detail == 1;
-
- if (ctrPressed) {
- isFeedbackAfter = true;
- }
- return ctrPressed;
- }
-
- @Override
- public void performDrop(DropTargetEvent event) {
- try {
- TreeItem dragOverTreeITem = treeViewer.getTree().getItem(treeViewer.getTree().toControl(event.x, event.y));
-
- // This should always be true as all items are Group Explorer Items
- if (dragOverTreeITem.getData() instanceof GroupExplorerItem) {
- final GroupExplorerItem dragOverExplorerItem = (GroupExplorerItem) dragOverTreeITem.getData();
-
- // Drag item dropped ON universal group item
- if (dragOverExplorerItem.isUniversalGroup()) {
-
- // Drag item came from inside Group Explorer
- if (event.data instanceof ArtifactData) {
- // If event originated outside, it's a copy event;
- // OR if event is inside and ctrl is down, this is a copy; add items to group
- if (!((ArtifactData) event.data).getSource().equals(viewId) || ((ArtifactData) event.data).getSource().equals(
- viewId) && isCtrlPressed) {
- copyArtifactsToGroup(event, dragOverExplorerItem);
- }
- // Else this is a move
- else {
- IStructuredSelection selectedItem = (IStructuredSelection) treeViewer.getSelection();
- Iterator<?> iterator = selectedItem.iterator();
- final Set<Artifact> insertArts = new HashSet<Artifact>();
- while (iterator.hasNext()) {
- Object obj = iterator.next();
- if (obj instanceof GroupExplorerItem) {
- insertArts.add(((GroupExplorerItem) obj).getArtifact());
- }
- }
- GroupExplorerItem parentUnivGroupItem =
- ((GroupExplorerItem) selectedItem.getFirstElement()).getParentItem();
- final Artifact parentArtifact = parentUnivGroupItem.getArtifact();
- final Artifact targetArtifact = dragOverExplorerItem.getArtifact();
-
- for (Artifact artifact : insertArts) {
- // Remove item from old group
- parentArtifact.deleteRelation(CoreRelationTypes.Universal_Grouping__Members, artifact);
- // Add items to new group
- targetArtifact.addRelation(CoreRelationTypes.Universal_Grouping__Members, artifact);
- }
- Artifacts.persistInTransaction(parentArtifact, targetArtifact);
- }
- }
- }
- // Drag item dropped before or after group member
- else if (!dragOverExplorerItem.isUniversalGroup()) {
-
- if (event.data instanceof ArtifactData) {
-
- GroupExplorerItem parentUnivGroupItem = null;
- // Drag item came from inside Group Explorer
- if (((ArtifactData) event.data).getSource().equals(viewId)) {
- IStructuredSelection selectedItem = (IStructuredSelection) treeViewer.getSelection();
- Iterator<?> iterator = selectedItem.iterator();
- Set<Artifact> insertArts = new HashSet<Artifact>();
- while (iterator.hasNext()) {
- Object obj = iterator.next();
- if (obj instanceof GroupExplorerItem) {
- insertArts.add(((GroupExplorerItem) obj).getArtifact());
- }
- }
- parentUnivGroupItem = ((GroupExplorerItem) selectedItem.getFirstElement()).getParentItem();
- insertArts.toArray(new Artifact[insertArts.size()]);
-
- Artifact parentArtifact = parentUnivGroupItem.getArtifact();
- Artifact targetArtifact = dragOverExplorerItem.getArtifact();
-
- for (Artifact art : insertArts) {
- parentArtifact.setRelationOrder(CoreRelationTypes.Universal_Grouping__Members, targetArtifact,
- isFeedbackAfter, art);
- targetArtifact = art;
- }
- parentArtifact.persist();
- }
- // Drag item came from outside Group Explorer
- else {
- List<Artifact> insertArts = Arrays.asList(((ArtifactData) event.data).getArtifacts());
- parentUnivGroupItem = dragOverExplorerItem.getParentItem();
- insertArts.toArray(new Artifact[insertArts.size()]);
-
- Artifact parentArtifact = parentUnivGroupItem.getArtifact();
- Artifact targetArtifact = dragOverExplorerItem.getArtifact();
-
- for (Artifact art : insertArts) {
- parentArtifact.addRelation(RelationOrderBaseTypes.USER_DEFINED,
- CoreRelationTypes.Universal_Grouping__Members, targetArtifact, isFeedbackAfter, art, "");
- }
- parentArtifact.persist();
- }
- }
- }
- treeViewer.refresh(dragOverExplorerItem);
- }
-
- isFeedbackAfter = false;
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- public void copyArtifactsToGroup(DropTargetEvent event, final GroupExplorerItem dragOverExplorerItem) {
- // Items dropped on Group; simply add items to group
- final Artifact[] artsToRelate = ((ArtifactData) event.data).getArtifacts();
- for (Artifact artifact : artsToRelate) {
- if (!artifact.getBranch().equals(branch)) {
- AWorkbench.popup("ERROR",
- "Cross-branch grouping not supported.\n\nGroup and Artifacts must belong to same branch.");
- return;
- }
- }
- boolean alreadyRelated = true;
- for (Artifact artifact : artsToRelate) {
- if (!dragOverExplorerItem.contains(artifact)) {
- alreadyRelated = false;
- break;
- }
- }
- if (alreadyRelated) {
- AWorkbench.popup("ERROR", "Artifact(s) already related.");
- return;
- }
- try {
- SkynetTransaction transaction = new SkynetTransaction(branch, "Drag and drop: copy artifacts to group");
-
- for (Artifact art : artsToRelate) {
- if (!dragOverExplorerItem.contains(art)) {
- dragOverExplorerItem.getArtifact().addRelation(CoreRelationTypes.Universal_Grouping__Members, art);
- }
- }
- dragOverExplorerItem.getArtifact().persist(transaction);
-
- transaction.execute();
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- public void setBranch(Branch branch) {
- this.branch = branch;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.group;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
+import org.eclipse.osee.framework.core.enums.RelationOrderBaseTypes;
+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.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactData;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactTransfer;
+import org.eclipse.osee.framework.ui.skynet.util.SkynetDragAndDrop;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class GroupExplorerDragAndDrop extends SkynetDragAndDrop {
+
+ boolean isFeedbackAfter = false;
+ private final TreeViewer treeViewer;
+ private final String viewId;
+ private boolean isCtrlPressed = false;
+ private Branch branch;
+
+ public GroupExplorerDragAndDrop(TreeViewer treeViewer, String viewId, Branch branch) {
+ super(treeViewer.getTree(), viewId);
+ this.treeViewer = treeViewer;
+ this.viewId = viewId;
+ this.branch = branch;
+ treeViewer.getTree().addKeyListener(new keySelectedListener());
+ }
+ private class keySelectedListener implements KeyListener {
+ public void keyPressed(KeyEvent e) {
+ isCtrlPressed = e.keyCode == SWT.CONTROL;
+ }
+
+ public void keyReleased(KeyEvent e) {
+ if (e.keyCode == 'a' && e.stateMask == SWT.CONTROL) {
+ treeViewer.getTree().selectAll();
+ }
+ if (e.keyCode == 'x' && e.stateMask == SWT.CONTROL) {
+ expandAll((IStructuredSelection) treeViewer.getSelection());
+ }
+ isCtrlPressed = !(e.keyCode == SWT.CONTROL);
+ }
+ }
+
+ private void expandAll(IStructuredSelection selection) {
+ Iterator<?> iter = selection.iterator();
+ while (iter.hasNext()) {
+ treeViewer.expandToLevel(iter.next(), TreeViewer.ALL_LEVELS);
+ }
+ }
+
+ @Override
+ public Artifact[] getArtifacts() {
+ IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
+ Iterator<?> i = selection.iterator();
+ List<Artifact> artifacts = new ArrayList<Artifact>();
+ while (i.hasNext()) {
+ Object object = i.next();
+ if (object instanceof GroupExplorerItem) {
+ artifacts.add(((GroupExplorerItem) object).getArtifact());
+ }
+ }
+ return artifacts.toArray(new Artifact[artifacts.size()]);
+ }
+
+ @Override
+ public void performDragOver(DropTargetEvent event) throws OseeCoreException {
+ if (!ArtifactTransfer.getInstance().isSupportedType(event.currentDataType)) {
+ event.detail = DND.DROP_NONE;
+ return;
+ }
+ final ArtifactData artData = ArtifactTransfer.getInstance().nativeToJava(event.currentDataType);
+ if (artData == null) {
+ event.detail = DND.DROP_NONE;
+ return;
+ }
+ for (Artifact art : artData.getArtifacts()) {
+ if (art.isOfType(CoreArtifactTypes.UniversalGroup)) {
+ event.detail = DND.DROP_NONE;
+ return;
+ }
+ }
+ Tree tree = treeViewer.getTree();
+ TreeItem dragOverTreeItem = tree.getItem(treeViewer.getTree().toControl(event.x, event.y));
+
+ event.feedback = DND.FEEDBACK_EXPAND;
+ event.detail = DND.DROP_NONE;
+
+ // Set as COPY if drag item over group (copy versus move will be determined on drop
+ if (dragOverTreeItem != null && ((GroupExplorerItem) dragOverTreeItem.getData()).isUniversalGroup()) {
+ event.detail = DND.DROP_COPY;
+ tree.setInsertMark(null, false);
+ }
+ // Handle re-ordering within same group
+ else if (dragOverTreeItem != null && !((GroupExplorerItem) dragOverTreeItem.getData()).isUniversalGroup()) {
+ GroupExplorerItem dragOverGroupItem = (GroupExplorerItem) dragOverTreeItem.getData();
+ IStructuredSelection selectedItem = (IStructuredSelection) treeViewer.getSelection();
+ Object obj = selectedItem.getFirstElement();
+ if (obj instanceof GroupExplorerItem) {
+ GroupExplorerItem droppingGroupItem = (GroupExplorerItem) obj;
+
+ // the group to move must belong to the same group as the member to insert before/after
+ if (dragOverGroupItem.getParentItem().equals(droppingGroupItem.getParentItem())) {
+ if (isFeedbackAfter) {
+ event.feedback = DND.FEEDBACK_INSERT_AFTER;
+ } else {
+ event.feedback = DND.FEEDBACK_INSERT_BEFORE;
+ }
+ event.detail = DND.DROP_MOVE;
+ }
+ } else {
+ if (isFeedbackAfter) {
+ event.feedback = DND.FEEDBACK_INSERT_AFTER;
+ } else {
+ event.feedback = DND.FEEDBACK_INSERT_BEFORE;
+ }
+ event.detail = DND.DROP_COPY;
+ }
+ } else {
+ tree.setInsertMark(null, false);
+ }
+ }
+
+ @Override
+ public void operationChanged(DropTargetEvent event) {
+ if (!isCtrlPressed(event)) {
+ isFeedbackAfter = false;
+ }
+ }
+
+ private boolean isCtrlPressed(DropTargetEvent event) {
+ boolean ctrPressed = event.detail == 1;
+
+ if (ctrPressed) {
+ isFeedbackAfter = true;
+ }
+ return ctrPressed;
+ }
+
+ @Override
+ public void performDrop(DropTargetEvent event) {
+ try {
+ TreeItem dragOverTreeITem = treeViewer.getTree().getItem(treeViewer.getTree().toControl(event.x, event.y));
+
+ // This should always be true as all items are Group Explorer Items
+ if (dragOverTreeITem.getData() instanceof GroupExplorerItem) {
+ final GroupExplorerItem dragOverExplorerItem = (GroupExplorerItem) dragOverTreeITem.getData();
+
+ // Drag item dropped ON universal group item
+ if (dragOverExplorerItem.isUniversalGroup()) {
+
+ // Drag item came from inside Group Explorer
+ if (event.data instanceof ArtifactData) {
+ // If event originated outside, it's a copy event;
+ // OR if event is inside and ctrl is down, this is a copy; add items to group
+ if (!((ArtifactData) event.data).getSource().equals(viewId) || ((ArtifactData) event.data).getSource().equals(
+ viewId) && isCtrlPressed) {
+ copyArtifactsToGroup(event, dragOverExplorerItem);
+ }
+ // Else this is a move
+ else {
+ IStructuredSelection selectedItem = (IStructuredSelection) treeViewer.getSelection();
+ Iterator<?> iterator = selectedItem.iterator();
+ final Set<Artifact> insertArts = new HashSet<Artifact>();
+ while (iterator.hasNext()) {
+ Object obj = iterator.next();
+ if (obj instanceof GroupExplorerItem) {
+ insertArts.add(((GroupExplorerItem) obj).getArtifact());
+ }
+ }
+ GroupExplorerItem parentUnivGroupItem =
+ ((GroupExplorerItem) selectedItem.getFirstElement()).getParentItem();
+ final Artifact parentArtifact = parentUnivGroupItem.getArtifact();
+ final Artifact targetArtifact = dragOverExplorerItem.getArtifact();
+
+ for (Artifact artifact : insertArts) {
+ // Remove item from old group
+ parentArtifact.deleteRelation(CoreRelationTypes.Universal_Grouping__Members, artifact);
+ // Add items to new group
+ targetArtifact.addRelation(CoreRelationTypes.Universal_Grouping__Members, artifact);
+ }
+ Artifacts.persistInTransaction(parentArtifact, targetArtifact);
+ }
+ }
+ }
+ // Drag item dropped before or after group member
+ else if (!dragOverExplorerItem.isUniversalGroup()) {
+
+ if (event.data instanceof ArtifactData) {
+
+ GroupExplorerItem parentUnivGroupItem = null;
+ // Drag item came from inside Group Explorer
+ if (((ArtifactData) event.data).getSource().equals(viewId)) {
+ IStructuredSelection selectedItem = (IStructuredSelection) treeViewer.getSelection();
+ Iterator<?> iterator = selectedItem.iterator();
+ Set<Artifact> insertArts = new HashSet<Artifact>();
+ while (iterator.hasNext()) {
+ Object obj = iterator.next();
+ if (obj instanceof GroupExplorerItem) {
+ insertArts.add(((GroupExplorerItem) obj).getArtifact());
+ }
+ }
+ parentUnivGroupItem = ((GroupExplorerItem) selectedItem.getFirstElement()).getParentItem();
+ insertArts.toArray(new Artifact[insertArts.size()]);
+
+ Artifact parentArtifact = parentUnivGroupItem.getArtifact();
+ Artifact targetArtifact = dragOverExplorerItem.getArtifact();
+
+ for (Artifact art : insertArts) {
+ parentArtifact.setRelationOrder(CoreRelationTypes.Universal_Grouping__Members, targetArtifact,
+ isFeedbackAfter, art);
+ targetArtifact = art;
+ }
+ parentArtifact.persist();
+ }
+ // Drag item came from outside Group Explorer
+ else {
+ List<Artifact> insertArts = Arrays.asList(((ArtifactData) event.data).getArtifacts());
+ parentUnivGroupItem = dragOverExplorerItem.getParentItem();
+ insertArts.toArray(new Artifact[insertArts.size()]);
+
+ Artifact parentArtifact = parentUnivGroupItem.getArtifact();
+ Artifact targetArtifact = dragOverExplorerItem.getArtifact();
+
+ for (Artifact art : insertArts) {
+ parentArtifact.addRelation(RelationOrderBaseTypes.USER_DEFINED,
+ CoreRelationTypes.Universal_Grouping__Members, targetArtifact, isFeedbackAfter, art, "");
+ }
+ parentArtifact.persist();
+ }
+ }
+ }
+ treeViewer.refresh(dragOverExplorerItem);
+ }
+
+ isFeedbackAfter = false;
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ public void copyArtifactsToGroup(DropTargetEvent event, final GroupExplorerItem dragOverExplorerItem) {
+ // Items dropped on Group; simply add items to group
+ final Artifact[] artsToRelate = ((ArtifactData) event.data).getArtifacts();
+ for (Artifact artifact : artsToRelate) {
+ if (!artifact.getBranch().equals(branch)) {
+ AWorkbench.popup("ERROR",
+ "Cross-branch grouping not supported.\n\nGroup and Artifacts must belong to same branch.");
+ return;
+ }
+ }
+ boolean alreadyRelated = true;
+ for (Artifact artifact : artsToRelate) {
+ if (!dragOverExplorerItem.contains(artifact)) {
+ alreadyRelated = false;
+ break;
+ }
+ }
+ if (alreadyRelated) {
+ AWorkbench.popup("ERROR", "Artifact(s) already related.");
+ return;
+ }
+ try {
+ SkynetTransaction transaction = new SkynetTransaction(branch, "Drag and drop: copy artifacts to group");
+
+ for (Artifact art : artsToRelate) {
+ if (!dragOverExplorerItem.contains(art)) {
+ dragOverExplorerItem.getArtifact().addRelation(CoreRelationTypes.Universal_Grouping__Members, art);
+ }
+ }
+ dragOverExplorerItem.getArtifact().persist(transaction);
+
+ transaction.execute();
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ public void setBranch(Branch branch) {
+ this.branch = branch;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/group/GroupTreeViewer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/group/GroupTreeViewer.java
index 998045f756e..da27cd1857e 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/group/GroupTreeViewer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/group/GroupTreeViewer.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.framework.ui.skynet.group;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @author Donald G. Dunne
- */
-public class GroupTreeViewer extends TreeViewer {
-
- private final GroupExplorer groupExplorer;
-
- /**
- * @param parent
- */
- public GroupTreeViewer(GroupExplorer groupExplorer, Composite parent) {
- super(parent);
- this.groupExplorer = groupExplorer;
- }
-
- @Override
- public void refresh() {
- super.refresh();
- // System.out.println("TreeViewer: refresh");
- groupExplorer.restoreExpandedAndSelection();
- }
-
- @Override
- public void refresh(boolean updateLabels) {
- super.refresh(updateLabels);
- // System.out.println("TreeViewer: refresh(updateLabels)");
- groupExplorer.restoreExpandedAndSelection();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.group;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class GroupTreeViewer extends TreeViewer {
+
+ private final GroupExplorer groupExplorer;
+
+ /**
+ * @param parent
+ */
+ public GroupTreeViewer(GroupExplorer groupExplorer, Composite parent) {
+ super(parent);
+ this.groupExplorer = groupExplorer;
+ }
+
+ @Override
+ public void refresh() {
+ super.refresh();
+ // System.out.println("TreeViewer: refresh");
+ groupExplorer.restoreExpandedAndSelection();
+ }
+
+ @Override
+ public void refresh(boolean updateLabels) {
+ super.refresh(updateLabels);
+ // System.out.println("TreeViewer: refresh(updateLabels)");
+ groupExplorer.restoreExpandedAndSelection();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/group/IGroupExplorerProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/group/IGroupExplorerProvider.java
index adcc55270d6..56ca3b86a91 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/group/IGroupExplorerProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/group/IGroupExplorerProvider.java
@@ -8,14 +8,14 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.group;
-
+package org.eclipse.osee.framework.ui.skynet.group;
+
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-
-/**
- * @author Donald G. Dunne
- */
-public interface IGroupExplorerProvider {
-
- public String getGroupExplorerName() throws OseeCoreException;
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IGroupExplorerProvider {
+
+ public String getGroupExplorerName() throws OseeCoreException;
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/handler/UIOutlineResolutionHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/handler/UIOutlineResolutionHandler.java
index 6ac36d3f65e..eed5e8a5c08 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/handler/UIOutlineResolutionHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/handler/UIOutlineResolutionHandler.java
@@ -1,58 +1,58 @@
-/*******************************************************************************
- * Copyright (c) 2010 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.handler;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.commons.lang.mutable.MutableBoolean;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.IStatusHandler;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.osee.framework.skynet.core.importing.parsers.WordOutlineExtractorDelegate.ContentType;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Roberto Escobar
- * @author Karol M. Wilk
- */
-
-public class UIOutlineResolutionHandler implements IStatusHandler {
-
- @Override
- public Object handleStatus(IStatus status, Object source) throws CoreException {
- if (source instanceof ArrayList<?>) {
- final List<String> list = (ArrayList<String>) source;
- // Preferences get the last should ask?
- // Use the last preference ?
- final MutableBoolean mutableBoolean = new MutableBoolean(false);
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- String message =
- String.format(
- "Previous valid outline number was \"%s\", is \"%s\" the next outline number? If not, I will treat it as content.",
- list.get(0), list.get(1));
- mutableBoolean.setValue(MessageDialog.openQuestion(
- PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Help me decide...", message));
- }
- };
- Displays.ensureInDisplayThread(runnable, true);
- return mutableBoolean.booleanValue() ? ContentType.OUTLINE_TITLE : ContentType.CONTENT;
- }
-
- throw new CoreException(new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID,
- "Invalid source object in UIOutlineResolutionHandler"));
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.handler;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang.mutable.MutableBoolean;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.IStatusHandler;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osee.framework.skynet.core.importing.parsers.WordOutlineExtractorDelegate.ContentType;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Roberto Escobar
+ * @author Karol M. Wilk
+ */
+
+public class UIOutlineResolutionHandler implements IStatusHandler {
+
+ @Override
+ public Object handleStatus(IStatus status, Object source) throws CoreException {
+ if (source instanceof ArrayList<?>) {
+ final List<String> list = (ArrayList<String>) source;
+ // Preferences get the last should ask?
+ // Use the last preference ?
+ final MutableBoolean mutableBoolean = new MutableBoolean(false);
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ String message =
+ String.format(
+ "Previous valid outline number was \"%s\", is \"%s\" the next outline number? If not, I will treat it as content.",
+ list.get(0), list.get(1));
+ mutableBoolean.setValue(MessageDialog.openQuestion(
+ PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Help me decide...", message));
+ }
+ };
+ Displays.ensureInDisplayThread(runnable, true);
+ return mutableBoolean.booleanValue() ? ContentType.OUTLINE_TITLE : ContentType.CONTENT;
+ }
+
+ throw new CoreException(new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID,
+ "Invalid source object in UIOutlineResolutionHandler"));
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/listener/IRebuildMenuListener.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/listener/IRebuildMenuListener.java
index 872ed856d65..24daaea70e4 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/listener/IRebuildMenuListener.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/listener/IRebuildMenuListener.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.listener;
-
-/**
- * @author Jeff C. Phillips
- */
-public interface IRebuildMenuListener {
-
- public void rebuildMenu();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.listener;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public interface IRebuildMenuListener {
+
+ public void rebuildMenu();
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/menu/ArtifactDiffMenu.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/menu/ArtifactDiffMenu.java
index 0ac900621b4..f1d07a39667 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/menu/ArtifactDiffMenu.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/menu/ArtifactDiffMenu.java
@@ -1,154 +1,154 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.menu;
-
-import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.INCLUDE_DELETED;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.TransactionDelta;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.util.Conditions;
-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.change.ArtifactDelta;
-import org.eclipse.osee.framework.skynet.core.change.Change;
-import org.eclipse.osee.framework.ui.skynet.render.FileSystemRenderer;
-import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
-import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MenuEvent;
-import org.eclipse.swt.events.MenuListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-
-/**
- * @author Jeff C. Phillips
- */
-public final class ArtifactDiffMenu {
-
- private ArtifactDiffMenu() {
- }
-
- public static void createDiffMenuItem(Menu parentMenu, Viewer viewer, String subMenuText) {
- MenuItem diffMenuItem = new MenuItem(parentMenu, SWT.CASCADE);
- diffMenuItem.setText(subMenuText);
- diffMenuItem.addSelectionListener(new SelectionListener(viewer));
- parentMenu.addMenuListener(new CompareMenuListener(viewer, diffMenuItem));
- }
-
- private static final class CompareMenuListener implements MenuListener {
- private final Viewer viewer;
- private final MenuItem diffMenuItem;
-
- public CompareMenuListener(Viewer viewer, MenuItem diffMenuItem) {
- super();
- this.diffMenuItem = diffMenuItem;
- this.viewer = viewer;
- }
-
- public void menuHidden(MenuEvent e) {
- }
-
- public void menuShown(MenuEvent e) {
- boolean isValidSelection = false;
-
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
- if (selection.size() == 2) {
- isValidSelection = true;
- for (Object object : selection.toArray()) {
- isValidSelection &= isComparable(object);
- }
- }
- diffMenuItem.setEnabled(isValidSelection);
- }
-
- private boolean isComparable(Object object) {
- boolean isValidSelection = false;
- if (object instanceof Change) {
- Change change = (Change) object;
- try {
- Artifact toCheck = change.getChangeArtifact();
- if (toCheck != null) {
- FileSystemRenderer renderer = RendererManager.getBestFileRenderer(PresentationType.DIFF, toCheck);
- isValidSelection = renderer.supportsCompare();
- }
- } catch (OseeCoreException ex) {
- }
- }
- return isValidSelection;
- }
- }
-
- private static final class SelectionListener extends SelectionAdapter {
- private final Viewer viewer;
-
- public SelectionListener(Viewer viewer) {
- super();
- this.viewer = viewer;
- }
-
- @Override
- public void widgetSelected(SelectionEvent ev) {
- try {
- processSelectedArtifacts();
- } catch (Exception ex) {
- }
- }
-
- private void processSelectedArtifacts() throws Exception {
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
- if (selection.size() == 2) {
- Object[] selections = selection.toArray();
- Object selectionA = selections[0];
- Object selectionB = selections[1];
- ArtifactDelta artifactDelta = asArtifactDelta(selectionA, selectionB);
- if (artifactDelta != null) {
- RendererManager.diffInJob(artifactDelta);
- }
- }
- }
-
- private ArtifactDelta asArtifactDelta(Object selectionA, Object selectionB) throws OseeCoreException {
- ArtifactDelta toReturn = null;
- if (selectionA instanceof Change && selectionB instanceof Change) {
- Change changeA = (Change) selectionA;
- Change changeB = (Change) selectionB;
-
- Conditions.checkExpressionFailOnTrue(changeA.getArtId() != changeB.getArtId(),
- "Change art ids don't match [%s:%s]", changeA.getArtId(), changeB.getArtId());
-
- int artId = changeA.getArtId();
- TransactionDelta txDelta = asTxDelta(changeA, changeB);
-
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.menu;
+
+import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.INCLUDE_DELETED;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.TransactionDelta;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.util.Conditions;
+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.change.ArtifactDelta;
+import org.eclipse.osee.framework.skynet.core.change.Change;
+import org.eclipse.osee.framework.ui.skynet.render.FileSystemRenderer;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
+import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.events.MenuListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public final class ArtifactDiffMenu {
+
+ private ArtifactDiffMenu() {
+ }
+
+ public static void createDiffMenuItem(Menu parentMenu, Viewer viewer, String subMenuText) {
+ MenuItem diffMenuItem = new MenuItem(parentMenu, SWT.CASCADE);
+ diffMenuItem.setText(subMenuText);
+ diffMenuItem.addSelectionListener(new SelectionListener(viewer));
+ parentMenu.addMenuListener(new CompareMenuListener(viewer, diffMenuItem));
+ }
+
+ private static final class CompareMenuListener implements MenuListener {
+ private final Viewer viewer;
+ private final MenuItem diffMenuItem;
+
+ public CompareMenuListener(Viewer viewer, MenuItem diffMenuItem) {
+ super();
+ this.diffMenuItem = diffMenuItem;
+ this.viewer = viewer;
+ }
+
+ public void menuHidden(MenuEvent e) {
+ }
+
+ public void menuShown(MenuEvent e) {
+ boolean isValidSelection = false;
+
+ IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+ if (selection.size() == 2) {
+ isValidSelection = true;
+ for (Object object : selection.toArray()) {
+ isValidSelection &= isComparable(object);
+ }
+ }
+ diffMenuItem.setEnabled(isValidSelection);
+ }
+
+ private boolean isComparable(Object object) {
+ boolean isValidSelection = false;
+ if (object instanceof Change) {
+ Change change = (Change) object;
+ try {
+ Artifact toCheck = change.getChangeArtifact();
+ if (toCheck != null) {
+ FileSystemRenderer renderer = RendererManager.getBestFileRenderer(PresentationType.DIFF, toCheck);
+ isValidSelection = renderer.supportsCompare();
+ }
+ } catch (OseeCoreException ex) {
+ }
+ }
+ return isValidSelection;
+ }
+ }
+
+ private static final class SelectionListener extends SelectionAdapter {
+ private final Viewer viewer;
+
+ public SelectionListener(Viewer viewer) {
+ super();
+ this.viewer = viewer;
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent ev) {
+ try {
+ processSelectedArtifacts();
+ } catch (Exception ex) {
+ }
+ }
+
+ private void processSelectedArtifacts() throws Exception {
+ IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+ if (selection.size() == 2) {
+ Object[] selections = selection.toArray();
+ Object selectionA = selections[0];
+ Object selectionB = selections[1];
+ ArtifactDelta artifactDelta = asArtifactDelta(selectionA, selectionB);
+ if (artifactDelta != null) {
+ RendererManager.diffInJob(artifactDelta);
+ }
+ }
+ }
+
+ private ArtifactDelta asArtifactDelta(Object selectionA, Object selectionB) throws OseeCoreException {
+ ArtifactDelta toReturn = null;
+ if (selectionA instanceof Change && selectionB instanceof Change) {
+ Change changeA = (Change) selectionA;
+ Change changeB = (Change) selectionB;
+
+ Conditions.checkExpressionFailOnTrue(changeA.getArtId() != changeB.getArtId(),
+ "Change art ids don't match [%s:%s]", changeA.getArtId(), changeB.getArtId());
+
+ int artId = changeA.getArtId();
+ TransactionDelta txDelta = asTxDelta(changeA, changeB);
+
Artifact startArtifact =
ArtifactQuery.getHistoricalArtifactFromId(artId, txDelta.getStartTx(), INCLUDE_DELETED);
Artifact endArtifact =
ArtifactQuery.getHistoricalArtifactFromId(artId, txDelta.getEndTx(), INCLUDE_DELETED);
- toReturn = new ArtifactDelta(txDelta, startArtifact, endArtifact);
- }
- return toReturn;
- }
-
- private TransactionDelta asTxDelta(Change first, Change second) throws OseeCoreException {
- TransactionRecord startTx = first.getChangeArtifact().getTransactionRecord();
- TransactionRecord endTx = second.getChangeArtifact().getTransactionRecord();
- if (startTx.getId() > endTx.getId()) {
- startTx = second.getChangeArtifact().getTransactionRecord();
+ toReturn = new ArtifactDelta(txDelta, startArtifact, endArtifact);
+ }
+ return toReturn;
+ }
+
+ private TransactionDelta asTxDelta(Change first, Change second) throws OseeCoreException {
+ TransactionRecord startTx = first.getChangeArtifact().getTransactionRecord();
+ TransactionRecord endTx = second.getChangeArtifact().getTransactionRecord();
+ if (startTx.getId() > endTx.getId()) {
+ startTx = second.getChangeArtifact().getTransactionRecord();
endTx = first.getChangeArtifact().getTransactionRecord();
- }
- return new TransactionDelta(startTx, endTx);
- }
-
- }
-}
+ }
+ return new TransactionDelta(startTx, endTx);
+ }
+
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/menu/GlobalMenuPermissions.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/menu/GlobalMenuPermissions.java
index 236ffb8f430..30d785d557b 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/menu/GlobalMenuPermissions.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/menu/GlobalMenuPermissions.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.framework.ui.skynet.menu;
-
-import java.util.Arrays;
-import java.util.Collection;
-import org.eclipse.osee.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-
-/**
- * @author Donald G. Dunne
- */
-public class GlobalMenuPermissions {
- private boolean isLocked;
- private boolean accessToRemoveLock;
- private boolean writePermission;
- private boolean readPermission;
- private boolean fullAccess;
- private String subjectFromLockedObjectName;
- private final boolean hasArtifacts;
-
- /**
- * Return permission set. This is a one-shot deal at the time of instantiation. Permissions are not kept up to date
- * with changes to getSelectedArtifacts in given globalMenuHelper. Must be called again to get refreshed permissions.
- *
- * @param globalMenuHelper
- */
- public GlobalMenuPermissions(IGlobalMenuHelper globalMenuHelper) throws OseeCoreException {
- this(globalMenuHelper.getArtifacts());
- }
-
- /**
- * Return permission set for given artifact.
- *
- * @param artifact
- */
- public GlobalMenuPermissions(Artifact artifact) throws OseeCoreException {
- this(Arrays.asList(artifact));
- }
-
- /**
- * Return permission set for given artifacts.
- *
- * @param artifacts
- */
- public GlobalMenuPermissions(Collection<Artifact> artifacts) throws OseeCoreException {
- hasArtifacts = artifacts.size() > 0;
- writePermission = true;
- readPermission = true;
- fullAccess = true;
- isLocked = false;
- accessToRemoveLock = true;
- Artifact combinationSubject = null;
-
- for (Artifact objectArtifact : artifacts) {
-
- writePermission &=
- AccessControlManager.hasPermission(objectArtifact, PermissionEnum.WRITE) && objectArtifact.getBranch().isEditable();
- readPermission &= AccessControlManager.hasPermission(objectArtifact, PermissionEnum.READ);
- fullAccess &= AccessControlManager.hasPermission(objectArtifact, PermissionEnum.FULLACCESS);
- isLocked |= AccessControlManager.hasLock(objectArtifact);
- accessToRemoveLock &= AccessControlManager.canUnlockObject(objectArtifact, UserManager.getUser());
-
- // acquire the name of the subject that has the lock
- Artifact subject = AccessControlManager.getSubjectFromLockedObject(objectArtifact);
-
- if (isLocked && subject != null) {
- if (combinationSubject == null) {
- combinationSubject = subject;
- subjectFromLockedObjectName = combinationSubject.getName();
- } else if (!combinationSubject.equals(subject)) {
- subjectFromLockedObjectName = "Mixed names";
- }
- }
- }
- }
-
- /**
- * @return the isLocked
- */
- public boolean isLocked() {
- return isLocked;
- }
-
- /**
- * @return the accessToRemoveLock
- */
- public boolean isAccessToRemoveLock() {
- return accessToRemoveLock;
- }
-
- /**
- * @return the writePermission
- */
- public boolean isWritePermission() {
- return writePermission;
- }
-
- /**
- * @return the readPermission
- */
- public boolean isReadPermission() {
- return readPermission;
- }
-
- /**
- * @return the fullAccess
- */
- public boolean isFullAccess() {
- return fullAccess;
- }
-
- /**
- * @return the subjectFromLockedObjectName
- */
- public String getSubjectFromLockedObjectName() {
- return subjectFromLockedObjectName;
- }
-
- /**
- * @return the branchReadable
- */
- public boolean isBranchReadable(Branch branch) throws OseeCoreException {
- return AccessControlManager.hasPermission(branch, PermissionEnum.READ);
- }
-
- /**
- * @return the hasArtifacts
- */
- public boolean isHasArtifacts() {
- return hasArtifacts;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.menu;
+
+import java.util.Arrays;
+import java.util.Collection;
+import org.eclipse.osee.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class GlobalMenuPermissions {
+ private boolean isLocked;
+ private boolean accessToRemoveLock;
+ private boolean writePermission;
+ private boolean readPermission;
+ private boolean fullAccess;
+ private String subjectFromLockedObjectName;
+ private final boolean hasArtifacts;
+
+ /**
+ * Return permission set. This is a one-shot deal at the time of instantiation. Permissions are not kept up to date
+ * with changes to getSelectedArtifacts in given globalMenuHelper. Must be called again to get refreshed permissions.
+ *
+ * @param globalMenuHelper
+ */
+ public GlobalMenuPermissions(IGlobalMenuHelper globalMenuHelper) throws OseeCoreException {
+ this(globalMenuHelper.getArtifacts());
+ }
+
+ /**
+ * Return permission set for given artifact.
+ *
+ * @param artifact
+ */
+ public GlobalMenuPermissions(Artifact artifact) throws OseeCoreException {
+ this(Arrays.asList(artifact));
+ }
+
+ /**
+ * Return permission set for given artifacts.
+ *
+ * @param artifacts
+ */
+ public GlobalMenuPermissions(Collection<Artifact> artifacts) throws OseeCoreException {
+ hasArtifacts = artifacts.size() > 0;
+ writePermission = true;
+ readPermission = true;
+ fullAccess = true;
+ isLocked = false;
+ accessToRemoveLock = true;
+ Artifact combinationSubject = null;
+
+ for (Artifact objectArtifact : artifacts) {
+
+ writePermission &=
+ AccessControlManager.hasPermission(objectArtifact, PermissionEnum.WRITE) && objectArtifact.getBranch().isEditable();
+ readPermission &= AccessControlManager.hasPermission(objectArtifact, PermissionEnum.READ);
+ fullAccess &= AccessControlManager.hasPermission(objectArtifact, PermissionEnum.FULLACCESS);
+ isLocked |= AccessControlManager.hasLock(objectArtifact);
+ accessToRemoveLock &= AccessControlManager.canUnlockObject(objectArtifact, UserManager.getUser());
+
+ // acquire the name of the subject that has the lock
+ Artifact subject = AccessControlManager.getSubjectFromLockedObject(objectArtifact);
+
+ if (isLocked && subject != null) {
+ if (combinationSubject == null) {
+ combinationSubject = subject;
+ subjectFromLockedObjectName = combinationSubject.getName();
+ } else if (!combinationSubject.equals(subject)) {
+ subjectFromLockedObjectName = "Mixed names";
+ }
+ }
+ }
+ }
+
+ /**
+ * @return the isLocked
+ */
+ public boolean isLocked() {
+ return isLocked;
+ }
+
+ /**
+ * @return the accessToRemoveLock
+ */
+ public boolean isAccessToRemoveLock() {
+ return accessToRemoveLock;
+ }
+
+ /**
+ * @return the writePermission
+ */
+ public boolean isWritePermission() {
+ return writePermission;
+ }
+
+ /**
+ * @return the readPermission
+ */
+ public boolean isReadPermission() {
+ return readPermission;
+ }
+
+ /**
+ * @return the fullAccess
+ */
+ public boolean isFullAccess() {
+ return fullAccess;
+ }
+
+ /**
+ * @return the subjectFromLockedObjectName
+ */
+ public String getSubjectFromLockedObjectName() {
+ return subjectFromLockedObjectName;
+ }
+
+ /**
+ * @return the branchReadable
+ */
+ public boolean isBranchReadable(Branch branch) throws OseeCoreException {
+ return AccessControlManager.hasPermission(branch, PermissionEnum.READ);
+ }
+
+ /**
+ * @return the hasArtifacts
+ */
+ public boolean isHasArtifacts() {
+ return hasArtifacts;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/ConflictResolutionWizard.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/ConflictResolutionWizard.java
index b347384bdef..0711e598792 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/ConflictResolutionWizard.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/ConflictResolutionWizard.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.framework.ui.skynet.mergeWizard;
-
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.conflict.AttributeConflict;
-import org.eclipse.osee.framework.skynet.core.conflict.Conflict;
-import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.XMergeLabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Theron Virgin
- */
-public class ConflictResolutionWizard extends Wizard {
- public static final String TITLE = "How would you like to resolve this conflict?";
- public static final String INDENT = " ";
- public static final String SOURCE_TITLE = "Source Value:";
- public static final String DEST_TITLE = "Destination value:";
- public static final String ART_TEXT = "Artifact: ";
- public static final String TYPE_TEXT = "Attribute type: ";
-
- private WizardPage editWizardPage;
- private final AttributeConflict conflict;
-
- public ConflictResolutionWizard(Conflict conflict) {
- if (conflict instanceof AttributeConflict)
- this.conflict = (AttributeConflict) conflict;
- else
- this.conflict = null;
-
- }
-
- @Override
- public void addPages() {
- if (conflict.isWordAttribute()) {
- editWizardPage = new EditWFCAttributeWizardPage(conflict);
- } else {
- editWizardPage = new EditAttributeWizardPage(conflict);
- }
- addPage(editWizardPage);
- }
-
- @Override
- public boolean performFinish() {
- IWizardPage page = getContainer().getCurrentPage();
- if (page instanceof EditAttributeWizardPage) {
- return ((EditAttributeWizardPage) page).closingPage();
- } else if (page instanceof EditWFCAttributeWizardPage) {
- return ((EditWFCAttributeWizardPage) page).closingPage();
- }
- return true;
- }
-
- @Override
- public boolean canFinish() {
- return true;
- }
-
- public boolean getResolved() {
- return true;
- }
-
- @Override
- public IWizardPage getStartingPage() {
- if (conflict.isWordAttribute())
- return getPage(EditWFCAttributeWizardPage.TITLE);
- else
- return getPage(EditAttributeWizardPage.TITLE);
-
- }
-
- @Override
- public IWizardPage getPreviousPage(IWizardPage page) {
- return null;
- }
-
- @Override
- public boolean performCancel() {
- return super.performCancel();
- }
-
- public void setResolution() throws OseeCoreException {
- if (getContainer() != null) {
- IWizardPage page = getContainer().getCurrentPage();
- Image image = XMergeLabelProvider.getMergeImage(conflict);
- if (page instanceof EditAttributeWizardPage) {
- ((EditAttributeWizardPage) page).setResolution(image);
- } else if (page instanceof EditWFCAttributeWizardPage) {
- ((EditWFCAttributeWizardPage) page).setResolution(image);
- }
- }
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.mergeWizard;
+
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.conflict.AttributeConflict;
+import org.eclipse.osee.framework.skynet.core.conflict.Conflict;
+import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.XMergeLabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Theron Virgin
+ */
+public class ConflictResolutionWizard extends Wizard {
+ public static final String TITLE = "How would you like to resolve this conflict?";
+ public static final String INDENT = " ";
+ public static final String SOURCE_TITLE = "Source Value:";
+ public static final String DEST_TITLE = "Destination value:";
+ public static final String ART_TEXT = "Artifact: ";
+ public static final String TYPE_TEXT = "Attribute type: ";
+
+ private WizardPage editWizardPage;
+ private final AttributeConflict conflict;
+
+ public ConflictResolutionWizard(Conflict conflict) {
+ if (conflict instanceof AttributeConflict)
+ this.conflict = (AttributeConflict) conflict;
+ else
+ this.conflict = null;
+
+ }
+
+ @Override
+ public void addPages() {
+ if (conflict.isWordAttribute()) {
+ editWizardPage = new EditWFCAttributeWizardPage(conflict);
+ } else {
+ editWizardPage = new EditAttributeWizardPage(conflict);
+ }
+ addPage(editWizardPage);
+ }
+
+ @Override
+ public boolean performFinish() {
+ IWizardPage page = getContainer().getCurrentPage();
+ if (page instanceof EditAttributeWizardPage) {
+ return ((EditAttributeWizardPage) page).closingPage();
+ } else if (page instanceof EditWFCAttributeWizardPage) {
+ return ((EditWFCAttributeWizardPage) page).closingPage();
+ }
+ return true;
+ }
+
+ @Override
+ public boolean canFinish() {
+ return true;
+ }
+
+ public boolean getResolved() {
+ return true;
+ }
+
+ @Override
+ public IWizardPage getStartingPage() {
+ if (conflict.isWordAttribute())
+ return getPage(EditWFCAttributeWizardPage.TITLE);
+ else
+ return getPage(EditAttributeWizardPage.TITLE);
+
+ }
+
+ @Override
+ public IWizardPage getPreviousPage(IWizardPage page) {
+ return null;
+ }
+
+ @Override
+ public boolean performCancel() {
+ return super.performCancel();
+ }
+
+ public void setResolution() throws OseeCoreException {
+ if (getContainer() != null) {
+ IWizardPage page = getContainer().getCurrentPage();
+ Image image = XMergeLabelProvider.getMergeImage(conflict);
+ if (page instanceof EditAttributeWizardPage) {
+ ((EditAttributeWizardPage) page).setResolution(image);
+ } else if (page instanceof EditWFCAttributeWizardPage) {
+ ((EditWFCAttributeWizardPage) page).setResolution(image);
+ }
+ }
+
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditAttributeWizardPage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditAttributeWizardPage.java
index 0fe3d568260..0fa3f5198ee 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditAttributeWizardPage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditAttributeWizardPage.java
@@ -1,180 +1,180 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.mergeWizard;
-
-import java.util.Arrays;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.wizard.WizardPage;
-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.conflict.AttributeConflict;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-
-/**
- * @author Theron Virgin
- */
-public class EditAttributeWizardPage extends WizardPage {
-
- public static final String TITLE = "Editor Page";
- private AttributeConflict conflict;
- private String changeType = "";
- private Button sourceButton;
- private Button destButton;
- private Button clearButton;
- private Label imageLabel;
- private static final String SOURCE_BUTTON_TEXT = "Load Source Data";
- private static final String SOURCE_TEXT = ConflictResolutionWizard.SOURCE_TITLE;
- private static final String SOURCE_TOOLTIP = "Load the Editor with the Source Branch Attribute Value";
- private static final String DEST_BUTTON_TEXT = "Load Destination Data";
- private static final String DEST_TEXT = ConflictResolutionWizard.DEST_TITLE;
- private static final String DEST_TOOLTIP = "Load the Editor with the Destination Branch Attribute Value";
- private static final String CLEAR_BUTTON_TEXT = "Clear the Editor Value";
- private static final String CLEAR_TOOLTIP = "Clear the Editor Value";
- private static final int NUM_COLUMNS = 1;
- private IEmbeddedAttributeEditor editor;
-
- private final Listener listener = new Listener() {
- public void handleEvent(Event event) {
- // ...
- try {
- if (conflict.okToOverwriteMerge()) {
- if (event.widget == sourceButton) {
- if (conflict.getSourceObject() != null) {
- editor.update(conflict.getSourceObject());
- }
- }
- if (event.widget == destButton) {
- if (conflict.getDestObject() != null) {
- editor.update(conflict.getDestObject());
- }
- }
- if (event.widget == clearButton) {
- editor.update("");
- }
- } else {
- MessageDialog.openInformation(getShell(), "Attention", MergeUtility.COMMITED_PROMPT);
- }
-
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- getWizard().getContainer().updateButtons();
- }
- };
-
- /**
- * @param pageName
- */
-
- public EditAttributeWizardPage(AttributeConflict conflict) {
- super(TITLE);
- try {
- this.conflict = conflict;
- changeType = conflict.getAttributeType().getName();
- if (!conflict.isWordAttribute()) {
- editor =
- EmbededAttributeEditorFactory.getEmbeddedEditor(conflict.getAttributeType(),
- conflict.getSourceDisplayData(), Arrays.asList(conflict), true);
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @Override
- public void createControl(Composite parent) {
- setTitle("Edit the attribute ");
- Composite composite = new Composite(parent, SWT.NONE);
-
- if (editor == null) {
- setControl(composite);
- return;
- }
-
- GridLayout gl = new GridLayout();
- gl.numColumns = NUM_COLUMNS;
- composite.setLayout(gl);
- GridData gd = new GridData(SWT.BEGINNING);
- composite.setLayoutData(gd);
- gd.horizontalSpan = NUM_COLUMNS;
-
- imageLabel = new Label(composite, SWT.NONE);
- imageLabel.setText("hello there");
- imageLabel.setImage(null);
-
- try {
- new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.ART_TEXT);
- new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.INDENT + conflict.getArtifactName());
- new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.TYPE_TEXT);
- new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.INDENT + changeType);
-
- new Label(composite, SWT.NONE).setText("");
-
- new Label(composite, SWT.NONE).setText(SOURCE_TEXT);
- new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.INDENT + conflict.getSourceDisplayData());
- // sourceButton =
- // createButton(conflict.getSourceDisplayData(),SOURCE_TOOLTIP,composite,gd);
- new Label(composite, SWT.NONE).setText(DEST_TEXT);
- new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.INDENT + conflict.getDestDisplayData());
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
-
- Composite buttonComp = new Composite(composite, SWT.NONE);
- GridLayout glay = new GridLayout();
- glay.numColumns = 3;
- buttonComp.setLayout(glay);
- GridData gdata = new GridData(SWT.FILL);
- buttonComp.setLayoutData(gdata);
- gdata.horizontalSpan = 1;
-
- sourceButton = createButton(SOURCE_BUTTON_TEXT, SOURCE_TOOLTIP, buttonComp);
- destButton = createButton(DEST_BUTTON_TEXT, DEST_TOOLTIP, buttonComp);
- // clearButton = createButton(CLEAR_BUTTON_TEXT, CLEAR_TOOLTIP,
- // buttonComp, gdata);
-
- editor.create(composite, gd);
-
- setControl(composite);
- }
-
- private Button createButton(String text, String tooltip, Composite composite) {
- Button button = new Button(composite, SWT.PUSH);
- button.addListener(SWT.Selection, listener);
- button.setText(text);
- button.setToolTipText(tooltip);
- return button;
- }
-
- public boolean canFinish() {
- return editor.canFinish();
- }
-
- public boolean closingPage() {
- return editor.commit();
- }
-
- public void setResolution(Image image) {
- imageLabel.setImage(image);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.mergeWizard;
+
+import java.util.Arrays;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.wizard.WizardPage;
+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.conflict.AttributeConflict;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+
+/**
+ * @author Theron Virgin
+ */
+public class EditAttributeWizardPage extends WizardPage {
+
+ public static final String TITLE = "Editor Page";
+ private AttributeConflict conflict;
+ private String changeType = "";
+ private Button sourceButton;
+ private Button destButton;
+ private Button clearButton;
+ private Label imageLabel;
+ private static final String SOURCE_BUTTON_TEXT = "Load Source Data";
+ private static final String SOURCE_TEXT = ConflictResolutionWizard.SOURCE_TITLE;
+ private static final String SOURCE_TOOLTIP = "Load the Editor with the Source Branch Attribute Value";
+ private static final String DEST_BUTTON_TEXT = "Load Destination Data";
+ private static final String DEST_TEXT = ConflictResolutionWizard.DEST_TITLE;
+ private static final String DEST_TOOLTIP = "Load the Editor with the Destination Branch Attribute Value";
+ private static final String CLEAR_BUTTON_TEXT = "Clear the Editor Value";
+ private static final String CLEAR_TOOLTIP = "Clear the Editor Value";
+ private static final int NUM_COLUMNS = 1;
+ private IEmbeddedAttributeEditor editor;
+
+ private final Listener listener = new Listener() {
+ public void handleEvent(Event event) {
+ // ...
+ try {
+ if (conflict.okToOverwriteMerge()) {
+ if (event.widget == sourceButton) {
+ if (conflict.getSourceObject() != null) {
+ editor.update(conflict.getSourceObject());
+ }
+ }
+ if (event.widget == destButton) {
+ if (conflict.getDestObject() != null) {
+ editor.update(conflict.getDestObject());
+ }
+ }
+ if (event.widget == clearButton) {
+ editor.update("");
+ }
+ } else {
+ MessageDialog.openInformation(getShell(), "Attention", MergeUtility.COMMITED_PROMPT);
+ }
+
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ getWizard().getContainer().updateButtons();
+ }
+ };
+
+ /**
+ * @param pageName
+ */
+
+ public EditAttributeWizardPage(AttributeConflict conflict) {
+ super(TITLE);
+ try {
+ this.conflict = conflict;
+ changeType = conflict.getAttributeType().getName();
+ if (!conflict.isWordAttribute()) {
+ editor =
+ EmbededAttributeEditorFactory.getEmbeddedEditor(conflict.getAttributeType(),
+ conflict.getSourceDisplayData(), Arrays.asList(conflict), true);
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ setTitle("Edit the attribute ");
+ Composite composite = new Composite(parent, SWT.NONE);
+
+ if (editor == null) {
+ setControl(composite);
+ return;
+ }
+
+ GridLayout gl = new GridLayout();
+ gl.numColumns = NUM_COLUMNS;
+ composite.setLayout(gl);
+ GridData gd = new GridData(SWT.BEGINNING);
+ composite.setLayoutData(gd);
+ gd.horizontalSpan = NUM_COLUMNS;
+
+ imageLabel = new Label(composite, SWT.NONE);
+ imageLabel.setText("hello there");
+ imageLabel.setImage(null);
+
+ try {
+ new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.ART_TEXT);
+ new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.INDENT + conflict.getArtifactName());
+ new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.TYPE_TEXT);
+ new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.INDENT + changeType);
+
+ new Label(composite, SWT.NONE).setText("");
+
+ new Label(composite, SWT.NONE).setText(SOURCE_TEXT);
+ new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.INDENT + conflict.getSourceDisplayData());
+ // sourceButton =
+ // createButton(conflict.getSourceDisplayData(),SOURCE_TOOLTIP,composite,gd);
+ new Label(composite, SWT.NONE).setText(DEST_TEXT);
+ new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.INDENT + conflict.getDestDisplayData());
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ Composite buttonComp = new Composite(composite, SWT.NONE);
+ GridLayout glay = new GridLayout();
+ glay.numColumns = 3;
+ buttonComp.setLayout(glay);
+ GridData gdata = new GridData(SWT.FILL);
+ buttonComp.setLayoutData(gdata);
+ gdata.horizontalSpan = 1;
+
+ sourceButton = createButton(SOURCE_BUTTON_TEXT, SOURCE_TOOLTIP, buttonComp);
+ destButton = createButton(DEST_BUTTON_TEXT, DEST_TOOLTIP, buttonComp);
+ // clearButton = createButton(CLEAR_BUTTON_TEXT, CLEAR_TOOLTIP,
+ // buttonComp, gdata);
+
+ editor.create(composite, gd);
+
+ setControl(composite);
+ }
+
+ private Button createButton(String text, String tooltip, Composite composite) {
+ Button button = new Button(composite, SWT.PUSH);
+ button.addListener(SWT.Selection, listener);
+ button.setText(text);
+ button.setToolTipText(tooltip);
+ return button;
+ }
+
+ public boolean canFinish() {
+ return editor.canFinish();
+ }
+
+ public boolean closingPage() {
+ return editor.commit();
+ }
+
+ public void setResolution(Image image) {
+ imageLabel.setImage(image);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditWFCAttributeWizardPage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditWFCAttributeWizardPage.java
index 38c01ecbae3..93301d9eae9 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditWFCAttributeWizardPage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EditWFCAttributeWizardPage.java
@@ -1,235 +1,235 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.mergeWizard;
-
-import java.util.Date;
-import org.eclipse.jface.wizard.WizardPage;
-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.conflict.AttributeConflict;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-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.xmerge.MergeUtility;
-import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.XMergeLabelProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-
-/**
- * @author Theron Virgin
- */
-public class EditWFCAttributeWizardPage extends WizardPage {
-
- public static final String TITLE = "WFC Editor Page";
- private AttributeConflict conflict;
- private String changeType = "";
- private Button editButton;
- private Button mergeButton;
- private Button clearButton;
- private Button sourceButton;
- private Button destButton;
- private Button sourceDiffButton;
- private Button destDiffButton;
- private Button sourceDestDiffButton;
- private Button sourceMergeDiffButton;
- private Button destMergeDiffButton;
- private Label imageLabel;
- private static final String EDIT_TEXT = "Edit Merge Artifact";
- private static final String EDIT_TOOLTIP = "Make additional changes using the Document/Merge Editor";
- private static final String MERGE_TEXT = "Generate Three Way Merge (Developmental)";
- private static final String MERGE_TOOLTIP = "Use the new inline merging";
- private static final String CLEAR_TEXT = "Clear the Merge Artifact";
- private static final String CLEAR_TOOLTIP = "Reinitializes the merge for this Document";
- private static final String SOURCE_TEXT = "Populate with Source Data";
- private static final String SOURCE_TOOLTIP = "Initialize the Document with Source Values";
- private static final String DEST_TEXT = "Populate with Destination Data";
- private static final String DEST_TOOLTIP = "Initialize the Document with Destination Values";
- private static final String SDIFF_TEXT = "Show Source Diff";
- private static final String SDIFF_TOOLTIP =
- "Show the differences between the current Source" + " artifact and the artifact at the time the Source Branch was created";
- private static final String DDIFF_TEXT = "Show Destination Diff";
- private static final String DDIFF_TOOLTIP =
- "Show the differences between the current Destination" + " artifact and the artifact at the time the Source Branch was created";
- private static final String SDDIFF_TEXT = "Show Source/Destination Diff";
- private static final String SDDIFF_TOOLTIP =
- "Show the differences between the current Source" + " artifact and the current Merge artifact";
- private static final String SMDIFF_TEXT = "Show Source/Merge Diff";
- private static final String SMDIFF_TOOLTIP =
- "Show the differences between the current Destination" + " artifact and the current Merge artifact";
- private static final String DMDIFF_TEXT = "Show Destination/Merge Diff";
- private static final String DMDIFF_TOOLTIP =
- "Show the differences between the current Destination" + " artifact and the current Source artifact";
- private static final int NUM_COLUMNS = 1;
-
- private final Listener listener = new Listener() {
- public void handleEvent(Event event) {
- // ...
-
- try {
- if (event.widget == editButton) {
- RendererManager.openInJob(conflict.getArtifact(), PresentationType.SPECIALIZED_EDIT);
- conflict.markStatusToReflectEdit();
- } else if (event.widget == clearButton) {
- MergeUtility.clearValue(conflict, getShell(), true);
- } else if (event.widget == sourceButton) {
- MergeUtility.setToSource(conflict, getShell(), true);
- } else if (event.widget == destButton) {
- MergeUtility.setToDest(conflict, getShell(), true);
- } else if (event.widget == sourceDiffButton) {
- MergeUtility.showCompareFile(MergeUtility.getStartArtifact(conflict), conflict.getSourceArtifact(),
- "Source_Diff_For_" + conflict.getArtifact().getSafeName() + (new Date()).toString().replaceAll(
- ":", ";") + ".xml");
- } else if (event.widget == destDiffButton) {
- MergeUtility.showCompareFile(
- MergeUtility.getStartArtifact(conflict),
- conflict.getDestArtifact(),
- "Destination_Diff_For_" + conflict.getArtifact().getSafeName() + (new Date()).toString().replaceAll(
- ":", ";") + ".xml");
- } else if (event.widget == sourceDestDiffButton) {
- MergeUtility.showCompareFile(
- conflict.getSourceArtifact(),
- conflict.getDestArtifact(),
- "Source_Destination_Diff_For_" + conflict.getArtifact().getSafeName() + (new Date()).toString().replaceAll(
- ":", ";") + ".xml");
- } else if (event.widget == sourceMergeDiffButton) {
- if (conflict.wordMarkupPresent()) {
- throw new OseeCoreException(AttributeConflict.DIFF_MERGE_MARKUP);
- }
- MergeUtility.showCompareFile(
- conflict.getSourceArtifact(),
- conflict.getArtifact(),
- "Source_Merge_Diff_For_" + conflict.getArtifact().getSafeName() + (new Date()).toString().replaceAll(
- ":", ";") + ".xml");
- } else if (event.widget == destMergeDiffButton) {
- if (conflict.wordMarkupPresent()) {
- throw new OseeCoreException(AttributeConflict.DIFF_MERGE_MARKUP);
- }
- MergeUtility.showCompareFile(
- conflict.getDestArtifact(),
- conflict.getArtifact(),
- "Destination_Merge_Diff_For_" + conflict.getArtifact().getSafeName() + (new Date()).toString().replaceAll(
- ":", ";") + ".xml");
- } else if (event.widget == mergeButton) {
- MergeUtility.launchMerge(conflict, getShell());
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- getWizard().getContainer().updateButtons();
- }
- };
-
- /**
- * @param pageName
- */
-
- public EditWFCAttributeWizardPage(AttributeConflict conflict) {
- super(TITLE);
- try {
- if (conflict != null) {
- this.conflict = conflict;
- changeType = conflict.getAttributeType().getName();
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @Override
- public void createControl(Composite parent) {
- setTitle("Edit the attribute ");
-
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout gl = new GridLayout();
- gl.numColumns = NUM_COLUMNS;
- composite.setLayout(gl);
- GridData gd = new GridData(SWT.BEGINNING);
- composite.setLayoutData(gd);
- gd.horizontalSpan = NUM_COLUMNS;
-
- imageLabel = new Label(composite, SWT.NONE);
- imageLabel.setImage(null);
-
- try {
- new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.ART_TEXT);
- new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.INDENT + conflict.getArtifactName());
- new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.TYPE_TEXT);
- new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.INDENT + changeType);
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
-
- new Label(composite, SWT.NONE);
-
- editButton = createButton(EDIT_TEXT, EDIT_TOOLTIP, composite);
- mergeButton = createButton(MERGE_TEXT, MERGE_TOOLTIP, composite);
- new Label(composite, SWT.NONE);
- sourceButton = createButton(SOURCE_TEXT, SOURCE_TOOLTIP, composite);
- destButton = createButton(DEST_TEXT, DEST_TOOLTIP, composite);
- clearButton = createButton(CLEAR_TEXT, CLEAR_TOOLTIP, composite);
- new Label(composite, SWT.NONE);
-
- Composite buttonComp = new Composite(composite, SWT.NONE);
- GridLayout glay = new GridLayout();
- glay.numColumns = 3;
- buttonComp.setLayout(glay);
- GridData gdata = new GridData(SWT.FILL);
- buttonComp.setLayoutData(gdata);
- gdata.horizontalSpan = 1;
-
- sourceDiffButton = createButton(SDIFF_TEXT, SDIFF_TOOLTIP, buttonComp);
- destDiffButton = createButton(DDIFF_TEXT, DDIFF_TOOLTIP, buttonComp);
- sourceDestDiffButton = createButton(SDDIFF_TEXT, SDDIFF_TOOLTIP, buttonComp);
- sourceMergeDiffButton = createButton(SMDIFF_TEXT, SMDIFF_TOOLTIP, buttonComp);
- destMergeDiffButton = createButton(DMDIFF_TEXT, DMDIFF_TOOLTIP, buttonComp);
- if (MergeUtility.getStartArtifact(conflict) == null) {
- sourceDiffButton.setEnabled(false);
- destDiffButton.setEnabled(false);
- }
-
- try {
- setResolution(XMergeLabelProvider.getMergeImage(conflict));
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
-
- setControl(composite);
- }
-
- private Button createButton(String text, String tooltip, Composite composite) {
- Button button = new Button(composite, SWT.PUSH);
- button.addListener(SWT.Selection, listener);
- button.setText(text);
- button.setToolTipText(tooltip);
- return button;
- }
-
- public boolean canFinish() {
- return true;
- }
-
- public boolean closingPage() {
- return true;
- }
-
- public void setResolution(Image image) {
- imageLabel.setImage(image);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.mergeWizard;
+
+import java.util.Date;
+import org.eclipse.jface.wizard.WizardPage;
+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.conflict.AttributeConflict;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+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.xmerge.MergeUtility;
+import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.XMergeLabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+
+/**
+ * @author Theron Virgin
+ */
+public class EditWFCAttributeWizardPage extends WizardPage {
+
+ public static final String TITLE = "WFC Editor Page";
+ private AttributeConflict conflict;
+ private String changeType = "";
+ private Button editButton;
+ private Button mergeButton;
+ private Button clearButton;
+ private Button sourceButton;
+ private Button destButton;
+ private Button sourceDiffButton;
+ private Button destDiffButton;
+ private Button sourceDestDiffButton;
+ private Button sourceMergeDiffButton;
+ private Button destMergeDiffButton;
+ private Label imageLabel;
+ private static final String EDIT_TEXT = "Edit Merge Artifact";
+ private static final String EDIT_TOOLTIP = "Make additional changes using the Document/Merge Editor";
+ private static final String MERGE_TEXT = "Generate Three Way Merge (Developmental)";
+ private static final String MERGE_TOOLTIP = "Use the new inline merging";
+ private static final String CLEAR_TEXT = "Clear the Merge Artifact";
+ private static final String CLEAR_TOOLTIP = "Reinitializes the merge for this Document";
+ private static final String SOURCE_TEXT = "Populate with Source Data";
+ private static final String SOURCE_TOOLTIP = "Initialize the Document with Source Values";
+ private static final String DEST_TEXT = "Populate with Destination Data";
+ private static final String DEST_TOOLTIP = "Initialize the Document with Destination Values";
+ private static final String SDIFF_TEXT = "Show Source Diff";
+ private static final String SDIFF_TOOLTIP =
+ "Show the differences between the current Source" + " artifact and the artifact at the time the Source Branch was created";
+ private static final String DDIFF_TEXT = "Show Destination Diff";
+ private static final String DDIFF_TOOLTIP =
+ "Show the differences between the current Destination" + " artifact and the artifact at the time the Source Branch was created";
+ private static final String SDDIFF_TEXT = "Show Source/Destination Diff";
+ private static final String SDDIFF_TOOLTIP =
+ "Show the differences between the current Source" + " artifact and the current Merge artifact";
+ private static final String SMDIFF_TEXT = "Show Source/Merge Diff";
+ private static final String SMDIFF_TOOLTIP =
+ "Show the differences between the current Destination" + " artifact and the current Merge artifact";
+ private static final String DMDIFF_TEXT = "Show Destination/Merge Diff";
+ private static final String DMDIFF_TOOLTIP =
+ "Show the differences between the current Destination" + " artifact and the current Source artifact";
+ private static final int NUM_COLUMNS = 1;
+
+ private final Listener listener = new Listener() {
+ public void handleEvent(Event event) {
+ // ...
+
+ try {
+ if (event.widget == editButton) {
+ RendererManager.openInJob(conflict.getArtifact(), PresentationType.SPECIALIZED_EDIT);
+ conflict.markStatusToReflectEdit();
+ } else if (event.widget == clearButton) {
+ MergeUtility.clearValue(conflict, getShell(), true);
+ } else if (event.widget == sourceButton) {
+ MergeUtility.setToSource(conflict, getShell(), true);
+ } else if (event.widget == destButton) {
+ MergeUtility.setToDest(conflict, getShell(), true);
+ } else if (event.widget == sourceDiffButton) {
+ MergeUtility.showCompareFile(MergeUtility.getStartArtifact(conflict), conflict.getSourceArtifact(),
+ "Source_Diff_For_" + conflict.getArtifact().getSafeName() + (new Date()).toString().replaceAll(
+ ":", ";") + ".xml");
+ } else if (event.widget == destDiffButton) {
+ MergeUtility.showCompareFile(
+ MergeUtility.getStartArtifact(conflict),
+ conflict.getDestArtifact(),
+ "Destination_Diff_For_" + conflict.getArtifact().getSafeName() + (new Date()).toString().replaceAll(
+ ":", ";") + ".xml");
+ } else if (event.widget == sourceDestDiffButton) {
+ MergeUtility.showCompareFile(
+ conflict.getSourceArtifact(),
+ conflict.getDestArtifact(),
+ "Source_Destination_Diff_For_" + conflict.getArtifact().getSafeName() + (new Date()).toString().replaceAll(
+ ":", ";") + ".xml");
+ } else if (event.widget == sourceMergeDiffButton) {
+ if (conflict.wordMarkupPresent()) {
+ throw new OseeCoreException(AttributeConflict.DIFF_MERGE_MARKUP);
+ }
+ MergeUtility.showCompareFile(
+ conflict.getSourceArtifact(),
+ conflict.getArtifact(),
+ "Source_Merge_Diff_For_" + conflict.getArtifact().getSafeName() + (new Date()).toString().replaceAll(
+ ":", ";") + ".xml");
+ } else if (event.widget == destMergeDiffButton) {
+ if (conflict.wordMarkupPresent()) {
+ throw new OseeCoreException(AttributeConflict.DIFF_MERGE_MARKUP);
+ }
+ MergeUtility.showCompareFile(
+ conflict.getDestArtifact(),
+ conflict.getArtifact(),
+ "Destination_Merge_Diff_For_" + conflict.getArtifact().getSafeName() + (new Date()).toString().replaceAll(
+ ":", ";") + ".xml");
+ } else if (event.widget == mergeButton) {
+ MergeUtility.launchMerge(conflict, getShell());
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ getWizard().getContainer().updateButtons();
+ }
+ };
+
+ /**
+ * @param pageName
+ */
+
+ public EditWFCAttributeWizardPage(AttributeConflict conflict) {
+ super(TITLE);
+ try {
+ if (conflict != null) {
+ this.conflict = conflict;
+ changeType = conflict.getAttributeType().getName();
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ setTitle("Edit the attribute ");
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout gl = new GridLayout();
+ gl.numColumns = NUM_COLUMNS;
+ composite.setLayout(gl);
+ GridData gd = new GridData(SWT.BEGINNING);
+ composite.setLayoutData(gd);
+ gd.horizontalSpan = NUM_COLUMNS;
+
+ imageLabel = new Label(composite, SWT.NONE);
+ imageLabel.setImage(null);
+
+ try {
+ new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.ART_TEXT);
+ new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.INDENT + conflict.getArtifactName());
+ new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.TYPE_TEXT);
+ new Label(composite, SWT.NONE).setText(ConflictResolutionWizard.INDENT + changeType);
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ new Label(composite, SWT.NONE);
+
+ editButton = createButton(EDIT_TEXT, EDIT_TOOLTIP, composite);
+ mergeButton = createButton(MERGE_TEXT, MERGE_TOOLTIP, composite);
+ new Label(composite, SWT.NONE);
+ sourceButton = createButton(SOURCE_TEXT, SOURCE_TOOLTIP, composite);
+ destButton = createButton(DEST_TEXT, DEST_TOOLTIP, composite);
+ clearButton = createButton(CLEAR_TEXT, CLEAR_TOOLTIP, composite);
+ new Label(composite, SWT.NONE);
+
+ Composite buttonComp = new Composite(composite, SWT.NONE);
+ GridLayout glay = new GridLayout();
+ glay.numColumns = 3;
+ buttonComp.setLayout(glay);
+ GridData gdata = new GridData(SWT.FILL);
+ buttonComp.setLayoutData(gdata);
+ gdata.horizontalSpan = 1;
+
+ sourceDiffButton = createButton(SDIFF_TEXT, SDIFF_TOOLTIP, buttonComp);
+ destDiffButton = createButton(DDIFF_TEXT, DDIFF_TOOLTIP, buttonComp);
+ sourceDestDiffButton = createButton(SDDIFF_TEXT, SDDIFF_TOOLTIP, buttonComp);
+ sourceMergeDiffButton = createButton(SMDIFF_TEXT, SMDIFF_TOOLTIP, buttonComp);
+ destMergeDiffButton = createButton(DMDIFF_TEXT, DMDIFF_TOOLTIP, buttonComp);
+ if (MergeUtility.getStartArtifact(conflict) == null) {
+ sourceDiffButton.setEnabled(false);
+ destDiffButton.setEnabled(false);
+ }
+
+ try {
+ setResolution(XMergeLabelProvider.getMergeImage(conflict));
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ setControl(composite);
+ }
+
+ private Button createButton(String text, String tooltip, Composite composite) {
+ Button button = new Button(composite, SWT.PUSH);
+ button.addListener(SWT.Selection, listener);
+ button.setText(text);
+ button.setToolTipText(tooltip);
+ return button;
+ }
+
+ public boolean canFinish() {
+ return true;
+ }
+
+ public boolean closingPage() {
+ return true;
+ }
+
+ public void setResolution(Image image) {
+ imageLabel.setImage(image);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedBooleanAttributeEditor.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedBooleanAttributeEditor.java
index 2b3282f9fcb..602a0adb22a 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedBooleanAttributeEditor.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedBooleanAttributeEditor.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.framework.ui.skynet.mergeWizard;
-
-import java.util.Collection;
-import org.eclipse.osee.framework.core.data.IAttributeType;
-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.conflict.AttributeConflict;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeUtility;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @author Theron Virgin
- */
-/*
- * All of the instance of checks are needed to support both artifacts and
- * conflicts. The reason to support both is I created the classes for
- * artifacts so all of the work was already done for them. I then realized
- * that I needed to control the setting of values for conflicts and thus had to call
- * the conflict specific methods instead of simply setting the values.
- */
-public class EmbeddedBooleanAttributeEditor implements IEmbeddedAttributeEditor {
-
- protected IAttributeType attributeType;
- protected String displayName;
- protected Collection<?> attributeHolder;
- protected boolean persist;
- protected EmbeddedBooleanEditor editor;
-
- public EmbeddedBooleanAttributeEditor(String prompt, Collection<?> attributeHolder, String displayName, IAttributeType attributeType, boolean persist) {
- this.attributeType = attributeType;
- this.displayName = displayName;
- this.attributeHolder = attributeHolder;
- this.persist = persist;
- }
-
- public boolean create(Composite composite, GridData gd) {
- if (attributeHolder == null) {
- return false;
- }
- if (attributeHolder.size() < 1) {
- return false;
- }
- Object obj = attributeHolder.iterator().next();
- if (obj instanceof Artifact) {
- String type = ((Artifact) obj).getArtifactTypeName();
- for (Object object : attributeHolder) {
- if (object instanceof Artifact) {
- if (!type.equals(((Artifact) object).getArtifactTypeName())) {
- AWorkbench.popup("ERROR",
- "All artifacts must be of the same type when " + "edited in a boolean editor.");
- return false;
- }
- } else {
- return false;
- }
- }
- }
- editor = new EmbeddedBooleanEditor("Select a value for the " + attributeType);
- editor.createEditor(composite, gd);
-
- try {
- if (obj instanceof Artifact) {
- try {
- Object object = ((Artifact) obj).getSoleAttributeValue(attributeType);
- if (object instanceof Boolean) {
- editor.setEntry(((Boolean) object).booleanValue());
- } else {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, new Exception(
- "Boolean editor did not receive a boolean value"));
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- if (obj instanceof AttributeConflict) {
- Object object = ((AttributeConflict) obj).getMergeObject();
- if (object instanceof Boolean) {
- editor.setEntry(((Boolean) object).booleanValue());
- }
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return true;
- }
-
- public void update(Object value) {
- if (editor != null) {
- editor.setEntry(((Boolean) value).booleanValue());
- }
- }
-
- public boolean commit() {
- if (editor != null) {
- boolean value = editor.getEntry();
- try {
- for (Object obj : attributeHolder) {
- if (obj instanceof Artifact) {
- ((Artifact) obj).setSoleAttributeValue(attributeType, new Boolean(value));
- if (persist) {
- ((Artifact) obj).persist();
- }
- }
- if (obj instanceof AttributeConflict) {
- if (!((AttributeConflict) obj).setAttributeValue(new Boolean(value))) {
- AWorkbench.popup("Attention", MergeUtility.COMMITED_PROMPT);
- }
- }
- }
- return true;
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- AWorkbench.popup("ERROR", "Could not store the attribute");
- return false;
- }
-
- public boolean canClear() {
- return false;
- }
-
- public boolean canFinish() {
- 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.framework.ui.skynet.mergeWizard;
+
+import java.util.Collection;
+import org.eclipse.osee.framework.core.data.IAttributeType;
+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.conflict.AttributeConflict;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeUtility;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @author Theron Virgin
+ */
+/*
+ * All of the instance of checks are needed to support both artifacts and
+ * conflicts. The reason to support both is I created the classes for
+ * artifacts so all of the work was already done for them. I then realized
+ * that I needed to control the setting of values for conflicts and thus had to call
+ * the conflict specific methods instead of simply setting the values.
+ */
+public class EmbeddedBooleanAttributeEditor implements IEmbeddedAttributeEditor {
+
+ protected IAttributeType attributeType;
+ protected String displayName;
+ protected Collection<?> attributeHolder;
+ protected boolean persist;
+ protected EmbeddedBooleanEditor editor;
+
+ public EmbeddedBooleanAttributeEditor(String prompt, Collection<?> attributeHolder, String displayName, IAttributeType attributeType, boolean persist) {
+ this.attributeType = attributeType;
+ this.displayName = displayName;
+ this.attributeHolder = attributeHolder;
+ this.persist = persist;
+ }
+
+ public boolean create(Composite composite, GridData gd) {
+ if (attributeHolder == null) {
+ return false;
+ }
+ if (attributeHolder.size() < 1) {
+ return false;
+ }
+ Object obj = attributeHolder.iterator().next();
+ if (obj instanceof Artifact) {
+ String type = ((Artifact) obj).getArtifactTypeName();
+ for (Object object : attributeHolder) {
+ if (object instanceof Artifact) {
+ if (!type.equals(((Artifact) object).getArtifactTypeName())) {
+ AWorkbench.popup("ERROR",
+ "All artifacts must be of the same type when " + "edited in a boolean editor.");
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+ }
+ editor = new EmbeddedBooleanEditor("Select a value for the " + attributeType);
+ editor.createEditor(composite, gd);
+
+ try {
+ if (obj instanceof Artifact) {
+ try {
+ Object object = ((Artifact) obj).getSoleAttributeValue(attributeType);
+ if (object instanceof Boolean) {
+ editor.setEntry(((Boolean) object).booleanValue());
+ } else {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, new Exception(
+ "Boolean editor did not receive a boolean value"));
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ if (obj instanceof AttributeConflict) {
+ Object object = ((AttributeConflict) obj).getMergeObject();
+ if (object instanceof Boolean) {
+ editor.setEntry(((Boolean) object).booleanValue());
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return true;
+ }
+
+ public void update(Object value) {
+ if (editor != null) {
+ editor.setEntry(((Boolean) value).booleanValue());
+ }
+ }
+
+ public boolean commit() {
+ if (editor != null) {
+ boolean value = editor.getEntry();
+ try {
+ for (Object obj : attributeHolder) {
+ if (obj instanceof Artifact) {
+ ((Artifact) obj).setSoleAttributeValue(attributeType, new Boolean(value));
+ if (persist) {
+ ((Artifact) obj).persist();
+ }
+ }
+ if (obj instanceof AttributeConflict) {
+ if (!((AttributeConflict) obj).setAttributeValue(new Boolean(value))) {
+ AWorkbench.popup("Attention", MergeUtility.COMMITED_PROMPT);
+ }
+ }
+ }
+ return true;
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ AWorkbench.popup("ERROR", "Could not store the attribute");
+ return false;
+ }
+
+ public boolean canClear() {
+ return false;
+ }
+
+ public boolean canFinish() {
+ return true;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedBooleanEditor.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedBooleanEditor.java
index b4073808d86..b0ad5a7b47d 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedBooleanEditor.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedBooleanEditor.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.framework.ui.skynet.mergeWizard;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-
-/**
- * @author Theron Virgin
- */
-
-public class EmbeddedBooleanEditor {
- Button booleanValue;
- String dialogMessage;
-
- public EmbeddedBooleanEditor(String dialogMessage) {
- this.dialogMessage = dialogMessage;
- }
-
- public void createEditor(Composite composite, GridData gd) {
-
- new Label(composite, SWT.NONE).setText(dialogMessage);
- booleanValue = new Button(composite, SWT.CHECK);
- booleanValue.setText("");
- composite.layout();
- }
-
- public boolean getEntry() {
- return booleanValue.getSelection();
- }
-
- public void setEntry(boolean entry) {
- booleanValue.setSelection(entry);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.mergeWizard;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * @author Theron Virgin
+ */
+
+public class EmbeddedBooleanEditor {
+ Button booleanValue;
+ String dialogMessage;
+
+ public EmbeddedBooleanEditor(String dialogMessage) {
+ this.dialogMessage = dialogMessage;
+ }
+
+ public void createEditor(Composite composite, GridData gd) {
+
+ new Label(composite, SWT.NONE).setText(dialogMessage);
+ booleanValue = new Button(composite, SWT.CHECK);
+ booleanValue.setText("");
+ composite.layout();
+ }
+
+ public boolean getEntry() {
+ return booleanValue.getSelection();
+ }
+
+ public void setEntry(boolean entry) {
+ booleanValue.setSelection(entry);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedDateAttributeEditor.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedDateAttributeEditor.java
index 34bfed737a4..34282eecfca 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedDateAttributeEditor.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedDateAttributeEditor.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.framework.ui.skynet.mergeWizard;
-
-import java.util.Collection;
-import java.util.Date;
-import org.eclipse.osee.framework.core.data.IAttributeType;
-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.conflict.AttributeConflict;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeUtility;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @author Theron Virgin
- */
-
-/*
- * All of the instance of checks are needed to support both artifacts and
- * conflicts. The reason to support both is I created the classes for
- * artifacts so all of the work was already done for them. I then realized
- * that I needed to control the setting of values for conflicts and thus had to call
- * the conflict specific methods instead of simply setting the values.
- */
-public class EmbeddedDateAttributeEditor implements IEmbeddedAttributeEditor {
-
- protected IAttributeType attributeType;
- protected String displayName;
- protected Collection<?> attributeHolder;
- protected boolean persist;
- protected EmbeddedDateEditor editor;
-
- public EmbeddedDateAttributeEditor(String notUsed, Collection<?> attributeHolder, String displayName, IAttributeType attributeType, boolean persist) {
- this.attributeType = attributeType;
- this.displayName = displayName;
- this.attributeHolder = attributeHolder;
- this.persist = persist;
- }
-
- public boolean create(Composite composite, GridData gd) {
- if (attributeHolder == null) {
- return false;
- }
- if (attributeHolder.size() < 1) {
- return false;
- }
- Object obj = attributeHolder.iterator().next();
- if (obj instanceof Artifact) {
- String type = ((Artifact) obj).getArtifactTypeName();
- for (Object object : attributeHolder) {
- if (object instanceof Artifact) {
- if (!type.equals(((Artifact) object).getArtifactTypeName())) {
- AWorkbench.popup("ERROR",
- "All artifacts must be of the same " + "type when edited in an date editor.");
- return false;
- }
- } else {
- return false;
- }
- }
- }
- Date date = new Date();
- if (obj instanceof Artifact) {
- try {
- Object object = ((Artifact) obj).getSoleAttributeValue(attributeType);
- if (object instanceof Date) {
- date = (Date) object;
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- if (obj instanceof AttributeConflict) {
- try {
- Object object = ((AttributeConflict) obj).getMergeObject();
- if (object instanceof Date) {
- date = (Date) object;
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- editor = new EmbeddedDateEditor("Edit " + displayName, date);
- editor.createEditor(composite);
- return true;
- }
-
- public void update(Object value) {
- editor.setSelectedDate((Date) value);
- }
-
- public boolean commit() {
- Date selected = editor.getSelectedDate();
- try {
- for (Object object : attributeHolder) {
- if (object instanceof Artifact) {
- if (selected == null) {
- ((Artifact) object).setSoleAttributeValue(attributeType, "");
- } else {
- ((Artifact) object).setSoleAttributeValue(attributeType, selected.getTime() + "");
- }
- if (persist) {
- ((Artifact) object).persist();
- }
- }
- if (object instanceof AttributeConflict) {
- if (selected == null) {
- if (!((AttributeConflict) object).clearValue()) {
- AWorkbench.popup("Attention", MergeUtility.COMMITED_PROMPT);
- }
- } else {
- if (!((AttributeConflict) object).setAttributeValue(selected)) {
- AWorkbench.popup("Attention", MergeUtility.COMMITED_PROMPT);
- }
- }
- }
- }
- return true;
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- AWorkbench.popup("ERROR", "Could not store the attribute");
- return false;
- }
-
- public boolean canClear() {
- return false;
- }
-
- public boolean canFinish() {
- 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.framework.ui.skynet.mergeWizard;
+
+import java.util.Collection;
+import java.util.Date;
+import org.eclipse.osee.framework.core.data.IAttributeType;
+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.conflict.AttributeConflict;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeUtility;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @author Theron Virgin
+ */
+
+/*
+ * All of the instance of checks are needed to support both artifacts and
+ * conflicts. The reason to support both is I created the classes for
+ * artifacts so all of the work was already done for them. I then realized
+ * that I needed to control the setting of values for conflicts and thus had to call
+ * the conflict specific methods instead of simply setting the values.
+ */
+public class EmbeddedDateAttributeEditor implements IEmbeddedAttributeEditor {
+
+ protected IAttributeType attributeType;
+ protected String displayName;
+ protected Collection<?> attributeHolder;
+ protected boolean persist;
+ protected EmbeddedDateEditor editor;
+
+ public EmbeddedDateAttributeEditor(String notUsed, Collection<?> attributeHolder, String displayName, IAttributeType attributeType, boolean persist) {
+ this.attributeType = attributeType;
+ this.displayName = displayName;
+ this.attributeHolder = attributeHolder;
+ this.persist = persist;
+ }
+
+ public boolean create(Composite composite, GridData gd) {
+ if (attributeHolder == null) {
+ return false;
+ }
+ if (attributeHolder.size() < 1) {
+ return false;
+ }
+ Object obj = attributeHolder.iterator().next();
+ if (obj instanceof Artifact) {
+ String type = ((Artifact) obj).getArtifactTypeName();
+ for (Object object : attributeHolder) {
+ if (object instanceof Artifact) {
+ if (!type.equals(((Artifact) object).getArtifactTypeName())) {
+ AWorkbench.popup("ERROR",
+ "All artifacts must be of the same " + "type when edited in an date editor.");
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+ }
+ Date date = new Date();
+ if (obj instanceof Artifact) {
+ try {
+ Object object = ((Artifact) obj).getSoleAttributeValue(attributeType);
+ if (object instanceof Date) {
+ date = (Date) object;
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ if (obj instanceof AttributeConflict) {
+ try {
+ Object object = ((AttributeConflict) obj).getMergeObject();
+ if (object instanceof Date) {
+ date = (Date) object;
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ editor = new EmbeddedDateEditor("Edit " + displayName, date);
+ editor.createEditor(composite);
+ return true;
+ }
+
+ public void update(Object value) {
+ editor.setSelectedDate((Date) value);
+ }
+
+ public boolean commit() {
+ Date selected = editor.getSelectedDate();
+ try {
+ for (Object object : attributeHolder) {
+ if (object instanceof Artifact) {
+ if (selected == null) {
+ ((Artifact) object).setSoleAttributeValue(attributeType, "");
+ } else {
+ ((Artifact) object).setSoleAttributeValue(attributeType, selected.getTime() + "");
+ }
+ if (persist) {
+ ((Artifact) object).persist();
+ }
+ }
+ if (object instanceof AttributeConflict) {
+ if (selected == null) {
+ if (!((AttributeConflict) object).clearValue()) {
+ AWorkbench.popup("Attention", MergeUtility.COMMITED_PROMPT);
+ }
+ } else {
+ if (!((AttributeConflict) object).setAttributeValue(selected)) {
+ AWorkbench.popup("Attention", MergeUtility.COMMITED_PROMPT);
+ }
+ }
+ }
+ }
+ return true;
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ AWorkbench.popup("ERROR", "Could not store the attribute");
+ return false;
+ }
+
+ public boolean canClear() {
+ return false;
+ }
+
+ public boolean canFinish() {
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedDateEditor.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedDateEditor.java
index 141ff298a86..77e90c04451 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedDateEditor.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedDateEditor.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.mergeWizard;
-
-import java.util.Calendar;
-import java.util.Date;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.DateTime;
-import org.eclipse.swt.widgets.Label;
-
-public class EmbeddedDateEditor {
- private Date selectedDate;
- private final String dialogMessage;
- private DateTime datePicker;
-
- public EmbeddedDateEditor(String dialogMessage, Date selectedDate) {
- this.selectedDate = selectedDate;
- this.dialogMessage = dialogMessage;
- }
-
- public void createEditor(Composite container) {
- (new Label(container, SWT.None)).setText(dialogMessage);
- datePicker = new DateTime(container, SWT.DATE | SWT.DROP_DOWN);
- setSelectedDate(selectedDate);
- }
-
- public void setSelectedDate(Date selectedDate) {
- this.selectedDate = selectedDate;
- if (selectedDate != null) {
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(selectedDate);
- datePicker.setDate(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH),
- calendar.get(Calendar.DAY_OF_MONTH));
- }
- }
-
- public Date getSelectedDate() {
- Calendar calendar = Calendar.getInstance();
- calendar.set(datePicker.getYear(), datePicker.getMonth(), datePicker.getDay());
- return calendar.getTime();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.mergeWizard;
+
+import java.util.Calendar;
+import java.util.Date;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DateTime;
+import org.eclipse.swt.widgets.Label;
+
+public class EmbeddedDateEditor {
+ private Date selectedDate;
+ private final String dialogMessage;
+ private DateTime datePicker;
+
+ public EmbeddedDateEditor(String dialogMessage, Date selectedDate) {
+ this.selectedDate = selectedDate;
+ this.dialogMessage = dialogMessage;
+ }
+
+ public void createEditor(Composite container) {
+ (new Label(container, SWT.None)).setText(dialogMessage);
+ datePicker = new DateTime(container, SWT.DATE | SWT.DROP_DOWN);
+ setSelectedDate(selectedDate);
+ }
+
+ public void setSelectedDate(Date selectedDate) {
+ this.selectedDate = selectedDate;
+ if (selectedDate != null) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(selectedDate);
+ datePicker.setDate(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH),
+ calendar.get(Calendar.DAY_OF_MONTH));
+ }
+ }
+
+ public Date getSelectedDate() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(datePicker.getYear(), datePicker.getMonth(), datePicker.getDay());
+ return calendar.getTime();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedEnumAttributeEditor.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedEnumAttributeEditor.java
index 63ab2e56b04..12db3569161 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedEnumAttributeEditor.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedEnumAttributeEditor.java
@@ -1,154 +1,154 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.mergeWizard;
-
-import java.util.Collection;
-import java.util.TreeSet;
-import org.eclipse.osee.framework.core.data.IAttributeType;
-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.attribute.AttributeTypeManager;
-import org.eclipse.osee.framework.skynet.core.conflict.AttributeConflict;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeUtility;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @author Theron Virgin
- */
-
-/*
- * All of the instance of checks are needed to support both artifacts and
- * conflicts. The reason to support both is I created the classes for
- * artifacts so all of the work was already done for them. I then realized
- * that I needed to control the setting of values for conflicts and thus had to call
- * the conflict specific methods instead of simply setting the values.
- */
-
-public class EmbeddedEnumAttributeEditor implements IEmbeddedAttributeEditor {
- private static final String PROMPT = "Please select a value from the combo box";
- private static final String ERROR_PROMPT =
- "All artifacts must be of the same type when edited in an enumeration editor.";
- protected IAttributeType attributeType;
- protected String displayName;
- protected Collection<?> attributeHolder;
- protected boolean persist;
- protected EmbeddedEnumEditor editor;
-
- public EmbeddedEnumAttributeEditor(String arg, Collection<?> attributeHolder, String displayName, IAttributeType attributeType, boolean persist) {
- this.attributeType = attributeType;
- this.displayName = displayName;
- this.attributeHolder = attributeHolder;
- this.persist = persist;
- }
-
- public boolean create(Composite composite, GridData gd) {
- if (attributeHolder == null) {
- return false;
- }
- if (attributeHolder.size() < 1) {
- return false;
- }
- Object obj = attributeHolder.iterator().next();
- if (obj instanceof Artifact) {
- String type = ((Artifact) obj).getArtifactTypeName();
- for (Object object : attributeHolder) {
- if (object instanceof Artifact) {
- if (!type.equals(((Artifact) object).getArtifactTypeName())) {
- AWorkbench.popup("ERROR", ERROR_PROMPT);
- return false;
- }
- } else {
- return false;
- }
- }
- }
- editor = new EmbeddedEnumEditor(PROMPT);
- editor.createEditor(composite);
- TreeSet<String> options = new TreeSet<String>();
- try {
- if (obj instanceof Artifact) {
- options = new TreeSet<String>(AttributeTypeManager.getEnumerationValues(attributeType));
- }
- if (obj instanceof AttributeConflict) {
- options = ((AttributeConflict) obj).getEnumerationAttributeValues();
- }
- for (String string : options) {
- editor.addSelectionChoice(string);
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- if (obj instanceof Artifact) {
- try {
- editor.setSelected(((Artifact) obj).getSoleAttributeValue(attributeType).toString());
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- } else if (obj instanceof AttributeConflict) {
- try {
- if (((AttributeConflict) obj).getMergeObject() != null) {
- editor.setSelected(((AttributeConflict) obj).getMergeObject().toString());
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- return true;
- }
-
- public void update(Object value) {
- editor.setSelected(value.toString());
- }
-
- public boolean commit() {
- String selection = editor.getSelected();
- try {
- for (Object object : attributeHolder) {
- if (object instanceof Artifact) {
- ((Artifact) object).setSoleAttributeFromString(attributeType, selection);
- if (persist) {
- ((Artifact) object).persist();
- }
- }
- if (object instanceof AttributeConflict) {
- if (selection.equals("")) {
- if (!((AttributeConflict) object).clearValue()) {
- AWorkbench.popup("Attention", MergeUtility.COMMITED_PROMPT);
- }
- } else {
- if (!((AttributeConflict) object).setStringAttributeValue(selection)) {
- AWorkbench.popup("Attention", MergeUtility.COMMITED_PROMPT);
- }
- }
- }
- }
- return true;
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return true;
- }
-
- public boolean canClear() {
- return false;
- }
-
- public boolean canFinish() {
- 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.framework.ui.skynet.mergeWizard;
+
+import java.util.Collection;
+import java.util.TreeSet;
+import org.eclipse.osee.framework.core.data.IAttributeType;
+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.attribute.AttributeTypeManager;
+import org.eclipse.osee.framework.skynet.core.conflict.AttributeConflict;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeUtility;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @author Theron Virgin
+ */
+
+/*
+ * All of the instance of checks are needed to support both artifacts and
+ * conflicts. The reason to support both is I created the classes for
+ * artifacts so all of the work was already done for them. I then realized
+ * that I needed to control the setting of values for conflicts and thus had to call
+ * the conflict specific methods instead of simply setting the values.
+ */
+
+public class EmbeddedEnumAttributeEditor implements IEmbeddedAttributeEditor {
+ private static final String PROMPT = "Please select a value from the combo box";
+ private static final String ERROR_PROMPT =
+ "All artifacts must be of the same type when edited in an enumeration editor.";
+ protected IAttributeType attributeType;
+ protected String displayName;
+ protected Collection<?> attributeHolder;
+ protected boolean persist;
+ protected EmbeddedEnumEditor editor;
+
+ public EmbeddedEnumAttributeEditor(String arg, Collection<?> attributeHolder, String displayName, IAttributeType attributeType, boolean persist) {
+ this.attributeType = attributeType;
+ this.displayName = displayName;
+ this.attributeHolder = attributeHolder;
+ this.persist = persist;
+ }
+
+ public boolean create(Composite composite, GridData gd) {
+ if (attributeHolder == null) {
+ return false;
+ }
+ if (attributeHolder.size() < 1) {
+ return false;
+ }
+ Object obj = attributeHolder.iterator().next();
+ if (obj instanceof Artifact) {
+ String type = ((Artifact) obj).getArtifactTypeName();
+ for (Object object : attributeHolder) {
+ if (object instanceof Artifact) {
+ if (!type.equals(((Artifact) object).getArtifactTypeName())) {
+ AWorkbench.popup("ERROR", ERROR_PROMPT);
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+ }
+ editor = new EmbeddedEnumEditor(PROMPT);
+ editor.createEditor(composite);
+ TreeSet<String> options = new TreeSet<String>();
+ try {
+ if (obj instanceof Artifact) {
+ options = new TreeSet<String>(AttributeTypeManager.getEnumerationValues(attributeType));
+ }
+ if (obj instanceof AttributeConflict) {
+ options = ((AttributeConflict) obj).getEnumerationAttributeValues();
+ }
+ for (String string : options) {
+ editor.addSelectionChoice(string);
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ if (obj instanceof Artifact) {
+ try {
+ editor.setSelected(((Artifact) obj).getSoleAttributeValue(attributeType).toString());
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ } else if (obj instanceof AttributeConflict) {
+ try {
+ if (((AttributeConflict) obj).getMergeObject() != null) {
+ editor.setSelected(((AttributeConflict) obj).getMergeObject().toString());
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ return true;
+ }
+
+ public void update(Object value) {
+ editor.setSelected(value.toString());
+ }
+
+ public boolean commit() {
+ String selection = editor.getSelected();
+ try {
+ for (Object object : attributeHolder) {
+ if (object instanceof Artifact) {
+ ((Artifact) object).setSoleAttributeFromString(attributeType, selection);
+ if (persist) {
+ ((Artifact) object).persist();
+ }
+ }
+ if (object instanceof AttributeConflict) {
+ if (selection.equals("")) {
+ if (!((AttributeConflict) object).clearValue()) {
+ AWorkbench.popup("Attention", MergeUtility.COMMITED_PROMPT);
+ }
+ } else {
+ if (!((AttributeConflict) object).setStringAttributeValue(selection)) {
+ AWorkbench.popup("Attention", MergeUtility.COMMITED_PROMPT);
+ }
+ }
+ }
+ }
+ return true;
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return true;
+ }
+
+ public boolean canClear() {
+ return false;
+ }
+
+ public boolean canFinish() {
+ return true;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedEnumEditor.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedEnumEditor.java
index 0e797b2da9c..acbbc616af9 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedEnumEditor.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedEnumEditor.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.framework.ui.skynet.mergeWizard;
-
-
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-
-/**
- * @author Theron Virgin
- */
-public class EmbeddedEnumEditor {
-
- private String dialogMessage;
- private Combo comboBox;
- public final static String NO_SELECTION = "";
-
- public EmbeddedEnumEditor(String dialogMessage) {
- this.dialogMessage = dialogMessage;
- }
-
- public boolean createEditor(Composite composite) {
- new Label(composite, SWT.NONE).setText(dialogMessage);
-
- comboBox = new Combo(composite, SWT.READ_ONLY);
- comboBox.setBounds(50, 50, 650, 65);
-
- comboBox.add(NO_SELECTION);
-
- return true;
- }
-
- public void addSelectionChoice(String choice){
- if (choice != null)
- comboBox.add(choice);
- }
-
- public String getSelected() {
- int index = comboBox.getSelectionIndex();
- if (index == -1)
- return NO_SELECTION;
- else
- return comboBox.getItem(index);
- }
-
- public void setSelected(String selection){
- int index = comboBox.indexOf(selection);
- if (index == -1)
- AWorkbench.popup("ERROR","Attempting to set Enumeration to invalid value " + selection);
- comboBox.select(index);
- }
-
-
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.mergeWizard;
+
+
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * @author Theron Virgin
+ */
+public class EmbeddedEnumEditor {
+
+ private String dialogMessage;
+ private Combo comboBox;
+ public final static String NO_SELECTION = "";
+
+ public EmbeddedEnumEditor(String dialogMessage) {
+ this.dialogMessage = dialogMessage;
+ }
+
+ public boolean createEditor(Composite composite) {
+ new Label(composite, SWT.NONE).setText(dialogMessage);
+
+ comboBox = new Combo(composite, SWT.READ_ONLY);
+ comboBox.setBounds(50, 50, 650, 65);
+
+ comboBox.add(NO_SELECTION);
+
+ return true;
+ }
+
+ public void addSelectionChoice(String choice){
+ if (choice != null)
+ comboBox.add(choice);
+ }
+
+ public String getSelected() {
+ int index = comboBox.getSelectionIndex();
+ if (index == -1)
+ return NO_SELECTION;
+ else
+ return comboBox.getItem(index);
+ }
+
+ public void setSelected(String selection){
+ int index = comboBox.indexOf(selection);
+ if (index == -1)
+ AWorkbench.popup("ERROR","Attempting to set Enumeration to invalid value " + selection);
+ comboBox.select(index);
+ }
+
+
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedStringAttributeEditor.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedStringAttributeEditor.java
index 50097a7b0a2..6b0022d852c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedStringAttributeEditor.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedStringAttributeEditor.java
@@ -1,155 +1,155 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.mergeWizard;
-
-import java.util.Collection;
-import org.eclipse.osee.framework.core.data.IAttributeType;
-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.conflict.AttributeConflict;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeUtility;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @author Theron Virgin
- */
-
-/*
- * All of the instance of checks are needed to support both artifacts and
- * conflicts. The reason to support both is I created the classes for
- * artifacts so all of the work was already done for them. I then realized
- * that I needed to control the setting of values for conflicts and thus had to call
- * the conflict specific methods instead of simply setting the values.
- */
-
-public class EmbeddedStringAttributeEditor implements IEmbeddedAttributeEditor {
- private static final String PROMPT = "Set the Attribute Value";
- private static final String VALIDATION_ERROR =
- "ERROR: You have entered an invalid value." + " This value can not be saved.";
- private static final String TYPE_ERROR = "All the artifacts being edited are not of the same type.";
-
- protected IAttributeType attributeType;
- protected String displayName;
- protected Collection<?> attributeHolders;
- protected boolean persist;
- protected EmbeddedStringEditor editor;
- protected String regExp;
-
- public EmbeddedStringAttributeEditor(String regExp, Collection<?> attributeHolders, String displayName, IAttributeType attributeType, boolean persist) {
- this.regExp = regExp;
- this.attributeType = attributeType;
- this.displayName = displayName;
- this.attributeHolders = attributeHolders;
- this.persist = persist;
- }
-
- public boolean create(Composite composite, GridData gd) {
- if (attributeHolders == null) {
- return false;
- }
- if (attributeHolders.size() < 1) {
- return false;
- }
- Object obj = attributeHolders.iterator().next();
- if (obj instanceof Artifact) {
- String type = ((Artifact) obj).getArtifactTypeName();
- for (Object object : attributeHolders) {
- if (object instanceof Artifact) {
- if (!type.equals(((Artifact) object).getArtifactTypeName())) {
- AWorkbench.popup("ERROR", TYPE_ERROR);
- return false;
- }
- } else {
- return false;
- }
- }
- }
- editor = new EmbeddedStringEditor(PROMPT);
- editor.setValidationErrorString(VALIDATION_ERROR);
- editor.createEditor(composite);
- if (obj instanceof Artifact) {
- try {
- editor.setEntry(((Artifact) obj).getSoleAttributeValue(attributeType).toString());
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- } else if (obj instanceof AttributeConflict) {
- try {
- if (((AttributeConflict) obj).getMergeObject() != null) {
- editor.setEntry(((AttributeConflict) obj).getMergeObject().toString());
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- if (regExp != null) {
- editor.setValidationRegularExpression(regExp);
- }
- return true;
- }
-
- public void update(Object value) {
- if (value != null) {
- editor.setEntry(value.toString());
- }
- }
-
- public boolean commit() {
- if (editor != null) {
- try {
- for (Object object : attributeHolders) {
- if (object instanceof Artifact) {
- ((Artifact) object).setSoleAttributeFromString(attributeType, editor.getEntry());
- if (persist) {
- ((Artifact) object).persist();
- }
- }
- if (object instanceof AttributeConflict) {
- if (!editor.getEntry().equals("")) {
- try {
- if (!((AttributeConflict) object).setStringAttributeValue(editor.getEntry())) {
- AWorkbench.popup("Attention", MergeUtility.COMMITED_PROMPT);
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- } else {
- if (!((AttributeConflict) object).clearValue()) {
- AWorkbench.popup("Attention", MergeUtility.COMMITED_PROMPT);
- }
- }
- }
- }
- return true;
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- return false;
-
- }
-
- public boolean canClear() {
- return true;
- }
-
- public boolean canFinish() {
- if (editor == null) {
- return false;
- }
- return editor.handleModified() || editor.getEntry().equals("");
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.mergeWizard;
+
+import java.util.Collection;
+import org.eclipse.osee.framework.core.data.IAttributeType;
+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.conflict.AttributeConflict;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeUtility;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @author Theron Virgin
+ */
+
+/*
+ * All of the instance of checks are needed to support both artifacts and
+ * conflicts. The reason to support both is I created the classes for
+ * artifacts so all of the work was already done for them. I then realized
+ * that I needed to control the setting of values for conflicts and thus had to call
+ * the conflict specific methods instead of simply setting the values.
+ */
+
+public class EmbeddedStringAttributeEditor implements IEmbeddedAttributeEditor {
+ private static final String PROMPT = "Set the Attribute Value";
+ private static final String VALIDATION_ERROR =
+ "ERROR: You have entered an invalid value." + " This value can not be saved.";
+ private static final String TYPE_ERROR = "All the artifacts being edited are not of the same type.";
+
+ protected IAttributeType attributeType;
+ protected String displayName;
+ protected Collection<?> attributeHolders;
+ protected boolean persist;
+ protected EmbeddedStringEditor editor;
+ protected String regExp;
+
+ public EmbeddedStringAttributeEditor(String regExp, Collection<?> attributeHolders, String displayName, IAttributeType attributeType, boolean persist) {
+ this.regExp = regExp;
+ this.attributeType = attributeType;
+ this.displayName = displayName;
+ this.attributeHolders = attributeHolders;
+ this.persist = persist;
+ }
+
+ public boolean create(Composite composite, GridData gd) {
+ if (attributeHolders == null) {
+ return false;
+ }
+ if (attributeHolders.size() < 1) {
+ return false;
+ }
+ Object obj = attributeHolders.iterator().next();
+ if (obj instanceof Artifact) {
+ String type = ((Artifact) obj).getArtifactTypeName();
+ for (Object object : attributeHolders) {
+ if (object instanceof Artifact) {
+ if (!type.equals(((Artifact) object).getArtifactTypeName())) {
+ AWorkbench.popup("ERROR", TYPE_ERROR);
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+ }
+ editor = new EmbeddedStringEditor(PROMPT);
+ editor.setValidationErrorString(VALIDATION_ERROR);
+ editor.createEditor(composite);
+ if (obj instanceof Artifact) {
+ try {
+ editor.setEntry(((Artifact) obj).getSoleAttributeValue(attributeType).toString());
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ } else if (obj instanceof AttributeConflict) {
+ try {
+ if (((AttributeConflict) obj).getMergeObject() != null) {
+ editor.setEntry(((AttributeConflict) obj).getMergeObject().toString());
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ if (regExp != null) {
+ editor.setValidationRegularExpression(regExp);
+ }
+ return true;
+ }
+
+ public void update(Object value) {
+ if (value != null) {
+ editor.setEntry(value.toString());
+ }
+ }
+
+ public boolean commit() {
+ if (editor != null) {
+ try {
+ for (Object object : attributeHolders) {
+ if (object instanceof Artifact) {
+ ((Artifact) object).setSoleAttributeFromString(attributeType, editor.getEntry());
+ if (persist) {
+ ((Artifact) object).persist();
+ }
+ }
+ if (object instanceof AttributeConflict) {
+ if (!editor.getEntry().equals("")) {
+ try {
+ if (!((AttributeConflict) object).setStringAttributeValue(editor.getEntry())) {
+ AWorkbench.popup("Attention", MergeUtility.COMMITED_PROMPT);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ } else {
+ if (!((AttributeConflict) object).clearValue()) {
+ AWorkbench.popup("Attention", MergeUtility.COMMITED_PROMPT);
+ }
+ }
+ }
+ }
+ return true;
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ return false;
+
+ }
+
+ public boolean canClear() {
+ return true;
+ }
+
+ public boolean canFinish() {
+ if (editor == null) {
+ return false;
+ }
+ return editor.handleModified() || editor.getEntry().equals("");
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedStringEditor.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedStringEditor.java
index 3164c560834..ddf183dcd91 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedStringEditor.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbeddedStringEditor.java
@@ -1,121 +1,121 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.mergeWizard;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.osee.framework.ui.skynet.widgets.XText;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-
-public class EmbeddedStringEditor{
-
- XText text;
- String entryText = "";
- String validationRegularExpression = null;
- String validationErrorString = "";
- Button ok;
- Label errorLabel;
- String dialogMessage;
- private Composite composite;
- boolean fillVertically = false;
-
-
- public EmbeddedStringEditor(String dialogMessage) {
- this.dialogMessage = dialogMessage;
- }
-
-
- public void createEditor(Composite composite) {
- this.composite = composite;
-
- // Create error label
- errorLabel = new Label(composite, SWT.NONE);
- errorLabel.setSize(errorLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- errorLabel.setForeground(new Color(null,255,0,0));
- errorLabel.setText("");
-
- new Label(composite, SWT.NONE).setText(dialogMessage);
- text = new XText();
- text.setFillHorizontally(true);
- text.setFocus();
- text.setDisplayLabel(false);
- if (!entryText.equals("")) text.set(entryText);
- if (fillVertically) {
- text.setFillVertically(true);
- text.setHeight(200);
- }
- text.createWidgets(composite, 2);
-
- text.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- handleModified();
- }
- });
-
- composite.layout();
- }
-
- public boolean handleModified() {
- if (text != null) {
- if (!isEntryValid()) {
- errorLabel.setText(validationErrorString);
- errorLabel.update();
- composite.layout();
- return false;
- } else {
- errorLabel.setText("");
- errorLabel.update();
- composite.layout();
- return true;
- }
- }
- return true;
- }
-
- public String getEntry() {
- return text.get();
- }
-
- public void setEntry(String entry) {
- if (text != null) text.set(entry);
- this.entryText = entry;
- }
-
- /**
- * override this method to make own checks on entry this will be called with every keystroke
- *
- * @return true if entry is valid
- */
- public boolean isEntryValid() {
- if (validationRegularExpression == null) {
- return true;
- }
- // verify title is alpha-numeric with spaces and dashes
- Matcher m = Pattern.compile(validationRegularExpression).matcher(text.get());
- return m.find();
- }
-
- public void setValidationRegularExpression(String regExp) {
- validationRegularExpression = regExp;
- }
-
- public void setValidationErrorString(String errorText) {
- validationErrorString = errorText;
- }
-
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.mergeWizard;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.osee.framework.ui.skynet.widgets.XText;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+public class EmbeddedStringEditor{
+
+ XText text;
+ String entryText = "";
+ String validationRegularExpression = null;
+ String validationErrorString = "";
+ Button ok;
+ Label errorLabel;
+ String dialogMessage;
+ private Composite composite;
+ boolean fillVertically = false;
+
+
+ public EmbeddedStringEditor(String dialogMessage) {
+ this.dialogMessage = dialogMessage;
+ }
+
+
+ public void createEditor(Composite composite) {
+ this.composite = composite;
+
+ // Create error label
+ errorLabel = new Label(composite, SWT.NONE);
+ errorLabel.setSize(errorLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+ errorLabel.setForeground(new Color(null,255,0,0));
+ errorLabel.setText("");
+
+ new Label(composite, SWT.NONE).setText(dialogMessage);
+ text = new XText();
+ text.setFillHorizontally(true);
+ text.setFocus();
+ text.setDisplayLabel(false);
+ if (!entryText.equals("")) text.set(entryText);
+ if (fillVertically) {
+ text.setFillVertically(true);
+ text.setHeight(200);
+ }
+ text.createWidgets(composite, 2);
+
+ text.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ handleModified();
+ }
+ });
+
+ composite.layout();
+ }
+
+ public boolean handleModified() {
+ if (text != null) {
+ if (!isEntryValid()) {
+ errorLabel.setText(validationErrorString);
+ errorLabel.update();
+ composite.layout();
+ return false;
+ } else {
+ errorLabel.setText("");
+ errorLabel.update();
+ composite.layout();
+ return true;
+ }
+ }
+ return true;
+ }
+
+ public String getEntry() {
+ return text.get();
+ }
+
+ public void setEntry(String entry) {
+ if (text != null) text.set(entry);
+ this.entryText = entry;
+ }
+
+ /**
+ * override this method to make own checks on entry this will be called with every keystroke
+ *
+ * @return true if entry is valid
+ */
+ public boolean isEntryValid() {
+ if (validationRegularExpression == null) {
+ return true;
+ }
+ // verify title is alpha-numeric with spaces and dashes
+ Matcher m = Pattern.compile(validationRegularExpression).matcher(text.get());
+ return m.find();
+ }
+
+ public void setValidationRegularExpression(String regExp) {
+ validationRegularExpression = regExp;
+ }
+
+ public void setValidationErrorString(String errorText) {
+ validationErrorString = errorText;
+ }
+
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbededAttributeEditorFactory.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbededAttributeEditorFactory.java
index 70bbc0c93b3..85406e37303 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbededAttributeEditorFactory.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/EmbededAttributeEditorFactory.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.framework.ui.skynet.mergeWizard;
-
-import java.util.Collection;
-import org.eclipse.osee.framework.core.data.IAttributeType;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
-import org.eclipse.osee.framework.skynet.core.attribute.BooleanAttribute;
-import org.eclipse.osee.framework.skynet.core.attribute.DateAttribute;
-import org.eclipse.osee.framework.skynet.core.attribute.EnumeratedAttribute;
-import org.eclipse.osee.framework.skynet.core.attribute.FloatingPointAttribute;
-import org.eclipse.osee.framework.skynet.core.attribute.IntegerAttribute;
-import org.eclipse.osee.framework.skynet.core.attribute.StringAttribute;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-
-/**
- * @author Theron Virgin
- */
-public class EmbededAttributeEditorFactory {
-
- private final static String VALID_FLOAT_REG_EX = "^[0-9\\.]+$";
- private final static String VALID_INTEGER_REG_EX = "^[0-9]+$";
- private final static String VALID_PERCENT_REG_EX =
- "^(0*100{1,1}\\.?((?<=\\.)0*)?%?$)|(^0*\\d{0,2}\\.?((?<=\\.)\\d*)?%?)$";
-
- public static IEmbeddedAttributeEditor getEmbeddedEditor(IAttributeType attributeType, String displayName, final Collection<?> attributeHolder, boolean persist) {
- try {
- if (AttributeTypeManager.isBaseTypeCompatible(DateAttribute.class, attributeType)) {
- return new EmbeddedDateAttributeEditor(null, attributeHolder, displayName, attributeType, persist);
- } else if (AttributeTypeManager.isBaseTypeCompatible(FloatingPointAttribute.class, attributeType)) {
- return new EmbeddedStringAttributeEditor(VALID_FLOAT_REG_EX, attributeHolder, displayName, attributeType,
- persist);
- } else if (AttributeTypeManager.isBaseTypeCompatible(IntegerAttribute.class, attributeType)) {
- return new EmbeddedStringAttributeEditor(VALID_INTEGER_REG_EX, attributeHolder, displayName, attributeType,
- persist);
- } else if (AttributeTypeManager.isBaseTypeCompatible(BooleanAttribute.class, attributeType)) {
- return new EmbeddedBooleanAttributeEditor(null, attributeHolder, displayName, attributeType, persist);
- } else if (AttributeTypeManager.isBaseTypeCompatible(EnumeratedAttribute.class, attributeType)) {
- return new EmbeddedEnumAttributeEditor(null, attributeHolder, displayName, attributeType, persist);
- } else if (AttributeTypeManager.isBaseTypeCompatible(StringAttribute.class, attributeType)) {
- return new EmbeddedStringAttributeEditor(null, attributeHolder, displayName, attributeType, persist);
- } else {
- AWorkbench.popup("ERROR", "Unhandled attribute type. No editor defined for this type");
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- 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.framework.ui.skynet.mergeWizard;
+
+import java.util.Collection;
+import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
+import org.eclipse.osee.framework.skynet.core.attribute.BooleanAttribute;
+import org.eclipse.osee.framework.skynet.core.attribute.DateAttribute;
+import org.eclipse.osee.framework.skynet.core.attribute.EnumeratedAttribute;
+import org.eclipse.osee.framework.skynet.core.attribute.FloatingPointAttribute;
+import org.eclipse.osee.framework.skynet.core.attribute.IntegerAttribute;
+import org.eclipse.osee.framework.skynet.core.attribute.StringAttribute;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+
+/**
+ * @author Theron Virgin
+ */
+public class EmbededAttributeEditorFactory {
+
+ private final static String VALID_FLOAT_REG_EX = "^[0-9\\.]+$";
+ private final static String VALID_INTEGER_REG_EX = "^[0-9]+$";
+ private final static String VALID_PERCENT_REG_EX =
+ "^(0*100{1,1}\\.?((?<=\\.)0*)?%?$)|(^0*\\d{0,2}\\.?((?<=\\.)\\d*)?%?)$";
+
+ public static IEmbeddedAttributeEditor getEmbeddedEditor(IAttributeType attributeType, String displayName, final Collection<?> attributeHolder, boolean persist) {
+ try {
+ if (AttributeTypeManager.isBaseTypeCompatible(DateAttribute.class, attributeType)) {
+ return new EmbeddedDateAttributeEditor(null, attributeHolder, displayName, attributeType, persist);
+ } else if (AttributeTypeManager.isBaseTypeCompatible(FloatingPointAttribute.class, attributeType)) {
+ return new EmbeddedStringAttributeEditor(VALID_FLOAT_REG_EX, attributeHolder, displayName, attributeType,
+ persist);
+ } else if (AttributeTypeManager.isBaseTypeCompatible(IntegerAttribute.class, attributeType)) {
+ return new EmbeddedStringAttributeEditor(VALID_INTEGER_REG_EX, attributeHolder, displayName, attributeType,
+ persist);
+ } else if (AttributeTypeManager.isBaseTypeCompatible(BooleanAttribute.class, attributeType)) {
+ return new EmbeddedBooleanAttributeEditor(null, attributeHolder, displayName, attributeType, persist);
+ } else if (AttributeTypeManager.isBaseTypeCompatible(EnumeratedAttribute.class, attributeType)) {
+ return new EmbeddedEnumAttributeEditor(null, attributeHolder, displayName, attributeType, persist);
+ } else if (AttributeTypeManager.isBaseTypeCompatible(StringAttribute.class, attributeType)) {
+ return new EmbeddedStringAttributeEditor(null, attributeHolder, displayName, attributeType, persist);
+ } else {
+ AWorkbench.popup("ERROR", "Unhandled attribute type. No editor defined for this type");
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return null;
+
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/IEmbeddedAttributeEditor.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/IEmbeddedAttributeEditor.java
index 7c896d52ee5..860f04127ef 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/IEmbeddedAttributeEditor.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/mergeWizard/IEmbeddedAttributeEditor.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.framework.ui.skynet.mergeWizard;
-
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @author Theron Virgin
- */
-public interface IEmbeddedAttributeEditor {
-
- public void update(Object value);
-
- public boolean create(Composite composite, GridData gd);
-
- public boolean commit();
-
- public boolean canClear();
-
- public boolean canFinish();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.mergeWizard;
+
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @author Theron Virgin
+ */
+public interface IEmbeddedAttributeEditor {
+
+ public void update(Object value);
+
+ public boolean create(Composite composite, GridData gd);
+
+ public boolean commit();
+
+ public boolean canClear();
+
+ public boolean canFinish();
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/notify/INotificationManager.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/notify/INotificationManager.java
index 8426a4ddea1..c18f6d1aa16 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/notify/INotificationManager.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/notify/INotificationManager.java
@@ -8,22 +8,22 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.notify;
-
+package org.eclipse.osee.framework.ui.skynet.notify;
+
import java.util.List;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-
-/**
- * @author Donald G. Dunne
- */
-public interface INotificationManager {
-
- public void addNotificationEvent(OseeNotificationEvent notificationEvent);
-
- public void clear();
-
- public List<OseeNotificationEvent> getNotificationEvents();
-
- public void sendNotifications() throws OseeCoreException;
-
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface INotificationManager {
+
+ public void addNotificationEvent(OseeNotificationEvent notificationEvent);
+
+ public void clear();
+
+ public List<OseeNotificationEvent> getNotificationEvents();
+
+ public void sendNotifications() throws OseeCoreException;
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/notify/OseeNotificationEvent.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/notify/OseeNotificationEvent.java
index a26e3e5b055..bbe1ecebe3b 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/notify/OseeNotificationEvent.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/notify/OseeNotificationEvent.java
@@ -1,78 +1,78 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.notify;
-
-import java.util.Collection;
-import org.eclipse.osee.framework.skynet.core.User;
-
-/**
- * @author Donald G. Dunne
- */
-public class OseeNotificationEvent {
-
- private Collection<User> users;
- private final String id;
- private String type;
- private String description;
- private String url;
-
- public OseeNotificationEvent(Collection<User> users, String id, String type, String description) {
- this.users = users;
- this.id = id;
- this.type = type;
- this.description = description;
- }
-
- public OseeNotificationEvent(Collection<User> users, String id, String type, String description, String url) {
- this(users, id, type, description);
- this.url = url;
- }
-
- public String toString() {
- return type + " - " + id + " - " + users + " - " + description;
- }
-
- public String getId() {
- return id;
- }
-
- public String getType() {
- return type;
- }
-
- public String getDescription() {
- return description;
- }
-
- public Collection<User> getUsers() {
- return users;
- }
-
- public void setUsers(Collection<User> users) {
- this.users = users;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.notify;
+
+import java.util.Collection;
+import org.eclipse.osee.framework.skynet.core.User;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class OseeNotificationEvent {
+
+ private Collection<User> users;
+ private final String id;
+ private String type;
+ private String description;
+ private String url;
+
+ public OseeNotificationEvent(Collection<User> users, String id, String type, String description) {
+ this.users = users;
+ this.id = id;
+ this.type = type;
+ this.description = description;
+ }
+
+ public OseeNotificationEvent(Collection<User> users, String id, String type, String description, String url) {
+ this(users, id, type, description);
+ this.url = url;
+ }
+
+ public String toString() {
+ return type + " - " + id + " - " + users + " - " + description;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public Collection<User> getUsers() {
+ return users;
+ }
+
+ public void setUsers(Collection<User> users) {
+ this.users = users;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/notify/OseeNotificationManager.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/notify/OseeNotificationManager.java
index 2a358811fe1..49c800ab4e6 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/notify/OseeNotificationManager.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/notify/OseeNotificationManager.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.framework.ui.skynet.notify;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-
-/**
- * Stores notification events generated by the framework or applications. Currently, send happens upon call to
- * sendNotifications(). Eventually, a timer will kick the send event at certain intervals. This mechanism allows for
- * notifications to be collected for a certain period of time and rolled into a single notification. This will
- * eventually also support other types of notifications such as popups and allow the user to configure which events are
- * sent and how.
- *
- * @author Donald G. Dunne
- */
-public class OseeNotificationManager implements INotificationManager {
-
- private boolean emailEnabled = true;
- private static OseeNotificationManager instance = new OseeNotificationManager();
- private List<OseeNotificationEvent> notificationEvents = new ArrayList<OseeNotificationEvent>();
-
- private OseeNotificationManager() {
- instance = this;
- }
-
- public void addNotificationEvent(OseeNotificationEvent notificationEvent) {
- notificationEvents.add(notificationEvent);
- }
-
- public void clear() {
- notificationEvents.clear();
- }
-
- public void sendNotifications() throws OseeCoreException {
- if (!emailEnabled) {
- OseeLog.log(SkynetGuiPlugin.class, Level.INFO, "Osee Notification Disabled");
- return;
- }
- List<OseeNotificationEvent> sendEvents = new ArrayList<OseeNotificationEvent>();
- sendEvents.addAll(notificationEvents);
- notificationEvents.clear();
- OseeNotifyUsersJob job = new OseeNotifyUsersJob(sendEvents);
- job.setPriority(Job.SHORT);
- job.schedule();
- }
-
- public boolean isEmailEnabled() {
- return emailEnabled;
- }
-
- public void setEmailEnabled(boolean emailEnabled) {
- this.emailEnabled = emailEnabled;
- }
-
- public List<OseeNotificationEvent> getNotificationEvents() {
- return notificationEvents;
- }
-
- public static OseeNotificationManager getInstance() {
- return instance;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.notify;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+
+/**
+ * Stores notification events generated by the framework or applications. Currently, send happens upon call to
+ * sendNotifications(). Eventually, a timer will kick the send event at certain intervals. This mechanism allows for
+ * notifications to be collected for a certain period of time and rolled into a single notification. This will
+ * eventually also support other types of notifications such as popups and allow the user to configure which events are
+ * sent and how.
+ *
+ * @author Donald G. Dunne
+ */
+public class OseeNotificationManager implements INotificationManager {
+
+ private boolean emailEnabled = true;
+ private static OseeNotificationManager instance = new OseeNotificationManager();
+ private List<OseeNotificationEvent> notificationEvents = new ArrayList<OseeNotificationEvent>();
+
+ private OseeNotificationManager() {
+ instance = this;
+ }
+
+ public void addNotificationEvent(OseeNotificationEvent notificationEvent) {
+ notificationEvents.add(notificationEvent);
+ }
+
+ public void clear() {
+ notificationEvents.clear();
+ }
+
+ public void sendNotifications() throws OseeCoreException {
+ if (!emailEnabled) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.INFO, "Osee Notification Disabled");
+ return;
+ }
+ List<OseeNotificationEvent> sendEvents = new ArrayList<OseeNotificationEvent>();
+ sendEvents.addAll(notificationEvents);
+ notificationEvents.clear();
+ OseeNotifyUsersJob job = new OseeNotifyUsersJob(sendEvents);
+ job.setPriority(Job.SHORT);
+ job.schedule();
+ }
+
+ public boolean isEmailEnabled() {
+ return emailEnabled;
+ }
+
+ public void setEmailEnabled(boolean emailEnabled) {
+ this.emailEnabled = emailEnabled;
+ }
+
+ public List<OseeNotificationEvent> getNotificationEvents() {
+ return notificationEvents;
+ }
+
+ public static OseeNotificationManager getInstance() {
+ return instance;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/AbstractItemSelectPanel.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/AbstractItemSelectPanel.java
index 839b80e01a8..9eb26afe404 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/AbstractItemSelectPanel.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/AbstractItemSelectPanel.java
@@ -1,163 +1,163 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.panels;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.window.Window;
-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.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.swt.ALayout;
-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.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Roberto E. Escobar
- */
-public abstract class AbstractItemSelectPanel<T> {
-
- private T defaultItem;
- private T lastSelectedItem;
- private TableViewer currentItemWidget;
- private final Set<Listener> listeners;
- private final IBaseLabelProvider labelProvider;
- private final IContentProvider contentProvider;
-
- protected AbstractItemSelectPanel(IBaseLabelProvider labelProvider, IContentProvider contentProvider) {
- listeners = new HashSet<Listener>();
- this.labelProvider = labelProvider;
- this.contentProvider = contentProvider;
- }
-
- public void addListener(Listener listener) {
- synchronized (listeners) {
- listeners.add(listener);
- }
- }
-
- public void removeListener(Listener listener) {
- synchronized (listeners) {
- listeners.remove(listener);
- }
- }
-
- private void fireSelectionEvent(Event event) {
- for (Listener listener : listeners) {
- listener.handleEvent(event);
- }
- }
-
- public void createControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(ALayout.getZeroMarginLayout(2, false));
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- currentItemWidget = new TableViewer(composite, SWT.BORDER | SWT.READ_ONLY);
- currentItemWidget.setLabelProvider(labelProvider);
- currentItemWidget.setContentProvider(contentProvider);
- currentItemWidget.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- Button button = new Button(composite, SWT.PUSH);
- button.setLayoutData(new GridData(SWT.END, SWT.TOP, false, false));
- button.setText("Select");
- button.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- createDialog();
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- });
- updateCurrentItemWidget();
- }
-
- protected void updateCurrentItemWidget() {
- if (currentItemWidget != null && Widgets.isAccessible(currentItemWidget.getControl())) {
- T object = getSelected();
- if (object == null) {
- object = getDefaultItem();
- }
- if (object != null) {
- Object input;
- if (object instanceof Collection<?>) {
- input = object;
- } else {
- input = new Object[] {object};
- }
- currentItemWidget.setInput(input);
- currentItemWidget.getTable().layout();
- } else {
- currentItemWidget.setInput(new Object[] {});
- currentItemWidget.getTable().layout();
- }
- }
- }
-
- public void setDefaultItem(T defaultItem) {
- this.defaultItem = defaultItem;
- setSelected(defaultItem);
- }
-
- public T getDefaultItem() {
- return defaultItem;
- }
-
- public void setSelected(T item) {
- this.lastSelectedItem = item;
- }
-
- public T getSelected() {
- return lastSelectedItem;
- }
-
- private final void createDialog() throws OseeCoreException {
-
- T lastSelected = getSelected();
- if (lastSelected == null) {
- lastSelected = getDefaultItem();
- }
- Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
- Dialog dialog = createSelectDialog(shell, lastSelected);
-
- int result = dialog.open();
- if (result == Window.OK) {
- if (updateFromDialogResult(dialog)) {
- updateCurrentItemWidget();
- Event event = new Event();
- event.widget = currentItemWidget.getControl();
- fireSelectionEvent(event);
- }
- }
- }
-
- protected abstract boolean updateFromDialogResult(Dialog dialog);
-
- protected abstract Dialog createSelectDialog(Shell shell, T lastSelected) 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.framework.ui.skynet.panels;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.IBaseLabelProvider;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.window.Window;
+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.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.swt.ALayout;
+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.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public abstract class AbstractItemSelectPanel<T> {
+
+ private T defaultItem;
+ private T lastSelectedItem;
+ private TableViewer currentItemWidget;
+ private final Set<Listener> listeners;
+ private final IBaseLabelProvider labelProvider;
+ private final IContentProvider contentProvider;
+
+ protected AbstractItemSelectPanel(IBaseLabelProvider labelProvider, IContentProvider contentProvider) {
+ listeners = new HashSet<Listener>();
+ this.labelProvider = labelProvider;
+ this.contentProvider = contentProvider;
+ }
+
+ public void addListener(Listener listener) {
+ synchronized (listeners) {
+ listeners.add(listener);
+ }
+ }
+
+ public void removeListener(Listener listener) {
+ synchronized (listeners) {
+ listeners.remove(listener);
+ }
+ }
+
+ private void fireSelectionEvent(Event event) {
+ for (Listener listener : listeners) {
+ listener.handleEvent(event);
+ }
+ }
+
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(ALayout.getZeroMarginLayout(2, false));
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ currentItemWidget = new TableViewer(composite, SWT.BORDER | SWT.READ_ONLY);
+ currentItemWidget.setLabelProvider(labelProvider);
+ currentItemWidget.setContentProvider(contentProvider);
+ currentItemWidget.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ Button button = new Button(composite, SWT.PUSH);
+ button.setLayoutData(new GridData(SWT.END, SWT.TOP, false, false));
+ button.setText("Select");
+ button.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ createDialog();
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ });
+ updateCurrentItemWidget();
+ }
+
+ protected void updateCurrentItemWidget() {
+ if (currentItemWidget != null && Widgets.isAccessible(currentItemWidget.getControl())) {
+ T object = getSelected();
+ if (object == null) {
+ object = getDefaultItem();
+ }
+ if (object != null) {
+ Object input;
+ if (object instanceof Collection<?>) {
+ input = object;
+ } else {
+ input = new Object[] {object};
+ }
+ currentItemWidget.setInput(input);
+ currentItemWidget.getTable().layout();
+ } else {
+ currentItemWidget.setInput(new Object[] {});
+ currentItemWidget.getTable().layout();
+ }
+ }
+ }
+
+ public void setDefaultItem(T defaultItem) {
+ this.defaultItem = defaultItem;
+ setSelected(defaultItem);
+ }
+
+ public T getDefaultItem() {
+ return defaultItem;
+ }
+
+ public void setSelected(T item) {
+ this.lastSelectedItem = item;
+ }
+
+ public T getSelected() {
+ return lastSelectedItem;
+ }
+
+ private final void createDialog() throws OseeCoreException {
+
+ T lastSelected = getSelected();
+ if (lastSelected == null) {
+ lastSelected = getDefaultItem();
+ }
+ Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
+ Dialog dialog = createSelectDialog(shell, lastSelected);
+
+ int result = dialog.open();
+ if (result == Window.OK) {
+ if (updateFromDialogResult(dialog)) {
+ updateCurrentItemWidget();
+ Event event = new Event();
+ event.widget = currentItemWidget.getControl();
+ fireSelectionEvent(event);
+ }
+ }
+ }
+
+ protected abstract boolean updateFromDialogResult(Dialog dialog);
+
+ protected abstract Dialog createSelectDialog(Shell shell, T lastSelected) throws OseeCoreException;
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/ArtifactExtractorSelectPanel.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/ArtifactExtractorSelectPanel.java
index a45bdb8d951..4aed0ab0412 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/ArtifactExtractorSelectPanel.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/ArtifactExtractorSelectPanel.java
@@ -1,183 +1,183 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.panels;
-
-import java.util.HashSet;
-import java.util.Set;
-import org.eclipse.osee.framework.skynet.core.importing.ArtifactExtractorContributionManager;
-import org.eclipse.osee.framework.skynet.core.importing.parsers.IArtifactExtractor;
-import org.eclipse.osee.framework.skynet.core.importing.parsers.IArtifactExtractorDelegate;
-import org.eclipse.osee.framework.ui.swt.ALayout;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ArtifactExtractorSelectPanel {
-
- private Combo extractorCombo;
- private Combo delegateCombo;
- private Text parserInformation;
- private final ArtifactExtractorContributionManager importContributionManager;
- private final Set<Listener> listeners;
- private IArtifactExtractor selectedParser;
-
- public ArtifactExtractorSelectPanel(ArtifactExtractorContributionManager importContributionManager) {
- this.listeners = new HashSet<Listener>();
- this.importContributionManager = importContributionManager;
- }
-
- public IArtifactExtractor getArtifactExtractor() {
- return selectedParser;
- }
-
- public void setArtifactExtractor(IArtifactExtractor selectedParser) {
- this.selectedParser = selectedParser;
- }
-
- public void addListener(Listener listener) {
- synchronized (listeners) {
- listeners.add(listener);
- }
- }
-
- public void removeListener(Listener listener) {
- synchronized (listeners) {
- listeners.remove(listener);
- }
- }
-
- private void fireSelectionEvent(Event event) {
- for (Listener listener : listeners) {
- listener.handleEvent(event);
- }
- }
-
- public void createControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(ALayout.getZeroMarginLayout(1, false));
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- extractorCombo = new Combo(composite, SWT.SINGLE | SWT.BORDER | SWT.DROP_DOWN);
- extractorCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- delegateCombo = new Combo(composite, SWT.SINGLE | SWT.BORDER | SWT.DROP_DOWN);
- delegateCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- extractorCombo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleExtractorSelection();
- }
- });
-
- delegateCombo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleDelegateSelection();
- }
- });
-
- parserInformation = new Text(parent, SWT.MULTI | SWT.H_SCROLL | SWT.WRAP);
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
- gd.heightHint = 30;
- gd.widthHint = 50;
- parserInformation.setLayoutData(gd);
- parserInformation.setEditable(false);
-
- populateData();
- }
-
- private void populateData() {
- for (IArtifactExtractor extractor : importContributionManager.getExtractors()) {
- String extractorName = extractor.getName();
- extractorCombo.add(extractorName);
- extractorCombo.setData(extractorName, extractor);
- }
- extractorCombo.select(extractorCombo.getItemCount() - 3);
- handleExtractorSelection();
- }
-
- private void handleExtractorSelection() {
- IArtifactExtractor extractor = null;
- int selected = extractorCombo.getSelectionIndex();
- if (selected >= 0) {
- String key = extractorCombo.getItem(selected);
- Object object = extractorCombo.getData(key);
- if (object instanceof IArtifactExtractor) {
- extractor = (IArtifactExtractor) object;
- }
- }
- if (extractor != null) {
- parserInformation.setText(extractor.getDescription());
- setArtifactExtractor(extractor);
- } else {
- parserInformation.setText("Select a source artifact extractor");
- }
-
- java.util.List<IArtifactExtractorDelegate> delegates = importContributionManager.getDelegates(extractor);
- if (!delegates.isEmpty()) {
- delegateCombo.removeAll();
- for (int index = 0; index < delegates.size(); index++) {
- IArtifactExtractorDelegate delegate = delegates.get(index);
-
- delegateCombo.add(delegate.getName());
- delegateCombo.setData(delegate.getName(), delegate);
-
- if (extractor != null && extractor.isDelegateRequired()) {
- extractor.setDelegate(delegate);
- }
- }
- delegateCombo.select(0);
- extractor.setDelegate(delegates.get(0));
- }
- delegateCombo.setEnabled(!delegates.isEmpty());
-
- Event event = new Event();
- event.widget = extractorCombo;
- fireSelectionEvent(event);
- }
-
- private void handleDelegateSelection() {
- IArtifactExtractorDelegate delegate = null;
- if (delegateCombo.isVisible()) {
- int index = delegateCombo.getSelectionIndex();
- if (index >= 0) {
- String key = delegateCombo.getItem(index);
- Object object = delegateCombo.getData(key);
- if (object instanceof IArtifactExtractorDelegate) {
- delegate = (IArtifactExtractorDelegate) object;
- }
- }
- }
-
- IArtifactExtractor extractor = getArtifactExtractor();
- if (extractor != null) {
- if (extractor.isDelegateRequired()) {
- extractor.setDelegate(delegate);
- } else {
- extractor.setDelegate(null);
- }
- }
-
- Event event = new Event();
- event.widget = delegateCombo;
- fireSelectionEvent(event);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.panels;
+
+import java.util.HashSet;
+import java.util.Set;
+import org.eclipse.osee.framework.skynet.core.importing.ArtifactExtractorContributionManager;
+import org.eclipse.osee.framework.skynet.core.importing.parsers.IArtifactExtractor;
+import org.eclipse.osee.framework.skynet.core.importing.parsers.IArtifactExtractorDelegate;
+import org.eclipse.osee.framework.ui.swt.ALayout;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ArtifactExtractorSelectPanel {
+
+ private Combo extractorCombo;
+ private Combo delegateCombo;
+ private Text parserInformation;
+ private final ArtifactExtractorContributionManager importContributionManager;
+ private final Set<Listener> listeners;
+ private IArtifactExtractor selectedParser;
+
+ public ArtifactExtractorSelectPanel(ArtifactExtractorContributionManager importContributionManager) {
+ this.listeners = new HashSet<Listener>();
+ this.importContributionManager = importContributionManager;
+ }
+
+ public IArtifactExtractor getArtifactExtractor() {
+ return selectedParser;
+ }
+
+ public void setArtifactExtractor(IArtifactExtractor selectedParser) {
+ this.selectedParser = selectedParser;
+ }
+
+ public void addListener(Listener listener) {
+ synchronized (listeners) {
+ listeners.add(listener);
+ }
+ }
+
+ public void removeListener(Listener listener) {
+ synchronized (listeners) {
+ listeners.remove(listener);
+ }
+ }
+
+ private void fireSelectionEvent(Event event) {
+ for (Listener listener : listeners) {
+ listener.handleEvent(event);
+ }
+ }
+
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(ALayout.getZeroMarginLayout(1, false));
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ extractorCombo = new Combo(composite, SWT.SINGLE | SWT.BORDER | SWT.DROP_DOWN);
+ extractorCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ delegateCombo = new Combo(composite, SWT.SINGLE | SWT.BORDER | SWT.DROP_DOWN);
+ delegateCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ extractorCombo.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleExtractorSelection();
+ }
+ });
+
+ delegateCombo.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleDelegateSelection();
+ }
+ });
+
+ parserInformation = new Text(parent, SWT.MULTI | SWT.H_SCROLL | SWT.WRAP);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gd.heightHint = 30;
+ gd.widthHint = 50;
+ parserInformation.setLayoutData(gd);
+ parserInformation.setEditable(false);
+
+ populateData();
+ }
+
+ private void populateData() {
+ for (IArtifactExtractor extractor : importContributionManager.getExtractors()) {
+ String extractorName = extractor.getName();
+ extractorCombo.add(extractorName);
+ extractorCombo.setData(extractorName, extractor);
+ }
+ extractorCombo.select(extractorCombo.getItemCount() - 3);
+ handleExtractorSelection();
+ }
+
+ private void handleExtractorSelection() {
+ IArtifactExtractor extractor = null;
+ int selected = extractorCombo.getSelectionIndex();
+ if (selected >= 0) {
+ String key = extractorCombo.getItem(selected);
+ Object object = extractorCombo.getData(key);
+ if (object instanceof IArtifactExtractor) {
+ extractor = (IArtifactExtractor) object;
+ }
+ }
+ if (extractor != null) {
+ parserInformation.setText(extractor.getDescription());
+ setArtifactExtractor(extractor);
+ } else {
+ parserInformation.setText("Select a source artifact extractor");
+ }
+
+ java.util.List<IArtifactExtractorDelegate> delegates = importContributionManager.getDelegates(extractor);
+ if (!delegates.isEmpty()) {
+ delegateCombo.removeAll();
+ for (int index = 0; index < delegates.size(); index++) {
+ IArtifactExtractorDelegate delegate = delegates.get(index);
+
+ delegateCombo.add(delegate.getName());
+ delegateCombo.setData(delegate.getName(), delegate);
+
+ if (extractor != null && extractor.isDelegateRequired()) {
+ extractor.setDelegate(delegate);
+ }
+ }
+ delegateCombo.select(0);
+ extractor.setDelegate(delegates.get(0));
+ }
+ delegateCombo.setEnabled(!delegates.isEmpty());
+
+ Event event = new Event();
+ event.widget = extractorCombo;
+ fireSelectionEvent(event);
+ }
+
+ private void handleDelegateSelection() {
+ IArtifactExtractorDelegate delegate = null;
+ if (delegateCombo.isVisible()) {
+ int index = delegateCombo.getSelectionIndex();
+ if (index >= 0) {
+ String key = delegateCombo.getItem(index);
+ Object object = delegateCombo.getData(key);
+ if (object instanceof IArtifactExtractorDelegate) {
+ delegate = (IArtifactExtractorDelegate) object;
+ }
+ }
+ }
+
+ IArtifactExtractor extractor = getArtifactExtractor();
+ if (extractor != null) {
+ if (extractor.isDelegateRequired()) {
+ extractor.setDelegate(delegate);
+ } else {
+ extractor.setDelegate(null);
+ }
+ }
+
+ Event event = new Event();
+ event.widget = delegateCombo;
+ fireSelectionEvent(event);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/ArtifactSelectPanel.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/ArtifactSelectPanel.java
index 52fb447b319..155d1a7b02a 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/ArtifactSelectPanel.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/ArtifactSelectPanel.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.framework.ui.skynet.panels;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-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.BranchManager;
-import org.eclipse.osee.framework.ui.skynet.ArtifactLabelProvider;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.dialogs.ArtifactSelectionDialog;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.ISelectionStatusValidator;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ArtifactSelectPanel extends AbstractItemSelectPanel<Artifact> {
-
- private String title;
- private String message;
-
- public ArtifactSelectPanel() {
- super(new ArtifactLabelProvider(), new ArrayContentProvider());
- this.title = "";
- this.message = "";
- }
-
- public void setDialogTitle(String title) {
- this.title = title;
- }
-
- public void setDialogMessage(String message) {
- this.message = message;
- }
-
- @Override
- protected Dialog createSelectDialog(Shell shell, Artifact lastSelected) throws OseeCoreException {
- ArtifactSelectionDialog dialog = new ArtifactSelectionDialog(shell);
- dialog.setTitle(title);
- dialog.setMessage(message);
- dialog.setImage(ImageManager.getImage(FrameworkImage.ARTIFACT_EXPLORER));
- dialog.setValidator(new SingleSelectionStatusValidator());
- Branch branch = lastSelected != null ? lastSelected.getBranch() : BranchManager.getCommonBranch();
- dialog.setInput(branch);
- if (lastSelected != null) {
- dialog.setInitialSelections(new Object[] {lastSelected});
- }
- return dialog;
- }
-
- @Override
- protected boolean updateFromDialogResult(Dialog dialog) {
- boolean wasUpdated = false;
- ArtifactSelectionDialog castedDialog = (ArtifactSelectionDialog) dialog;
- Artifact artifact = castedDialog.getFirstResult();
- if (artifact != null) {
- setSelected(artifact);
- wasUpdated = true;
- }
- return wasUpdated;
- }
-
- private final class SingleSelectionStatusValidator implements ISelectionStatusValidator {
-
- @Override
- public IStatus validate(Object[] selection) {
- IStatus status;
- if (selection == null || selection.length != 1) {
- status = new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, IStatus.ERROR, "Must select 1 item", null);
- } else {
- status = new Status(IStatus.OK, SkynetGuiPlugin.PLUGIN_ID, 0, "", null);
- }
- return status;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.panels;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+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.BranchManager;
+import org.eclipse.osee.framework.ui.skynet.ArtifactLabelProvider;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.dialogs.ArtifactSelectionDialog;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.ISelectionStatusValidator;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ArtifactSelectPanel extends AbstractItemSelectPanel<Artifact> {
+
+ private String title;
+ private String message;
+
+ public ArtifactSelectPanel() {
+ super(new ArtifactLabelProvider(), new ArrayContentProvider());
+ this.title = "";
+ this.message = "";
+ }
+
+ public void setDialogTitle(String title) {
+ this.title = title;
+ }
+
+ public void setDialogMessage(String message) {
+ this.message = message;
+ }
+
+ @Override
+ protected Dialog createSelectDialog(Shell shell, Artifact lastSelected) throws OseeCoreException {
+ ArtifactSelectionDialog dialog = new ArtifactSelectionDialog(shell);
+ dialog.setTitle(title);
+ dialog.setMessage(message);
+ dialog.setImage(ImageManager.getImage(FrameworkImage.ARTIFACT_EXPLORER));
+ dialog.setValidator(new SingleSelectionStatusValidator());
+ Branch branch = lastSelected != null ? lastSelected.getBranch() : BranchManager.getCommonBranch();
+ dialog.setInput(branch);
+ if (lastSelected != null) {
+ dialog.setInitialSelections(new Object[] {lastSelected});
+ }
+ return dialog;
+ }
+
+ @Override
+ protected boolean updateFromDialogResult(Dialog dialog) {
+ boolean wasUpdated = false;
+ ArtifactSelectionDialog castedDialog = (ArtifactSelectionDialog) dialog;
+ Artifact artifact = castedDialog.getFirstResult();
+ if (artifact != null) {
+ setSelected(artifact);
+ wasUpdated = true;
+ }
+ return wasUpdated;
+ }
+
+ private final class SingleSelectionStatusValidator implements ISelectionStatusValidator {
+
+ @Override
+ public IStatus validate(Object[] selection) {
+ IStatus status;
+ if (selection == null || selection.length != 1) {
+ status = new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, IStatus.ERROR, "Must select 1 item", null);
+ } else {
+ status = new Status(IStatus.OK, SkynetGuiPlugin.PLUGIN_ID, 0, "", null);
+ }
+ return status;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/ArtifactTypeSelectPanel.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/ArtifactTypeSelectPanel.java
index 3801777c44a..67990a00399 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/ArtifactTypeSelectPanel.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/ArtifactTypeSelectPanel.java
@@ -1,87 +1,87 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.panels;
-
-import java.util.Arrays;
-import java.util.Collection;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.ArtifactType;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.util.ArtifactTypeLabelProvider;
-import org.eclipse.osee.framework.ui.skynet.widgets.dialog.ArtifactTypeFilteredTreeDialog;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ArtifactTypeSelectPanel extends AbstractItemSelectPanel<ArtifactType> {
-
- private Collection<ArtifactType> artifactTypes;
- private String title;
- private String message;
-
- public ArtifactTypeSelectPanel() {
- super(new ArtifactTypeLabelProvider(), new ArrayContentProvider());
- this.title = "";
- this.message = "";
- }
-
- public void setDialogTitle(String title) {
- this.title = title;
- }
-
- public void setDialogMessage(String message) {
- this.message = message;
- }
-
- public void setAllowedArtifactTypes(Collection<ArtifactType> artifactTypes) {
- this.artifactTypes = artifactTypes;
- ArtifactType currentSelection = getSelected();
- if (!artifactTypes.contains(currentSelection)) {
- this.setSelected(null);
- this.updateCurrentItemWidget();
- }
- }
-
- @Override
- protected Dialog createSelectDialog(Shell shell, ArtifactType lastSelected) throws OseeCoreException {
- ArtifactTypeFilteredTreeDialog dialog = new ArtifactTypeFilteredTreeDialog(title, message);
- dialog.setMultiSelect(false);
- if (lastSelected != null) {
- dialog.setInitialSelections(Arrays.asList(lastSelected));
- }
- try {
- dialog.setInput(artifactTypes);
- } catch (Exception ex) {
- ErrorDialog.openError(shell, title, null, // no special message
- new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, 0,
- "Unable to create artifact type selectiong dialog", ex));
- }
- return dialog;
- }
-
- @Override
- protected boolean updateFromDialogResult(Dialog dialog) {
- boolean wasUpdated = false;
- ArtifactTypeFilteredTreeDialog castedDialog = (ArtifactTypeFilteredTreeDialog) dialog;
- ArtifactType artifactType = castedDialog.getSelection();
- if (artifactType != null) {
- setSelected(artifactType);
- wasUpdated = true;
- }
- return wasUpdated;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.panels;
+
+import java.util.Arrays;
+import java.util.Collection;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.type.ArtifactType;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.util.ArtifactTypeLabelProvider;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.ArtifactTypeFilteredTreeDialog;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ArtifactTypeSelectPanel extends AbstractItemSelectPanel<ArtifactType> {
+
+ private Collection<ArtifactType> artifactTypes;
+ private String title;
+ private String message;
+
+ public ArtifactTypeSelectPanel() {
+ super(new ArtifactTypeLabelProvider(), new ArrayContentProvider());
+ this.title = "";
+ this.message = "";
+ }
+
+ public void setDialogTitle(String title) {
+ this.title = title;
+ }
+
+ public void setDialogMessage(String message) {
+ this.message = message;
+ }
+
+ public void setAllowedArtifactTypes(Collection<ArtifactType> artifactTypes) {
+ this.artifactTypes = artifactTypes;
+ ArtifactType currentSelection = getSelected();
+ if (!artifactTypes.contains(currentSelection)) {
+ this.setSelected(null);
+ this.updateCurrentItemWidget();
+ }
+ }
+
+ @Override
+ protected Dialog createSelectDialog(Shell shell, ArtifactType lastSelected) throws OseeCoreException {
+ ArtifactTypeFilteredTreeDialog dialog = new ArtifactTypeFilteredTreeDialog(title, message);
+ dialog.setMultiSelect(false);
+ if (lastSelected != null) {
+ dialog.setInitialSelections(Arrays.asList(lastSelected));
+ }
+ try {
+ dialog.setInput(artifactTypes);
+ } catch (Exception ex) {
+ ErrorDialog.openError(shell, title, null, // no special message
+ new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, 0,
+ "Unable to create artifact type selectiong dialog", ex));
+ }
+ return dialog;
+ }
+
+ @Override
+ protected boolean updateFromDialogResult(Dialog dialog) {
+ boolean wasUpdated = false;
+ ArtifactTypeFilteredTreeDialog castedDialog = (ArtifactTypeFilteredTreeDialog) dialog;
+ ArtifactType artifactType = castedDialog.getSelection();
+ if (artifactType != null) {
+ setSelected(artifactType);
+ wasUpdated = true;
+ }
+ return wasUpdated;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/AttributeTypeSelectPanel.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/AttributeTypeSelectPanel.java
index fcd2cb65a90..82c69f4d4c8 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/AttributeTypeSelectPanel.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/AttributeTypeSelectPanel.java
@@ -1,71 +1,71 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.panels;
-
-import java.util.Collection;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-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.dialog.AttributeTypeCheckTreeDialog;
-import org.eclipse.osee.framework.ui.skynet.widgets.dialog.AttributeTypeLabelProvider;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @author Roberto E. Escobar
- */
-public class AttributeTypeSelectPanel extends AbstractItemSelectPanel<Collection<AttributeType>> {
-
- private Collection<AttributeType> attributeTypes;
- private String title;
- private String message;
-
- public AttributeTypeSelectPanel() {
- super(new AttributeTypeLabelProvider(), new ArrayContentProvider());
- this.title = "";
- this.message = "";
- }
-
- public void setAllowedAttributeTypes(Collection<AttributeType> attributeTypes) {
- this.attributeTypes = attributeTypes;
- }
-
- public void setDialogTitle(String title) {
- this.title = title;
- }
-
- public void setDialogMessage(String message) {
- this.message = message;
- }
-
- @Override
- protected Dialog createSelectDialog(Shell shell, Collection<AttributeType> lastSelected) throws OseeCoreException {
- AttributeTypeCheckTreeDialog dialog = new AttributeTypeCheckTreeDialog(attributeTypes);
- dialog.setTitle(title);
- dialog.setMessage(message);
- if (lastSelected != null) {
- dialog.setInitialSelections(lastSelected.toArray());
- }
- return dialog;
- }
-
- @Override
- protected boolean updateFromDialogResult(Dialog dialog) {
- boolean wasUpdated = false;
- AttributeTypeCheckTreeDialog castedDialog = (AttributeTypeCheckTreeDialog) dialog;
- Collection<AttributeType> artifactTypes = castedDialog.getSelection();
- if (artifactTypes != null) {
- setSelected(artifactTypes);
- wasUpdated = true;
- }
- return wasUpdated;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.panels;
+
+import java.util.Collection;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+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.dialog.AttributeTypeCheckTreeDialog;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.AttributeTypeLabelProvider;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AttributeTypeSelectPanel extends AbstractItemSelectPanel<Collection<AttributeType>> {
+
+ private Collection<AttributeType> attributeTypes;
+ private String title;
+ private String message;
+
+ public AttributeTypeSelectPanel() {
+ super(new AttributeTypeLabelProvider(), new ArrayContentProvider());
+ this.title = "";
+ this.message = "";
+ }
+
+ public void setAllowedAttributeTypes(Collection<AttributeType> attributeTypes) {
+ this.attributeTypes = attributeTypes;
+ }
+
+ public void setDialogTitle(String title) {
+ this.title = title;
+ }
+
+ public void setDialogMessage(String message) {
+ this.message = message;
+ }
+
+ @Override
+ protected Dialog createSelectDialog(Shell shell, Collection<AttributeType> lastSelected) throws OseeCoreException {
+ AttributeTypeCheckTreeDialog dialog = new AttributeTypeCheckTreeDialog(attributeTypes);
+ dialog.setTitle(title);
+ dialog.setMessage(message);
+ if (lastSelected != null) {
+ dialog.setInitialSelections(lastSelected.toArray());
+ }
+ return dialog;
+ }
+
+ @Override
+ protected boolean updateFromDialogResult(Dialog dialog) {
+ boolean wasUpdated = false;
+ AttributeTypeCheckTreeDialog castedDialog = (AttributeTypeCheckTreeDialog) dialog;
+ Collection<AttributeType> artifactTypes = castedDialog.getSelection();
+ if (artifactTypes != null) {
+ setSelected(artifactTypes);
+ wasUpdated = true;
+ }
+ return wasUpdated;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/BranchSelectSimpleComposite.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/BranchSelectSimpleComposite.java
index bee17d7db3d..127777d7a41 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/BranchSelectSimpleComposite.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/BranchSelectSimpleComposite.java
@@ -1,275 +1,275 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.panels;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.branch.BranchSelectionDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-
-/**
- * @author Roberto E. Escobar
- */
-public class BranchSelectSimpleComposite extends Composite implements Listener {
- protected static final int SIZING_TEXT_FIELD_WIDTH = 250;
-
- private Button branchSelectButton;
- private Combo branchSelectCombo;
- private boolean entryChanged;
- private Branch currentBranch;
- private final Set<Listener> listeners;
- private final boolean allowOnlyWorkingBranches;
-
- private BranchSelectSimpleComposite(Composite parent, int style, boolean allowOnlyWorkingBranches) {
- super(parent, style);
- this.allowOnlyWorkingBranches = allowOnlyWorkingBranches;
- this.entryChanged = false;
- this.listeners = Collections.synchronizedSet(new HashSet<Listener>());
- this.currentBranch = null;
- createControl(this);
- }
-
- public static BranchSelectSimpleComposite createWorkingBranchSelectComposite(Composite parent, int style) {
- return new BranchSelectSimpleComposite(parent, style, true);
- }
-
- public static BranchSelectSimpleComposite createBranchSelectComposite(Composite parent, int style) {
- return new BranchSelectSimpleComposite(parent, style, false);
- }
-
- private void createControl(Composite parent) {
- parent.setLayout(new GridLayout(2, false));
- parent.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
-
- branchSelectCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- branchSelectCombo.setLayoutData(data);
- branchSelectCombo.setFont(parent.getFont());
- branchSelectCombo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- updateFromSourceField();
- }
- });
-
- branchSelectCombo.addKeyListener(new KeyAdapter() {
- @Override
- public void keyPressed(KeyEvent e) {
- // If there has been a key pressed then mark as dirty
- entryChanged = true;
- }
- });
-
- branchSelectCombo.addFocusListener(new FocusAdapter() {
- @Override
- public void focusLost(FocusEvent e) {
- // Clear the flag to prevent constant update
- if (entryChanged) {
- entryChanged = false;
- updateFromSourceField();
- }
- }
- });
-
- branchSelectButton = new Button(parent, SWT.PUSH);
- branchSelectButton.setText("Select Branch...");
- branchSelectButton.addListener(SWT.Selection, this);
- branchSelectButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- branchSelectButton.setFont(parent.getFont());
- }
-
- public Branch getSelectedBranch() {
- Branch toReturn = null;
- if (branchSelectCombo != null && branchSelectCombo.isDisposed() != true) {
- String branchName = branchSelectCombo.getText();
- if (Strings.isValid(branchName)) {
- toReturn = (Branch) branchSelectCombo.getData(branchName);
- if (toReturn == null) {
- try {
- toReturn = BranchManager.getBranch(branchName);
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- }
- currentBranch = toReturn;
- }
- return currentBranch;
- }
-
- private boolean areOnlyWorkingBranchesAllowed() {
- return allowOnlyWorkingBranches;
- }
-
- private void updateFromSourceField() {
- setBranchName(getSelectedBranch());
- notifyListener(new Event());
- }
-
- private Branch getCurrentBranch() {
- return currentBranch;
- }
-
- private void setBranchName(Branch branch) {
- if (branch != null) {
- String branchName = branch.getName();
- String[] currentItems = this.branchSelectCombo.getItems();
- int selectionIndex = -1;
- for (int i = 0; i < currentItems.length; i++) {
- if (currentItems[i].equals(branchName)) {
- selectionIndex = i;
- }
- }
- if (selectionIndex < 0) {
- int oldLength = currentItems.length;
- String[] newItems = new String[oldLength + 1];
- System.arraycopy(currentItems, 0, newItems, 0, oldLength);
- newItems[oldLength] = branchName;
- this.branchSelectCombo.setItems(newItems);
- selectionIndex = oldLength;
- branchSelectCombo.setData(branch.getName(), branch);
- branchSelectCombo.setData(String.valueOf(branch.getId()), branch);
- }
- this.branchSelectCombo.select(selectionIndex);
- }
- }
-
- public void restoreWidgetValues(String[] branchIds, String lastSelected) {
- Branch currentBranch = getCurrentBranch();
-
- // Add stored directories into selector
- if (Strings.isValid(lastSelected) == false && currentBranch != null) {
- lastSelected = Integer.toString(currentBranch.getId());
- }
-
- if (branchIds == null) {
- if (Strings.isValid(lastSelected)) {
- branchIds = new String[] {lastSelected};
- } else {
- branchIds = new String[0];
- }
- }
-
- List<String> branchIdsToUse = new ArrayList<String>();
- for (String id : branchIds) {
- try {
- Branch branch = BranchManager.getBranch(Integer.parseInt(id));
- if (branch != null) {
- branchIdsToUse.add(id);
- }
- } catch (Exception ex) {
- // Do nothing
- }
- }
-
- setCombo(branchIdsToUse.toArray(new String[branchIdsToUse.size()]), lastSelected);
- }
-
- private void setCombo(String[] values, String lastSelected) {
- int toSelect = 0;
- for (int i = 0; i < values.length; i++) {
- String toStore = values[i];
- if (Strings.isValid(toStore)) {
- try {
- Branch branch = BranchManager.getBranch(Integer.parseInt(toStore));
-
- if (isBranchAllowed(branch) != false) {
- String branchName = branch.getName();
- branchSelectCombo.add(branchName);
- branchSelectCombo.setData(String.valueOf(branch.getId()), branch);
- branchSelectCombo.setData(branchName, branch);
- if (toStore.equals(lastSelected)) {
- toSelect = i;
- branchSelectCombo.select(toSelect);
- }
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, String.format(
- "Unable to add invalid branch id [%s] to selection list.", toStore));
- }
- }
- }
- }
-
- private boolean isBranchAllowed(Branch branch) throws Exception {
- if (areOnlyWorkingBranchesAllowed() && !branch.hasParentBranch()) {
- return false;
- }
- return true;
- }
-
- public String[] getBranchIds() {
- String[] items = branchSelectCombo.getItems();
- List<String> toReturn = new ArrayList<String>();
- for (String item : items) {
- Branch branch = (Branch) branchSelectCombo.getData(item);
- if (branch != null) {
- toReturn.add(String.valueOf(branch.getId()));
- }
- }
- return toReturn.toArray(new String[toReturn.size()]);
- }
-
- public void handleEvent(Event event) {
- if (event.widget == branchSelectButton) {
- if (areOnlyWorkingBranchesAllowed() != false) {
- setBranchName(BranchSelectionDialog.getWorkingBranchFromUser());
- } else {
- setBranchName(BranchSelectionDialog.getBranchFromUser());
- }
- }
- notifyListener(event);
- }
-
- private void notifyListener(Event event) {
- synchronized (listeners) {
- for (Listener listener : listeners) {
- listener.handleEvent(event);
- }
- }
- }
-
- public void addListener(Listener listener) {
- synchronized (listeners) {
- listeners.add(listener);
- }
- }
-
- public void removeListener(Listener listener) {
- synchronized (listeners) {
- listeners.remove(listener);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.panels;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.branch.BranchSelectionDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class BranchSelectSimpleComposite extends Composite implements Listener {
+ protected static final int SIZING_TEXT_FIELD_WIDTH = 250;
+
+ private Button branchSelectButton;
+ private Combo branchSelectCombo;
+ private boolean entryChanged;
+ private Branch currentBranch;
+ private final Set<Listener> listeners;
+ private final boolean allowOnlyWorkingBranches;
+
+ private BranchSelectSimpleComposite(Composite parent, int style, boolean allowOnlyWorkingBranches) {
+ super(parent, style);
+ this.allowOnlyWorkingBranches = allowOnlyWorkingBranches;
+ this.entryChanged = false;
+ this.listeners = Collections.synchronizedSet(new HashSet<Listener>());
+ this.currentBranch = null;
+ createControl(this);
+ }
+
+ public static BranchSelectSimpleComposite createWorkingBranchSelectComposite(Composite parent, int style) {
+ return new BranchSelectSimpleComposite(parent, style, true);
+ }
+
+ public static BranchSelectSimpleComposite createBranchSelectComposite(Composite parent, int style) {
+ return new BranchSelectSimpleComposite(parent, style, false);
+ }
+
+ private void createControl(Composite parent) {
+ parent.setLayout(new GridLayout(2, false));
+ parent.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+
+ branchSelectCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
+ data.widthHint = SIZING_TEXT_FIELD_WIDTH;
+ branchSelectCombo.setLayoutData(data);
+ branchSelectCombo.setFont(parent.getFont());
+ branchSelectCombo.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateFromSourceField();
+ }
+ });
+
+ branchSelectCombo.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ // If there has been a key pressed then mark as dirty
+ entryChanged = true;
+ }
+ });
+
+ branchSelectCombo.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusLost(FocusEvent e) {
+ // Clear the flag to prevent constant update
+ if (entryChanged) {
+ entryChanged = false;
+ updateFromSourceField();
+ }
+ }
+ });
+
+ branchSelectButton = new Button(parent, SWT.PUSH);
+ branchSelectButton.setText("Select Branch...");
+ branchSelectButton.addListener(SWT.Selection, this);
+ branchSelectButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+ branchSelectButton.setFont(parent.getFont());
+ }
+
+ public Branch getSelectedBranch() {
+ Branch toReturn = null;
+ if (branchSelectCombo != null && branchSelectCombo.isDisposed() != true) {
+ String branchName = branchSelectCombo.getText();
+ if (Strings.isValid(branchName)) {
+ toReturn = (Branch) branchSelectCombo.getData(branchName);
+ if (toReturn == null) {
+ try {
+ toReturn = BranchManager.getBranch(branchName);
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ currentBranch = toReturn;
+ }
+ return currentBranch;
+ }
+
+ private boolean areOnlyWorkingBranchesAllowed() {
+ return allowOnlyWorkingBranches;
+ }
+
+ private void updateFromSourceField() {
+ setBranchName(getSelectedBranch());
+ notifyListener(new Event());
+ }
+
+ private Branch getCurrentBranch() {
+ return currentBranch;
+ }
+
+ private void setBranchName(Branch branch) {
+ if (branch != null) {
+ String branchName = branch.getName();
+ String[] currentItems = this.branchSelectCombo.getItems();
+ int selectionIndex = -1;
+ for (int i = 0; i < currentItems.length; i++) {
+ if (currentItems[i].equals(branchName)) {
+ selectionIndex = i;
+ }
+ }
+ if (selectionIndex < 0) {
+ int oldLength = currentItems.length;
+ String[] newItems = new String[oldLength + 1];
+ System.arraycopy(currentItems, 0, newItems, 0, oldLength);
+ newItems[oldLength] = branchName;
+ this.branchSelectCombo.setItems(newItems);
+ selectionIndex = oldLength;
+ branchSelectCombo.setData(branch.getName(), branch);
+ branchSelectCombo.setData(String.valueOf(branch.getId()), branch);
+ }
+ this.branchSelectCombo.select(selectionIndex);
+ }
+ }
+
+ public void restoreWidgetValues(String[] branchIds, String lastSelected) {
+ Branch currentBranch = getCurrentBranch();
+
+ // Add stored directories into selector
+ if (Strings.isValid(lastSelected) == false && currentBranch != null) {
+ lastSelected = Integer.toString(currentBranch.getId());
+ }
+
+ if (branchIds == null) {
+ if (Strings.isValid(lastSelected)) {
+ branchIds = new String[] {lastSelected};
+ } else {
+ branchIds = new String[0];
+ }
+ }
+
+ List<String> branchIdsToUse = new ArrayList<String>();
+ for (String id : branchIds) {
+ try {
+ Branch branch = BranchManager.getBranch(Integer.parseInt(id));
+ if (branch != null) {
+ branchIdsToUse.add(id);
+ }
+ } catch (Exception ex) {
+ // Do nothing
+ }
+ }
+
+ setCombo(branchIdsToUse.toArray(new String[branchIdsToUse.size()]), lastSelected);
+ }
+
+ private void setCombo(String[] values, String lastSelected) {
+ int toSelect = 0;
+ for (int i = 0; i < values.length; i++) {
+ String toStore = values[i];
+ if (Strings.isValid(toStore)) {
+ try {
+ Branch branch = BranchManager.getBranch(Integer.parseInt(toStore));
+
+ if (isBranchAllowed(branch) != false) {
+ String branchName = branch.getName();
+ branchSelectCombo.add(branchName);
+ branchSelectCombo.setData(String.valueOf(branch.getId()), branch);
+ branchSelectCombo.setData(branchName, branch);
+ if (toStore.equals(lastSelected)) {
+ toSelect = i;
+ branchSelectCombo.select(toSelect);
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, String.format(
+ "Unable to add invalid branch id [%s] to selection list.", toStore));
+ }
+ }
+ }
+ }
+
+ private boolean isBranchAllowed(Branch branch) throws Exception {
+ if (areOnlyWorkingBranchesAllowed() && !branch.hasParentBranch()) {
+ return false;
+ }
+ return true;
+ }
+
+ public String[] getBranchIds() {
+ String[] items = branchSelectCombo.getItems();
+ List<String> toReturn = new ArrayList<String>();
+ for (String item : items) {
+ Branch branch = (Branch) branchSelectCombo.getData(item);
+ if (branch != null) {
+ toReturn.add(String.valueOf(branch.getId()));
+ }
+ }
+ return toReturn.toArray(new String[toReturn.size()]);
+ }
+
+ public void handleEvent(Event event) {
+ if (event.widget == branchSelectButton) {
+ if (areOnlyWorkingBranchesAllowed() != false) {
+ setBranchName(BranchSelectionDialog.getWorkingBranchFromUser());
+ } else {
+ setBranchName(BranchSelectionDialog.getBranchFromUser());
+ }
+ }
+ notifyListener(event);
+ }
+
+ private void notifyListener(Event event) {
+ synchronized (listeners) {
+ for (Listener listener : listeners) {
+ listener.handleEvent(event);
+ }
+ }
+ }
+
+ public void addListener(Listener listener) {
+ synchronized (listeners) {
+ listeners.add(listener);
+ }
+ }
+
+ public void removeListener(Listener listener) {
+ synchronized (listeners) {
+ listeners.remove(listener);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/DetailsBrowserComposite.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/DetailsBrowserComposite.java
index 74c372096af..5db7cda333a 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/DetailsBrowserComposite.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/DetailsBrowserComposite.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.panels;
-
-import java.util.logging.Level;
-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.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.ToolBar;
-
-/**
- * @author Donald G. Dunne
- */
-public class DetailsBrowserComposite extends BrowserComposite {
-
- /**
- * @param parent
- * @param style
- */
- public DetailsBrowserComposite(Artifact artifact, Composite parent, int style, ToolBar toolBar) {
- super(parent, style, toolBar);
- StringBuffer sb =
- new StringBuffer(AHTML.getLabelValueStr("Name", artifact.getName()) + AHTML.newline());
- try {
- sb.append(AHTML.getLabelValueStr("GUID", artifact.getGuid()) + AHTML.newline());
- sb.append(AHTML.getLabelValueStr("HRID", artifact.getHumanReadableId()) + AHTML.newline());
- sb.append(AHTML.getLabelValueStr("Branch", artifact.getBranch().toString()) + AHTML.newline());
- sb.append(AHTML.getLabelValueStr("Branch Id", String.valueOf(artifact.getBranch().getId())) + AHTML.newline());
- sb.append(AHTML.getLabelValueStr("Artifact Id", String.valueOf(artifact.getArtId())) + AHTML.newline());
- sb.append(AHTML.getLabelValueStr("Artifact Type Name", artifact.getArtifactTypeName()) + AHTML.newline());
- sb.append(AHTML.getLabelValueStr("Artifact Type Id", String.valueOf(artifact.getArtTypeId())) + AHTML.newline());
- sb.append(AHTML.getLabelValueStr("Gamma Id", String.valueOf(artifact.getGammaId())) + AHTML.newline());
- sb.append(AHTML.getLabelValueStr("Historical", String.valueOf(artifact.isHistorical())) + AHTML.newline());
- sb.append(AHTML.getLabelValueStr("Deleted", String.valueOf(artifact.isDeleted())) + AHTML.newline());
- sb.append(AHTML.getLabelValueStr("Revision", String.valueOf(artifact.getTransactionNumber())) + AHTML.newline());
- sb.append(AHTML.getLabelValueStr("Last Modified", String.valueOf(artifact.getLastModified())) + AHTML.newline());
- sb.append(AHTML.getLabelValueStr("Last Modified By", String.valueOf(artifact.getLastModifiedBy())) + AHTML.newline());
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- sb.append(AHTML.getLabelStr("Exception in rendering details: ", ex.getLocalizedMessage()));
- }
- setHtml(AHTML.simplePage(sb.toString()));
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.panels;
+
+import java.util.logging.Level;
+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.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.ToolBar;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class DetailsBrowserComposite extends BrowserComposite {
+
+ /**
+ * @param parent
+ * @param style
+ */
+ public DetailsBrowserComposite(Artifact artifact, Composite parent, int style, ToolBar toolBar) {
+ super(parent, style, toolBar);
+ StringBuffer sb =
+ new StringBuffer(AHTML.getLabelValueStr("Name", artifact.getName()) + AHTML.newline());
+ try {
+ sb.append(AHTML.getLabelValueStr("GUID", artifact.getGuid()) + AHTML.newline());
+ sb.append(AHTML.getLabelValueStr("HRID", artifact.getHumanReadableId()) + AHTML.newline());
+ sb.append(AHTML.getLabelValueStr("Branch", artifact.getBranch().toString()) + AHTML.newline());
+ sb.append(AHTML.getLabelValueStr("Branch Id", String.valueOf(artifact.getBranch().getId())) + AHTML.newline());
+ sb.append(AHTML.getLabelValueStr("Artifact Id", String.valueOf(artifact.getArtId())) + AHTML.newline());
+ sb.append(AHTML.getLabelValueStr("Artifact Type Name", artifact.getArtifactTypeName()) + AHTML.newline());
+ sb.append(AHTML.getLabelValueStr("Artifact Type Id", String.valueOf(artifact.getArtTypeId())) + AHTML.newline());
+ sb.append(AHTML.getLabelValueStr("Gamma Id", String.valueOf(artifact.getGammaId())) + AHTML.newline());
+ sb.append(AHTML.getLabelValueStr("Historical", String.valueOf(artifact.isHistorical())) + AHTML.newline());
+ sb.append(AHTML.getLabelValueStr("Deleted", String.valueOf(artifact.isDeleted())) + AHTML.newline());
+ sb.append(AHTML.getLabelValueStr("Revision", String.valueOf(artifact.getTransactionNumber())) + AHTML.newline());
+ sb.append(AHTML.getLabelValueStr("Last Modified", String.valueOf(artifact.getLastModified())) + AHTML.newline());
+ sb.append(AHTML.getLabelValueStr("Last Modified By", String.valueOf(artifact.getLastModifiedBy())) + AHTML.newline());
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ sb.append(AHTML.getLabelStr("Exception in rendering details: ", ex.getLocalizedMessage()));
+ }
+ setHtml(AHTML.simplePage(sb.toString()));
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/SearchComposite.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/SearchComposite.java
index b31b023bad7..82dcc8d4a76 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/SearchComposite.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/SearchComposite.java
@@ -1,290 +1,290 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.panels;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.swt.Widgets;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- * @author Roberto E. Escobar
- */
-public class SearchComposite extends Composite implements Listener {
- private static final String SEARCH_BUTTON_TOOLTIP = "Executes search";
- private static final String SEARCH_COMBO_TOOLTIP =
- "Enter word(s) to search for or select historical value from pull-down on the right.";
-
- private final Set<Listener> listeners;
- private Combo searchArea;
- private Button executeSearch;
- private Button clear;
- private boolean entryChanged;
-
- public SearchComposite(Composite parent, int style) {
- super(parent, style);
- this.listeners = new HashSet<Listener>();
- this.entryChanged = false;
- createControl(this);
- }
-
- private void createControl(Composite parent) {
- GridLayout gL = new GridLayout();
- gL.marginHeight = 0;
- gL.marginWidth = 0;
- parent.setLayout(gL);
- parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- createSearchInputArea(parent);
- }
-
- private void createSearchInputArea(Composite parent) {
- Group group = new Group(parent, SWT.NONE);
- group.setLayout(new GridLayout(2, false));
- group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- group.setText("Enter Search String");
-
- createButtonBar(group);
-
- this.searchArea = new Combo(group, SWT.BORDER);
- this.searchArea.setFont(getFont());
- this.searchArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- this.searchArea.addKeyListener(new KeyAdapter() {
- @Override
- public void keyPressed(KeyEvent event) {
- // If there has been a key pressed then mark as dirty
- entryChanged = true;
-
- if (event.character == '\r') {
- if (executeSearch.getEnabled()) {
- if (entryChanged) {
- entryChanged = false;
- updateFromSourceField();
- }
-
- Event sendEvent = new Event();
- sendEvent.widget = event.widget;
- sendEvent.character = event.character;
- sendEvent.type = SWT.KeyUp;
- notifyListener(sendEvent);
- }
- }
- }
- });
-
- this.searchArea.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- updateWidgetEnablements();
- }
- });
-
- this.searchArea.setToolTipText(SEARCH_COMBO_TOOLTIP);
- }
-
- private void createButtonBar(Composite parent) {
- this.executeSearch = new Button(parent, SWT.NONE);
- this.executeSearch.setText("Search");
- this.executeSearch.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (entryChanged) {
- entryChanged = false;
- updateFromSourceField();
- }
- }
- });
- this.executeSearch.addListener(SWT.Selection, this);
- this.executeSearch.setEnabled(false);
- this.executeSearch.setFont(getFont());
- this.executeSearch.setToolTipText(SEARCH_BUTTON_TOOLTIP);
- }
-
- public void clearHistory() {
- if (searchArea.getItemCount() > 0) {
- searchArea.removeAll();
- }
- }
-
- private void updateFromSourceField() {
- setSearchQuery(getQuery());
- updateWidgetEnablements();
- }
-
- private void setSearchQuery(String query) {
- if (Strings.isValid(query)) {
- String[] currentItems = this.searchArea.getItems();
- int selectionIndex = -1;
- for (int i = 0; i < currentItems.length; i++) {
- if (currentItems[i].equals(query)) {
- selectionIndex = i;
- }
- }
- if (selectionIndex < 0) {
- int oldLength = currentItems.length;
- String[] newItems = new String[oldLength + 1];
- System.arraycopy(currentItems, 0, newItems, 0, oldLength);
- newItems[oldLength] = query;
- this.searchArea.setItems(newItems);
- selectionIndex = oldLength;
- }
- this.searchArea.select(selectionIndex);
- }
- }
-
- public String getQuery() {
- String toReturn = "";
- if (Widgets.isAccessible(this.searchArea)) {
- String query = this.searchArea.getText();
- if (Strings.isValid(query)) {
- toReturn = query;
- }
- }
- return toReturn;
- }
-
- private void updateWidgetEnablements() {
- if (Widgets.isAccessible(this.searchArea)) {
- String value = this.searchArea.getText();
- if (value != null) {
- value = value.trim();
- }
- if (Widgets.isAccessible(this.executeSearch)) {
- this.executeSearch.setEnabled(Strings.isValid(value));
- }
- if (Widgets.isAccessible(this.clear)) {
- this.clear.setEnabled(this.searchArea.getItemCount() > 0);
- }
- }
- }
-
- public void handleEvent(Event event) {
- updateWidgetEnablements();
- notifyListener(event);
- }
-
- public void addListener(Listener listener) {
- synchronized (listeners) {
- this.listeners.add(listener);
- }
- }
-
- public void removeListener(Listener listener) {
- synchronized (listeners) {
- this.listeners.remove(listener);
- }
- }
-
- private void notifyListener(Event event) {
- synchronized (listeners) {
- for (Listener listener : listeners) {
- listener.handleEvent(event);
- }
- }
- }
-
- public String[] getQueryHistory() {
- return Widgets.isAccessible(this.searchArea) ? this.searchArea.getItems() : new String[0];
- }
-
- private void setCombo(List<String> values, String lastSelected) {
- int toSelect = 0;
- for (int i = 0; i < values.size(); i++) {
- String toStore = values.get(i);
- if (Strings.isValid(toStore)) {
- this.searchArea.add(toStore);
- if (toStore.equals(lastSelected)) {
- toSelect = i;
- this.searchArea.select(toSelect);
- }
- }
- }
- }
-
- public void restoreWidgetValues(List<String> querySearches, String lastSelected, Map<String, Boolean> options, Map<String, String[]> configs) {
- String currentSearch = getQuery();
-
- // Add stored directories into selector
- if (Strings.isValid(lastSelected) == false && currentSearch != null) {
- lastSelected = currentSearch;
- }
-
- if (querySearches == null || querySearches.isEmpty()) {
- if (Strings.isValid(lastSelected)) {
- querySearches = new ArrayList<String>();
- querySearches.add(lastSelected);
- } else {
- querySearches = Collections.emptyList();
- }
- }
- setCombo(querySearches, lastSelected);
- }
-
- public boolean isExecuteSearchEvent(Event event) {
- boolean toReturn = false;
- Widget widget = event.widget;
- if (widget != null) {
- if (widget.equals(this.executeSearch)) {
- toReturn = true;
- } else if (widget.equals(this.searchArea) && event.type == SWT.KeyUp && event.character == '\r') {
- toReturn = true;
- }
- }
- return toReturn;
- }
-
- public void setToolTipForSearchCombo(String toolTip) {
- if (Widgets.isAccessible(this.searchArea)) {
- this.searchArea.setToolTipText(toolTip);
- }
- }
-
- public void setHelpContext(String helpContext) {
- if (Widgets.isAccessible(this.searchArea) && Widgets.isAccessible(this.executeSearch) && Widgets.isAccessible(this.clear)) {
- SkynetGuiPlugin.getInstance().setHelp(searchArea, helpContext, "org.eclipse.osee.framework.help.ui");
- SkynetGuiPlugin.getInstance().setHelp(executeSearch, helpContext, "org.eclipse.osee.framework.help.ui");
- SkynetGuiPlugin.getInstance().setHelp(clear, helpContext, "org.eclipse.osee.framework.help.ui");
- }
- }
-
- public List<Control> getSearchChildren() {
- List<Control> children = new ArrayList<Control>();
- if (Widgets.isAccessible(this.searchArea) && Widgets.isAccessible(this.executeSearch) && Widgets.isAccessible(this.clear)) {
- children = Arrays.asList(this, searchArea, executeSearch, clear);
- }
- return children;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.panels;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.swt.Widgets;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Widget;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class SearchComposite extends Composite implements Listener {
+ private static final String SEARCH_BUTTON_TOOLTIP = "Executes search";
+ private static final String SEARCH_COMBO_TOOLTIP =
+ "Enter word(s) to search for or select historical value from pull-down on the right.";
+
+ private final Set<Listener> listeners;
+ private Combo searchArea;
+ private Button executeSearch;
+ private Button clear;
+ private boolean entryChanged;
+
+ public SearchComposite(Composite parent, int style) {
+ super(parent, style);
+ this.listeners = new HashSet<Listener>();
+ this.entryChanged = false;
+ createControl(this);
+ }
+
+ private void createControl(Composite parent) {
+ GridLayout gL = new GridLayout();
+ gL.marginHeight = 0;
+ gL.marginWidth = 0;
+ parent.setLayout(gL);
+ parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ createSearchInputArea(parent);
+ }
+
+ private void createSearchInputArea(Composite parent) {
+ Group group = new Group(parent, SWT.NONE);
+ group.setLayout(new GridLayout(2, false));
+ group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ group.setText("Enter Search String");
+
+ createButtonBar(group);
+
+ this.searchArea = new Combo(group, SWT.BORDER);
+ this.searchArea.setFont(getFont());
+ this.searchArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ this.searchArea.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent event) {
+ // If there has been a key pressed then mark as dirty
+ entryChanged = true;
+
+ if (event.character == '\r') {
+ if (executeSearch.getEnabled()) {
+ if (entryChanged) {
+ entryChanged = false;
+ updateFromSourceField();
+ }
+
+ Event sendEvent = new Event();
+ sendEvent.widget = event.widget;
+ sendEvent.character = event.character;
+ sendEvent.type = SWT.KeyUp;
+ notifyListener(sendEvent);
+ }
+ }
+ }
+ });
+
+ this.searchArea.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ updateWidgetEnablements();
+ }
+ });
+
+ this.searchArea.setToolTipText(SEARCH_COMBO_TOOLTIP);
+ }
+
+ private void createButtonBar(Composite parent) {
+ this.executeSearch = new Button(parent, SWT.NONE);
+ this.executeSearch.setText("Search");
+ this.executeSearch.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (entryChanged) {
+ entryChanged = false;
+ updateFromSourceField();
+ }
+ }
+ });
+ this.executeSearch.addListener(SWT.Selection, this);
+ this.executeSearch.setEnabled(false);
+ this.executeSearch.setFont(getFont());
+ this.executeSearch.setToolTipText(SEARCH_BUTTON_TOOLTIP);
+ }
+
+ public void clearHistory() {
+ if (searchArea.getItemCount() > 0) {
+ searchArea.removeAll();
+ }
+ }
+
+ private void updateFromSourceField() {
+ setSearchQuery(getQuery());
+ updateWidgetEnablements();
+ }
+
+ private void setSearchQuery(String query) {
+ if (Strings.isValid(query)) {
+ String[] currentItems = this.searchArea.getItems();
+ int selectionIndex = -1;
+ for (int i = 0; i < currentItems.length; i++) {
+ if (currentItems[i].equals(query)) {
+ selectionIndex = i;
+ }
+ }
+ if (selectionIndex < 0) {
+ int oldLength = currentItems.length;
+ String[] newItems = new String[oldLength + 1];
+ System.arraycopy(currentItems, 0, newItems, 0, oldLength);
+ newItems[oldLength] = query;
+ this.searchArea.setItems(newItems);
+ selectionIndex = oldLength;
+ }
+ this.searchArea.select(selectionIndex);
+ }
+ }
+
+ public String getQuery() {
+ String toReturn = "";
+ if (Widgets.isAccessible(this.searchArea)) {
+ String query = this.searchArea.getText();
+ if (Strings.isValid(query)) {
+ toReturn = query;
+ }
+ }
+ return toReturn;
+ }
+
+ private void updateWidgetEnablements() {
+ if (Widgets.isAccessible(this.searchArea)) {
+ String value = this.searchArea.getText();
+ if (value != null) {
+ value = value.trim();
+ }
+ if (Widgets.isAccessible(this.executeSearch)) {
+ this.executeSearch.setEnabled(Strings.isValid(value));
+ }
+ if (Widgets.isAccessible(this.clear)) {
+ this.clear.setEnabled(this.searchArea.getItemCount() > 0);
+ }
+ }
+ }
+
+ public void handleEvent(Event event) {
+ updateWidgetEnablements();
+ notifyListener(event);
+ }
+
+ public void addListener(Listener listener) {
+ synchronized (listeners) {
+ this.listeners.add(listener);
+ }
+ }
+
+ public void removeListener(Listener listener) {
+ synchronized (listeners) {
+ this.listeners.remove(listener);
+ }
+ }
+
+ private void notifyListener(Event event) {
+ synchronized (listeners) {
+ for (Listener listener : listeners) {
+ listener.handleEvent(event);
+ }
+ }
+ }
+
+ public String[] getQueryHistory() {
+ return Widgets.isAccessible(this.searchArea) ? this.searchArea.getItems() : new String[0];
+ }
+
+ private void setCombo(List<String> values, String lastSelected) {
+ int toSelect = 0;
+ for (int i = 0; i < values.size(); i++) {
+ String toStore = values.get(i);
+ if (Strings.isValid(toStore)) {
+ this.searchArea.add(toStore);
+ if (toStore.equals(lastSelected)) {
+ toSelect = i;
+ this.searchArea.select(toSelect);
+ }
+ }
+ }
+ }
+
+ public void restoreWidgetValues(List<String> querySearches, String lastSelected, Map<String, Boolean> options, Map<String, String[]> configs) {
+ String currentSearch = getQuery();
+
+ // Add stored directories into selector
+ if (Strings.isValid(lastSelected) == false && currentSearch != null) {
+ lastSelected = currentSearch;
+ }
+
+ if (querySearches == null || querySearches.isEmpty()) {
+ if (Strings.isValid(lastSelected)) {
+ querySearches = new ArrayList<String>();
+ querySearches.add(lastSelected);
+ } else {
+ querySearches = Collections.emptyList();
+ }
+ }
+ setCombo(querySearches, lastSelected);
+ }
+
+ public boolean isExecuteSearchEvent(Event event) {
+ boolean toReturn = false;
+ Widget widget = event.widget;
+ if (widget != null) {
+ if (widget.equals(this.executeSearch)) {
+ toReturn = true;
+ } else if (widget.equals(this.searchArea) && event.type == SWT.KeyUp && event.character == '\r') {
+ toReturn = true;
+ }
+ }
+ return toReturn;
+ }
+
+ public void setToolTipForSearchCombo(String toolTip) {
+ if (Widgets.isAccessible(this.searchArea)) {
+ this.searchArea.setToolTipText(toolTip);
+ }
+ }
+
+ public void setHelpContext(String helpContext) {
+ if (Widgets.isAccessible(this.searchArea) && Widgets.isAccessible(this.executeSearch) && Widgets.isAccessible(this.clear)) {
+ SkynetGuiPlugin.getInstance().setHelp(searchArea, helpContext, "org.eclipse.osee.framework.help.ui");
+ SkynetGuiPlugin.getInstance().setHelp(executeSearch, helpContext, "org.eclipse.osee.framework.help.ui");
+ SkynetGuiPlugin.getInstance().setHelp(clear, helpContext, "org.eclipse.osee.framework.help.ui");
+ }
+ }
+
+ public List<Control> getSearchChildren() {
+ List<Control> children = new ArrayList<Control>();
+ if (Widgets.isAccessible(this.searchArea) && Widgets.isAccessible(this.executeSearch) && Widgets.isAccessible(this.clear)) {
+ children = Arrays.asList(this, searchArea, executeSearch, clear);
+ }
+ return children;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/ArbitrationServerPage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/ArbitrationServerPage.java
index b66c4c686c3..24ef97706de 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/ArbitrationServerPage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/ArbitrationServerPage.java
@@ -1,150 +1,150 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.preferences;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.osee.framework.core.client.OseeClientProperties;
-import org.eclipse.osee.framework.core.client.server.HttpUrlBuilderClient;
-import org.eclipse.osee.framework.core.data.OseeCodeVersion;
-import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ArbitrationServerPage extends PreferencePage implements IWorkbenchPreferencePage {
-
- public ArbitrationServerPage() {
- super();
- }
-
- @Override
- protected Control createContents(Composite parent) {
- Composite content = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- content.setLayout(layout);
- content.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- Group resourceGroup = new Group(content, SWT.NONE);
- resourceGroup.setLayout(new GridLayout());
- resourceGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- resourceGroup.setText("OSEE Arbitration");
-
- Composite resourceComposite = new Composite(resourceGroup, SWT.NONE);
- resourceComposite.setLayout(new GridLayout(2, false));
- resourceComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- boolean wasArbitrationOverriden = Strings.isValid(OseeClientProperties.getOseeApplicationServer());
- String defaultArbitrationServer = null;
- if (!wasArbitrationOverriden) {
- try {
- defaultArbitrationServer = HttpUrlBuilderClient.getInstance().getArbitrationServerPrefix();
- } catch (OseeDataStoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
-
- String defaultApplicationServer = null;
- try {
- defaultApplicationServer = HttpUrlBuilderClient.getInstance().getApplicationServerPrefix();
- } catch (OseeDataStoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
-
- List<Data> entries = new ArrayList<Data>();
-
- if (wasArbitrationOverriden) {
- entries.add(new Data("Arbitration", "Disabled", Displays.getSystemColor(SWT.COLOR_RED)));
- entries.add(new Data("Application Server: ", defaultApplicationServer != null ? defaultApplicationServer : ""));
- } else {
- entries.add(new Data("Arbitration Server: ", defaultArbitrationServer != null ? defaultArbitrationServer : ""));
- entries.add(new Data("Version To Match: ", OseeCodeVersion.getVersion()));
- entries.add(new Data("Resolved To Server: ", defaultApplicationServer != null ? defaultApplicationServer : ""));
- }
- for (Data entry : entries) {
- Label label1 = new Label(resourceComposite, SWT.NONE);
- label1.setForeground(entry.getLabelColor());
- label1.setText(entry.getLabelText());
-
- Label label2 = new Label(resourceComposite, SWT.NONE);
- label2.setForeground(entry.getDataColor());
- label2.setText(entry.getDataText());
- }
- return content;
- }
-
- public void init(IWorkbench workbench) {
- setPreferenceStore(SkynetGuiPlugin.getInstance().getPreferenceStore());
- setDescription("See default Arbitration Server below.");
- }
-
- private final class Data {
- private final String label;
- private final Color labelColor;
- private final String value;
- private final Color valueColor;
-
- public Data(String label, Color labelColor, String value, Color valueColor) {
- super();
- this.label = label;
- this.labelColor = labelColor;
- this.value = value;
- this.valueColor = valueColor;
- }
-
- public Data(String label, Color labelColor, String value) {
- this(label, labelColor, value, Displays.getSystemColor(SWT.COLOR_BLACK));
- }
-
- public Data(String label, String value, Color valueColor) {
- this(label, Displays.getSystemColor(SWT.COLOR_BLUE), value, valueColor);
- }
-
- public Data(String label, String value) {
- this(label, Displays.getSystemColor(SWT.COLOR_BLUE), value, Displays.getSystemColor(SWT.COLOR_BLACK));
- }
-
- public String getLabelText() {
- return label;
- }
-
- public Color getLabelColor() {
- return labelColor;
- }
-
- public String getDataText() {
- return value;
- }
-
- public Color getDataColor() {
- return valueColor;
- }
-
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.preferences;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.osee.framework.core.client.OseeClientProperties;
+import org.eclipse.osee.framework.core.client.server.HttpUrlBuilderClient;
+import org.eclipse.osee.framework.core.data.OseeCodeVersion;
+import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ArbitrationServerPage extends PreferencePage implements IWorkbenchPreferencePage {
+
+ public ArbitrationServerPage() {
+ super();
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite content = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ content.setLayout(layout);
+ content.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ Group resourceGroup = new Group(content, SWT.NONE);
+ resourceGroup.setLayout(new GridLayout());
+ resourceGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ resourceGroup.setText("OSEE Arbitration");
+
+ Composite resourceComposite = new Composite(resourceGroup, SWT.NONE);
+ resourceComposite.setLayout(new GridLayout(2, false));
+ resourceComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ boolean wasArbitrationOverriden = Strings.isValid(OseeClientProperties.getOseeApplicationServer());
+ String defaultArbitrationServer = null;
+ if (!wasArbitrationOverriden) {
+ try {
+ defaultArbitrationServer = HttpUrlBuilderClient.getInstance().getArbitrationServerPrefix();
+ } catch (OseeDataStoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ String defaultApplicationServer = null;
+ try {
+ defaultApplicationServer = HttpUrlBuilderClient.getInstance().getApplicationServerPrefix();
+ } catch (OseeDataStoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+
+ List<Data> entries = new ArrayList<Data>();
+
+ if (wasArbitrationOverriden) {
+ entries.add(new Data("Arbitration", "Disabled", Displays.getSystemColor(SWT.COLOR_RED)));
+ entries.add(new Data("Application Server: ", defaultApplicationServer != null ? defaultApplicationServer : ""));
+ } else {
+ entries.add(new Data("Arbitration Server: ", defaultArbitrationServer != null ? defaultArbitrationServer : ""));
+ entries.add(new Data("Version To Match: ", OseeCodeVersion.getVersion()));
+ entries.add(new Data("Resolved To Server: ", defaultApplicationServer != null ? defaultApplicationServer : ""));
+ }
+ for (Data entry : entries) {
+ Label label1 = new Label(resourceComposite, SWT.NONE);
+ label1.setForeground(entry.getLabelColor());
+ label1.setText(entry.getLabelText());
+
+ Label label2 = new Label(resourceComposite, SWT.NONE);
+ label2.setForeground(entry.getDataColor());
+ label2.setText(entry.getDataText());
+ }
+ return content;
+ }
+
+ public void init(IWorkbench workbench) {
+ setPreferenceStore(SkynetGuiPlugin.getInstance().getPreferenceStore());
+ setDescription("See default Arbitration Server below.");
+ }
+
+ private final class Data {
+ private final String label;
+ private final Color labelColor;
+ private final String value;
+ private final Color valueColor;
+
+ public Data(String label, Color labelColor, String value, Color valueColor) {
+ super();
+ this.label = label;
+ this.labelColor = labelColor;
+ this.value = value;
+ this.valueColor = valueColor;
+ }
+
+ public Data(String label, Color labelColor, String value) {
+ this(label, labelColor, value, Displays.getSystemColor(SWT.COLOR_BLACK));
+ }
+
+ public Data(String label, String value, Color valueColor) {
+ this(label, Displays.getSystemColor(SWT.COLOR_BLUE), value, valueColor);
+ }
+
+ public Data(String label, String value) {
+ this(label, Displays.getSystemColor(SWT.COLOR_BLUE), value, Displays.getSystemColor(SWT.COLOR_BLACK));
+ }
+
+ public String getLabelText() {
+ return label;
+ }
+
+ public Color getLabelColor() {
+ return labelColor;
+ }
+
+ public String getDataText() {
+ return value;
+ }
+
+ public Color getDataColor() {
+ return valueColor;
+ }
+
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/ConfigurationDetails.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/ConfigurationDetails.java
index 4c5763c030a..c85eefd234f 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/ConfigurationDetails.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/ConfigurationDetails.java
@@ -1,124 +1,124 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.preferences;
-
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.osee.framework.core.client.ClientSessionManager;
-import org.eclipse.osee.framework.core.data.OseeCodeVersion;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.logging.IHealthStatus;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.event.RemoteEventManager;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ConfigurationDetails extends PreferencePage implements IWorkbenchPreferencePage {
- public static final String PAGE_ID = "org.eclipse.osee.framework.ui.skynet.preferences.OseeConfigDetailsPage";
-
- private static final String HTML_HEADER =
- "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html14/loose.dtd\">\n";
-
- private static final String CSS_SHEET =
- "<style type=\"text/css\"> table.oseeTable { font: 0.7em \"arial\", serif; border-width: 1px 1px 1px 1px; border-spacing: 2px; border-style: solid solid solid solid; border-color: blue blue blue blue; border-collapse: separate; background-color: rgb(255, 250, 250); } " + " table.oseeTable th { border-width: 1px 1px 1px 1px; padding: 4px 4px 4px 4px; border-style: solid solid solid solid; border-color: black black black black; background-color: white; -moz-border-radius: 0px 0px 0px 0px; } " + " table.oseeTable td { border-width: 1px 1px 1px 1px; padding: 4px 4px 4px 4px; border-style: solid solid solid solid; border-color: black black black black; background-color: white; -moz-border-radius: 0px 0px 0px 0px; } </style>\n";
-
- private static final String PAGE_TEMPLATE =
- HTML_HEADER + "<html>\n<head>\n" + CSS_SHEET + "</head>\n<body>\n%s</body>\n</html>";
-
- private Browser browser;
-
- public ConfigurationDetails() {
- super();
- this.browser = null;
- }
-
- public void init(IWorkbench workbench) {
- setPreferenceStore(SkynetGuiPlugin.getInstance().getPreferenceStore());
- setDescription("See below for OSEE configuration details.");
- }
-
- @Override
- protected Control createContents(Composite parent) {
- Composite content = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- content.setLayout(layout);
- content.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- Group composite = new Group(content, SWT.NONE);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- composite.setText("Connections");
-
- browser = new Browser(composite, SWT.READ_ONLY | SWT.BORDER);
- browser.setLayout(new FillLayout());
- browser.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
-
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- generatePage();
- }
- });
- return content;
- }
-
- private void generatePage() {
- StringBuilder builder = new StringBuilder();
- builder.append("<table class=\"oseeTable\" width=\"100%\">");
- builder.append(AHTML.addHeaderRowMultiColumnTable(new String[] {"Type", "Info", "Status"}));
-
- String buildType = "N/A";
- boolean wasSuccessful = false;
- try {
- buildType = ClientSessionManager.getClientBuildDesignation();
- wasSuccessful = true;
- } catch (OseeCoreException ex) {
- // Do Nothing;
- }
-
- builder.append(AHTML.addRowMultiColumnTable("<b>OSEE Client Version</b>", OseeCodeVersion.getVersion(),
- "<font color=\"green\"><b>Ok</b></font>"));
-
- builder.append(AHTML.addRowMultiColumnTable(
- "<b>OSEE Client Build Type</b>",
- buildType,
- wasSuccessful ? "<font color=\"green\"><b>Ok</b></font>" : "<font color=\"red\"><b>Unavailable</b></font>"));
-
- for (IHealthStatus status : OseeLog.getStatus()) {
- builder.append(AHTML.addRowMultiColumnTable(
- "<b>" + status.getSourceName() + "</b>",
- status.getMessage().replaceAll("]", "]<br/>"),
- status.isOk() ? "<font color=\"green\"><b>Ok</b></font>" : "<font color=\"red\"><b>Unavailable</b></font>"));
- }
- builder.append(AHTML.addRowMultiColumnTable(
- "<b>Remote Event Service</b>",
- "",
- RemoteEventManager.isConnected() ? "<font color=\"green\"><b>Ok</b></font>" : "<font color=\"red\"><b>Unavailable</b></font>"));
-
- builder.append(AHTML.endMultiColumnTable());
- browser.setText(String.format(PAGE_TEMPLATE, builder.toString()));
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.preferences;
+
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.osee.framework.core.client.ClientSessionManager;
+import org.eclipse.osee.framework.core.data.OseeCodeVersion;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.logging.IHealthStatus;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.event.RemoteEventManager;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ConfigurationDetails extends PreferencePage implements IWorkbenchPreferencePage {
+ public static final String PAGE_ID = "org.eclipse.osee.framework.ui.skynet.preferences.OseeConfigDetailsPage";
+
+ private static final String HTML_HEADER =
+ "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html14/loose.dtd\">\n";
+
+ private static final String CSS_SHEET =
+ "<style type=\"text/css\"> table.oseeTable { font: 0.7em \"arial\", serif; border-width: 1px 1px 1px 1px; border-spacing: 2px; border-style: solid solid solid solid; border-color: blue blue blue blue; border-collapse: separate; background-color: rgb(255, 250, 250); } " + " table.oseeTable th { border-width: 1px 1px 1px 1px; padding: 4px 4px 4px 4px; border-style: solid solid solid solid; border-color: black black black black; background-color: white; -moz-border-radius: 0px 0px 0px 0px; } " + " table.oseeTable td { border-width: 1px 1px 1px 1px; padding: 4px 4px 4px 4px; border-style: solid solid solid solid; border-color: black black black black; background-color: white; -moz-border-radius: 0px 0px 0px 0px; } </style>\n";
+
+ private static final String PAGE_TEMPLATE =
+ HTML_HEADER + "<html>\n<head>\n" + CSS_SHEET + "</head>\n<body>\n%s</body>\n</html>";
+
+ private Browser browser;
+
+ public ConfigurationDetails() {
+ super();
+ this.browser = null;
+ }
+
+ public void init(IWorkbench workbench) {
+ setPreferenceStore(SkynetGuiPlugin.getInstance().getPreferenceStore());
+ setDescription("See below for OSEE configuration details.");
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite content = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ content.setLayout(layout);
+ content.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ Group composite = new Group(content, SWT.NONE);
+ composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ composite.setText("Connections");
+
+ browser = new Browser(composite, SWT.READ_ONLY | SWT.BORDER);
+ browser.setLayout(new FillLayout());
+ browser.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
+
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ generatePage();
+ }
+ });
+ return content;
+ }
+
+ private void generatePage() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("<table class=\"oseeTable\" width=\"100%\">");
+ builder.append(AHTML.addHeaderRowMultiColumnTable(new String[] {"Type", "Info", "Status"}));
+
+ String buildType = "N/A";
+ boolean wasSuccessful = false;
+ try {
+ buildType = ClientSessionManager.getClientBuildDesignation();
+ wasSuccessful = true;
+ } catch (OseeCoreException ex) {
+ // Do Nothing;
+ }
+
+ builder.append(AHTML.addRowMultiColumnTable("<b>OSEE Client Version</b>", OseeCodeVersion.getVersion(),
+ "<font color=\"green\"><b>Ok</b></font>"));
+
+ builder.append(AHTML.addRowMultiColumnTable(
+ "<b>OSEE Client Build Type</b>",
+ buildType,
+ wasSuccessful ? "<font color=\"green\"><b>Ok</b></font>" : "<font color=\"red\"><b>Unavailable</b></font>"));
+
+ for (IHealthStatus status : OseeLog.getStatus()) {
+ builder.append(AHTML.addRowMultiColumnTable(
+ "<b>" + status.getSourceName() + "</b>",
+ status.getMessage().replaceAll("]", "]<br/>"),
+ status.isOk() ? "<font color=\"green\"><b>Ok</b></font>" : "<font color=\"red\"><b>Unavailable</b></font>"));
+ }
+ builder.append(AHTML.addRowMultiColumnTable(
+ "<b>Remote Event Service</b>",
+ "",
+ RemoteEventManager.isConnected() ? "<font color=\"green\"><b>Ok</b></font>" : "<font color=\"red\"><b>Unavailable</b></font>"));
+
+ builder.append(AHTML.endMultiColumnTable());
+ browser.setText(String.format(PAGE_TEMPLATE, builder.toString()));
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/DataSourceDetails.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/DataSourceDetails.java
index fc43af94139..2758d3317bc 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/DataSourceDetails.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/DataSourceDetails.java
@@ -1,137 +1,137 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.preferences;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.osee.framework.core.client.ClientSessionManager;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.database.core.OseeInfo;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-/**
- * @author Roberto E. Escobar
- */
-public class DataSourceDetails extends PreferencePage implements IWorkbenchPreferencePage {
- private static final String HTML_HEADER =
- "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html14/loose.dtd\">\n";
-
- private static final String CSS_SHEET =
- "<style type=\"text/css\"> table.oseeTable { font: 0.7em \"arial\", serif; border-width: 1px 1px 1px 1px; border-spacing: 2px; border-style: solid solid solid solid; border-color: blue blue blue blue; border-collapse: separate; background-color: rgb(255, 250, 250); } " + " table.oseeTable th { border-width: 1px 1px 1px 1px; padding: 4px 4px 4px 4px; border-style: solid solid solid solid; border-color: black black black black; background-color: white; -moz-border-radius: 0px 0px 0px 0px; } " + " table.oseeTable td { border-width: 1px 1px 1px 1px; padding: 4px 4px 4px 4px; border-style: solid solid solid solid; border-color: black black black black; background-color: white; -moz-border-radius: 0px 0px 0px 0px; } </style>\n";
-
- private static final String PAGE_TEMPLATE =
- HTML_HEADER + "<html>\n<head>\n" + CSS_SHEET + "</head>\n<body>\n%s</body>\n</html>";
-
- private Browser browser;
-
- public DataSourceDetails() {
- super();
- this.browser = null;
- }
-
- public void init(IWorkbench workbench) {
- setPreferenceStore(SkynetGuiPlugin.getInstance().getPreferenceStore());
- setDescription("See below for OSEE Data Source Details.");
- }
-
- @Override
- protected Control createContents(Composite parent) {
- Composite content = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- content.setLayout(layout);
- content.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- Group composite = new Group(content, SWT.NONE);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- composite.setText("Data Source(s)");
-
- browser = new Browser(composite, SWT.READ_ONLY | SWT.BORDER);
- browser.setLayout(new FillLayout());
- browser.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
-
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- generatePage();
- }
- });
- return content;
- }
-
- private void generatePage() {
- StringBuilder builder = new StringBuilder();
- builder.append(getDatabaseSourceInfo());
- builder.append("<br/>");
- builder.append(getDatabaseImportSource());
- browser.setText(String.format(PAGE_TEMPLATE, builder.toString()));
- }
-
- private String getDatabaseSourceInfo() {
- StringBuilder builder = new StringBuilder();
- builder.append("<table class=\"oseeTable\" width=\"100%\">");
- builder.append(AHTML.addHeaderRowMultiColumnTable(new String[] {"Data Source"}));
- try {
- builder.append(AHTML.addRowMultiColumnTable(String.format(
- "<b>Name:</b> %s<br/><b>Schema:</b> %s<br/><b>Driver:</b> %s<br/><b>Is Production:</b> %s<br/><b>ID:</b> %s<br/>",
- ClientSessionManager.getDataStoreName(), ClientSessionManager.getDataStoreLoginName(),
- ClientSessionManager.getDataStoreDriver(), ClientSessionManager.isProductionDataStore(),
- OseeInfo.getDatabaseGuid())));
- } catch (Exception ex) {
- builder.append(Lib.exceptionToString(ex));
- } finally {
- builder.append(AHTML.endMultiColumnTable());
- }
- return builder.toString();
- }
-
- private String getDatabaseImportSource() {
- DateFormat dateFormat = SimpleDateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
- StringBuilder builder = new StringBuilder();
- builder.append("<table class=\"oseeTable\" width=\"100%\">");
- builder.append(AHTML.addHeaderRowMultiColumnTable(new String[] {"Source Id", "Exported On", "Imported On"}));
- IOseeStatement chStmt = null;
- try {
- chStmt = ConnectionHandler.getStatement();
- chStmt.runPreparedQuery("select * from osee_import_source");
- while (chStmt.next()) {
- builder.append(AHTML.addRowMultiColumnTable(chStmt.getString("db_source_guid"),
- dateFormat.format(chStmt.getTimestamp("source_export_date")),
- dateFormat.format(chStmt.getTimestamp("date_imported"))));
- }
- } catch (Exception ex) {
- builder.append(AHTML.addRowSpanMultiColumnTable(Lib.exceptionToString(ex), 3));
- } finally {
- builder.append(AHTML.endMultiColumnTable());
- if (chStmt != null) {
- chStmt.close();
- }
- }
- return builder.toString().replaceAll("\n", "<br/>");
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.preferences;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.osee.framework.core.client.ClientSessionManager;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.database.core.OseeInfo;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DataSourceDetails extends PreferencePage implements IWorkbenchPreferencePage {
+ private static final String HTML_HEADER =
+ "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html14/loose.dtd\">\n";
+
+ private static final String CSS_SHEET =
+ "<style type=\"text/css\"> table.oseeTable { font: 0.7em \"arial\", serif; border-width: 1px 1px 1px 1px; border-spacing: 2px; border-style: solid solid solid solid; border-color: blue blue blue blue; border-collapse: separate; background-color: rgb(255, 250, 250); } " + " table.oseeTable th { border-width: 1px 1px 1px 1px; padding: 4px 4px 4px 4px; border-style: solid solid solid solid; border-color: black black black black; background-color: white; -moz-border-radius: 0px 0px 0px 0px; } " + " table.oseeTable td { border-width: 1px 1px 1px 1px; padding: 4px 4px 4px 4px; border-style: solid solid solid solid; border-color: black black black black; background-color: white; -moz-border-radius: 0px 0px 0px 0px; } </style>\n";
+
+ private static final String PAGE_TEMPLATE =
+ HTML_HEADER + "<html>\n<head>\n" + CSS_SHEET + "</head>\n<body>\n%s</body>\n</html>";
+
+ private Browser browser;
+
+ public DataSourceDetails() {
+ super();
+ this.browser = null;
+ }
+
+ public void init(IWorkbench workbench) {
+ setPreferenceStore(SkynetGuiPlugin.getInstance().getPreferenceStore());
+ setDescription("See below for OSEE Data Source Details.");
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite content = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ content.setLayout(layout);
+ content.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ Group composite = new Group(content, SWT.NONE);
+ composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ composite.setText("Data Source(s)");
+
+ browser = new Browser(composite, SWT.READ_ONLY | SWT.BORDER);
+ browser.setLayout(new FillLayout());
+ browser.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
+
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ generatePage();
+ }
+ });
+ return content;
+ }
+
+ private void generatePage() {
+ StringBuilder builder = new StringBuilder();
+ builder.append(getDatabaseSourceInfo());
+ builder.append("<br/>");
+ builder.append(getDatabaseImportSource());
+ browser.setText(String.format(PAGE_TEMPLATE, builder.toString()));
+ }
+
+ private String getDatabaseSourceInfo() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("<table class=\"oseeTable\" width=\"100%\">");
+ builder.append(AHTML.addHeaderRowMultiColumnTable(new String[] {"Data Source"}));
+ try {
+ builder.append(AHTML.addRowMultiColumnTable(String.format(
+ "<b>Name:</b> %s<br/><b>Schema:</b> %s<br/><b>Driver:</b> %s<br/><b>Is Production:</b> %s<br/><b>ID:</b> %s<br/>",
+ ClientSessionManager.getDataStoreName(), ClientSessionManager.getDataStoreLoginName(),
+ ClientSessionManager.getDataStoreDriver(), ClientSessionManager.isProductionDataStore(),
+ OseeInfo.getDatabaseGuid())));
+ } catch (Exception ex) {
+ builder.append(Lib.exceptionToString(ex));
+ } finally {
+ builder.append(AHTML.endMultiColumnTable());
+ }
+ return builder.toString();
+ }
+
+ private String getDatabaseImportSource() {
+ DateFormat dateFormat = SimpleDateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
+ StringBuilder builder = new StringBuilder();
+ builder.append("<table class=\"oseeTable\" width=\"100%\">");
+ builder.append(AHTML.addHeaderRowMultiColumnTable(new String[] {"Source Id", "Exported On", "Imported On"}));
+ IOseeStatement chStmt = null;
+ try {
+ chStmt = ConnectionHandler.getStatement();
+ chStmt.runPreparedQuery("select * from osee_import_source");
+ while (chStmt.next()) {
+ builder.append(AHTML.addRowMultiColumnTable(chStmt.getString("db_source_guid"),
+ dateFormat.format(chStmt.getTimestamp("source_export_date")),
+ dateFormat.format(chStmt.getTimestamp("date_imported"))));
+ }
+ } catch (Exception ex) {
+ builder.append(AHTML.addRowSpanMultiColumnTable(Lib.exceptionToString(ex), 3));
+ } finally {
+ builder.append(AHTML.endMultiColumnTable());
+ if (chStmt != null) {
+ chStmt.close();
+ }
+ }
+ return builder.toString().replaceAll("\n", "<br/>");
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/DefaultWithStringAndIntegerFields.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/DefaultWithStringAndIntegerFields.java
index 0efe6c58bdf..e3d098e2b32 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/DefaultWithStringAndIntegerFields.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/DefaultWithStringAndIntegerFields.java
@@ -1,200 +1,200 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.preferences;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-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.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * @author Roberto E. Escobar
- */
-public class DefaultWithStringAndIntegerFields extends FieldEditor {
- private static final String CUSTOM_BUTTON_KEY = ".custom";
- private static final String STRING_FIELD_KEY = ".stringField";
- private static final String INTEGER_FIELD_KEY = ".integerField";
-
- private Button defaultButton;
- private Button userButton;
- private Label defaultLabel;
- private Text text1;
- private Text text2;
- private String defaultValue;
- private String labelText1;
- private String labelText2;
- private Composite textComposite;
-
- public DefaultWithStringAndIntegerFields(String name, String defaultValue, String labelText1, String labelText2, Composite parent) {
- super();
- Assert.isNotNull(defaultValue);
- this.defaultValue = defaultValue;
- this.labelText1 = labelText1;
- this.labelText2 = labelText2;
-
- init(name, "");
- createControl(parent);
- }
-
- @Override
- protected void adjustForNumColumns(int numColumns) {
- }
-
- @Override
- protected void doFillIntoGrid(Composite parent, int numColumns) {
- }
-
- @Override
- protected void createControl(Composite parent) {
- Composite baseComposite = new Composite(parent, SWT.NONE);
- baseComposite.setLayout(new GridLayout());
- baseComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- Composite buttonComposite = new Composite(baseComposite, SWT.NONE);
- buttonComposite.setLayout(new GridLayout(2, false));
- buttonComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- defaultButton = new Button(buttonComposite, SWT.RADIO);
- defaultButton.setText("Default: ");
-
- defaultLabel = new Label(buttonComposite, SWT.NONE);
- defaultLabel.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, false));
- defaultLabel.setText(defaultValue);
-
- userButton = new Button(buttonComposite, SWT.RADIO);
- userButton.setText("User Defined: ");
-
- createCustomArea(baseComposite);
- attachListeners();
- }
-
- private void createCustomArea(Composite parent) {
- textComposite = new Composite(parent, SWT.BORDER);
- GridLayout gridLayout = new GridLayout(2, false);
- textComposite.setLayout(gridLayout);
- textComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- Label text1Label = new Label(textComposite, SWT.NONE);
- text1Label.setText(labelText1);
-
- text1 = new Text(textComposite, SWT.BORDER | SWT.SINGLE);
- text1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- Label text2Label = new Label(textComposite, SWT.NONE);
- text2Label.setText(labelText2);
-
- text2 = new Text(textComposite, SWT.BORDER | SWT.SINGLE);
- text2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- }
-
- @Override
- protected void doLoad() {
- performLoad();
- }
-
- @Override
- protected void doLoadDefault() {
- performLoad();
- }
-
- @Override
- protected void doStore() {
- IPreferenceStore store = getPreferenceStore();
- if (userButton.getSelection()) {
- String textField = text1.getText();
- String integerField = text2.getText();
- if (areValuesValid(textField, integerField)) {
- store.setValue(getPreferenceName() + CUSTOM_BUTTON_KEY, true);
- store.setValue(getPreferenceName() + STRING_FIELD_KEY, textField);
- store.setValue(getPreferenceName() + INTEGER_FIELD_KEY, integerField);
- store.setValue(getPreferenceName(), textField + ":" + integerField);
- }
- } else {
- store.setValue(getPreferenceName() + CUSTOM_BUTTON_KEY, false);
- store.setValue(getPreferenceName(), defaultValue);
- }
- }
-
- public String getSelected() {
- String toReturn = defaultValue;
- if (userButton.getSelection()) {
- String textField = text1.getText();
- String integerField = text2.getText();
- if (areValuesValid(textField, integerField)) {
- toReturn = String.format("http://%s:%s", textField, integerField);
- }
- }
- return toReturn;
- }
-
- @Override
- public int getNumberOfControls() {
- return 2;
- }
-
- private boolean areValuesValid(String textField, String integerField) {
- boolean toReturn = false;
- if (Strings.isValid(textField)) {
- try {
- Integer integer = new Integer(integerField);
- if (integer != null) {
- toReturn = true;
- }
- } catch (NumberFormatException ex) {
- }
- }
- return toReturn;
- }
-
- private void performLoad() {
- IPreferenceStore store = getPreferenceStore();
- boolean wasCustomSelected = store.getBoolean(getPreferenceName() + CUSTOM_BUTTON_KEY);
- String stringField = store.getString(getPreferenceName() + STRING_FIELD_KEY);
- String integerField = store.getString(getPreferenceName() + INTEGER_FIELD_KEY);
- if (wasCustomSelected && areValuesValid(stringField, integerField)) {
- selectDefaultButton(false);
- text1.setText(stringField);
- text2.setText(integerField);
- } else {
- selectDefaultButton(true);
- }
- }
-
- private void attachListeners() {
- defaultButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- selectDefaultButton(defaultButton.getSelection());
- }
- });
- }
-
- private void selectDefaultButton(boolean isSelected) {
- defaultButton.setSelection(isSelected);
- defaultLabel.setEnabled(isSelected);
- userButton.setSelection(!isSelected);
- textComposite.setEnabled(!isSelected);
- for (Control child : textComposite.getChildren()) {
- child.setEnabled(!isSelected);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.preferences;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+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.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DefaultWithStringAndIntegerFields extends FieldEditor {
+ private static final String CUSTOM_BUTTON_KEY = ".custom";
+ private static final String STRING_FIELD_KEY = ".stringField";
+ private static final String INTEGER_FIELD_KEY = ".integerField";
+
+ private Button defaultButton;
+ private Button userButton;
+ private Label defaultLabel;
+ private Text text1;
+ private Text text2;
+ private String defaultValue;
+ private String labelText1;
+ private String labelText2;
+ private Composite textComposite;
+
+ public DefaultWithStringAndIntegerFields(String name, String defaultValue, String labelText1, String labelText2, Composite parent) {
+ super();
+ Assert.isNotNull(defaultValue);
+ this.defaultValue = defaultValue;
+ this.labelText1 = labelText1;
+ this.labelText2 = labelText2;
+
+ init(name, "");
+ createControl(parent);
+ }
+
+ @Override
+ protected void adjustForNumColumns(int numColumns) {
+ }
+
+ @Override
+ protected void doFillIntoGrid(Composite parent, int numColumns) {
+ }
+
+ @Override
+ protected void createControl(Composite parent) {
+ Composite baseComposite = new Composite(parent, SWT.NONE);
+ baseComposite.setLayout(new GridLayout());
+ baseComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ Composite buttonComposite = new Composite(baseComposite, SWT.NONE);
+ buttonComposite.setLayout(new GridLayout(2, false));
+ buttonComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ defaultButton = new Button(buttonComposite, SWT.RADIO);
+ defaultButton.setText("Default: ");
+
+ defaultLabel = new Label(buttonComposite, SWT.NONE);
+ defaultLabel.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, false));
+ defaultLabel.setText(defaultValue);
+
+ userButton = new Button(buttonComposite, SWT.RADIO);
+ userButton.setText("User Defined: ");
+
+ createCustomArea(baseComposite);
+ attachListeners();
+ }
+
+ private void createCustomArea(Composite parent) {
+ textComposite = new Composite(parent, SWT.BORDER);
+ GridLayout gridLayout = new GridLayout(2, false);
+ textComposite.setLayout(gridLayout);
+ textComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ Label text1Label = new Label(textComposite, SWT.NONE);
+ text1Label.setText(labelText1);
+
+ text1 = new Text(textComposite, SWT.BORDER | SWT.SINGLE);
+ text1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ Label text2Label = new Label(textComposite, SWT.NONE);
+ text2Label.setText(labelText2);
+
+ text2 = new Text(textComposite, SWT.BORDER | SWT.SINGLE);
+ text2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ }
+
+ @Override
+ protected void doLoad() {
+ performLoad();
+ }
+
+ @Override
+ protected void doLoadDefault() {
+ performLoad();
+ }
+
+ @Override
+ protected void doStore() {
+ IPreferenceStore store = getPreferenceStore();
+ if (userButton.getSelection()) {
+ String textField = text1.getText();
+ String integerField = text2.getText();
+ if (areValuesValid(textField, integerField)) {
+ store.setValue(getPreferenceName() + CUSTOM_BUTTON_KEY, true);
+ store.setValue(getPreferenceName() + STRING_FIELD_KEY, textField);
+ store.setValue(getPreferenceName() + INTEGER_FIELD_KEY, integerField);
+ store.setValue(getPreferenceName(), textField + ":" + integerField);
+ }
+ } else {
+ store.setValue(getPreferenceName() + CUSTOM_BUTTON_KEY, false);
+ store.setValue(getPreferenceName(), defaultValue);
+ }
+ }
+
+ public String getSelected() {
+ String toReturn = defaultValue;
+ if (userButton.getSelection()) {
+ String textField = text1.getText();
+ String integerField = text2.getText();
+ if (areValuesValid(textField, integerField)) {
+ toReturn = String.format("http://%s:%s", textField, integerField);
+ }
+ }
+ return toReturn;
+ }
+
+ @Override
+ public int getNumberOfControls() {
+ return 2;
+ }
+
+ private boolean areValuesValid(String textField, String integerField) {
+ boolean toReturn = false;
+ if (Strings.isValid(textField)) {
+ try {
+ Integer integer = new Integer(integerField);
+ if (integer != null) {
+ toReturn = true;
+ }
+ } catch (NumberFormatException ex) {
+ }
+ }
+ return toReturn;
+ }
+
+ private void performLoad() {
+ IPreferenceStore store = getPreferenceStore();
+ boolean wasCustomSelected = store.getBoolean(getPreferenceName() + CUSTOM_BUTTON_KEY);
+ String stringField = store.getString(getPreferenceName() + STRING_FIELD_KEY);
+ String integerField = store.getString(getPreferenceName() + INTEGER_FIELD_KEY);
+ if (wasCustomSelected && areValuesValid(stringField, integerField)) {
+ selectDefaultButton(false);
+ text1.setText(stringField);
+ text2.setText(integerField);
+ } else {
+ selectDefaultButton(true);
+ }
+ }
+
+ private void attachListeners() {
+ defaultButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ selectDefaultButton(defaultButton.getSelection());
+ }
+ });
+ }
+
+ private void selectDefaultButton(boolean isSelected) {
+ defaultButton.setSelection(isSelected);
+ defaultLabel.setEnabled(isSelected);
+ userButton.setSelection(!isSelected);
+ textComposite.setEnabled(!isSelected);
+ for (Control child : textComposite.getChildren()) {
+ child.setEnabled(!isSelected);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/EditorsPreferencePage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/EditorsPreferencePage.java
index ec32ae6bf59..3503b4ee38a 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/EditorsPreferencePage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/EditorsPreferencePage.java
@@ -1,110 +1,110 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.preferences;
-
-import java.util.logging.Level;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-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.artifact.StaticIdManager;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-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.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-public class EditorsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
-
- private static String PreviewOnDoubleClickForWordArtifacts = "PreviewOnDoubleClickForWordArtifacts";
- private static String CHANGE_REPORT_CLOSE_CHANGE_REPORT_EDITORS_ON_SHUTDOWN =
- "change.report.close.editors.on.shutdown";
- private Button previewOnDoubleClickForWordArtifacts;
- private Button closeChangeReportEditorsOnShutdown;
-
- public static boolean isCloseChangeReportEditorsOnShutdown() throws OseeCoreException {
- return UserManager.getUser().getBooleanSetting(CHANGE_REPORT_CLOSE_CHANGE_REPORT_EDITORS_ON_SHUTDOWN);
- }
-
- public static boolean isPreviewOnDoubleClickForWordArtifacts() throws OseeCoreException {
- return StaticIdManager.hasValue(UserManager.getUser(), PreviewOnDoubleClickForWordArtifacts);
- }
-
- @Override
- protected Control createContents(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- // TODO Temporary until editor opening can be configured by users
- previewOnDoubleClickForWordArtifacts = new Button(composite, SWT.CHECK);
- previewOnDoubleClickForWordArtifacts.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false));
- previewOnDoubleClickForWordArtifacts.setText("Open MS Word preview on double-click of MS Word Artifact");
- try {
- previewOnDoubleClickForWordArtifacts.setSelection(EditorsPreferencePage.isPreviewOnDoubleClickForWordArtifacts());
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
-
- closeChangeReportEditorsOnShutdown = new Button(composite, SWT.CHECK);
- closeChangeReportEditorsOnShutdown.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false));
- closeChangeReportEditorsOnShutdown.setText("Close Change Report Editors on Shutdown");
- try {
- boolean value = UserManager.getUser().getBooleanSetting(CHANGE_REPORT_CLOSE_CHANGE_REPORT_EDITORS_ON_SHUTDOWN);
- closeChangeReportEditorsOnShutdown.setSelection(value);
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
-
- return composite;
- }
-
- /**
- * initialize the preference store to use with the workbench
- */
- public void init(IWorkbench workbench) {
- }
-
- @Override
- protected void performDefaults() {
- }
-
- @Override
- protected void performApply() {
- performOk();
- }
-
- @Override
- public boolean performOk() {
- try {
- User user = UserManager.getUser();
- if (previewOnDoubleClickForWordArtifacts.getSelection()) {
- StaticIdManager.setSingletonAttributeValue(user, PreviewOnDoubleClickForWordArtifacts);
- } else {
- user.deleteAttribute(CoreAttributeTypes.STATIC_ID, PreviewOnDoubleClickForWordArtifacts);
- }
-
- boolean result = closeChangeReportEditorsOnShutdown.getSelection();
- user.setSetting(CHANGE_REPORT_CLOSE_CHANGE_REPORT_EDITORS_ON_SHUTDOWN, String.valueOf(result));
-
- user.persist();
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- return super.performOk();
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.preferences;
+
+import java.util.logging.Level;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+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.artifact.StaticIdManager;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+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.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+public class EditorsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+
+ private static String PreviewOnDoubleClickForWordArtifacts = "PreviewOnDoubleClickForWordArtifacts";
+ private static String CHANGE_REPORT_CLOSE_CHANGE_REPORT_EDITORS_ON_SHUTDOWN =
+ "change.report.close.editors.on.shutdown";
+ private Button previewOnDoubleClickForWordArtifacts;
+ private Button closeChangeReportEditorsOnShutdown;
+
+ public static boolean isCloseChangeReportEditorsOnShutdown() throws OseeCoreException {
+ return UserManager.getUser().getBooleanSetting(CHANGE_REPORT_CLOSE_CHANGE_REPORT_EDITORS_ON_SHUTDOWN);
+ }
+
+ public static boolean isPreviewOnDoubleClickForWordArtifacts() throws OseeCoreException {
+ return StaticIdManager.hasValue(UserManager.getUser(), PreviewOnDoubleClickForWordArtifacts);
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ // TODO Temporary until editor opening can be configured by users
+ previewOnDoubleClickForWordArtifacts = new Button(composite, SWT.CHECK);
+ previewOnDoubleClickForWordArtifacts.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false));
+ previewOnDoubleClickForWordArtifacts.setText("Open MS Word preview on double-click of MS Word Artifact");
+ try {
+ previewOnDoubleClickForWordArtifacts.setSelection(EditorsPreferencePage.isPreviewOnDoubleClickForWordArtifacts());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+
+ closeChangeReportEditorsOnShutdown = new Button(composite, SWT.CHECK);
+ closeChangeReportEditorsOnShutdown.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false));
+ closeChangeReportEditorsOnShutdown.setText("Close Change Report Editors on Shutdown");
+ try {
+ boolean value = UserManager.getUser().getBooleanSetting(CHANGE_REPORT_CLOSE_CHANGE_REPORT_EDITORS_ON_SHUTDOWN);
+ closeChangeReportEditorsOnShutdown.setSelection(value);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+
+ return composite;
+ }
+
+ /**
+ * initialize the preference store to use with the workbench
+ */
+ public void init(IWorkbench workbench) {
+ }
+
+ @Override
+ protected void performDefaults() {
+ }
+
+ @Override
+ protected void performApply() {
+ performOk();
+ }
+
+ @Override
+ public boolean performOk() {
+ try {
+ User user = UserManager.getUser();
+ if (previewOnDoubleClickForWordArtifacts.getSelection()) {
+ StaticIdManager.setSingletonAttributeValue(user, PreviewOnDoubleClickForWordArtifacts);
+ } else {
+ user.deleteAttribute(CoreAttributeTypes.STATIC_ID, PreviewOnDoubleClickForWordArtifacts);
+ }
+
+ boolean result = closeChangeReportEditorsOnShutdown.getSelection();
+ user.setSetting(CHANGE_REPORT_CLOSE_CHANGE_REPORT_EDITORS_ON_SHUTDOWN, String.valueOf(result));
+
+ user.persist();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ return super.performOk();
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/MsWordPreferencePage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/MsWordPreferencePage.java
index d982ef1139b..f4c7db064a8 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/MsWordPreferencePage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/MsWordPreferencePage.java
@@ -1,93 +1,93 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.preferences;
-
-import java.util.logging.Level;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-/**
- * @author Theron Virgin
- * @author Ryan D. Brooks
- */
-public class MsWordPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
- public static final String IDENTFY_IMAGE_CHANGES = "IdentifyImageChangesInWordDiff";
- public static final String REMOVE_TRACKED_CHANGES = "RemoveTrackedChangesInWordDiff";
- public static final String MUTI_EDIT_SAVE_ALL_CHANGES = "multieditSaveAllChanges";
- private Button identifyImageChangesInWord;
- private Button removeTrackedChangesInWord;
- private Button saveAllChanges;
-
- @Override
- protected Control createContents(Composite parent) {
- noDefaultAndApplyButton();
-
- identifyImageChangesInWord = new Button(parent, SWT.CHECK);
- identifyImageChangesInWord.setText("Do Not Display OSEE Detected Image Change Indication in Differences");
- identifyImageChangesInWord.setSelection(getUserBooleanSetting(IDENTFY_IMAGE_CHANGES));
-
- removeTrackedChangesInWord = new Button(parent, SWT.CHECK);
- removeTrackedChangesInWord.setText("Do Not Remove Word Tracked Changes prior to Diffing");
- removeTrackedChangesInWord.setSelection(getUserBooleanSetting(REMOVE_TRACKED_CHANGES));
-
- saveAllChanges = new Button(parent, SWT.CHECK);
- saveAllChanges.setText("When multi-editing save all chaneged artifacts (even those with no textual changes)");
- saveAllChanges.setSelection(getUserBooleanSetting(MUTI_EDIT_SAVE_ALL_CHANGES));
-
- return parent;
- }
-
- private boolean getUserBooleanSetting(String settingKey) {
- try {
- return UserManager.getUser().getBooleanSetting(settingKey);
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- return false;
- }
- }
-
- private void setUserBooleanSetting(String settingKey, Button button) {
- try {
- UserManager.getUser().setSetting(settingKey, String.valueOf(button.getSelection()));
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
-
- /**
- * initialize the preference store to use with the workbench
- */
- public void init(IWorkbench workbench) {
- }
-
- @Override
- public boolean performOk() {
-
- setUserBooleanSetting(IDENTFY_IMAGE_CHANGES, identifyImageChangesInWord);
- setUserBooleanSetting(REMOVE_TRACKED_CHANGES, removeTrackedChangesInWord);
- setUserBooleanSetting(MUTI_EDIT_SAVE_ALL_CHANGES, saveAllChanges);
- try {
- UserManager.getUser().persist();
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- return super.performOk();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.preferences;
+
+import java.util.logging.Level;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * @author Theron Virgin
+ * @author Ryan D. Brooks
+ */
+public class MsWordPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+ public static final String IDENTFY_IMAGE_CHANGES = "IdentifyImageChangesInWordDiff";
+ public static final String REMOVE_TRACKED_CHANGES = "RemoveTrackedChangesInWordDiff";
+ public static final String MUTI_EDIT_SAVE_ALL_CHANGES = "multieditSaveAllChanges";
+ private Button identifyImageChangesInWord;
+ private Button removeTrackedChangesInWord;
+ private Button saveAllChanges;
+
+ @Override
+ protected Control createContents(Composite parent) {
+ noDefaultAndApplyButton();
+
+ identifyImageChangesInWord = new Button(parent, SWT.CHECK);
+ identifyImageChangesInWord.setText("Do Not Display OSEE Detected Image Change Indication in Differences");
+ identifyImageChangesInWord.setSelection(getUserBooleanSetting(IDENTFY_IMAGE_CHANGES));
+
+ removeTrackedChangesInWord = new Button(parent, SWT.CHECK);
+ removeTrackedChangesInWord.setText("Do Not Remove Word Tracked Changes prior to Diffing");
+ removeTrackedChangesInWord.setSelection(getUserBooleanSetting(REMOVE_TRACKED_CHANGES));
+
+ saveAllChanges = new Button(parent, SWT.CHECK);
+ saveAllChanges.setText("When multi-editing save all chaneged artifacts (even those with no textual changes)");
+ saveAllChanges.setSelection(getUserBooleanSetting(MUTI_EDIT_SAVE_ALL_CHANGES));
+
+ return parent;
+ }
+
+ private boolean getUserBooleanSetting(String settingKey) {
+ try {
+ return UserManager.getUser().getBooleanSetting(settingKey);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ return false;
+ }
+ }
+
+ private void setUserBooleanSetting(String settingKey, Button button) {
+ try {
+ UserManager.getUser().setSetting(settingKey, String.valueOf(button.getSelection()));
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ /**
+ * initialize the preference store to use with the workbench
+ */
+ public void init(IWorkbench workbench) {
+ }
+
+ @Override
+ public boolean performOk() {
+
+ setUserBooleanSetting(IDENTFY_IMAGE_CHANGES, identifyImageChangesInWord);
+ setUserBooleanSetting(REMOVE_TRACKED_CHANGES, removeTrackedChangesInWord);
+ setUserBooleanSetting(MUTI_EDIT_SAVE_ALL_CHANGES, saveAllChanges);
+ try {
+ UserManager.getUser().persist();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ return super.performOk();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/relation/explorer/RelationExplorerWindow.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/relation/explorer/RelationExplorerWindow.java
index 76b12589e3b..b60682d12e5 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/relation/explorer/RelationExplorerWindow.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/relation/explorer/RelationExplorerWindow.java
@@ -1,346 +1,346 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.relation.explorer;
-
-import java.util.ArrayList;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.type.ArtifactType;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
-import org.eclipse.osee.framework.skynet.core.relation.RelationTypeSide;
-import org.eclipse.osee.framework.skynet.core.relation.RelationTypeSideSorter;
-import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.ControlListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-
-/**
- * @author Michael S. Rodgers
- */
-public class RelationExplorerWindow {
-
- private RelationTableViewer relationTableViewer;
- private final RelationTypeSideSorter relationGroup;
- private final boolean persistOnOk;
- private boolean cancelled = false;
-
- // Private arrays for valid drops
- private final ArrayList<Artifact> validArtifacts;
- private final ArrayList<String> urls;
- private final ArrayList<String> names;
- private Branch branch;
-
- // Private arrays for invalid drops
- private final ArrayList<String> invalidName;
- private final ArrayList<String> invalidReason;
- private final ArrayList<Artifact> invalidArtifacts;
-
- private boolean needWindow;
-
- private Shell shell;
-
- private ArtifactType descriptor = null;
-
- private final StructuredViewer viewer;
-
- public static final int ADD_NUM = 0;
- public static final int ARTIFACT_NAME_NUM = 1;
- public static final int ARTIFACT_TYPE_NUM = 2;
- public static final int RATIONALE_NUM = 3;
-
- public static final int NAME_NUM = 0;
- public static final int REASON_NUM = 1;
-
- public RelationExplorerWindow(StructuredViewer viewer, RelationTypeSideSorter group, boolean persistOnOk) {
- this.validArtifacts = new ArrayList<Artifact>();
- this.invalidArtifacts = new ArrayList<Artifact>();
-
- this.urls = new ArrayList<String>();
- this.names = new ArrayList<String>();
-
- this.invalidName = new ArrayList<String>();
- this.invalidReason = new ArrayList<String>();
-
- this.viewer = viewer;
- this.relationGroup = group;
- this.persistOnOk = persistOnOk;
- this.needWindow = false;
-
- }
-
- public RelationExplorerWindow(StructuredViewer viewer, RelationTypeSideSorter group) {
- this(viewer, group, false);
- }
-
- public void addValid(Artifact artifact) {
- if (artifact == null) {
- needWindow = true;
- } else {
- this.branch = artifact.getBranch();
- this.validArtifacts.add(artifact);
- this.names.add(artifact.getName());
- }
- }
-
- public void addInvalid(String name, String reason) {
- invalidName.add(name);
- invalidReason.add(reason);
- needWindow = true;
- }
-
- public void createArtifactInformationBox() throws OseeCoreException {
- drawWindow();
- }
-
- private void drawWindow() throws OseeCoreException {
- shell = new Shell(SWT.ON_TOP | SWT.APPLICATION_MODAL | SWT.TITLE | SWT.MIN | SWT.MAX | SWT.RESIZE);
-
- // Setup Title
- shell.setText("Artifact Information");
-
- // Setup Icon
- Image image = ArtifactImageManager.getImage(ArtifactTypeManager.getType("Artifact"));
- shell.setImage(image);
-
- // Setup Form Layout
- FormLayout layout = new FormLayout();
- layout.marginHeight = 5;
- layout.marginWidth = 5;
- shell.setLayout(layout);
-
- SashForm sashForm = new SashForm(shell, SWT.VERTICAL);
-
- // Create valid artifact fields
- FormLayout validLayout = new FormLayout();
- validLayout.spacing = 5;
-
- Composite validComposite = new Composite(sashForm, SWT.NONE);
- validComposite.setLayout(validLayout);
-
- Label validLabel = new Label(validComposite, SWT.LEFT);
- validLabel.setText("Valid artifacts - will be added");
-
- Table validTable =
- new Table(validComposite,
- SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
- validTable.setLinesVisible(true);
- validTable.setHeaderVisible(true);
-
- // Create invalid artifacts fields
- FormLayout invalidLayout = new FormLayout();
- invalidLayout.spacing = 5;
-
- Composite invalidComposite = new Composite(sashForm, SWT.NONE);
- invalidComposite.setLayout(invalidLayout);
-
- Label invalidLabel = new Label(invalidComposite, SWT.LEFT);
- invalidLabel.setText("Invalid artifacts - will not be added");
-
- Table invalidTable =
- new Table(invalidComposite,
- SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
- invalidTable.setLinesVisible(true);
- invalidTable.setHeaderVisible(true);
-
- // Create the Buttons
- Button okButton = new Button(invalidComposite, SWT.PUSH);
- okButton.setText("OK");
-
- Button cancelButton = new Button(invalidComposite, SWT.PUSH);
- cancelButton.setText("Cancel");
-
- // Attach validLabel to top-left corner
- FormData data = new FormData();
- data.top = new FormAttachment(0);
- data.left = new FormAttachment(0);
- validLabel.setLayoutData(data);
-
- // Attach validTable to bottom of validLabel
- data = new FormData();
- data.top = new FormAttachment(validLabel);
- data.bottom = new FormAttachment(100);
- data.left = new FormAttachment(0);
- data.right = new FormAttachment(100);
- data.height = validTable.getItemHeight() * 10;
- validTable.setLayoutData(data);
-
- // Attach invalidLabel to top-left corner
- data = new FormData();
- data.top = new FormAttachment(0);
- data.left = new FormAttachment(0);
- invalidLabel.setLayoutData(data);
-
- // Attach invalidTable to bottom of invalidLabel
- data = new FormData();
- data.top = new FormAttachment(invalidLabel);
- data.bottom = new FormAttachment(okButton);
- data.left = new FormAttachment(0);
- data.right = new FormAttachment(100);
- data.height = validTable.getItemHeight() * 10;
- invalidTable.setLayoutData(data);
-
- // Attach sashForm to top-left corner of shell
- data = new FormData();
- data.top = new FormAttachment(0);
- data.bottom = new FormAttachment(100);
- data.left = new FormAttachment(0);
- data.right = new FormAttachment(100);
- sashForm.setLayoutData(data);
-
- // Attach buttons to bottom of sashForm
- data = new FormData();
- data.bottom = new FormAttachment(100);
- data.right = new FormAttachment(100);
- cancelButton.setLayoutData(data);
-
- data = new FormData();
- data.bottom = new FormAttachment(100);
- data.right = new FormAttachment(cancelButton);
- okButton.setLayoutData(data);
-
- // Populate Tables
- relationTableViewer = new RelationTableViewer(validTable, invalidTable, branch);
- for (int i = 0; i < validArtifacts.size(); i++) {
- relationTableViewer.addValidItem(validArtifacts.get(i));
- }
- for (int i = 0; i < invalidName.size(); i++) {
- relationTableViewer.addInvalidItem(invalidName.get(i), invalidReason.get(i));
- }
-
- // Add Listeners to buttons
- okButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- okSelected();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
-
- cancelButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- cancelSelected();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
-
- // Add shell resize listener
- shell.addControlListener(new ControlListener() {
-
- public void controlMoved(ControlEvent e) {
- }
-
- public void controlResized(ControlEvent e) {
- relationTableViewer.resizeTable(((Shell) e.widget).getClientArea().width);
- shell.layout();
- }
- });
-
- if (needWindow) {
- shell.pack();
- shell.open();
- } else {
- okSelected();
- }
- }
-
- /**
- * Create the TableViewer
- */
-
- private void okSelected() {
- ArrayList<ArtifactModel> artifactList = relationTableViewer.getArtifactList().getArtifactModel();
-
- for (int i = 0; i < artifactList.size(); i++) {
- ArtifactModel model = artifactList.get(i);
-
- if (model.isAdd()) {
- Artifact artifact = model.getArtifact();
- descriptor = model.getDescriptor();
- if (artifact == null) {
- if (descriptor != null) {
- try {
- artifact = ArtifactTypeManager.makeNewArtifact(descriptor, branch);
- artifact.setSoleAttributeValue("Name", model.getName());
- artifact.setSoleAttributeValue("Content URL", urls.get(names.indexOf(model.getName())));
- artifact.persist();
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- } else {
- artifact = model.getArtifact();
- }
-
- if (artifact != null) {
- try {
- RelationTypeSide relationToInsert =
- new RelationTypeSide(relationGroup.getRelationType(), relationGroup.getSide());
- relationGroup.getArtifact().addRelation(relationToInsert, artifact);
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
- }
- if (persistOnOk) {
- try {
- relationGroup.getArtifact().persist();
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- shell.dispose();
- viewer.refresh();
-
- }
-
- private void cancelSelected() {
- cancelled = true;
- shell.dispose();
- }
-
- public RelationTypeSideSorter getRelationGroup() {
- return relationGroup;
- }
-
- public boolean isCancelled() {
- return cancelled;
- }
-
- public ArrayList<Artifact> getInvalidArtifacts() {
- return invalidArtifacts;
- }
-
- public void addInvalidArtifact(Artifact invalidArtifact, String errorMessage) {
- invalidArtifacts.add(invalidArtifact);
- addInvalid(invalidArtifact.getName(), errorMessage);
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.relation.explorer;
+
+import java.util.ArrayList;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.type.ArtifactType;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
+import org.eclipse.osee.framework.skynet.core.relation.RelationTypeSide;
+import org.eclipse.osee.framework.skynet.core.relation.RelationTypeSideSorter;
+import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+
+/**
+ * @author Michael S. Rodgers
+ */
+public class RelationExplorerWindow {
+
+ private RelationTableViewer relationTableViewer;
+ private final RelationTypeSideSorter relationGroup;
+ private final boolean persistOnOk;
+ private boolean cancelled = false;
+
+ // Private arrays for valid drops
+ private final ArrayList<Artifact> validArtifacts;
+ private final ArrayList<String> urls;
+ private final ArrayList<String> names;
+ private Branch branch;
+
+ // Private arrays for invalid drops
+ private final ArrayList<String> invalidName;
+ private final ArrayList<String> invalidReason;
+ private final ArrayList<Artifact> invalidArtifacts;
+
+ private boolean needWindow;
+
+ private Shell shell;
+
+ private ArtifactType descriptor = null;
+
+ private final StructuredViewer viewer;
+
+ public static final int ADD_NUM = 0;
+ public static final int ARTIFACT_NAME_NUM = 1;
+ public static final int ARTIFACT_TYPE_NUM = 2;
+ public static final int RATIONALE_NUM = 3;
+
+ public static final int NAME_NUM = 0;
+ public static final int REASON_NUM = 1;
+
+ public RelationExplorerWindow(StructuredViewer viewer, RelationTypeSideSorter group, boolean persistOnOk) {
+ this.validArtifacts = new ArrayList<Artifact>();
+ this.invalidArtifacts = new ArrayList<Artifact>();
+
+ this.urls = new ArrayList<String>();
+ this.names = new ArrayList<String>();
+
+ this.invalidName = new ArrayList<String>();
+ this.invalidReason = new ArrayList<String>();
+
+ this.viewer = viewer;
+ this.relationGroup = group;
+ this.persistOnOk = persistOnOk;
+ this.needWindow = false;
+
+ }
+
+ public RelationExplorerWindow(StructuredViewer viewer, RelationTypeSideSorter group) {
+ this(viewer, group, false);
+ }
+
+ public void addValid(Artifact artifact) {
+ if (artifact == null) {
+ needWindow = true;
+ } else {
+ this.branch = artifact.getBranch();
+ this.validArtifacts.add(artifact);
+ this.names.add(artifact.getName());
+ }
+ }
+
+ public void addInvalid(String name, String reason) {
+ invalidName.add(name);
+ invalidReason.add(reason);
+ needWindow = true;
+ }
+
+ public void createArtifactInformationBox() throws OseeCoreException {
+ drawWindow();
+ }
+
+ private void drawWindow() throws OseeCoreException {
+ shell = new Shell(SWT.ON_TOP | SWT.APPLICATION_MODAL | SWT.TITLE | SWT.MIN | SWT.MAX | SWT.RESIZE);
+
+ // Setup Title
+ shell.setText("Artifact Information");
+
+ // Setup Icon
+ Image image = ArtifactImageManager.getImage(ArtifactTypeManager.getType("Artifact"));
+ shell.setImage(image);
+
+ // Setup Form Layout
+ FormLayout layout = new FormLayout();
+ layout.marginHeight = 5;
+ layout.marginWidth = 5;
+ shell.setLayout(layout);
+
+ SashForm sashForm = new SashForm(shell, SWT.VERTICAL);
+
+ // Create valid artifact fields
+ FormLayout validLayout = new FormLayout();
+ validLayout.spacing = 5;
+
+ Composite validComposite = new Composite(sashForm, SWT.NONE);
+ validComposite.setLayout(validLayout);
+
+ Label validLabel = new Label(validComposite, SWT.LEFT);
+ validLabel.setText("Valid artifacts - will be added");
+
+ Table validTable =
+ new Table(validComposite,
+ SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
+ validTable.setLinesVisible(true);
+ validTable.setHeaderVisible(true);
+
+ // Create invalid artifacts fields
+ FormLayout invalidLayout = new FormLayout();
+ invalidLayout.spacing = 5;
+
+ Composite invalidComposite = new Composite(sashForm, SWT.NONE);
+ invalidComposite.setLayout(invalidLayout);
+
+ Label invalidLabel = new Label(invalidComposite, SWT.LEFT);
+ invalidLabel.setText("Invalid artifacts - will not be added");
+
+ Table invalidTable =
+ new Table(invalidComposite,
+ SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
+ invalidTable.setLinesVisible(true);
+ invalidTable.setHeaderVisible(true);
+
+ // Create the Buttons
+ Button okButton = new Button(invalidComposite, SWT.PUSH);
+ okButton.setText("OK");
+
+ Button cancelButton = new Button(invalidComposite, SWT.PUSH);
+ cancelButton.setText("Cancel");
+
+ // Attach validLabel to top-left corner
+ FormData data = new FormData();
+ data.top = new FormAttachment(0);
+ data.left = new FormAttachment(0);
+ validLabel.setLayoutData(data);
+
+ // Attach validTable to bottom of validLabel
+ data = new FormData();
+ data.top = new FormAttachment(validLabel);
+ data.bottom = new FormAttachment(100);
+ data.left = new FormAttachment(0);
+ data.right = new FormAttachment(100);
+ data.height = validTable.getItemHeight() * 10;
+ validTable.setLayoutData(data);
+
+ // Attach invalidLabel to top-left corner
+ data = new FormData();
+ data.top = new FormAttachment(0);
+ data.left = new FormAttachment(0);
+ invalidLabel.setLayoutData(data);
+
+ // Attach invalidTable to bottom of invalidLabel
+ data = new FormData();
+ data.top = new FormAttachment(invalidLabel);
+ data.bottom = new FormAttachment(okButton);
+ data.left = new FormAttachment(0);
+ data.right = new FormAttachment(100);
+ data.height = validTable.getItemHeight() * 10;
+ invalidTable.setLayoutData(data);
+
+ // Attach sashForm to top-left corner of shell
+ data = new FormData();
+ data.top = new FormAttachment(0);
+ data.bottom = new FormAttachment(100);
+ data.left = new FormAttachment(0);
+ data.right = new FormAttachment(100);
+ sashForm.setLayoutData(data);
+
+ // Attach buttons to bottom of sashForm
+ data = new FormData();
+ data.bottom = new FormAttachment(100);
+ data.right = new FormAttachment(100);
+ cancelButton.setLayoutData(data);
+
+ data = new FormData();
+ data.bottom = new FormAttachment(100);
+ data.right = new FormAttachment(cancelButton);
+ okButton.setLayoutData(data);
+
+ // Populate Tables
+ relationTableViewer = new RelationTableViewer(validTable, invalidTable, branch);
+ for (int i = 0; i < validArtifacts.size(); i++) {
+ relationTableViewer.addValidItem(validArtifacts.get(i));
+ }
+ for (int i = 0; i < invalidName.size(); i++) {
+ relationTableViewer.addInvalidItem(invalidName.get(i), invalidReason.get(i));
+ }
+
+ // Add Listeners to buttons
+ okButton.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ okSelected();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ cancelButton.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ cancelSelected();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ // Add shell resize listener
+ shell.addControlListener(new ControlListener() {
+
+ public void controlMoved(ControlEvent e) {
+ }
+
+ public void controlResized(ControlEvent e) {
+ relationTableViewer.resizeTable(((Shell) e.widget).getClientArea().width);
+ shell.layout();
+ }
+ });
+
+ if (needWindow) {
+ shell.pack();
+ shell.open();
+ } else {
+ okSelected();
+ }
+ }
+
+ /**
+ * Create the TableViewer
+ */
+
+ private void okSelected() {
+ ArrayList<ArtifactModel> artifactList = relationTableViewer.getArtifactList().getArtifactModel();
+
+ for (int i = 0; i < artifactList.size(); i++) {
+ ArtifactModel model = artifactList.get(i);
+
+ if (model.isAdd()) {
+ Artifact artifact = model.getArtifact();
+ descriptor = model.getDescriptor();
+ if (artifact == null) {
+ if (descriptor != null) {
+ try {
+ artifact = ArtifactTypeManager.makeNewArtifact(descriptor, branch);
+ artifact.setSoleAttributeValue("Name", model.getName());
+ artifact.setSoleAttributeValue("Content URL", urls.get(names.indexOf(model.getName())));
+ artifact.persist();
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ } else {
+ artifact = model.getArtifact();
+ }
+
+ if (artifact != null) {
+ try {
+ RelationTypeSide relationToInsert =
+ new RelationTypeSide(relationGroup.getRelationType(), relationGroup.getSide());
+ relationGroup.getArtifact().addRelation(relationToInsert, artifact);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+ }
+ if (persistOnOk) {
+ try {
+ relationGroup.getArtifact().persist();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ shell.dispose();
+ viewer.refresh();
+
+ }
+
+ private void cancelSelected() {
+ cancelled = true;
+ shell.dispose();
+ }
+
+ public RelationTypeSideSorter getRelationGroup() {
+ return relationGroup;
+ }
+
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ public ArrayList<Artifact> getInvalidArtifacts() {
+ return invalidArtifacts;
+ }
+
+ public void addInvalidArtifact(Artifact invalidArtifact, String errorMessage) {
+ invalidArtifacts.add(invalidArtifact);
+ addInvalid(invalidArtifact.getName(), errorMessage);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/relation/explorer/RelationTableViewer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/relation/explorer/RelationTableViewer.java
index 3b49c614f2a..91b5a45e6f9 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/relation/explorer/RelationTableViewer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/relation/explorer/RelationTableViewer.java
@@ -1,251 +1,251 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.relation.explorer;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.CheckboxCellEditor;
-import org.eclipse.jface.viewers.ComboBoxCellEditor;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.type.ArtifactType;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-
-public class RelationTableViewer {
- private final Table validTable;
- private TableViewer tableViewer;
-
- private final Table invalidTable;
-
- private ArtifactModelList artifactList;
-
- private String[] validColumnNames;
- private static int[] validColumnWidths;
-
- private String[] invalidColumnNames;
- private static int[] invalidColumnWidths;
-
- public static final int ADD_NUM = 0;
- public static final int ARTIFACT_NAME_NUM = 1;
- public static final int ARTIFACT_TYPE_NUM = 2;
- public static final int RATIONALE_NUM = 3;
- public static final int INVALID_NAME_NUM = 0;
- public static final int INVALID_REASON_NUM = 1;
-
- public ArrayList<ArtifactType> fullDescriptorList;
- private ArtifactType defaultArtifactType;
-
- /**
- * @param validTable -
- * @param invalidTable -
- */
- public RelationTableViewer(Table validTable, Table invalidTable, Branch branch) {
- try {
- fullDescriptorList = new ArrayList<ArtifactType>(ArtifactTypeManager.getValidArtifactTypes(branch));
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
-
- this.validTable = validTable;
- this.invalidTable = invalidTable;
-
- this.createControl();
-
- tableViewer.setContentProvider(new RelationContentProvider());
- tableViewer.setLabelProvider(new ArtifactModelLabelProvider());
- tableViewer.setInput(artifactList);
- }
-
- public void addValidItem(Artifact artifact) {
- ArtifactModel model = new ArtifactModel(artifact);
- artifactList.addArtifact(model, true);
- }
-
- public void addInvalidItem(String name, String reason) {
- String[] itemText = new String[] {name, reason};
- TableItem item = new TableItem(invalidTable, SWT.NONE);
- item.setText(itemText);
- }
-
- private void createControl() {
- artifactList = new ArtifactModelList();
- createColumns();
- createTableViewer();
- }
-
- /**
- * Create the TableViewer
- */
- private void createTableViewer() {
-
- tableViewer = new TableViewer(validTable);
- tableViewer.setUseHashlookup(true);
- tableViewer.setColumnProperties(validColumnNames);
-
- CellEditor[] validEditors = new CellEditor[validColumnNames.length];
- validEditors[ADD_NUM] = new CheckboxCellEditor(validTable, SWT.CENTER);
- validEditors[ARTIFACT_NAME_NUM] = new TextCellEditor(validTable) {
- };
-
- String[] items = new String[fullDescriptorList.size()];
- for (int i = 0; i < items.length; i++) {
- items[i] = fullDescriptorList.get(i).getName();
- }
-
- validEditors[ARTIFACT_TYPE_NUM] = new ComboBoxCellEditor(validTable, items);
- validEditors[RATIONALE_NUM] = new TextCellEditor(validTable);
-
- // Assign the cell editors to the viewer
- tableViewer.setCellEditors(validEditors);
- // Assign the cell modifier to the viewer
- tableViewer.setCellModifier(new RelationTableCellModifier(this));
- }
-
- /**
- * Create the Columns
- */
- private void createColumns() {
- validColumnNames = new String[] {"Add", "Artifact Name", "Artifact Type", "Rationale"};
- validColumnWidths = new int[] {40, 200, 100, 500};
-
- invalidColumnNames = new String[] {"Name", "Reason"};
- invalidColumnWidths = new int[] {200, 640};
-
- TableColumn column = new TableColumn(validTable, SWT.LEFT, ADD_NUM);
- column.setText(validColumnNames[ADD_NUM]);
- column.setWidth(validColumnWidths[ADD_NUM]);
-
- column = new TableColumn(validTable, SWT.LEFT, ARTIFACT_NAME_NUM);
- column.setText(validColumnNames[ARTIFACT_NAME_NUM]);
- column.setWidth(validColumnWidths[ARTIFACT_NAME_NUM]);
- column.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- tableViewer.setSorter(new RelationTableSorter(RelationTableSorter.ARTIFACT_NAME));
- }
- });
-
- column = new TableColumn(validTable, SWT.LEFT, ARTIFACT_TYPE_NUM);
- column.setText(validColumnNames[ARTIFACT_TYPE_NUM]);
- column.setWidth(validColumnWidths[ARTIFACT_TYPE_NUM]);
- column.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- tableViewer.setSorter(new RelationTableSorter(RelationTableSorter.ARTIFACT_TYPE));
- }
- });
-
- column = new TableColumn(validTable, SWT.LEFT, RATIONALE_NUM);
- column.setText(validColumnNames[RATIONALE_NUM]);
- column.setWidth(validColumnWidths[RATIONALE_NUM]);
-
- column = new TableColumn(invalidTable, SWT.LEFT, INVALID_NAME_NUM);
- column.setText(invalidColumnNames[INVALID_NAME_NUM]);
- column.setWidth(invalidColumnWidths[INVALID_NAME_NUM]);
-
- column = new TableColumn(invalidTable, SWT.LEFT, INVALID_REASON_NUM);
- column.setText(invalidColumnNames[INVALID_REASON_NUM]);
- column.setWidth(invalidColumnWidths[INVALID_REASON_NUM]);
- }
-
- public List<String> getColumnNames() {
- return Arrays.asList(validColumnNames);
- }
-
- public ArtifactModelList getArtifactList() {
- return this.artifactList;
- }
-
- public void refresh() {
- tableViewer.refresh();
- }
-
- /**
- * @return Returns the invalidTable.
- */
- public Table getInvalidTable() {
- return invalidTable;
- }
-
- /**
- * @return Returns the validTable.
- */
- public Table getValidTable() {
- return validTable;
- }
-
- public void resizeTable(int windowWidth) {
- int otherColumns = 15;
- for (int i = 0; i < validColumnWidths.length - 1; i++)
- otherColumns += validColumnWidths[i];
-
- validColumnWidths[RATIONALE_NUM] = windowWidth - otherColumns;
- validTable.getColumns()[RATIONALE_NUM].setWidth(validColumnWidths[RATIONALE_NUM]);
-
- otherColumns = 15;
- for (int i = 0; i < invalidColumnWidths.length - 1; i++)
- otherColumns += invalidColumnWidths[i];
-
- invalidColumnWidths[INVALID_REASON_NUM] = windowWidth - otherColumns;
- invalidTable.getColumns()[INVALID_REASON_NUM].setWidth(invalidColumnWidths[INVALID_REASON_NUM]);
- }
-
- /**
- * InnerClass that acts as a proxy for the ArtifactModelList providing content for the Table. It implements the
- * IArtifactListViewer interface since it must register changeListeners with the ArtifactModelList
- */
- class RelationContentProvider implements IStructuredContentProvider, IArtifactListViewer {
-
- public void inputChanged(Viewer v, Object oldInput, Object newInput) {
- if (newInput != null)
- artifactList.addChangeListener(this);
- if (oldInput != null)
- artifactList.removeChangeListener(this);
- }
-
- public void dispose() {
- artifactList.removeChangeListener(this);
- }
-
- // Return the tasks as an array of Objects
- public Object[] getElements(Object parent) {
- return artifactList.getArtifactModel().toArray();
- }
-
- public void addArtifact(ArtifactModel artifact) {
- tableViewer.add(artifact);
- }
-
- public void removeArtifact(ArtifactModel artifact) {
- tableViewer.remove(artifact);
- }
-
- public void updateArtifact(ArtifactModel artifact) {
- tableViewer.update(artifact, 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.framework.ui.skynet.relation.explorer;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.CheckboxCellEditor;
+import org.eclipse.jface.viewers.ComboBoxCellEditor;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.type.ArtifactType;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+
+public class RelationTableViewer {
+ private final Table validTable;
+ private TableViewer tableViewer;
+
+ private final Table invalidTable;
+
+ private ArtifactModelList artifactList;
+
+ private String[] validColumnNames;
+ private static int[] validColumnWidths;
+
+ private String[] invalidColumnNames;
+ private static int[] invalidColumnWidths;
+
+ public static final int ADD_NUM = 0;
+ public static final int ARTIFACT_NAME_NUM = 1;
+ public static final int ARTIFACT_TYPE_NUM = 2;
+ public static final int RATIONALE_NUM = 3;
+ public static final int INVALID_NAME_NUM = 0;
+ public static final int INVALID_REASON_NUM = 1;
+
+ public ArrayList<ArtifactType> fullDescriptorList;
+ private ArtifactType defaultArtifactType;
+
+ /**
+ * @param validTable -
+ * @param invalidTable -
+ */
+ public RelationTableViewer(Table validTable, Table invalidTable, Branch branch) {
+ try {
+ fullDescriptorList = new ArrayList<ArtifactType>(ArtifactTypeManager.getValidArtifactTypes(branch));
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ this.validTable = validTable;
+ this.invalidTable = invalidTable;
+
+ this.createControl();
+
+ tableViewer.setContentProvider(new RelationContentProvider());
+ tableViewer.setLabelProvider(new ArtifactModelLabelProvider());
+ tableViewer.setInput(artifactList);
+ }
+
+ public void addValidItem(Artifact artifact) {
+ ArtifactModel model = new ArtifactModel(artifact);
+ artifactList.addArtifact(model, true);
+ }
+
+ public void addInvalidItem(String name, String reason) {
+ String[] itemText = new String[] {name, reason};
+ TableItem item = new TableItem(invalidTable, SWT.NONE);
+ item.setText(itemText);
+ }
+
+ private void createControl() {
+ artifactList = new ArtifactModelList();
+ createColumns();
+ createTableViewer();
+ }
+
+ /**
+ * Create the TableViewer
+ */
+ private void createTableViewer() {
+
+ tableViewer = new TableViewer(validTable);
+ tableViewer.setUseHashlookup(true);
+ tableViewer.setColumnProperties(validColumnNames);
+
+ CellEditor[] validEditors = new CellEditor[validColumnNames.length];
+ validEditors[ADD_NUM] = new CheckboxCellEditor(validTable, SWT.CENTER);
+ validEditors[ARTIFACT_NAME_NUM] = new TextCellEditor(validTable) {
+ };
+
+ String[] items = new String[fullDescriptorList.size()];
+ for (int i = 0; i < items.length; i++) {
+ items[i] = fullDescriptorList.get(i).getName();
+ }
+
+ validEditors[ARTIFACT_TYPE_NUM] = new ComboBoxCellEditor(validTable, items);
+ validEditors[RATIONALE_NUM] = new TextCellEditor(validTable);
+
+ // Assign the cell editors to the viewer
+ tableViewer.setCellEditors(validEditors);
+ // Assign the cell modifier to the viewer
+ tableViewer.setCellModifier(new RelationTableCellModifier(this));
+ }
+
+ /**
+ * Create the Columns
+ */
+ private void createColumns() {
+ validColumnNames = new String[] {"Add", "Artifact Name", "Artifact Type", "Rationale"};
+ validColumnWidths = new int[] {40, 200, 100, 500};
+
+ invalidColumnNames = new String[] {"Name", "Reason"};
+ invalidColumnWidths = new int[] {200, 640};
+
+ TableColumn column = new TableColumn(validTable, SWT.LEFT, ADD_NUM);
+ column.setText(validColumnNames[ADD_NUM]);
+ column.setWidth(validColumnWidths[ADD_NUM]);
+
+ column = new TableColumn(validTable, SWT.LEFT, ARTIFACT_NAME_NUM);
+ column.setText(validColumnNames[ARTIFACT_NAME_NUM]);
+ column.setWidth(validColumnWidths[ARTIFACT_NAME_NUM]);
+ column.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ tableViewer.setSorter(new RelationTableSorter(RelationTableSorter.ARTIFACT_NAME));
+ }
+ });
+
+ column = new TableColumn(validTable, SWT.LEFT, ARTIFACT_TYPE_NUM);
+ column.setText(validColumnNames[ARTIFACT_TYPE_NUM]);
+ column.setWidth(validColumnWidths[ARTIFACT_TYPE_NUM]);
+ column.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ tableViewer.setSorter(new RelationTableSorter(RelationTableSorter.ARTIFACT_TYPE));
+ }
+ });
+
+ column = new TableColumn(validTable, SWT.LEFT, RATIONALE_NUM);
+ column.setText(validColumnNames[RATIONALE_NUM]);
+ column.setWidth(validColumnWidths[RATIONALE_NUM]);
+
+ column = new TableColumn(invalidTable, SWT.LEFT, INVALID_NAME_NUM);
+ column.setText(invalidColumnNames[INVALID_NAME_NUM]);
+ column.setWidth(invalidColumnWidths[INVALID_NAME_NUM]);
+
+ column = new TableColumn(invalidTable, SWT.LEFT, INVALID_REASON_NUM);
+ column.setText(invalidColumnNames[INVALID_REASON_NUM]);
+ column.setWidth(invalidColumnWidths[INVALID_REASON_NUM]);
+ }
+
+ public List<String> getColumnNames() {
+ return Arrays.asList(validColumnNames);
+ }
+
+ public ArtifactModelList getArtifactList() {
+ return this.artifactList;
+ }
+
+ public void refresh() {
+ tableViewer.refresh();
+ }
+
+ /**
+ * @return Returns the invalidTable.
+ */
+ public Table getInvalidTable() {
+ return invalidTable;
+ }
+
+ /**
+ * @return Returns the validTable.
+ */
+ public Table getValidTable() {
+ return validTable;
+ }
+
+ public void resizeTable(int windowWidth) {
+ int otherColumns = 15;
+ for (int i = 0; i < validColumnWidths.length - 1; i++)
+ otherColumns += validColumnWidths[i];
+
+ validColumnWidths[RATIONALE_NUM] = windowWidth - otherColumns;
+ validTable.getColumns()[RATIONALE_NUM].setWidth(validColumnWidths[RATIONALE_NUM]);
+
+ otherColumns = 15;
+ for (int i = 0; i < invalidColumnWidths.length - 1; i++)
+ otherColumns += invalidColumnWidths[i];
+
+ invalidColumnWidths[INVALID_REASON_NUM] = windowWidth - otherColumns;
+ invalidTable.getColumns()[INVALID_REASON_NUM].setWidth(invalidColumnWidths[INVALID_REASON_NUM]);
+ }
+
+ /**
+ * InnerClass that acts as a proxy for the ArtifactModelList providing content for the Table. It implements the
+ * IArtifactListViewer interface since it must register changeListeners with the ArtifactModelList
+ */
+ class RelationContentProvider implements IStructuredContentProvider, IArtifactListViewer {
+
+ public void inputChanged(Viewer v, Object oldInput, Object newInput) {
+ if (newInput != null)
+ artifactList.addChangeListener(this);
+ if (oldInput != null)
+ artifactList.removeChangeListener(this);
+ }
+
+ public void dispose() {
+ artifactList.removeChangeListener(this);
+ }
+
+ // Return the tasks as an array of Objects
+ public Object[] getElements(Object parent) {
+ return artifactList.getArtifactModel().toArray();
+ }
+
+ public void addArtifact(ArtifactModel artifact) {
+ tableViewer.add(artifact);
+ }
+
+ public void removeArtifact(ArtifactModel artifact) {
+ tableViewer.remove(artifact);
+ }
+
+ public void updateArtifact(ArtifactModel artifact) {
+ tableViewer.update(artifact, null);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/ArtifactEditFileWatcher.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/ArtifactEditFileWatcher.java
index e5f9c020425..b65d8884fa9 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/ArtifactEditFileWatcher.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/ArtifactEditFileWatcher.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.render;
-
+package org.eclipse.osee.framework.ui.skynet.render;
+
import java.io.File;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@@ -20,47 +20,47 @@ import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.plugin.core.util.Jobs;
import org.eclipse.osee.framework.skynet.core.utility.FileWatcher;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-
-final class ArtifactEditFileWatcher extends FileWatcher {
-
- public ArtifactEditFileWatcher(long time, TimeUnit unit) {
- super(time, unit);
- }
-
- @Override
- public synchronized void run() {
- try {
- for (Map.Entry<File, Long> entry : filesToWatch.entrySet()) {
- final File file = entry.getKey();
- final Long storedLastModified = entry.getValue();
-
- Long latestLastModified = file.lastModified();
- boolean requiresUpdate = false;
- if (!storedLastModified.equals(latestLastModified)) {
- entry.setValue(latestLastModified);
- if (file.exists()) {
- requiresUpdate = true;
- }
- }
-
- if (requiresUpdate) {
- UpdateArtifactJob updateJob = new UpdateArtifactJob();
- updateJob.setWorkingFile(file);
- updateJob.addJobChangeListener(new JobChangeAdapter() {
-
- @Override
- public void done(IJobChangeEvent event) {
- if (event.getResult().isOK()) {
- OseeLog.log(SkynetGuiPlugin.class, Level.INFO,
- "Updated artifact linked to: " + file.getAbsolutePath());
- }
- }
- });
- Jobs.startJob(updateJob);
- }
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
+
+final class ArtifactEditFileWatcher extends FileWatcher {
+
+ public ArtifactEditFileWatcher(long time, TimeUnit unit) {
+ super(time, unit);
+ }
+
+ @Override
+ public synchronized void run() {
+ try {
+ for (Map.Entry<File, Long> entry : filesToWatch.entrySet()) {
+ final File file = entry.getKey();
+ final Long storedLastModified = entry.getValue();
+
+ Long latestLastModified = file.lastModified();
+ boolean requiresUpdate = false;
+ if (!storedLastModified.equals(latestLastModified)) {
+ entry.setValue(latestLastModified);
+ if (file.exists()) {
+ requiresUpdate = true;
+ }
+ }
+
+ if (requiresUpdate) {
+ UpdateArtifactJob updateJob = new UpdateArtifactJob();
+ updateJob.setWorkingFile(file);
+ updateJob.addJobChangeListener(new JobChangeAdapter() {
+
+ @Override
+ public void done(IJobChangeEvent event) {
+ if (event.getResult().isOK()) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.INFO,
+ "Updated artifact linked to: " + file.getAbsolutePath());
+ }
+ }
+ });
+ Jobs.startJob(updateJob);
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/ArtifactFileMonitor.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/ArtifactFileMonitor.java
index 63ad8e767a1..c1dad8fad2f 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/ArtifactFileMonitor.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/ArtifactFileMonitor.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.render;
-
+package org.eclipse.osee.framework.ui.skynet.render;
+
import java.io.File;
import java.util.concurrent.TimeUnit;
import org.eclipse.core.resources.IFile;
@@ -22,65 +22,65 @@ import org.eclipse.osee.framework.skynet.core.utility.FileWatcher;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchListener;
import org.eclipse.ui.PlatformUI;
-
-final class ArtifactFileMonitor {
- private final ResourceAttributes readonlyfileAttributes;
- private final FileWatcher watcher;
- private boolean firstTime;
- private boolean workbenchSavePopUpDisabled;
-
- public ArtifactFileMonitor() {
- firstTime = true;
- readonlyfileAttributes = new ResourceAttributes();
- readonlyfileAttributes.setReadOnly(true);
-
- watcher = new ArtifactEditFileWatcher(3, TimeUnit.SECONDS);
- watcher.start();
- }
-
- public void addFile(IFile file) {
- monitorFile(file.getLocation().toFile());
- }
-
- public void markAsReadOnly(IFile file) throws OseeCoreException {
- try {
- file.setResourceAttributes(readonlyfileAttributes);
- } catch (CoreException ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- }
-
- public boolean isWorkbenchSavePopUpDisabled() {
- return workbenchSavePopUpDisabled;
- }
-
- public void setWorkbenchSavePopUpDisabled(boolean workbenchSavePopUpDisabled) {
- this.workbenchSavePopUpDisabled = workbenchSavePopUpDisabled;
- }
-
- private void monitorFile(File file) {
- watcher.addFile(file);
- if (firstTime) {
- firstTime = false;
-
- if (!workbenchSavePopUpDisabled) {
- PlatformUI.getWorkbench().addWorkbenchListener(new IWorkbenchListener() {
-
- @Override
- public void postShutdown(IWorkbench workbench) {
- }
-
- @Override
- public boolean preShutdown(IWorkbench workbench, boolean forced) {
- boolean wasConfirmed =
- MessageDialog.openConfirm(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "OSEE Edit",
- "OSEE artifacts were opened for edit. Please save all external work before continuing. Click OK to continue shutdown process or Cancel to abort.");
- return forced || wasConfirmed;
- }
- });
- }
- }
- }
+
+final class ArtifactFileMonitor {
+ private final ResourceAttributes readonlyfileAttributes;
+ private final FileWatcher watcher;
+ private boolean firstTime;
+ private boolean workbenchSavePopUpDisabled;
+
+ public ArtifactFileMonitor() {
+ firstTime = true;
+ readonlyfileAttributes = new ResourceAttributes();
+ readonlyfileAttributes.setReadOnly(true);
+
+ watcher = new ArtifactEditFileWatcher(3, TimeUnit.SECONDS);
+ watcher.start();
+ }
+
+ public void addFile(IFile file) {
+ monitorFile(file.getLocation().toFile());
+ }
+
+ public void markAsReadOnly(IFile file) throws OseeCoreException {
+ try {
+ file.setResourceAttributes(readonlyfileAttributes);
+ } catch (CoreException ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ }
+
+ public boolean isWorkbenchSavePopUpDisabled() {
+ return workbenchSavePopUpDisabled;
+ }
+
+ public void setWorkbenchSavePopUpDisabled(boolean workbenchSavePopUpDisabled) {
+ this.workbenchSavePopUpDisabled = workbenchSavePopUpDisabled;
+ }
+
+ private void monitorFile(File file) {
+ watcher.addFile(file);
+ if (firstTime) {
+ firstTime = false;
+
+ if (!workbenchSavePopUpDisabled) {
+ PlatformUI.getWorkbench().addWorkbenchListener(new IWorkbenchListener() {
+
+ @Override
+ public void postShutdown(IWorkbench workbench) {
+ }
+
+ @Override
+ public boolean preShutdown(IWorkbench workbench, boolean forced) {
+ boolean wasConfirmed =
+ MessageDialog.openConfirm(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ "OSEE Edit",
+ "OSEE artifacts were opened for edit. Please save all external work before continuing. Click OK to continue shutdown process or Cancel to abort.");
+ return forced || wasConfirmed;
+ }
+ });
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/ArtifactGuidToWordML.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/ArtifactGuidToWordML.java
index 035a3c5fd9f..2193279bb0a 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/ArtifactGuidToWordML.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/ArtifactGuidToWordML.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.framework.ui.skynet.render;
-
-import java.util.ArrayList;
-import java.util.List;
-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.search.ArtifactQuery;
-import org.eclipse.osee.framework.skynet.core.linking.LinkType;
-import org.eclipse.osee.framework.skynet.core.linking.OseeLinkBuilder;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ArtifactGuidToWordML {
-
- private final OseeLinkBuilder linkBuilder;
-
- public ArtifactGuidToWordML(OseeLinkBuilder linkBuilder) {
- this.linkBuilder = linkBuilder;
- }
-
- public List<String> resolveAsOseeLinks(Branch branch, List<String> artifactGuids) throws OseeCoreException {
- List<String> mlLinks = new ArrayList<String>();
- for (String guid : artifactGuids) {
- Artifact artifact = ArtifactQuery.checkArtifactFromId(guid, branch);
- if (artifact != null) {
- mlLinks.add(linkBuilder.getWordMlLink(LinkType.OSEE_SERVER_LINK, artifact));
- } else {
- // Artifact does not exist - don't add a link
- }
- }
- return mlLinks;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.render;
+
+import java.util.ArrayList;
+import java.util.List;
+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.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.linking.LinkType;
+import org.eclipse.osee.framework.skynet.core.linking.OseeLinkBuilder;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ArtifactGuidToWordML {
+
+ private final OseeLinkBuilder linkBuilder;
+
+ public ArtifactGuidToWordML(OseeLinkBuilder linkBuilder) {
+ this.linkBuilder = linkBuilder;
+ }
+
+ public List<String> resolveAsOseeLinks(Branch branch, List<String> artifactGuids) throws OseeCoreException {
+ List<String> mlLinks = new ArrayList<String>();
+ for (String guid : artifactGuids) {
+ Artifact artifact = ArtifactQuery.checkArtifactFromId(guid, branch);
+ if (artifact != null) {
+ mlLinks.add(linkBuilder.getWordMlLink(LinkType.OSEE_SERVER_LINK, artifact));
+ } else {
+ // Artifact does not exist - don't add a link
+ }
+ }
+ return mlLinks;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/DefaultArtifactRenderer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/DefaultArtifactRenderer.java
index 7674d809fa4..102df9585e9 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/DefaultArtifactRenderer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/DefaultArtifactRenderer.java
@@ -1,187 +1,187 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.render;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-import org.eclipse.osee.framework.jdk.core.util.xml.Xml;
-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.linking.OseeLinkBuilder;
-import org.eclipse.osee.framework.skynet.core.relation.RelationManager;
-import org.eclipse.osee.framework.skynet.core.relation.order.RelationOrderData;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.artifact.editor.ArtifactEditor;
-import org.eclipse.osee.framework.ui.skynet.artifact.editor.ArtifactEditorInput;
-import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
-import org.eclipse.osee.framework.ui.skynet.render.compare.DefaultArtifactCompare;
-import org.eclipse.osee.framework.ui.skynet.render.compare.IComparator;
-import org.eclipse.osee.framework.ui.skynet.render.word.AttributeElement;
-import org.eclipse.osee.framework.ui.skynet.render.word.Producer;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Ryan D. Brooks
- * @author Jeff C. Philips
- */
-public class DefaultArtifactRenderer implements IRenderer {
- private static final IComparator DEFAULT_COMPARATOR = new DefaultArtifactCompare();
-
- private VariableMap options;
-
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.render;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.jdk.core.util.xml.Xml;
+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.linking.OseeLinkBuilder;
+import org.eclipse.osee.framework.skynet.core.relation.RelationManager;
+import org.eclipse.osee.framework.skynet.core.relation.order.RelationOrderData;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.artifact.editor.ArtifactEditor;
+import org.eclipse.osee.framework.ui.skynet.artifact.editor.ArtifactEditorInput;
+import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
+import org.eclipse.osee.framework.ui.skynet.render.compare.DefaultArtifactCompare;
+import org.eclipse.osee.framework.ui.skynet.render.compare.IComparator;
+import org.eclipse.osee.framework.ui.skynet.render.word.AttributeElement;
+import org.eclipse.osee.framework.ui.skynet.render.word.Producer;
+import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Ryan D. Brooks
+ * @author Jeff C. Philips
+ */
+public class DefaultArtifactRenderer implements IRenderer {
+ private static final IComparator DEFAULT_COMPARATOR = new DefaultArtifactCompare();
+
+ private VariableMap options;
+
+ @Override
+ public String getName() {
+ return "Artifact Editor";
+ }
+
+ public boolean supportsCompare() {
+ return false;
+ }
+
@Override
- public String getName() {
- return "Artifact Editor";
- }
-
- public boolean supportsCompare() {
- return false;
- }
-
- @Override
public void setOptions(VariableMap options) {
- this.options = options;
- }
-
- @Override
- public VariableMap getOptions() {
- return options;
- }
-
- @Override
- public String getStringOption(String key) throws OseeArgumentException {
- return options == null ? null : options.getString(key);
- }
-
- @Override
- public boolean getBooleanOption(String key) throws OseeArgumentException {
- if (options != null) {
- return options.getBoolean(key);
- }
- return false;
- }
-
- @Override
- public DefaultArtifactRenderer newInstance() throws OseeCoreException {
- return new DefaultArtifactRenderer();
- }
-
+ this.options = options;
+ }
+
+ @Override
+ public VariableMap getOptions() {
+ return options;
+ }
+
@Override
- public int getApplicabilityRating(PresentationType presentationType, Artifact artifact) throws OseeCoreException {
- if (presentationType == PresentationType.GENERALIZED_EDIT) {
- return PRESENTATION_TYPE;
- }
- return DEFAULT_MATCH;
- }
-
- @Override
- public int minimumRanking() throws OseeCoreException {
- return NO_MATCH;
- }
-
- @Override
- public void renderAttribute(String attributeTypeName, Artifact artifact, PresentationType presentationType, Producer producer, VariableMap map, AttributeElement attributeElement) throws OseeCoreException {
- WordMLProducer wordMl = (WordMLProducer) producer;
- String format = attributeElement.getFormat();
- boolean allAttrs = map.getBoolean("allAttrs");
-
- wordMl.startParagraph();
-
- if (allAttrs) {
- wordMl.addWordMl("<w:r><w:t> " + Xml.escape(attributeTypeName) + ": </w:t></w:r>");
- } else {
- // assumption: the label is of the form <w:r><w:t> text </w:t></w:r>
- wordMl.addWordMl(attributeElement.getLabel());
- }
-
- if (attributeTypeName.equals(CoreAttributeTypes.RELATION_ORDER.getName())) {
- wordMl.endParagraph();
- String data = renderRelationOrder(artifact);
- wordMl.addWordMl(data);
- } else {
- String valueList = artifact.getAttributesToString(attributeTypeName);
- if (attributeElement.getFormat().contains(">x<")) {
- wordMl.addWordMl(format.replace(">x<", ">" + Xml.escape(valueList).toString() + "<"));
- } else {
- wordMl.addTextInsideParagraph(valueList);
- }
- wordMl.endParagraph();
- }
- }
-
- private String renderRelationOrder(Artifact artifact) throws OseeCoreException {
- StringBuilder builder = new StringBuilder();
- ArtifactGuidToWordML guidResolver = new ArtifactGuidToWordML(new OseeLinkBuilder());
- RelationOrderRenderer renderer =
+ public String getStringOption(String key) throws OseeArgumentException {
+ return options == null ? null : options.getString(key);
+ }
+
+ @Override
+ public boolean getBooleanOption(String key) throws OseeArgumentException {
+ if (options != null) {
+ return options.getBoolean(key);
+ }
+ return false;
+ }
+
+ @Override
+ public DefaultArtifactRenderer newInstance() throws OseeCoreException {
+ return new DefaultArtifactRenderer();
+ }
+
+ @Override
+ public int getApplicabilityRating(PresentationType presentationType, Artifact artifact) throws OseeCoreException {
+ if (presentationType == PresentationType.GENERALIZED_EDIT) {
+ return PRESENTATION_TYPE;
+ }
+ return DEFAULT_MATCH;
+ }
+
+ @Override
+ public int minimumRanking() throws OseeCoreException {
+ return NO_MATCH;
+ }
+
+ @Override
+ public void renderAttribute(String attributeTypeName, Artifact artifact, PresentationType presentationType, Producer producer, VariableMap map, AttributeElement attributeElement) throws OseeCoreException {
+ WordMLProducer wordMl = (WordMLProducer) producer;
+ String format = attributeElement.getFormat();
+ boolean allAttrs = map.getBoolean("allAttrs");
+
+ wordMl.startParagraph();
+
+ if (allAttrs) {
+ wordMl.addWordMl("<w:r><w:t> " + Xml.escape(attributeTypeName) + ": </w:t></w:r>");
+ } else {
+ // assumption: the label is of the form <w:r><w:t> text </w:t></w:r>
+ wordMl.addWordMl(attributeElement.getLabel());
+ }
+
+ if (attributeTypeName.equals(CoreAttributeTypes.RELATION_ORDER.getName())) {
+ wordMl.endParagraph();
+ String data = renderRelationOrder(artifact);
+ wordMl.addWordMl(data);
+ } else {
+ String valueList = artifact.getAttributesToString(attributeTypeName);
+ if (attributeElement.getFormat().contains(">x<")) {
+ wordMl.addWordMl(format.replace(">x<", ">" + Xml.escape(valueList).toString() + "<"));
+ } else {
+ wordMl.addTextInsideParagraph(valueList);
+ }
+ wordMl.endParagraph();
+ }
+ }
+
+ private String renderRelationOrder(Artifact artifact) throws OseeCoreException {
+ StringBuilder builder = new StringBuilder();
+ ArtifactGuidToWordML guidResolver = new ArtifactGuidToWordML(new OseeLinkBuilder());
+ RelationOrderRenderer renderer =
new RelationOrderRenderer(SkynetGuiPlugin.getInstance().getOseeCacheService().getRelationTypeCache(),
guidResolver, RelationManager.getSorterProvider());
-
- WordMLProducer producer = new WordMLProducer(builder);
- RelationOrderData relationOrderData = RelationManager.createRelationOrderData(artifact);
- renderer.toWordML(producer, artifact.getBranch(), relationOrderData);
- return builder.toString();
- }
-
- @Override
- public Image getImage(Artifact artifact) throws OseeCoreException {
- return ArtifactImageManager.getImage(artifact);
- }
-
- @Override
- public List<String> getCommandId(PresentationType presentationType) {
- ArrayList<String> commandIds = new ArrayList<String>(2);
-
- if (presentationType == PresentationType.SPECIALIZED_EDIT) {
- commandIds.add("org.eclipse.osee.framework.ui.skynet.artifacteditor.command");
- }
-
- return commandIds;
- }
-
- @Override
- public IComparator getComparator() {
- return DEFAULT_COMPARATOR;
- }
-
+
+ WordMLProducer producer = new WordMLProducer(builder);
+ RelationOrderData relationOrderData = RelationManager.createRelationOrderData(artifact);
+ renderer.toWordML(producer, artifact.getBranch(), relationOrderData);
+ return builder.toString();
+ }
+
+ @Override
+ public Image getImage(Artifact artifact) throws OseeCoreException {
+ return ArtifactImageManager.getImage(artifact);
+ }
+
@Override
- public List<AttributeType> orderAttributeNames(Artifact artifact, Collection<AttributeType> attributeTypes) {
- ArrayList<AttributeType> orderedAttributeTypes = new ArrayList<AttributeType>(attributeTypes.size());
- AttributeType contentType = null;
-
- for (AttributeType attributeType : attributeTypes) {
- if (attributeType.equals(CoreAttributeTypes.WHOLE_WORD_CONTENT) || attributeType.equals(CoreAttributeTypes.WORD_TEMPLATE_CONTENT)) {
- contentType = attributeType;
- } else {
- orderedAttributeTypes.add(attributeType);
- }
- }
-
- Collections.sort(orderedAttributeTypes);
- if (contentType != null) {
- orderedAttributeTypes.add(contentType);
- }
- return orderedAttributeTypes;
- }
+ public List<String> getCommandId(PresentationType presentationType) {
+ ArrayList<String> commandIds = new ArrayList<String>(2);
+
+ if (presentationType == PresentationType.SPECIALIZED_EDIT) {
+ commandIds.add("org.eclipse.osee.framework.ui.skynet.artifacteditor.command");
+ }
+
+ return commandIds;
+ }
+
+ @Override
+ public IComparator getComparator() {
+ return DEFAULT_COMPARATOR;
+ }
+
+ @Override
+ public List<AttributeType> orderAttributeNames(Artifact artifact, Collection<AttributeType> attributeTypes) {
+ ArrayList<AttributeType> orderedAttributeTypes = new ArrayList<AttributeType>(attributeTypes.size());
+ AttributeType contentType = null;
+
+ for (AttributeType attributeType : attributeTypes) {
+ if (attributeType.equals(CoreAttributeTypes.WHOLE_WORD_CONTENT) || attributeType.equals(CoreAttributeTypes.WORD_TEMPLATE_CONTENT)) {
+ contentType = attributeType;
+ } else {
+ orderedAttributeTypes.add(attributeType);
+ }
+ }
+
+ Collections.sort(orderedAttributeTypes);
+ if (contentType != null) {
+ orderedAttributeTypes.add(contentType);
+ }
+ return orderedAttributeTypes;
+ }
@Override
public void open(final List<Artifact> artifacts, PresentationType presentationType) throws OseeCoreException {
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/FileSystemRenderer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/FileSystemRenderer.java
index 0f4955448a2..4276347e539 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/FileSystemRenderer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/FileSystemRenderer.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.framework.ui.skynet.render;
-
-import java.io.InputStream;
-import java.util.Collections;
-import java.util.List;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-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.plugin.core.util.AIFile;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.util.FileUiUtil;
-import org.eclipse.swt.program.Program;
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.FileEditorInput;
-
-/**
- * @author Ryan D. Brooks
- * @author Jeff C. Phillips
- */
-public abstract class FileSystemRenderer extends DefaultArtifactRenderer {
-
- private static final ArtifactFileMonitor FILE_MONITOR = new ArtifactFileMonitor();
-
- public IFile getRenderedFileForOpen(List<Artifact> artifacts) throws OseeCoreException {
- return getRenderedFile(artifacts, PresentationType.SPECIALIZED_EDIT);
- }
-
- public IFile getRenderedFile(List<Artifact> artifacts, PresentationType presentationType) throws OseeCoreException {
- IFile toReturn = null;
- if (!artifacts.isEmpty()) {
- Artifact firstArtifact = artifacts.iterator().next();
- IFolder baseFolder = RenderingUtil.getRenderFolder(firstArtifact.getBranch(), presentationType);
- toReturn = renderToFileSystem(baseFolder, artifacts, presentationType);
- }
- return toReturn;
- }
-
- public IFile renderToFileSystem(IFolder baseFolder, Artifact artifact, Branch branch, PresentationType presentationType) throws OseeCoreException {
- String fileName = RenderingUtil.getFilenameFromArtifact(this, artifact, presentationType);
- List<Artifact> artifacts;
- if (artifact != null) {
- artifacts = Collections.singletonList(artifact);
- } else {
- artifacts = Collections.emptyList();
- }
- InputStream inputStream = getRenderInputStream(presentationType, artifacts);
- return renderToFile(baseFolder, fileName, branch, inputStream, presentationType);
- }
-
- public IFile renderToFileSystem(IFolder baseFolder, List<Artifact> artifacts, PresentationType presentationType) throws OseeCoreException {
- Branch initialBranch = null;
- for (Artifact artifact : artifacts) {
- if (initialBranch == null) {
- initialBranch = artifact.getBranch();
- } else {
- if (artifact.getBranch() != initialBranch) {
- throw new IllegalArgumentException("All of the artifacts must be on the same branch to be mass edited");
- }
- }
- }
-
- Artifact artifact = null;
- if (artifacts.size() == 1) {
- artifact = artifacts.iterator().next();
- }
- String fileName = RenderingUtil.getFilenameFromArtifact(this, artifact, presentationType);
- InputStream inputStream = getRenderInputStream(presentationType, artifacts);
- return renderToFile(baseFolder, fileName, initialBranch, inputStream, presentationType);
- }
-
- public IFile renderToFile(IFolder baseFolder, String fileName, Branch branch, InputStream renderInputStream, PresentationType presentationType) throws OseeCoreException {
- IFile workingFile = baseFolder.getFile(fileName);
- AIFile.writeToFile(workingFile, renderInputStream);
-
- if (presentationType == PresentationType.SPECIALIZED_EDIT || presentationType == PresentationType.MERGE_EDIT) {
- FILE_MONITOR.addFile(workingFile);
- } else if (presentationType == PresentationType.PREVIEW) {
- FILE_MONITOR.markAsReadOnly(workingFile);
- }
- return workingFile;
- }
-
- public void addFileToWatcher(IFolder baseFolder, String fileName) {
- IFile workingFile = baseFolder.getFile(fileName);
- FILE_MONITOR.addFile(workingFile);
- }
-
- public abstract InputStream getRenderInputStream(PresentationType presentationType, List<Artifact> artifacts) throws OseeCoreException;
-
- public abstract Program getAssociatedProgram(Artifact artifact) throws OseeCoreException;
-
- public abstract String getAssociatedExtension(Artifact artifact) throws OseeCoreException;
-
- /**
- * @return the workbenchSavePopUpDisabled
- */
- public static boolean isWorkbenchSavePopUpDisabled() {
- return FILE_MONITOR.isWorkbenchSavePopUpDisabled();
- }
-
- /**
- * @param workbenchSavePopUpDisabled the workbenchSavePopUpDisabled to set
- */
- public static void setWorkbenchSavePopUpDisabled(boolean workbenchSavePopUpDisabled) {
- FILE_MONITOR.setWorkbenchSavePopUpDisabled(workbenchSavePopUpDisabled);
- }
-
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.render;
+
+import java.io.InputStream;
+import java.util.Collections;
+import java.util.List;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+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.plugin.core.util.AIFile;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.util.FileUiUtil;
+import org.eclipse.swt.program.Program;
+import org.eclipse.ui.IEditorDescriptor;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * @author Ryan D. Brooks
+ * @author Jeff C. Phillips
+ */
+public abstract class FileSystemRenderer extends DefaultArtifactRenderer {
+
+ private static final ArtifactFileMonitor FILE_MONITOR = new ArtifactFileMonitor();
+
+ public IFile getRenderedFileForOpen(List<Artifact> artifacts) throws OseeCoreException {
+ return getRenderedFile(artifacts, PresentationType.SPECIALIZED_EDIT);
+ }
+
+ public IFile getRenderedFile(List<Artifact> artifacts, PresentationType presentationType) throws OseeCoreException {
+ IFile toReturn = null;
+ if (!artifacts.isEmpty()) {
+ Artifact firstArtifact = artifacts.iterator().next();
+ IFolder baseFolder = RenderingUtil.getRenderFolder(firstArtifact.getBranch(), presentationType);
+ toReturn = renderToFileSystem(baseFolder, artifacts, presentationType);
+ }
+ return toReturn;
+ }
+
+ public IFile renderToFileSystem(IFolder baseFolder, Artifact artifact, Branch branch, PresentationType presentationType) throws OseeCoreException {
+ String fileName = RenderingUtil.getFilenameFromArtifact(this, artifact, presentationType);
+ List<Artifact> artifacts;
+ if (artifact != null) {
+ artifacts = Collections.singletonList(artifact);
+ } else {
+ artifacts = Collections.emptyList();
+ }
+ InputStream inputStream = getRenderInputStream(presentationType, artifacts);
+ return renderToFile(baseFolder, fileName, branch, inputStream, presentationType);
+ }
+
+ public IFile renderToFileSystem(IFolder baseFolder, List<Artifact> artifacts, PresentationType presentationType) throws OseeCoreException {
+ Branch initialBranch = null;
+ for (Artifact artifact : artifacts) {
+ if (initialBranch == null) {
+ initialBranch = artifact.getBranch();
+ } else {
+ if (artifact.getBranch() != initialBranch) {
+ throw new IllegalArgumentException("All of the artifacts must be on the same branch to be mass edited");
+ }
+ }
+ }
+
+ Artifact artifact = null;
+ if (artifacts.size() == 1) {
+ artifact = artifacts.iterator().next();
+ }
+ String fileName = RenderingUtil.getFilenameFromArtifact(this, artifact, presentationType);
+ InputStream inputStream = getRenderInputStream(presentationType, artifacts);
+ return renderToFile(baseFolder, fileName, initialBranch, inputStream, presentationType);
+ }
+
+ public IFile renderToFile(IFolder baseFolder, String fileName, Branch branch, InputStream renderInputStream, PresentationType presentationType) throws OseeCoreException {
+ IFile workingFile = baseFolder.getFile(fileName);
+ AIFile.writeToFile(workingFile, renderInputStream);
+
+ if (presentationType == PresentationType.SPECIALIZED_EDIT || presentationType == PresentationType.MERGE_EDIT) {
+ FILE_MONITOR.addFile(workingFile);
+ } else if (presentationType == PresentationType.PREVIEW) {
+ FILE_MONITOR.markAsReadOnly(workingFile);
+ }
+ return workingFile;
+ }
+
+ public void addFileToWatcher(IFolder baseFolder, String fileName) {
+ IFile workingFile = baseFolder.getFile(fileName);
+ FILE_MONITOR.addFile(workingFile);
+ }
+
+ public abstract InputStream getRenderInputStream(PresentationType presentationType, List<Artifact> artifacts) throws OseeCoreException;
+
+ public abstract Program getAssociatedProgram(Artifact artifact) throws OseeCoreException;
+
+ public abstract String getAssociatedExtension(Artifact artifact) throws OseeCoreException;
+
+ /**
+ * @return the workbenchSavePopUpDisabled
+ */
+ public static boolean isWorkbenchSavePopUpDisabled() {
+ return FILE_MONITOR.isWorkbenchSavePopUpDisabled();
+ }
+
+ /**
+ * @param workbenchSavePopUpDisabled the workbenchSavePopUpDisabled to set
+ */
+ public static void setWorkbenchSavePopUpDisabled(boolean workbenchSavePopUpDisabled) {
+ FILE_MONITOR.setWorkbenchSavePopUpDisabled(workbenchSavePopUpDisabled);
+ }
+
@Override
public void open(List<Artifact> artifacts, PresentationType presentationType) throws OseeCoreException {
IFile file = getRenderedFile(artifacts, presentationType);
@@ -150,4 +150,4 @@ public abstract class FileSystemRenderer extends DefaultArtifactRenderer {
}
}
}
-}
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IRenderer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IRenderer.java
index 5a4f5eec2a4..f5c655e6093 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IRenderer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IRenderer.java
@@ -1,64 +1,64 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.render;
-
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
-import org.eclipse.osee.framework.ui.skynet.render.compare.IComparator;
-import org.eclipse.osee.framework.ui.skynet.render.word.AttributeElement;
-import org.eclipse.osee.framework.ui.skynet.render.word.Producer;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Jeff C. Phillips
- */
-public interface IRenderer {
-
- public static final int PRESENTATION_SUBTYPE_MATCH = 50;
- public static final int PRESENTATION_TYPE = 40;
- public static final int SUBTYPE_TYPE_MATCH = 30;
- public static final int ARTIFACT_TYPE_MATCH = 20;
- public static final int DEFAULT_MATCH = 10;
- public static final int NO_MATCH = -1;
-
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.render;
+
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
+import org.eclipse.osee.framework.ui.skynet.render.compare.IComparator;
+import org.eclipse.osee.framework.ui.skynet.render.word.AttributeElement;
+import org.eclipse.osee.framework.ui.skynet.render.word.Producer;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public interface IRenderer {
+
+ public static final int PRESENTATION_SUBTYPE_MATCH = 50;
+ public static final int PRESENTATION_TYPE = 40;
+ public static final int SUBTYPE_TYPE_MATCH = 30;
+ public static final int ARTIFACT_TYPE_MATCH = 20;
+ public static final int DEFAULT_MATCH = 10;
+ public static final int NO_MATCH = -1;
+
public List<String> getCommandId(PresentationType presentationType);
-
+
public Image getImage(Artifact artifact) throws OseeCoreException;
-
+
public void renderAttribute(String attributeTypeName, Artifact artifact, PresentationType presentationType, Producer producer, VariableMap map, AttributeElement attributeElement) throws OseeCoreException;
-
+
public int minimumRanking() throws OseeCoreException;
-
+
public void open(List<Artifact> artifacts, PresentationType presentationType) throws OseeCoreException;
-
+
public int getApplicabilityRating(PresentationType presentationType, Artifact artifact) throws OseeCoreException;
-
+
public String getName();
-
+
public void setOptions(VariableMap options) throws OseeArgumentException;
-
+
public String getStringOption(String key) throws OseeArgumentException;
-
+
public boolean getBooleanOption(String key) throws OseeArgumentException;
-
+
public VariableMap getOptions();
-
+
public IRenderer newInstance() throws OseeCoreException;
-
+
public IComparator getComparator();
-
+
public List<AttributeType> orderAttributeNames(Artifact artifact, Collection<AttributeType> attributeTypes);
-}
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/ITemplateRenderer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/ITemplateRenderer.java
index 74d5255b70a..cd76652c044 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/ITemplateRenderer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/ITemplateRenderer.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.render;
-
-/**
- * @author Ryan D. Brooks
- */
-public interface ITemplateRenderer extends IRenderer {
- public static final String TEMPLATE_OPTION = "template";
- public static final String TRANSACTION_OPTION = "skynetTransaction";
- public static final String PREVIEW_WITH_RECURSE_VALUE = "PREVIEW_WITH_RECURSE";
- public static final String PREVIEW_WITH_RECURSE_NO_ATTRIBUTES_VALUE = "PREVIEW_WITH_RECURSE_NO_ATTRIBUTES";
- public static final String DIFF_VALUE = "DIFF";
- public static final String DIFF_NO_ATTRIBUTES_VALUE = "DIFF_NO_ATTRIBUTES";
- public static final Object[] PREVIEW_WITH_RECURSE_OPTION_PAIR =
- new String[] {TEMPLATE_OPTION, PREVIEW_WITH_RECURSE_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.framework.ui.skynet.render;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public interface ITemplateRenderer extends IRenderer {
+ public static final String TEMPLATE_OPTION = "template";
+ public static final String TRANSACTION_OPTION = "skynetTransaction";
+ public static final String PREVIEW_WITH_RECURSE_VALUE = "PREVIEW_WITH_RECURSE";
+ public static final String PREVIEW_WITH_RECURSE_NO_ATTRIBUTES_VALUE = "PREVIEW_WITH_RECURSE_NO_ATTRIBUTES";
+ public static final String DIFF_VALUE = "DIFF";
+ public static final String DIFF_NO_ATTRIBUTES_VALUE = "DIFF_NO_ATTRIBUTES";
+ public static final Object[] PREVIEW_WITH_RECURSE_OPTION_PAIR =
+ new String[] {TEMPLATE_OPTION, PREVIEW_WITH_RECURSE_VALUE};
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IVbaDiffGenerator.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IVbaDiffGenerator.java
index e95a596d233..86b70047919 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IVbaDiffGenerator.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/IVbaDiffGenerator.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.framework.ui.skynet.render;
-
-import java.io.File;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-
-/**
- * @author Theron Virgin
- */
-public interface IVbaDiffGenerator {
- public boolean initialize(boolean visible, boolean detectFormatChanges);
-
- public boolean addComparison(IFile baseFile, IFile newerFile, String diffPath, boolean merge);
-
- public void finish(String vbaScriptPath, boolean show) throws OseeCoreException;
-
- public File getFile(String path) 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.framework.ui.skynet.render;
+
+import java.io.File;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+
+/**
+ * @author Theron Virgin
+ */
+public interface IVbaDiffGenerator {
+ public boolean initialize(boolean visible, boolean detectFormatChanges);
+
+ public boolean addComparison(IFile baseFile, IFile newerFile, String diffPath, boolean merge);
+
+ public void finish(String vbaScriptPath, boolean show) throws OseeCoreException;
+
+ public File getFile(String path) throws OseeCoreException;
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/OpenOfficeWriterRenderer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/OpenOfficeWriterRenderer.java
index f04e0210be6..92d1a4d5631 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/OpenOfficeWriterRenderer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/OpenOfficeWriterRenderer.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.framework.ui.skynet.render;
-
-import java.io.InputStream;
-import java.util.List;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.swt.program.Program;
-
-/**
- * @author Ryan D. Brooks
- */
-public class OpenOfficeWriterRenderer extends FileSystemRenderer implements ITemplateRenderer {
-
- @Override
- public OpenOfficeWriterRenderer newInstance() throws OseeCoreException {
- return new OpenOfficeWriterRenderer();
- }
-
- @Override
- public String getAssociatedExtension(Artifact artifact) {
- return "odt";
- }
-
- @Override
- public InputStream getRenderInputStream(PresentationType presentationType, List<Artifact> artifacts) throws OseeCoreException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Program getAssociatedProgram(Artifact artifact) throws OseeCoreException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int getApplicabilityRating(PresentationType presentationType, Artifact artifact) throws OseeCoreException {
- return NO_MATCH;
- }
-
- @Override
- public int minimumRanking() throws OseeCoreException {
- return NO_MATCH;
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.render;
+
+import java.io.InputStream;
+import java.util.List;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.swt.program.Program;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public class OpenOfficeWriterRenderer extends FileSystemRenderer implements ITemplateRenderer {
+
+ @Override
+ public OpenOfficeWriterRenderer newInstance() throws OseeCoreException {
+ return new OpenOfficeWriterRenderer();
+ }
+
+ @Override
+ public String getAssociatedExtension(Artifact artifact) {
+ return "odt";
+ }
+
+ @Override
+ public InputStream getRenderInputStream(PresentationType presentationType, List<Artifact> artifacts) throws OseeCoreException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Program getAssociatedProgram(Artifact artifact) throws OseeCoreException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int getApplicabilityRating(PresentationType presentationType, Artifact artifact) throws OseeCoreException {
+ return NO_MATCH;
+ }
+
+ @Override
+ public int minimumRanking() throws OseeCoreException {
+ return NO_MATCH;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/PresentationType.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/PresentationType.java
index e35b996d70f..9102b595a0d 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/PresentationType.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/PresentationType.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.render;
-
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.render;
-public enum PresentationType {
+
+public enum PresentationType {
GENERALIZED_EDIT,
SPECIALIZED_EDIT,
DIFF,
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RelationOrderRenderer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RelationOrderRenderer.java
index 565898e3fb8..edc028b23e3 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RelationOrderRenderer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RelationOrderRenderer.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.framework.ui.skynet.render;
-
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.logging.Level;
-import org.eclipse.osee.framework.core.enums.RelationSide;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.cache.AbstractOseeCache;
-import org.eclipse.osee.framework.core.model.type.RelationType;
-import org.eclipse.osee.framework.jdk.core.type.Pair;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.relation.order.IRelationSorter;
-import org.eclipse.osee.framework.skynet.core.relation.order.RelationOrderData;
-import org.eclipse.osee.framework.skynet.core.relation.order.RelationSorterProvider;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.render.word.Producer;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-
-/**
- * @author Roberto E. Escobar
- */
-public class RelationOrderRenderer {
- private static final String NO_DATA_TAG = "None";
- private final ArtifactGuidToWordML guidResolver;
- private final RelationSorterProvider sorterProvider;
- private final AbstractOseeCache<RelationType> relationCache;
-
- public RelationOrderRenderer(AbstractOseeCache<RelationType> relationCache, ArtifactGuidToWordML guidResolver, RelationSorterProvider sorterProvider) {
- this.relationCache = relationCache;
- this.guidResolver = guidResolver;
- this.sorterProvider = sorterProvider;
- }
-
- private String resolveSorter(String sorterGuid) {
- String toReturn = sorterGuid;
- try {
- IRelationSorter sorter = sorterProvider.getRelationOrder(toReturn);
- toReturn = sorter.getSorterId().getName();
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- return toReturn;
- }
-
- private void writeTableRow(WordMLProducer writer, RelationType relationType, RelationSide side, String sorterName, List<String> orderedData) throws OseeCoreException {
- writer.startTableRow();
- String relationName = relationType.getName();
- String relationSideName = relationType.getSideName(side);
- String sideName = side.name().toLowerCase();
- if (orderedData.isEmpty()) {
- writer.addTableColumns(relationName, relationSideName, sideName, sorterName, NO_DATA_TAG);
- } else {
- writer.addTableColumns(relationName, relationSideName, sideName, sorterName);
- writer.startTableColumn();
- for (String link : orderedData) {
- writer.addParagraphNoEscape(link);
- }
- writer.endTableColumn();
- }
- writer.endTableRow();
-
- }
-
- public void toWordML(Producer producer, Branch branch, RelationOrderData relationOrderData) throws OseeCoreException {
- try {
- WordMLProducer writer = (WordMLProducer) producer;
- writer.startTable();
- writer.addWordMl("<w:tblPr><w:tblW w:w=\"8200\" w:type=\"dxa\"/><w:jc w:val=\"center\"/></w:tblPr>");
- if (!relationOrderData.hasEntries()) {
- writer.addTableRow(NO_DATA_TAG);
- } else {
- writer.addTableRow("Relation Type", "Side Name", "Side", "Order Type", "Related Artifacts");
- for (Entry<Pair<String, String>, Pair<String, List<String>>> entry : relationOrderData.getOrderedEntrySet()) {
- String relationTypeName = entry.getKey().getFirst();
- String relationSide = entry.getKey().getSecond();
- String sorterGuid = entry.getValue().getFirst();
-
- List<String> guidList = entry.getValue().getSecond();
- List<String> mlLinks = guidResolver.resolveAsOseeLinks(branch, guidList);
- RelationType relationType = relationCache.getUniqueByName(relationTypeName);
- RelationSide side = RelationSide.fromString(relationSide);
- try {
- writeTableRow(writer, relationType, side, resolveSorter(sorterGuid), mlLinks);
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- }
- writer.endTable();
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.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.framework.ui.skynet.render;
+
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.logging.Level;
+import org.eclipse.osee.framework.core.enums.RelationSide;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.cache.AbstractOseeCache;
+import org.eclipse.osee.framework.core.model.type.RelationType;
+import org.eclipse.osee.framework.jdk.core.type.Pair;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.relation.order.IRelationSorter;
+import org.eclipse.osee.framework.skynet.core.relation.order.RelationOrderData;
+import org.eclipse.osee.framework.skynet.core.relation.order.RelationSorterProvider;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.render.word.Producer;
+import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class RelationOrderRenderer {
+ private static final String NO_DATA_TAG = "None";
+ private final ArtifactGuidToWordML guidResolver;
+ private final RelationSorterProvider sorterProvider;
+ private final AbstractOseeCache<RelationType> relationCache;
+
+ public RelationOrderRenderer(AbstractOseeCache<RelationType> relationCache, ArtifactGuidToWordML guidResolver, RelationSorterProvider sorterProvider) {
+ this.relationCache = relationCache;
+ this.guidResolver = guidResolver;
+ this.sorterProvider = sorterProvider;
+ }
+
+ private String resolveSorter(String sorterGuid) {
+ String toReturn = sorterGuid;
+ try {
+ IRelationSorter sorter = sorterProvider.getRelationOrder(toReturn);
+ toReturn = sorter.getSorterId().getName();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ return toReturn;
+ }
+
+ private void writeTableRow(WordMLProducer writer, RelationType relationType, RelationSide side, String sorterName, List<String> orderedData) throws OseeCoreException {
+ writer.startTableRow();
+ String relationName = relationType.getName();
+ String relationSideName = relationType.getSideName(side);
+ String sideName = side.name().toLowerCase();
+ if (orderedData.isEmpty()) {
+ writer.addTableColumns(relationName, relationSideName, sideName, sorterName, NO_DATA_TAG);
+ } else {
+ writer.addTableColumns(relationName, relationSideName, sideName, sorterName);
+ writer.startTableColumn();
+ for (String link : orderedData) {
+ writer.addParagraphNoEscape(link);
+ }
+ writer.endTableColumn();
+ }
+ writer.endTableRow();
+
+ }
+
+ public void toWordML(Producer producer, Branch branch, RelationOrderData relationOrderData) throws OseeCoreException {
+ try {
+ WordMLProducer writer = (WordMLProducer) producer;
+ writer.startTable();
+ writer.addWordMl("<w:tblPr><w:tblW w:w=\"8200\" w:type=\"dxa\"/><w:jc w:val=\"center\"/></w:tblPr>");
+ if (!relationOrderData.hasEntries()) {
+ writer.addTableRow(NO_DATA_TAG);
+ } else {
+ writer.addTableRow("Relation Type", "Side Name", "Side", "Order Type", "Related Artifacts");
+ for (Entry<Pair<String, String>, Pair<String, List<String>>> entry : relationOrderData.getOrderedEntrySet()) {
+ String relationTypeName = entry.getKey().getFirst();
+ String relationSide = entry.getKey().getSecond();
+ String sorterGuid = entry.getValue().getFirst();
+
+ List<String> guidList = entry.getValue().getSecond();
+ List<String> mlLinks = guidResolver.resolveAsOseeLinks(branch, guidList);
+ RelationType relationType = relationCache.getUniqueByName(relationTypeName);
+ RelationSide side = RelationSide.fromString(relationSide);
+ try {
+ writeTableRow(writer, relationType, side, resolveSorter(sorterGuid), mlLinks);
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ writer.endTable();
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RendererManager.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RendererManager.java
index fe1779bb285..009117e1a42 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RendererManager.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RendererManager.java
@@ -1,306 +1,306 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.render;
-
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-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.type.AttributeType;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
-import org.eclipse.osee.framework.core.operation.IOperation;
-import org.eclipse.osee.framework.core.operation.Operations;
-import org.eclipse.osee.framework.jdk.core.type.HashCollection;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.plugin.core.util.ExtensionPoints;
-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.Artifact;
-import org.eclipse.osee.framework.skynet.core.change.ArtifactDelta;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
-import org.eclipse.osee.framework.ui.skynet.render.compare.IComparator;
-import org.eclipse.osee.framework.ui.skynet.render.word.AttributeElement;
-import org.eclipse.osee.framework.ui.skynet.render.word.Producer;
-
-/**
- * @author Ryan D. Brooks
- */
-public class RendererManager {
- private static final RendererManager instance = new RendererManager();
- private final HashMap<String, IRenderer> renderers = new HashMap<String, IRenderer>(40);
-
- private RendererManager() {
- registerRendersFromExtensionPoints();
- }
-
- /**
- * @param artifacts
- * @param presentationType
- * @return Returns the intersection of renderers applicable for all of the artifacts
- * @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.framework.ui.skynet.render;
+
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+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.type.AttributeType;
+import org.eclipse.osee.framework.core.operation.AbstractOperation;
+import org.eclipse.osee.framework.core.operation.IOperation;
+import org.eclipse.osee.framework.core.operation.Operations;
+import org.eclipse.osee.framework.jdk.core.type.HashCollection;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.plugin.core.util.ExtensionPoints;
+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.Artifact;
+import org.eclipse.osee.framework.skynet.core.change.ArtifactDelta;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
+import org.eclipse.osee.framework.ui.skynet.render.compare.IComparator;
+import org.eclipse.osee.framework.ui.skynet.render.word.AttributeElement;
+import org.eclipse.osee.framework.ui.skynet.render.word.Producer;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public class RendererManager {
+ private static final RendererManager instance = new RendererManager();
+ private final HashMap<String, IRenderer> renderers = new HashMap<String, IRenderer>(40);
+
+ private RendererManager() {
+ registerRendersFromExtensionPoints();
+ }
+
+ /**
+ * @param artifacts
+ * @param presentationType
+ * @return Returns the intersection of renderers applicable for all of the artifacts
+ * @throws OseeCoreException
+ */
public static List<IRenderer> getCommonRenderers(Collection<Artifact> artifacts, PresentationType presentationType) throws OseeCoreException {
List<IRenderer> commonRenders = getApplicableRenderers(presentationType, artifacts.iterator().next(), null);
-
- for (Artifact artifact : artifacts) {
- List<IRenderer> applicableRenders = getApplicableRenderers(presentationType, artifact, null);
-
- Iterator<?> commIterator = commonRenders.iterator();
-
- while (commIterator.hasNext()) {
- IRenderer commRenderer = (IRenderer) commIterator.next();
- boolean found = false;
- for (IRenderer appRenderer : applicableRenders) {
- if (appRenderer.getName().equals(commRenderer.getName())) {
- found = true;
- continue;
- }
- }
-
- if (!found) {
- commIterator.remove();
- }
- }
- }
- return commonRenders;
- }
-
- /**
- * Maps all renderers in the system to their applicable artifact types
- */
- @SuppressWarnings("unchecked")
- private void registerRendersFromExtensionPoints() {
- List<IConfigurationElement> elements =
+
+ for (Artifact artifact : artifacts) {
+ List<IRenderer> applicableRenders = getApplicableRenderers(presentationType, artifact, null);
+
+ Iterator<?> commIterator = commonRenders.iterator();
+
+ while (commIterator.hasNext()) {
+ IRenderer commRenderer = (IRenderer) commIterator.next();
+ boolean found = false;
+ for (IRenderer appRenderer : applicableRenders) {
+ if (appRenderer.getName().equals(commRenderer.getName())) {
+ found = true;
+ continue;
+ }
+ }
+
+ if (!found) {
+ commIterator.remove();
+ }
+ }
+ }
+ return commonRenders;
+ }
+
+ /**
+ * Maps all renderers in the system to their applicable artifact types
+ */
+ @SuppressWarnings("unchecked")
+ private void registerRendersFromExtensionPoints() {
+ List<IConfigurationElement> elements =
ExtensionPoints.getExtensionElements(SkynetGuiPlugin.getInstance(), "ArtifactRenderer", "Renderer");
-
- for (IConfigurationElement element : elements) {
- String classname = element.getAttribute("classname");
- String bundleName = element.getContributor().getName();
- try {
- Class<IRenderer> clazz = Platform.getBundle(bundleName).loadClass(classname);
- Constructor<IRenderer> constructor = clazz.getConstructor();
- IRenderer renderer = constructor.newInstance();
- renderers.put(renderer.getClass().getCanonicalName(), renderer);
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- } catch (NoClassDefFoundError er) {
- OseeLog.log(SkynetGuiPlugin.class, Level.WARNING,
+
+ for (IConfigurationElement element : elements) {
+ String classname = element.getAttribute("classname");
+ String bundleName = element.getContributor().getName();
+ try {
+ Class<IRenderer> clazz = Platform.getBundle(bundleName).loadClass(classname);
+ Constructor<IRenderer> constructor = clazz.getConstructor();
+ IRenderer renderer = constructor.newInstance();
+ renderers.put(renderer.getClass().getCanonicalName(), renderer);
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ } catch (NoClassDefFoundError er) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.WARNING,
"Failed to find a class definition for " + classname + ", registered from bundle " + bundleName, er);
- }
- }
- }
-
- public static FileSystemRenderer getBestFileRenderer(PresentationType presentationType, Artifact artifact) throws OseeCoreException {
- return getBestFileRenderer(presentationType, artifact, null);
- }
-
- public static FileSystemRenderer getBestFileRenderer(PresentationType presentationType, Artifact artifact, VariableMap options) throws OseeCoreException {
- IRenderer bestRenderer = getBestRenderer(presentationType, artifact, options);
- if (bestRenderer instanceof FileSystemRenderer) {
- return (FileSystemRenderer) bestRenderer;
- }
- throw new OseeArgumentException(
+ }
+ }
+ }
+
+ public static FileSystemRenderer getBestFileRenderer(PresentationType presentationType, Artifact artifact) throws OseeCoreException {
+ return getBestFileRenderer(presentationType, artifact, null);
+ }
+
+ public static FileSystemRenderer getBestFileRenderer(PresentationType presentationType, Artifact artifact, VariableMap options) throws OseeCoreException {
+ IRenderer bestRenderer = getBestRenderer(presentationType, artifact, options);
+ if (bestRenderer instanceof FileSystemRenderer) {
+ return (FileSystemRenderer) bestRenderer;
+ }
+ throw new OseeArgumentException(
"No FileRenderer found for " + artifact + " of type " + artifact.getArtifactTypeName());
- }
-
- private static IRenderer getBestRenderer(PresentationType presentationType, Artifact artifact, VariableMap options) throws OseeCoreException {
- IRenderer bestRenderer = getBestRendererPrototype(presentationType, artifact).newInstance();
- bestRenderer.setOptions(options);
- return bestRenderer;
- }
-
- private static IRenderer getBestRendererPrototype(PresentationType presentationType, Artifact artifact) throws OseeCoreException {
- IRenderer bestRendererPrototype = null;
- int bestRating = IRenderer.NO_MATCH;
- for (IRenderer renderer : instance.renderers.values()) {
- int rating = renderer.getApplicabilityRating(presentationType, artifact);
- if (rating > bestRating) {
- bestRendererPrototype = renderer;
- bestRating = rating;
- }
- }
- if (bestRendererPrototype == null) {
- throw new OseeStateException("At least the DefaultArtifactRenderer should have been found.");
- }
- return bestRendererPrototype;
- }
-
- public static void renderAttribute(String attrType, PresentationType presentationType, Artifact artifact, VariableMap options, Producer producer, AttributeElement attributeElement) throws OseeCoreException {
- getBestRenderer(presentationType, artifact, options).renderAttribute(attrType, artifact, presentationType,
+ }
+
+ private static IRenderer getBestRenderer(PresentationType presentationType, Artifact artifact, VariableMap options) throws OseeCoreException {
+ IRenderer bestRenderer = getBestRendererPrototype(presentationType, artifact).newInstance();
+ bestRenderer.setOptions(options);
+ return bestRenderer;
+ }
+
+ private static IRenderer getBestRendererPrototype(PresentationType presentationType, Artifact artifact) throws OseeCoreException {
+ IRenderer bestRendererPrototype = null;
+ int bestRating = IRenderer.NO_MATCH;
+ for (IRenderer renderer : instance.renderers.values()) {
+ int rating = renderer.getApplicabilityRating(presentationType, artifact);
+ if (rating > bestRating) {
+ bestRendererPrototype = renderer;
+ bestRating = rating;
+ }
+ }
+ if (bestRendererPrototype == null) {
+ throw new OseeStateException("At least the DefaultArtifactRenderer should have been found.");
+ }
+ return bestRendererPrototype;
+ }
+
+ public static void renderAttribute(String attrType, PresentationType presentationType, Artifact artifact, VariableMap options, Producer producer, AttributeElement attributeElement) throws OseeCoreException {
+ getBestRenderer(presentationType, artifact, options).renderAttribute(attrType, artifact, presentationType,
producer, options, attributeElement);
- }
-
- public static Collection<AttributeType> getAttributeTypeOrderList(Artifact artifact) throws OseeCoreException {
- return getBestRenderer(PresentationType.PREVIEW, artifact, null).orderAttributeNames(artifact,
+ }
+
+ public static Collection<AttributeType> getAttributeTypeOrderList(Artifact artifact) throws OseeCoreException {
+ return getBestRenderer(PresentationType.PREVIEW, artifact, null).orderAttributeNames(artifact,
artifact.getAttributeTypes());
- }
-
- public static List<IRenderer> getApplicableRenderers(PresentationType presentationType, Artifact artifact, VariableMap options) throws OseeCoreException {
- ArrayList<IRenderer> renderers = new ArrayList<IRenderer>();
-
- for (IRenderer prototypeRenderer : instance.renderers.values()) {
- // Add Catch Exception Code --
-
- int rating = prototypeRenderer.getApplicabilityRating(presentationType, artifact);
- if (rating > getBestRenderer(presentationType, artifact, options).minimumRanking()) {
- IRenderer renderer = prototypeRenderer.newInstance();
- renderer.setOptions(options);
- renderers.add(renderer);
- }
- }
- return renderers;
- }
-
+ }
+
+ public static List<IRenderer> getApplicableRenderers(PresentationType presentationType, Artifact artifact, VariableMap options) throws OseeCoreException {
+ ArrayList<IRenderer> renderers = new ArrayList<IRenderer>();
+
+ for (IRenderer prototypeRenderer : instance.renderers.values()) {
+ // Add Catch Exception Code --
+
+ int rating = prototypeRenderer.getApplicabilityRating(presentationType, artifact);
+ if (rating > getBestRenderer(presentationType, artifact, options).minimumRanking()) {
+ IRenderer renderer = prototypeRenderer.newInstance();
+ renderer.setOptions(options);
+ renderers.add(renderer);
+ }
+ }
+ return renderers;
+ }
+
public static HashCollection<IRenderer, Artifact> createRenderMap(PresentationType presentationType, Collection<Artifact> artifacts, VariableMap options) throws OseeCoreException {
- HashCollection<IRenderer, Artifact> prototypeRendererArtifactMap =
+ HashCollection<IRenderer, Artifact> prototypeRendererArtifactMap =
new HashCollection<IRenderer, Artifact>(false, LinkedList.class);
- for (Artifact artifact : artifacts) {
- prototypeRendererArtifactMap.put(getBestRendererPrototype(presentationType, artifact), artifact);
- }
-
- // now that the artifacts are grouped based on best renderer type, create instances of those renderer with the supplied options
- HashCollection<IRenderer, Artifact> rendererArtifactMap =
+ for (Artifact artifact : artifacts) {
+ prototypeRendererArtifactMap.put(getBestRendererPrototype(presentationType, artifact), artifact);
+ }
+
+ // now that the artifacts are grouped based on best renderer type, create instances of those renderer with the supplied options
+ HashCollection<IRenderer, Artifact> rendererArtifactMap =
new HashCollection<IRenderer, Artifact>(false, LinkedList.class);
- for (IRenderer prototypeRenderer : prototypeRendererArtifactMap.keySet()) {
- IRenderer renderer = prototypeRenderer.newInstance();
- renderer.setOptions(options);
- rendererArtifactMap.put(renderer, prototypeRendererArtifactMap.getValues(prototypeRenderer));
- }
- return rendererArtifactMap;
- }
-
- public static void openInJob(Artifact artifact, PresentationType presentationType) {
- ArrayList<Artifact> artifacts = new ArrayList<Artifact>(1);
- artifacts.add(artifact);
-
- openInJob(artifacts, null, presentationType);
- }
-
+ for (IRenderer prototypeRenderer : prototypeRendererArtifactMap.keySet()) {
+ IRenderer renderer = prototypeRenderer.newInstance();
+ renderer.setOptions(options);
+ rendererArtifactMap.put(renderer, prototypeRendererArtifactMap.getValues(prototypeRenderer));
+ }
+ return rendererArtifactMap;
+ }
+
+ public static void openInJob(Artifact artifact, PresentationType presentationType) {
+ ArrayList<Artifact> artifacts = new ArrayList<Artifact>(1);
+ artifacts.add(artifact);
+
+ openInJob(artifacts, null, presentationType);
+ }
+
public static void openInJob(Collection<Artifact> artifacts, PresentationType presentationType) {
- openInJob(artifacts, null, presentationType);
- }
-
+ openInJob(artifacts, null, presentationType);
+ }
+
public static void openInJob(Collection<Artifact> artifacts, VariableMap options, PresentationType presentationType) {
Operations.executeAsJob(new OpenUsingRenderer(artifacts, options, presentationType), true);
- }
-
+ }
+
public static void open(Collection<Artifact> artifacts, PresentationType presentationType, VariableMap options, IProgressMonitor monitor) throws OseeCoreException {
Operations.executeWorkAndCheckStatus(new OpenUsingRenderer(artifacts, options, presentationType), monitor, -1);
- }
-
+ }
+
public static void open(Collection<Artifact> artifacts, PresentationType presentationType) throws OseeCoreException {
open(artifacts, presentationType, null, new NullProgressMonitor());
- }
-
+ }
+
public static void open(Artifact artifact, final PresentationType presentationType, IProgressMonitor monitor) throws OseeCoreException {
- ArrayList<Artifact> artifacts = new ArrayList<Artifact>(1);
- artifacts.add(artifact);
+ ArrayList<Artifact> artifacts = new ArrayList<Artifact>(1);
+ artifacts.add(artifact);
open(artifacts, presentationType, null, monitor);
- }
-
+ }
+
public static void open(Artifact artifact, final PresentationType presentationType) throws OseeCoreException {
ArrayList<Artifact> artifacts = new ArrayList<Artifact>(1);
artifacts.add(artifact);
open(artifacts, presentationType);
- }
-
- public static String merge(Artifact baseVersion, Artifact newerVersion, String fileName, boolean show) throws OseeStateException, OseeCoreException {
- VariableMap variableMap = new VariableMap("fileName", fileName);
- IRenderer renderer = getBestRenderer(PresentationType.MERGE, baseVersion, variableMap);
- IComparator comparator = renderer.getComparator();
- ArtifactDelta delta = new ArtifactDelta(null, baseVersion, newerVersion);
- return comparator.compare(new NullProgressMonitor(), PresentationType.MERGE, delta, show);
- }
-
- public static String merge(Artifact baseVersion, Artifact newerVersion, IFile baseFile, IFile newerFile, String fileName, boolean show) throws OseeCoreException {
- VariableMap variableMap = new VariableMap("fileName", fileName);
- IRenderer renderer = getBestRenderer(PresentationType.MERGE_EDIT, baseVersion, variableMap);
- IComparator comparator = renderer.getComparator();
- return comparator.compare(baseVersion, newerVersion, baseFile, newerFile, PresentationType.MERGE_EDIT, show);
- }
-
- public static void diffInJob(ArtifactDelta artifactDelta) {
- diffInJob(artifactDelta, null);
- }
-
- public static void diffInJob(final ArtifactDelta artifactDelta, final VariableMap options) {
-
- IExceptionableRunnable runnable = new IExceptionableRunnable() {
+ }
+
+ public static String merge(Artifact baseVersion, Artifact newerVersion, String fileName, boolean show) throws OseeStateException, OseeCoreException {
+ VariableMap variableMap = new VariableMap("fileName", fileName);
+ IRenderer renderer = getBestRenderer(PresentationType.MERGE, baseVersion, variableMap);
+ IComparator comparator = renderer.getComparator();
+ ArtifactDelta delta = new ArtifactDelta(null, baseVersion, newerVersion);
+ return comparator.compare(new NullProgressMonitor(), PresentationType.MERGE, delta, show);
+ }
+
+ public static String merge(Artifact baseVersion, Artifact newerVersion, IFile baseFile, IFile newerFile, String fileName, boolean show) throws OseeCoreException {
+ VariableMap variableMap = new VariableMap("fileName", fileName);
+ IRenderer renderer = getBestRenderer(PresentationType.MERGE_EDIT, baseVersion, variableMap);
+ IComparator comparator = renderer.getComparator();
+ return comparator.compare(baseVersion, newerVersion, baseFile, newerFile, PresentationType.MERGE_EDIT, show);
+ }
+
+ public static void diffInJob(ArtifactDelta artifactDelta) {
+ diffInJob(artifactDelta, null);
+ }
+
+ public static void diffInJob(final ArtifactDelta artifactDelta, final VariableMap options) {
+
+ IExceptionableRunnable runnable = new IExceptionableRunnable() {
@Override
- public IStatus run(IProgressMonitor monitor) throws OseeCoreException {
- diff(artifactDelta, true, options);
- return Status.OK_STATUS;
- }
- };
-
- Artifact startVersion = artifactDelta.getStartArtifact();
- Artifact endVersion = artifactDelta.getEndArtifact();
-
- String jobName =
+ public IStatus run(IProgressMonitor monitor) throws OseeCoreException {
+ diff(artifactDelta, true, options);
+ return Status.OK_STATUS;
+ }
+ };
+
+ Artifact startVersion = artifactDelta.getStartArtifact();
+ Artifact endVersion = artifactDelta.getEndArtifact();
+
+ String jobName =
String.format("Compare %s to %s", startVersion == null ? " new " : startVersion.getName(),
endVersion == null ? " delete " : endVersion.getName());
- Jobs.runInJob(jobName, runnable, SkynetGuiPlugin.class, SkynetGuiPlugin.PLUGIN_ID);
-
- }
-
- public static String diff(final ArtifactDelta delta, IProgressMonitor monitor, boolean show) throws OseeCoreException {
- return diff(delta, monitor, show, null);
- }
-
- public static String diff(final ArtifactDelta delta, IProgressMonitor monitor, boolean show, final VariableMap options) throws OseeCoreException {
- // To handle comparisons with new or deleted artifacts
- Artifact sampleArtifact = delta.getStartArtifact() != null ? delta.getStartArtifact() : delta.getEndArtifact();
- IRenderer renderer = getBestRenderer(PresentationType.DIFF, sampleArtifact, options);
- IComparator comparator = renderer.getComparator();
- return comparator.compare(monitor, PresentationType.DIFF, delta, show);
- }
-
- public static String diff(ArtifactDelta artifactDelta, boolean show) throws OseeCoreException {
- return diff(artifactDelta, show, null);
- }
-
- public static String diff(ArtifactDelta artifactDelta, boolean show, final VariableMap options) throws OseeCoreException {
- return diff(artifactDelta, new NullProgressMonitor(), show, options);
- }
-
- public static Job diffInJob(final Collection<ArtifactDelta> itemsToCompare, final VariableMap options) {
- IOperation operation = new AbstractOperation("Combined Diff", SkynetGuiPlugin.PLUGIN_ID) {
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- ArtifactDelta entry = itemsToCompare.iterator().next();
- Artifact sampleArtifact =
+ Jobs.runInJob(jobName, runnable, SkynetGuiPlugin.class, SkynetGuiPlugin.PLUGIN_ID);
+
+ }
+
+ public static String diff(final ArtifactDelta delta, IProgressMonitor monitor, boolean show) throws OseeCoreException {
+ return diff(delta, monitor, show, null);
+ }
+
+ public static String diff(final ArtifactDelta delta, IProgressMonitor monitor, boolean show, final VariableMap options) throws OseeCoreException {
+ // To handle comparisons with new or deleted artifacts
+ Artifact sampleArtifact = delta.getStartArtifact() != null ? delta.getStartArtifact() : delta.getEndArtifact();
+ IRenderer renderer = getBestRenderer(PresentationType.DIFF, sampleArtifact, options);
+ IComparator comparator = renderer.getComparator();
+ return comparator.compare(monitor, PresentationType.DIFF, delta, show);
+ }
+
+ public static String diff(ArtifactDelta artifactDelta, boolean show) throws OseeCoreException {
+ return diff(artifactDelta, show, null);
+ }
+
+ public static String diff(ArtifactDelta artifactDelta, boolean show, final VariableMap options) throws OseeCoreException {
+ return diff(artifactDelta, new NullProgressMonitor(), show, options);
+ }
+
+ public static Job diffInJob(final Collection<ArtifactDelta> itemsToCompare, final VariableMap options) {
+ IOperation operation = new AbstractOperation("Combined Diff", SkynetGuiPlugin.PLUGIN_ID) {
+ @Override
+ protected void doWork(IProgressMonitor monitor) throws Exception {
+ ArtifactDelta entry = itemsToCompare.iterator().next();
+ Artifact sampleArtifact =
entry.getStartArtifact() != null ? entry.getStartArtifact() : entry.getEndArtifact();
-
- IRenderer renderer = getBestRenderer(PresentationType.DIFF, sampleArtifact, options);
- IComparator comparator = renderer.getComparator();
- comparator.compareArtifacts(monitor, PresentationType.DIFF, itemsToCompare);
- }
- };
- return Operations.executeAsJob(operation, false);
- }
+
+ IRenderer renderer = getBestRenderer(PresentationType.DIFF, sampleArtifact, options);
+ IComparator comparator = renderer.getComparator();
+ comparator.compareArtifacts(monitor, PresentationType.DIFF, itemsToCompare);
+ }
+ };
+ return Operations.executeAsJob(operation, false);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RenderingUtil.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RenderingUtil.java
index 9407183bdd3..32885515afb 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RenderingUtil.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RenderingUtil.java
@@ -4,12 +4,12 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.render;
-
+package org.eclipse.osee.framework.ui.skynet.render;
+
import java.util.Date;
import java.util.HashSet;
import java.util.Random;
@@ -30,153 +30,153 @@ import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
import org.eclipse.osee.framework.skynet.core.change.ArtifactDelta;
import org.eclipse.osee.framework.skynet.core.word.WordAnnotationHandler;
import org.eclipse.osee.framework.ui.skynet.preferences.MsWordPreferencePage;
-
-public final class RenderingUtil {
- private static final Random generator = new Random();
-
- private static IFolder workingFolder;
- private static IFolder diffFolder;
- private static IFolder previewFolder;
- private static IFolder mergeEditFolder;
- private static boolean arePopupsAllowed = true;
-
- private RenderingUtil() {
- }
-
- public static void setPopupsAllowed(boolean popupsAllowed) {
- arePopupsAllowed = popupsAllowed;
- }
-
- public static boolean arePopupsAllowed() {
- return arePopupsAllowed;
- }
-
- public static Pair<Artifact, Artifact> asRenderInput(ArtifactDelta delta) {
- Artifact artFile1;
- Artifact artFile2;
-
- // if (delta.getTxDelta() == null
- // || !delta.getTxDelta().areOnTheSameBranch()) {
- // // Assumptions - when comparing data between transactions on
- // // different branches, the start artifact will never be null;
- // if (delta.getStartArtifact().getModType().isDeleted()) {
- // artFile1 = delta.getStartArtifact();
- // artFile2 = null;
- // } else if (delta.getEndArtifact() == null) {
- // artFile1 = null;
- // artFile2 = delta.getStartArtifact();
- // } else { // case where there are new, modified, or deleted attributes (are artifact is not new or deleted)
- // // also could be introduced in both branches
- // artFile1 = delta.getEndArtifact();
- // artFile2 = delta.getStartArtifact();
- // }
- // } else {
- // Assumptions - when comparing data between transactions on the
- // same branch, the end artifact will never be null;
- if (delta.getEndArtifact().getModType().isDeleted()) {
- artFile1 = delta.getStartArtifact();
- artFile2 = null;
- } else if (delta.getStartArtifact() == null) {
- artFile1 = null;
- artFile2 = delta.getEndArtifact();
- } else {
- artFile1 = delta.getStartArtifact();
- artFile2 = delta.getEndArtifact();
- }
- // }
- return new Pair<Artifact, Artifact>(artFile1, artFile2);
- }
-
- public static String getFilenameFromArtifact(FileSystemRenderer renderer, Artifact artifact, PresentationType presentationType) throws OseeCoreException {
- StringBuilder name = new StringBuilder(100);
-
- if (artifact != null) {
- name.append(artifact.getSafeName());
- name.append("(");
- name.append(artifact.getGuid());
- name.append(")");
-
- if (artifact.isHistorical() || presentationType == PresentationType.DIFF) {
- name.append("(");
- name.append(artifact.getTransactionNumber());
- name.append(")");
- }
-
- name.append(" ");
- name.append(new Date().toString().replaceAll(":", ";"));
- name.append("-");
- name.append(generator.nextInt(99) + 1);
- name.append(".");
- name.append(renderer.getAssociatedExtension(artifact));
- } else {
- name.append(GUID.create());
- name.append(".xml");
- }
- return name.toString();
- }
-
- public static IFolder getRenderFolder(Branch branch, PresentationType presentationType) throws OseeCoreException {
- try {
- IFolder baseFolder = ensureRenderFolderExists(presentationType);
- IFolder renderFolder = baseFolder.getFolder(BranchManager.toFileName(branch));
- if (!renderFolder.exists()) {
- renderFolder.create(true, true, null);
- }
- return renderFolder;
- } catch (CoreException ex) {
- throw new OseeCoreException(ex);
- }
- }
-
- public static IFolder ensureRenderFolderExists(PresentationType presentationType) throws OseeCoreException {
- IFolder toReturn = null;
- switch (presentationType) {
- case DIFF:
- diffFolder = getOrCreateFolder(diffFolder, ".diff");
- toReturn = diffFolder;
- break;
- case SPECIALIZED_EDIT:
- workingFolder = getOrCreateFolder(workingFolder, ".working");
- toReturn = workingFolder;
- break;
- case PREVIEW:
- previewFolder = getOrCreateFolder(previewFolder, ".preview");
- toReturn = previewFolder;
- break;
- case MERGE_EDIT:
- mergeEditFolder = getOrCreateFolder(mergeEditFolder, ".mergeEdit");
- toReturn = mergeEditFolder;
- break;
- default:
- throw new OseeArgumentException("Unexpected presentation type");
- }
- return toReturn;
- }
-
- private static IFolder getOrCreateFolder(IFolder folder, String name) throws OseeCoreException {
- IFolder toCheck = folder;
- if (toCheck == null || !toCheck.exists()) {
- toCheck = OseeData.getFolder(name);
- }
- return toCheck;
- }
-
- public static Set<Artifact> checkForTrackedChangesOn(Artifact artifact) throws OseeCoreException {
- Set<Artifact> artifacts = new HashSet<Artifact>();
-
- if (!UserManager.getUser().getBooleanSetting(MsWordPreferencePage.REMOVE_TRACKED_CHANGES)) {
- if (artifact != null) {
- Attribute<?> attribute = artifact.getSoleAttribute(CoreAttributeTypes.WORD_TEMPLATE_CONTENT);
- if (attribute != null) {
- String value = attribute.getValue().toString();
- // check for track changes
- if (WordAnnotationHandler.containsWordAnnotations(value)) {
- // capture those artifacts that have tracked changes on
- artifacts.add(artifact);
- }
- }
- }
- }
- return artifacts;
- }
-}
+
+public final class RenderingUtil {
+ private static final Random generator = new Random();
+
+ private static IFolder workingFolder;
+ private static IFolder diffFolder;
+ private static IFolder previewFolder;
+ private static IFolder mergeEditFolder;
+ private static boolean arePopupsAllowed = true;
+
+ private RenderingUtil() {
+ }
+
+ public static void setPopupsAllowed(boolean popupsAllowed) {
+ arePopupsAllowed = popupsAllowed;
+ }
+
+ public static boolean arePopupsAllowed() {
+ return arePopupsAllowed;
+ }
+
+ public static Pair<Artifact, Artifact> asRenderInput(ArtifactDelta delta) {
+ Artifact artFile1;
+ Artifact artFile2;
+
+ // if (delta.getTxDelta() == null
+ // || !delta.getTxDelta().areOnTheSameBranch()) {
+ // // Assumptions - when comparing data between transactions on
+ // // different branches, the start artifact will never be null;
+ // if (delta.getStartArtifact().getModType().isDeleted()) {
+ // artFile1 = delta.getStartArtifact();
+ // artFile2 = null;
+ // } else if (delta.getEndArtifact() == null) {
+ // artFile1 = null;
+ // artFile2 = delta.getStartArtifact();
+ // } else { // case where there are new, modified, or deleted attributes (are artifact is not new or deleted)
+ // // also could be introduced in both branches
+ // artFile1 = delta.getEndArtifact();
+ // artFile2 = delta.getStartArtifact();
+ // }
+ // } else {
+ // Assumptions - when comparing data between transactions on the
+ // same branch, the end artifact will never be null;
+ if (delta.getEndArtifact().getModType().isDeleted()) {
+ artFile1 = delta.getStartArtifact();
+ artFile2 = null;
+ } else if (delta.getStartArtifact() == null) {
+ artFile1 = null;
+ artFile2 = delta.getEndArtifact();
+ } else {
+ artFile1 = delta.getStartArtifact();
+ artFile2 = delta.getEndArtifact();
+ }
+ // }
+ return new Pair<Artifact, Artifact>(artFile1, artFile2);
+ }
+
+ public static String getFilenameFromArtifact(FileSystemRenderer renderer, Artifact artifact, PresentationType presentationType) throws OseeCoreException {
+ StringBuilder name = new StringBuilder(100);
+
+ if (artifact != null) {
+ name.append(artifact.getSafeName());
+ name.append("(");
+ name.append(artifact.getGuid());
+ name.append(")");
+
+ if (artifact.isHistorical() || presentationType == PresentationType.DIFF) {
+ name.append("(");
+ name.append(artifact.getTransactionNumber());
+ name.append(")");
+ }
+
+ name.append(" ");
+ name.append(new Date().toString().replaceAll(":", ";"));
+ name.append("-");
+ name.append(generator.nextInt(99) + 1);
+ name.append(".");
+ name.append(renderer.getAssociatedExtension(artifact));
+ } else {
+ name.append(GUID.create());
+ name.append(".xml");
+ }
+ return name.toString();
+ }
+
+ public static IFolder getRenderFolder(Branch branch, PresentationType presentationType) throws OseeCoreException {
+ try {
+ IFolder baseFolder = ensureRenderFolderExists(presentationType);
+ IFolder renderFolder = baseFolder.getFolder(BranchManager.toFileName(branch));
+ if (!renderFolder.exists()) {
+ renderFolder.create(true, true, null);
+ }
+ return renderFolder;
+ } catch (CoreException ex) {
+ throw new OseeCoreException(ex);
+ }
+ }
+
+ public static IFolder ensureRenderFolderExists(PresentationType presentationType) throws OseeCoreException {
+ IFolder toReturn = null;
+ switch (presentationType) {
+ case DIFF:
+ diffFolder = getOrCreateFolder(diffFolder, ".diff");
+ toReturn = diffFolder;
+ break;
+ case SPECIALIZED_EDIT:
+ workingFolder = getOrCreateFolder(workingFolder, ".working");
+ toReturn = workingFolder;
+ break;
+ case PREVIEW:
+ previewFolder = getOrCreateFolder(previewFolder, ".preview");
+ toReturn = previewFolder;
+ break;
+ case MERGE_EDIT:
+ mergeEditFolder = getOrCreateFolder(mergeEditFolder, ".mergeEdit");
+ toReturn = mergeEditFolder;
+ break;
+ default:
+ throw new OseeArgumentException("Unexpected presentation type");
+ }
+ return toReturn;
+ }
+
+ private static IFolder getOrCreateFolder(IFolder folder, String name) throws OseeCoreException {
+ IFolder toCheck = folder;
+ if (toCheck == null || !toCheck.exists()) {
+ toCheck = OseeData.getFolder(name);
+ }
+ return toCheck;
+ }
+
+ public static Set<Artifact> checkForTrackedChangesOn(Artifact artifact) throws OseeCoreException {
+ Set<Artifact> artifacts = new HashSet<Artifact>();
+
+ if (!UserManager.getUser().getBooleanSetting(MsWordPreferencePage.REMOVE_TRACKED_CHANGES)) {
+ if (artifact != null) {
+ Attribute<?> attribute = artifact.getSoleAttribute(CoreAttributeTypes.WORD_TEMPLATE_CONTENT);
+ if (attribute != null) {
+ String value = attribute.getValue().toString();
+ // check for track changes
+ if (WordAnnotationHandler.containsWordAnnotations(value)) {
+ // capture those artifacts that have tracked changes on
+ artifacts.add(artifact);
+ }
+ }
+ }
+ }
+ return artifacts;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/TisRenderer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/TisRenderer.java
index abe5d930d42..5a0063f5ef0 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/TisRenderer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/TisRenderer.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.framework.ui.skynet.render;
-
-import java.io.InputStream;
-import java.nio.charset.CharacterCodingException;
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.jdk.core.util.io.CharBackedInputStream;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-import org.eclipse.osee.framework.ui.skynet.render.word.template.BasicTemplateAttributeHandler;
-import org.eclipse.osee.framework.ui.skynet.render.word.template.ITemplateAttributeHandler;
-import org.eclipse.osee.framework.ui.skynet.render.word.template.SRSSpecialPublishingAttributeHandler;
-import org.eclipse.osee.framework.ui.skynet.render.word.template.TISAttributeHandler;
-import org.eclipse.osee.framework.ui.skynet.render.word.template.WordAttributeTypeAttributeHandler;
-import org.eclipse.osee.framework.ui.skynet.render.word.template.WordTemplateManager;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class TisRenderer extends WordTemplateRenderer {
-
- @Override
- public TisRenderer newInstance() throws OseeCoreException {
- return new TisRenderer();
- }
-
- @Override
- public int getApplicabilityRating(PresentationType presentationType, Artifact artifact) throws OseeCoreException {
- if (artifact.isOfType(CoreArtifactTypes.TestInformationSheet) && presentationType == PresentationType.PREVIEW) {
- return SUBTYPE_TYPE_MATCH;
- }
- return NO_MATCH;
- }
-
- @Override
- public List<String> getCommandId(PresentationType presentationType) {
- ArrayList<String> commandIds = new ArrayList<String>(1);
-
- if (presentationType == PresentationType.PREVIEW) {
- commandIds.add("org.eclipse.osee.framework.ui.skynet.tispreview.command");
- }
-
- return commandIds;
- }
-
- @Override
- public String getName() {
- return "MS Word TIS Preview";
- }
-
- @Override
- public InputStream getRenderInputStream(PresentationType presentationType, List<Artifact> artifacts) throws OseeCoreException {
- if (PresentationType.GENERALIZED_EDIT == presentationType) {
- return super.getRenderInputStream(presentationType, artifacts);
- }
- final VariableMap variableMap = new VariableMap();
- String template;
-
- if (artifacts.isEmpty()) {
- // Still need to get a default template with a null artifact list
- template = getTemplate(null, presentationType);
- } else {
- Artifact firstArtifact = artifacts.iterator().next();
- template = getTemplate(firstArtifact, presentationType);
- }
-
- variableMap.setValue(DEFAULT_SET_NAME, artifacts);
-
- List<ITemplateAttributeHandler> handlers = new ArrayList<ITemplateAttributeHandler>();
- handlers.add(new SRSSpecialPublishingAttributeHandler());
- handlers.add(new TISAttributeHandler());
- handlers.add(new WordAttributeTypeAttributeHandler());
- handlers.add(new BasicTemplateAttributeHandler());
- WordTemplateManager wtm = new WordTemplateManager(template, handlers);
- CharBackedInputStream charBak = null;
- try {
- charBak = new CharBackedInputStream();
- WordMLProducer wordMl = new WordMLProducer(charBak);
- wtm.processArtifacts(wordMl, variableMap.getArtifacts(wtm.getArtifactSet()));
- } catch (CharacterCodingException ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- return charBak;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.render;
+
+import java.io.InputStream;
+import java.nio.charset.CharacterCodingException;
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeExceptions;
+import org.eclipse.osee.framework.jdk.core.util.io.CharBackedInputStream;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
+import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
+import org.eclipse.osee.framework.ui.skynet.render.word.template.BasicTemplateAttributeHandler;
+import org.eclipse.osee.framework.ui.skynet.render.word.template.ITemplateAttributeHandler;
+import org.eclipse.osee.framework.ui.skynet.render.word.template.SRSSpecialPublishingAttributeHandler;
+import org.eclipse.osee.framework.ui.skynet.render.word.template.TISAttributeHandler;
+import org.eclipse.osee.framework.ui.skynet.render.word.template.WordAttributeTypeAttributeHandler;
+import org.eclipse.osee.framework.ui.skynet.render.word.template.WordTemplateManager;
+
+/**
+ * @author Andrew M. Finkbeiner
+ */
+public class TisRenderer extends WordTemplateRenderer {
+
+ @Override
+ public TisRenderer newInstance() throws OseeCoreException {
+ return new TisRenderer();
+ }
+
+ @Override
+ public int getApplicabilityRating(PresentationType presentationType, Artifact artifact) throws OseeCoreException {
+ if (artifact.isOfType(CoreArtifactTypes.TestInformationSheet) && presentationType == PresentationType.PREVIEW) {
+ return SUBTYPE_TYPE_MATCH;
+ }
+ return NO_MATCH;
+ }
+
+ @Override
+ public List<String> getCommandId(PresentationType presentationType) {
+ ArrayList<String> commandIds = new ArrayList<String>(1);
+
+ if (presentationType == PresentationType.PREVIEW) {
+ commandIds.add("org.eclipse.osee.framework.ui.skynet.tispreview.command");
+ }
+
+ return commandIds;
+ }
+
+ @Override
+ public String getName() {
+ return "MS Word TIS Preview";
+ }
+
+ @Override
+ public InputStream getRenderInputStream(PresentationType presentationType, List<Artifact> artifacts) throws OseeCoreException {
+ if (PresentationType.GENERALIZED_EDIT == presentationType) {
+ return super.getRenderInputStream(presentationType, artifacts);
+ }
+ final VariableMap variableMap = new VariableMap();
+ String template;
+
+ if (artifacts.isEmpty()) {
+ // Still need to get a default template with a null artifact list
+ template = getTemplate(null, presentationType);
+ } else {
+ Artifact firstArtifact = artifacts.iterator().next();
+ template = getTemplate(firstArtifact, presentationType);
+ }
+
+ variableMap.setValue(DEFAULT_SET_NAME, artifacts);
+
+ List<ITemplateAttributeHandler> handlers = new ArrayList<ITemplateAttributeHandler>();
+ handlers.add(new SRSSpecialPublishingAttributeHandler());
+ handlers.add(new TISAttributeHandler());
+ handlers.add(new WordAttributeTypeAttributeHandler());
+ handlers.add(new BasicTemplateAttributeHandler());
+ WordTemplateManager wtm = new WordTemplateManager(template, handlers);
+ CharBackedInputStream charBak = null;
+ try {
+ charBak = new CharBackedInputStream();
+ WordMLProducer wordMl = new WordMLProducer(charBak);
+ wtm.processArtifacts(wordMl, variableMap.getArtifacts(wtm.getArtifactSet()));
+ } catch (CharacterCodingException ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ return charBak;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/UpdateArtifactJob.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/UpdateArtifactJob.java
index e89de0187bd..4d5fa4ab8c6 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/UpdateArtifactJob.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/UpdateArtifactJob.java
@@ -1,251 +1,251 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.render;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import javax.xml.parsers.ParserConfigurationException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.jdk.core.util.Collections;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.skynet.core.linking.LinkType;
-import org.eclipse.osee.framework.skynet.core.linking.WordMlLinkHandler;
-import org.eclipse.osee.framework.skynet.core.word.WordUtil;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.preferences.MsWordPreferencePage;
-import org.eclipse.osee.framework.ui.skynet.render.artifactElement.IElementExtractor;
-import org.eclipse.osee.framework.ui.skynet.render.artifactElement.MergeEditArtifactElementExtractor;
-import org.eclipse.osee.framework.ui.skynet.render.artifactElement.WordArtifactElementExtractor;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.xml.sax.SAXException;
-
-/**
- * @author Ryan D. Brooks
- */
-public class UpdateArtifactJob extends UpdateJob {
- private static final Pattern guidPattern = Pattern.compile(".*\\(([^)]+)\\)[^()]*");
- private static final Pattern multiPattern = Pattern.compile(".*[^()]*");
- private Element oleDataElement;
- private String singleGuid = null;
- private static final boolean DEBUG =
- "TRUE".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.osee.framework.ui.skynet/debug/Renderer"));
-
- public UpdateArtifactJob() {
- super("Update Artifact");
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- processUpdate();
- } catch (Exception ex) {
- return new Status(Status.ERROR, SkynetGuiPlugin.PLUGIN_ID, Status.OK, ex.getLocalizedMessage(), ex);
- }
- return Status.OK_STATUS;
- }
-
- private void processUpdate() throws Exception {
- Branch branch = BranchManager.fromFileName(workingFile.getParentFile().getName());
- if (branch.isEditable()) {
- Matcher singleEditMatcher = guidPattern.matcher(workingFile.getName());
- Matcher multiEditMatcher = multiPattern.matcher(workingFile.getName());
-
- if (singleEditMatcher.matches()) {
- singleGuid = singleEditMatcher.group(1);
-
- if (isMergeEdit()) {
- processMergeEdit(new MergeEditArtifactElementExtractor(extractJaxpDocument()), branch);
- } else {
- Artifact artifact = ArtifactQuery.getArtifactFromId(singleGuid, branch);
- processSingleEdit(artifact);
- }
- } else if (multiEditMatcher.matches()) {
- WordArtifactElementExtractor elementExtractor = new WordArtifactElementExtractor(extractJaxpDocument());
- processMultiEdit(elementExtractor, branch);
- }
- }
- }
-
- private boolean isMergeEdit() {
- return workingFile.getAbsolutePath().contains("mergeEdit");
- }
-
- private Document extractJaxpDocument() throws ParserConfigurationException, SAXException, IOException {
- Document document;
- InputStream inputStream = new BufferedInputStream(new FileInputStream(workingFile));
- try {
- document = Jaxp.readXmlDocument(inputStream);
- } finally {
- Lib.close(inputStream);
- }
- return document;
- }
-
- private void processMergeEdit(IElementExtractor elementExtractor, Branch branch) throws OseeCoreException, DOMException, ParserConfigurationException, SAXException, IOException {
- wordArtifactUpdate(elementExtractor, branch);
- }
-
- private void processSingleEdit(Artifact artifact) throws OseeCoreException, ParserConfigurationException, SAXException, IOException {
- if (artifact.isAttributeTypeValid(CoreAttributeTypes.WORD_TEMPLATE_CONTENT)) {
- WordArtifactElementExtractor elementExtractor = new WordArtifactElementExtractor(extractJaxpDocument());
- wordArtifactUpdate(elementExtractor, artifact.getBranch());
- } else {
- processNativeDocuments(artifact);
- }
- }
-
- private void processNativeDocuments(Artifact artifact) throws OseeCoreException, FileNotFoundException {
- if (artifact.isAttributeTypeValid(CoreAttributeTypes.WHOLE_WORD_CONTENT)) {
- updateNativeArtifact(artifact, CoreAttributeTypes.WHOLE_WORD_CONTENT);
- } else if (artifact.isAttributeTypeValid(CoreAttributeTypes.NATIVE_CONTENT)) {
- updateNativeArtifact(artifact, CoreAttributeTypes.NATIVE_CONTENT);
- } else {
- throw new OseeArgumentException("Artifact must be of type WordArtifact or NativeArtifact.");
- }
- }
-
- private void processMultiEdit(IElementExtractor elementExtractor, Branch branch) throws OseeCoreException, ParserConfigurationException, SAXException, IOException {
- wordArtifactUpdate(elementExtractor, branch);
- }
-
- private void logUpdateSkip(Artifact artifact) {
- OseeLog.log(SkynetGuiPlugin.class, Level.INFO, String.format("Skipping update - artifact [%s] is read-only",
- artifact.toString()));
- }
-
- private void updateNativeArtifact(Artifact artifact, CoreAttributeTypes attributeType) throws OseeCoreException, FileNotFoundException {
- if (!artifact.isReadOnly()) {
- InputStream stream = null;
- try {
- stream = new BufferedInputStream(new FileInputStream(workingFile));
- artifact.setSoleAttributeFromStream(attributeType, stream);
- artifact.persist();
- } finally {
- Lib.close(stream);
- }
- } else {
- logUpdateSkip(artifact);
- }
- }
-
- private void wordArtifactUpdate(IElementExtractor elementExtractor, Branch branch) throws OseeCoreException, DOMException, ParserConfigurationException, SAXException, IOException {
- List<String> deletedGuids = new LinkedList<String>();
- Collection<Element> artElements = elementExtractor.extractElements();
- oleDataElement = elementExtractor.getOleDataElement();
-
- try {
- boolean singleArtifact = artElements.size() == 1;
- boolean containsOleData = false;
- for (Element artElement : artElements) {
- String guid = getGuid(artElement);
- Artifact artifact = ArtifactQuery.getArtifactFromId(guid, branch);
-
- if (artifact == null) {
- deletedGuids.add(guid);
- } else {
- if (artifact.isReadOnly()) {
- logUpdateSkip(artifact);
- continue;
- }
- containsOleData = !artifact.getSoleAttributeValue(CoreAttributeTypes.WORD_OLE_DATA, "").equals("");
-
- if (oleDataElement == null && containsOleData) {
- artifact.setSoleAttributeValue(CoreAttributeTypes.WORD_OLE_DATA, "");
- } else if (oleDataElement != null && singleArtifact) {
- artifact.setSoleAttributeFromStream(CoreAttributeTypes.WORD_OLE_DATA, new ByteArrayInputStream(
- WordTemplateRenderer.getFormattedContent(oleDataElement)));
- }
- String content = null;
- try {
- content =
- Lib.inputStreamToString(new ByteArrayInputStream(
- WordTemplateRenderer.getFormattedContent(artElement)));
- } catch (IOException ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- // Only update if editing a single artifact or if in
- // multi-edit mode only update if the artifact has at least one textual change (if
- // the MUTI_EDIT_SAVE_ALL_CHANGES preference is not set).
- boolean multiSave =
- UserManager.getUser().getBooleanSetting(MsWordPreferencePage.MUTI_EDIT_SAVE_ALL_CHANGES) || !WordUtil.textOnly(
- artifact.getSoleAttributeValue(CoreAttributeTypes.WORD_TEMPLATE_CONTENT).toString()).equals(
- WordUtil.textOnly(content));
-
- if (singleArtifact || multiSave) {
- // TODO
- if (artElement.getNodeName().endsWith("body")) {
- // This code pulls out all of the stuff after the inserted listnum reordering
- // stuff. This needs to be
- // here so that we remove unwanted template information from single editing
- content = content.replace(WordMLProducer.LISTNUM_FIELD_HEAD, "");
- }
- LinkType linkType = LinkType.OSEE_SERVER_LINK;
- content = WordMlLinkHandler.unlink(linkType, artifact, content);
- artifact.setSoleAttributeValue(CoreAttributeTypes.WORD_TEMPLATE_CONTENT, content);
- }
- artifact.persist();
- }
- }
- } finally {
- if (!deletedGuids.isEmpty()) {
- throw new OseeStateException("The following deleted artifacts could not be saved: " + Collections.toString(
- ",", deletedGuids));
- }
- }
- }
-
- private String getGuid(Element artifactElement) throws OseeCoreException {
- if (singleGuid != null) {
- return singleGuid;
- }
-
- NamedNodeMap attributes = artifactElement.getAttributes();
- for (int i = 0; i < attributes.getLength(); i++) {
- // MS Word has a nasty habit of changing the namespace say from
- // ns0 to ns1, so we must
- // ignore the namespace by using endsWith()
- if (attributes.item(i).getNodeName().endsWith("guid")) {
- return attributes.item(i).getNodeValue();
- }
- }
- throw new OseeArgumentException("didn't find the guid attribure in element: " + artifactElement);
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.render;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import javax.xml.parsers.ParserConfigurationException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeExceptions;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.linking.LinkType;
+import org.eclipse.osee.framework.skynet.core.linking.WordMlLinkHandler;
+import org.eclipse.osee.framework.skynet.core.word.WordUtil;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.preferences.MsWordPreferencePage;
+import org.eclipse.osee.framework.ui.skynet.render.artifactElement.IElementExtractor;
+import org.eclipse.osee.framework.ui.skynet.render.artifactElement.MergeEditArtifactElementExtractor;
+import org.eclipse.osee.framework.ui.skynet.render.artifactElement.WordArtifactElementExtractor;
+import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.xml.sax.SAXException;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public class UpdateArtifactJob extends UpdateJob {
+ private static final Pattern guidPattern = Pattern.compile(".*\\(([^)]+)\\)[^()]*");
+ private static final Pattern multiPattern = Pattern.compile(".*[^()]*");
+ private Element oleDataElement;
+ private String singleGuid = null;
+ private static final boolean DEBUG =
+ "TRUE".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.osee.framework.ui.skynet/debug/Renderer"));
+
+ public UpdateArtifactJob() {
+ super("Update Artifact");
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ processUpdate();
+ } catch (Exception ex) {
+ return new Status(Status.ERROR, SkynetGuiPlugin.PLUGIN_ID, Status.OK, ex.getLocalizedMessage(), ex);
+ }
+ return Status.OK_STATUS;
+ }
+
+ private void processUpdate() throws Exception {
+ Branch branch = BranchManager.fromFileName(workingFile.getParentFile().getName());
+ if (branch.isEditable()) {
+ Matcher singleEditMatcher = guidPattern.matcher(workingFile.getName());
+ Matcher multiEditMatcher = multiPattern.matcher(workingFile.getName());
+
+ if (singleEditMatcher.matches()) {
+ singleGuid = singleEditMatcher.group(1);
+
+ if (isMergeEdit()) {
+ processMergeEdit(new MergeEditArtifactElementExtractor(extractJaxpDocument()), branch);
+ } else {
+ Artifact artifact = ArtifactQuery.getArtifactFromId(singleGuid, branch);
+ processSingleEdit(artifact);
+ }
+ } else if (multiEditMatcher.matches()) {
+ WordArtifactElementExtractor elementExtractor = new WordArtifactElementExtractor(extractJaxpDocument());
+ processMultiEdit(elementExtractor, branch);
+ }
+ }
+ }
+
+ private boolean isMergeEdit() {
+ return workingFile.getAbsolutePath().contains("mergeEdit");
+ }
+
+ private Document extractJaxpDocument() throws ParserConfigurationException, SAXException, IOException {
+ Document document;
+ InputStream inputStream = new BufferedInputStream(new FileInputStream(workingFile));
+ try {
+ document = Jaxp.readXmlDocument(inputStream);
+ } finally {
+ Lib.close(inputStream);
+ }
+ return document;
+ }
+
+ private void processMergeEdit(IElementExtractor elementExtractor, Branch branch) throws OseeCoreException, DOMException, ParserConfigurationException, SAXException, IOException {
+ wordArtifactUpdate(elementExtractor, branch);
+ }
+
+ private void processSingleEdit(Artifact artifact) throws OseeCoreException, ParserConfigurationException, SAXException, IOException {
+ if (artifact.isAttributeTypeValid(CoreAttributeTypes.WORD_TEMPLATE_CONTENT)) {
+ WordArtifactElementExtractor elementExtractor = new WordArtifactElementExtractor(extractJaxpDocument());
+ wordArtifactUpdate(elementExtractor, artifact.getBranch());
+ } else {
+ processNativeDocuments(artifact);
+ }
+ }
+
+ private void processNativeDocuments(Artifact artifact) throws OseeCoreException, FileNotFoundException {
+ if (artifact.isAttributeTypeValid(CoreAttributeTypes.WHOLE_WORD_CONTENT)) {
+ updateNativeArtifact(artifact, CoreAttributeTypes.WHOLE_WORD_CONTENT);
+ } else if (artifact.isAttributeTypeValid(CoreAttributeTypes.NATIVE_CONTENT)) {
+ updateNativeArtifact(artifact, CoreAttributeTypes.NATIVE_CONTENT);
+ } else {
+ throw new OseeArgumentException("Artifact must be of type WordArtifact or NativeArtifact.");
+ }
+ }
+
+ private void processMultiEdit(IElementExtractor elementExtractor, Branch branch) throws OseeCoreException, ParserConfigurationException, SAXException, IOException {
+ wordArtifactUpdate(elementExtractor, branch);
+ }
+
+ private void logUpdateSkip(Artifact artifact) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.INFO, String.format("Skipping update - artifact [%s] is read-only",
+ artifact.toString()));
+ }
+
+ private void updateNativeArtifact(Artifact artifact, CoreAttributeTypes attributeType) throws OseeCoreException, FileNotFoundException {
+ if (!artifact.isReadOnly()) {
+ InputStream stream = null;
+ try {
+ stream = new BufferedInputStream(new FileInputStream(workingFile));
+ artifact.setSoleAttributeFromStream(attributeType, stream);
+ artifact.persist();
+ } finally {
+ Lib.close(stream);
+ }
+ } else {
+ logUpdateSkip(artifact);
+ }
+ }
+
+ private void wordArtifactUpdate(IElementExtractor elementExtractor, Branch branch) throws OseeCoreException, DOMException, ParserConfigurationException, SAXException, IOException {
+ List<String> deletedGuids = new LinkedList<String>();
+ Collection<Element> artElements = elementExtractor.extractElements();
+ oleDataElement = elementExtractor.getOleDataElement();
+
+ try {
+ boolean singleArtifact = artElements.size() == 1;
+ boolean containsOleData = false;
+ for (Element artElement : artElements) {
+ String guid = getGuid(artElement);
+ Artifact artifact = ArtifactQuery.getArtifactFromId(guid, branch);
+
+ if (artifact == null) {
+ deletedGuids.add(guid);
+ } else {
+ if (artifact.isReadOnly()) {
+ logUpdateSkip(artifact);
+ continue;
+ }
+ containsOleData = !artifact.getSoleAttributeValue(CoreAttributeTypes.WORD_OLE_DATA, "").equals("");
+
+ if (oleDataElement == null && containsOleData) {
+ artifact.setSoleAttributeValue(CoreAttributeTypes.WORD_OLE_DATA, "");
+ } else if (oleDataElement != null && singleArtifact) {
+ artifact.setSoleAttributeFromStream(CoreAttributeTypes.WORD_OLE_DATA, new ByteArrayInputStream(
+ WordTemplateRenderer.getFormattedContent(oleDataElement)));
+ }
+ String content = null;
+ try {
+ content =
+ Lib.inputStreamToString(new ByteArrayInputStream(
+ WordTemplateRenderer.getFormattedContent(artElement)));
+ } catch (IOException ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ // Only update if editing a single artifact or if in
+ // multi-edit mode only update if the artifact has at least one textual change (if
+ // the MUTI_EDIT_SAVE_ALL_CHANGES preference is not set).
+ boolean multiSave =
+ UserManager.getUser().getBooleanSetting(MsWordPreferencePage.MUTI_EDIT_SAVE_ALL_CHANGES) || !WordUtil.textOnly(
+ artifact.getSoleAttributeValue(CoreAttributeTypes.WORD_TEMPLATE_CONTENT).toString()).equals(
+ WordUtil.textOnly(content));
+
+ if (singleArtifact || multiSave) {
+ // TODO
+ if (artElement.getNodeName().endsWith("body")) {
+ // This code pulls out all of the stuff after the inserted listnum reordering
+ // stuff. This needs to be
+ // here so that we remove unwanted template information from single editing
+ content = content.replace(WordMLProducer.LISTNUM_FIELD_HEAD, "");
+ }
+ LinkType linkType = LinkType.OSEE_SERVER_LINK;
+ content = WordMlLinkHandler.unlink(linkType, artifact, content);
+ artifact.setSoleAttributeValue(CoreAttributeTypes.WORD_TEMPLATE_CONTENT, content);
+ }
+ artifact.persist();
+ }
+ }
+ } finally {
+ if (!deletedGuids.isEmpty()) {
+ throw new OseeStateException("The following deleted artifacts could not be saved: " + Collections.toString(
+ ",", deletedGuids));
+ }
+ }
+ }
+
+ private String getGuid(Element artifactElement) throws OseeCoreException {
+ if (singleGuid != null) {
+ return singleGuid;
+ }
+
+ NamedNodeMap attributes = artifactElement.getAttributes();
+ for (int i = 0; i < attributes.getLength(); i++) {
+ // MS Word has a nasty habit of changing the namespace say from
+ // ns0 to ns1, so we must
+ // ignore the namespace by using endsWith()
+ if (attributes.item(i).getNodeName().endsWith("guid")) {
+ return attributes.item(i).getNodeValue();
+ }
+ }
+ throw new OseeArgumentException("didn't find the guid attribure in element: " + artifactElement);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/VbaWordDiffGenerator.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/VbaWordDiffGenerator.java
index 66da36eb01b..34bf1610792 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/VbaWordDiffGenerator.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/VbaWordDiffGenerator.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.framework.ui.skynet.render;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.jdk.core.util.io.streams.StreamCatcher;
-
-/**
- * @author Theron Virgin
- */
-public class VbaWordDiffGenerator implements IVbaDiffGenerator {
- private final static String header =
- "Option Explicit\n\nDim oWord\nDim baseDoc\nDim compareDoc\nDim authorName\nDim detectFormatChanges\nDim ver1\nDim ver2\nDim diffPath\nDim wdCompareTargetSelectedDiff\nDim wdCompareTargetSelectedMerge\nDim wdFormattingFromCurrent\nDim wdFormatXML\nDim wdDoNotSaveChanges\nDim visible\nDim mainDoc\n\nPublic Sub main()\n On error resume next\n wdCompareTargetSelectedDiff = 0\n wdCompareTargetSelectedMerge = 1\n wdDoNotSaveChanges = 0\n wdFormattingFromCurrent = 3\n wdFormatXML = 11\n\n authorName = \"OSEE Doc compare\"\n\n detectFormatChanges = True\n\n set oWord = WScript.CreateObject(\"Word.Application\")\n oWord.Visible = False\n\n";
-
- private final static String comparisonCommand =
- " baseDoc.Compare ver2, authorName, wdCompareTargetSelectedDiff, detectFormatChanges, False, False\n set compareDoc = oWord.ActiveDocument\n\n";
- private final static String comparisonCommandFirst =
- " set mainDoc = compareDoc\n baseDoc.close\n set baseDoc = Nothing\n";
-
- private final static String comparisonCommandOthers =
- " mainDoc.Range(mainDoc.Range.End-1, mainDoc.Range.End-1).FormattedText = compareDoc.Range.FormattedText\n\n baseDoc.close wdDoNotSaveChanges\n set baseDoc = Nothing\n\n compareDoc.close wdDoNotSaveChanges\n set compareDoc = Nothing\n\n";
-
- private final static String mergeCommand =
- " baseDoc.Merge ver2, wdCompareTargetSelectedMerge, detectFormatChanges, wdFormattingFromCurrent, False\n oWord.ActiveDocument.SaveAs diffPath, wdFormatXML, , , False\n\n";
-
- private final static String tail = " If visible Then\n oWord.Visible = True\n Else\n";
- private final static String tail2 =
- " oWord.Quit()\n set oWord = Nothing\n End If\n\nEnd Sub\n\nmain";
-
- private StringBuilder builder;
- private boolean finalized;
- private boolean initialized;
- private boolean first;
- private boolean merge;
-
- public VbaWordDiffGenerator() {
- initialized = false;
- finalized = false;
- first = true;
- merge = false;
- }
-
- public boolean initialize(boolean visible, boolean detectFormatChanges) {
- if (initialized) {
- return false;
- }
- initialized = true;
- builder = new StringBuilder();
- builder.append(header);
- if (visible) {
- builder.append(" visible = True\n\n");
- } else {
- builder.append(" visible = False\n\n");
- }
- if (detectFormatChanges) {
- builder.append(" detectFormatChanges = True\n\n");
- } else {
- builder.append(" detectFormatChanges = False\n\n");
- }
- return true;
- }
-
- public boolean addComparison(IFile baseFile, IFile newerFile, String diffPath, boolean merge) {
- if (finalized) {
- return false;
- }
- this.merge = merge;
- builder.append(" oWord.Visible = False\n");
- builder.append(" ver1 = \"");
- builder.append(baseFile.getLocation().toOSString());
- builder.append("\"\n");
-
- builder.append(" ver2 = \"");
- builder.append(newerFile.getLocation().toOSString());
- builder.append("\"\n");
-
- builder.append(" diffPath = \"");
- builder.append(diffPath);
- builder.append("\"\n\n");
-
- builder.append(" set baseDoc = oWord.Documents.Open (ver1)\n");
-
- if (merge) {
- builder.append(mergeCommand);
- } else {
- builder.append(comparisonCommand);
- if (first) {
- builder.append(comparisonCommandFirst);
- first = false;
- } else {
- builder.append(comparisonCommandOthers);
- }
- }
- return true;
- }
-
- @Override
- public void finish(String vbScriptPath, boolean show) throws OseeCoreException {
- finalized = true;
- if (show) {
- builder.append(" visible = True\n");
- builder.append(" mainDoc.SaveAs diffPath, wdFormatXML, , , False\n\n");
- }
- builder.append(tail);
- if (!show && !merge) {
- builder.append(" mainDoc.SaveAs diffPath, wdFormatXML, , , False\n\n");
- }
- builder.append(tail2);
- compare(getFile(vbScriptPath));
- }
-
- @Override
- public File getFile(String path) throws OseeCoreException {
- if (!finalized) {
- return null;
- }
- try {
- FileOutputStream out = new FileOutputStream(path != null ? path : "c:\\UserData\\compareDocs.vbs");
- out.write(builder.toString().getBytes(), 0, builder.toString().getBytes().length);
- out.close();
- } catch (IOException ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- return new File(path != null ? path : "c:\\UserData\\compareDocs.vbs");
- }
-
- private void compare(File vbDiffScript) throws OseeCoreException {
- try {
- String cmd[] = {"cmd", "/s /c", "\"" + vbDiffScript.getPath() + "\""};
-
- Process proc = Runtime.getRuntime().exec(cmd);
-
- StreamCatcher errorCatcher = new StreamCatcher(proc.getErrorStream(), "ERROR");
- StreamCatcher outputCatcher = new StreamCatcher(proc.getInputStream(), "OUTPUT");
-
- errorCatcher.start();
- outputCatcher.start();
- proc.waitFor();
- } catch (Exception ex) {
- OseeExceptions.wrapAndThrow(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.framework.ui.skynet.render;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeExceptions;
+import org.eclipse.osee.framework.jdk.core.util.io.streams.StreamCatcher;
+
+/**
+ * @author Theron Virgin
+ */
+public class VbaWordDiffGenerator implements IVbaDiffGenerator {
+ private final static String header =
+ "Option Explicit\n\nDim oWord\nDim baseDoc\nDim compareDoc\nDim authorName\nDim detectFormatChanges\nDim ver1\nDim ver2\nDim diffPath\nDim wdCompareTargetSelectedDiff\nDim wdCompareTargetSelectedMerge\nDim wdFormattingFromCurrent\nDim wdFormatXML\nDim wdDoNotSaveChanges\nDim visible\nDim mainDoc\n\nPublic Sub main()\n On error resume next\n wdCompareTargetSelectedDiff = 0\n wdCompareTargetSelectedMerge = 1\n wdDoNotSaveChanges = 0\n wdFormattingFromCurrent = 3\n wdFormatXML = 11\n\n authorName = \"OSEE Doc compare\"\n\n detectFormatChanges = True\n\n set oWord = WScript.CreateObject(\"Word.Application\")\n oWord.Visible = False\n\n";
+
+ private final static String comparisonCommand =
+ " baseDoc.Compare ver2, authorName, wdCompareTargetSelectedDiff, detectFormatChanges, False, False\n set compareDoc = oWord.ActiveDocument\n\n";
+ private final static String comparisonCommandFirst =
+ " set mainDoc = compareDoc\n baseDoc.close\n set baseDoc = Nothing\n";
+
+ private final static String comparisonCommandOthers =
+ " mainDoc.Range(mainDoc.Range.End-1, mainDoc.Range.End-1).FormattedText = compareDoc.Range.FormattedText\n\n baseDoc.close wdDoNotSaveChanges\n set baseDoc = Nothing\n\n compareDoc.close wdDoNotSaveChanges\n set compareDoc = Nothing\n\n";
+
+ private final static String mergeCommand =
+ " baseDoc.Merge ver2, wdCompareTargetSelectedMerge, detectFormatChanges, wdFormattingFromCurrent, False\n oWord.ActiveDocument.SaveAs diffPath, wdFormatXML, , , False\n\n";
+
+ private final static String tail = " If visible Then\n oWord.Visible = True\n Else\n";
+ private final static String tail2 =
+ " oWord.Quit()\n set oWord = Nothing\n End If\n\nEnd Sub\n\nmain";
+
+ private StringBuilder builder;
+ private boolean finalized;
+ private boolean initialized;
+ private boolean first;
+ private boolean merge;
+
+ public VbaWordDiffGenerator() {
+ initialized = false;
+ finalized = false;
+ first = true;
+ merge = false;
+ }
+
+ public boolean initialize(boolean visible, boolean detectFormatChanges) {
+ if (initialized) {
+ return false;
+ }
+ initialized = true;
+ builder = new StringBuilder();
+ builder.append(header);
+ if (visible) {
+ builder.append(" visible = True\n\n");
+ } else {
+ builder.append(" visible = False\n\n");
+ }
+ if (detectFormatChanges) {
+ builder.append(" detectFormatChanges = True\n\n");
+ } else {
+ builder.append(" detectFormatChanges = False\n\n");
+ }
+ return true;
+ }
+
+ public boolean addComparison(IFile baseFile, IFile newerFile, String diffPath, boolean merge) {
+ if (finalized) {
+ return false;
+ }
+ this.merge = merge;
+ builder.append(" oWord.Visible = False\n");
+ builder.append(" ver1 = \"");
+ builder.append(baseFile.getLocation().toOSString());
+ builder.append("\"\n");
+
+ builder.append(" ver2 = \"");
+ builder.append(newerFile.getLocation().toOSString());
+ builder.append("\"\n");
+
+ builder.append(" diffPath = \"");
+ builder.append(diffPath);
+ builder.append("\"\n\n");
+
+ builder.append(" set baseDoc = oWord.Documents.Open (ver1)\n");
+
+ if (merge) {
+ builder.append(mergeCommand);
+ } else {
+ builder.append(comparisonCommand);
+ if (first) {
+ builder.append(comparisonCommandFirst);
+ first = false;
+ } else {
+ builder.append(comparisonCommandOthers);
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public void finish(String vbScriptPath, boolean show) throws OseeCoreException {
+ finalized = true;
+ if (show) {
+ builder.append(" visible = True\n");
+ builder.append(" mainDoc.SaveAs diffPath, wdFormatXML, , , False\n\n");
+ }
+ builder.append(tail);
+ if (!show && !merge) {
+ builder.append(" mainDoc.SaveAs diffPath, wdFormatXML, , , False\n\n");
+ }
+ builder.append(tail2);
+ compare(getFile(vbScriptPath));
+ }
+
+ @Override
+ public File getFile(String path) throws OseeCoreException {
+ if (!finalized) {
+ return null;
+ }
+ try {
+ FileOutputStream out = new FileOutputStream(path != null ? path : "c:\\UserData\\compareDocs.vbs");
+ out.write(builder.toString().getBytes(), 0, builder.toString().getBytes().length);
+ out.close();
+ } catch (IOException ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ return new File(path != null ? path : "c:\\UserData\\compareDocs.vbs");
+ }
+
+ private void compare(File vbDiffScript) throws OseeCoreException {
+ try {
+ String cmd[] = {"cmd", "/s /c", "\"" + vbDiffScript.getPath() + "\""};
+
+ Process proc = Runtime.getRuntime().exec(cmd);
+
+ StreamCatcher errorCatcher = new StreamCatcher(proc.getErrorStream(), "ERROR");
+ StreamCatcher outputCatcher = new StreamCatcher(proc.getInputStream(), "OUTPUT");
+
+ errorCatcher.start();
+ outputCatcher.start();
+ proc.waitFor();
+ } catch (Exception ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WholeDocumentRenderer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WholeDocumentRenderer.java
index 7ce61a88d58..7adfe155336 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WholeDocumentRenderer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WholeDocumentRenderer.java
@@ -1,96 +1,96 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.render;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.jdk.core.util.io.Streams;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.attribute.WordWholeDocumentAttribute;
-import org.eclipse.osee.framework.skynet.core.linking.LinkType;
-import org.eclipse.osee.framework.skynet.core.linking.WordMlLinkHandler;
-import org.eclipse.osee.framework.skynet.core.word.WordAnnotationHandler;
-import org.eclipse.osee.framework.ui.skynet.render.compare.IComparator;
-import org.eclipse.osee.framework.ui.skynet.render.compare.WholeWordCompare;
-
-/**
- * @author Jeff C. Phillips
- */
-public class WholeDocumentRenderer extends WordRenderer {
-
- private final IComparator comparator;
-
- public WholeDocumentRenderer() {
- this.comparator = new WholeWordCompare(this);
- }
-
- @Override
- public WholeDocumentRenderer newInstance() throws OseeCoreException {
- return new WholeDocumentRenderer();
- }
-
- @Override
- public List<String> getCommandId(PresentationType presentationType) {
- ArrayList<String> commandIds = new ArrayList<String>(1);
-
- if (presentationType == PresentationType.SPECIALIZED_EDIT) {
- commandIds.add("org.eclipse.osee.framework.ui.skynet.wholedocumenteditor.command");
- } else if (presentationType == PresentationType.PREVIEW) {
- commandIds.add("org.eclipse.osee.framework.ui.skynet.wholewordpreview.command");
- }
-
- return commandIds;
- }
-
- @Override
- public int getApplicabilityRating(PresentationType presentationType, Artifact artifact) throws OseeCoreException {
- if (artifact.isAttributeTypeValid(CoreAttributeTypes.WHOLE_WORD_CONTENT) && presentationType != PresentationType.GENERALIZED_EDIT) {
- return PRESENTATION_SUBTYPE_MATCH;
- }
- return NO_MATCH;
- }
-
- @Override
- public InputStream getRenderInputStream(PresentationType presentationType, List<Artifact> artifacts) throws OseeCoreException {
- InputStream stream = null;
- try {
- if (artifacts.isEmpty()) {
- stream = Streams.convertStringToInputStream(WordWholeDocumentAttribute.getEmptyDocumentContent(), "UTF-8");
- } else {
- Artifact artifact = artifacts.iterator().next();
- String content = artifact.getOrInitializeSoleAttributeValue(CoreAttributeTypes.WHOLE_WORD_CONTENT);
- if (presentationType == PresentationType.DIFF && WordAnnotationHandler.containsWordAnnotations(content)) {
- throw new OseeStateException(
- "Trying to diff the " + artifact.getName() + " artifact on the " + artifact.getBranch().getShortName() + " branch, which has tracked changes turned on. All tracked changes must be removed before the artifacts can be compared.");
- }
-
- LinkType linkType = LinkType.OSEE_SERVER_LINK;
- content = WordMlLinkHandler.link(linkType, artifact, content);
- stream = Streams.convertStringToInputStream(content, "UTF-8");
- }
- } catch (IOException ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- return stream;
- }
-
- @Override
- public IComparator getComparator() {
- return comparator;
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.render;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeExceptions;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.jdk.core.util.io.Streams;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.attribute.WordWholeDocumentAttribute;
+import org.eclipse.osee.framework.skynet.core.linking.LinkType;
+import org.eclipse.osee.framework.skynet.core.linking.WordMlLinkHandler;
+import org.eclipse.osee.framework.skynet.core.word.WordAnnotationHandler;
+import org.eclipse.osee.framework.ui.skynet.render.compare.IComparator;
+import org.eclipse.osee.framework.ui.skynet.render.compare.WholeWordCompare;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class WholeDocumentRenderer extends WordRenderer {
+
+ private final IComparator comparator;
+
+ public WholeDocumentRenderer() {
+ this.comparator = new WholeWordCompare(this);
+ }
+
+ @Override
+ public WholeDocumentRenderer newInstance() throws OseeCoreException {
+ return new WholeDocumentRenderer();
+ }
+
+ @Override
+ public List<String> getCommandId(PresentationType presentationType) {
+ ArrayList<String> commandIds = new ArrayList<String>(1);
+
+ if (presentationType == PresentationType.SPECIALIZED_EDIT) {
+ commandIds.add("org.eclipse.osee.framework.ui.skynet.wholedocumenteditor.command");
+ } else if (presentationType == PresentationType.PREVIEW) {
+ commandIds.add("org.eclipse.osee.framework.ui.skynet.wholewordpreview.command");
+ }
+
+ return commandIds;
+ }
+
+ @Override
+ public int getApplicabilityRating(PresentationType presentationType, Artifact artifact) throws OseeCoreException {
+ if (artifact.isAttributeTypeValid(CoreAttributeTypes.WHOLE_WORD_CONTENT) && presentationType != PresentationType.GENERALIZED_EDIT) {
+ return PRESENTATION_SUBTYPE_MATCH;
+ }
+ return NO_MATCH;
+ }
+
+ @Override
+ public InputStream getRenderInputStream(PresentationType presentationType, List<Artifact> artifacts) throws OseeCoreException {
+ InputStream stream = null;
+ try {
+ if (artifacts.isEmpty()) {
+ stream = Streams.convertStringToInputStream(WordWholeDocumentAttribute.getEmptyDocumentContent(), "UTF-8");
+ } else {
+ Artifact artifact = artifacts.iterator().next();
+ String content = artifact.getOrInitializeSoleAttributeValue(CoreAttributeTypes.WHOLE_WORD_CONTENT);
+ if (presentationType == PresentationType.DIFF && WordAnnotationHandler.containsWordAnnotations(content)) {
+ throw new OseeStateException(
+ "Trying to diff the " + artifact.getName() + " artifact on the " + artifact.getBranch().getShortName() + " branch, which has tracked changes turned on. All tracked changes must be removed before the artifacts can be compared.");
+ }
+
+ LinkType linkType = LinkType.OSEE_SERVER_LINK;
+ content = WordMlLinkHandler.link(linkType, artifact, content);
+ stream = Streams.convertStringToInputStream(content, "UTF-8");
+ }
+ } catch (IOException ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ return stream;
+ }
+
+ @Override
+ public IComparator getComparator() {
+ return comparator;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordImageChecker.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordImageChecker.java
index a26327bdb39..c8526a38da1 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordImageChecker.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordImageChecker.java
@@ -1,93 +1,93 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.render;
-
-import java.io.UnsupportedEncodingException;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.type.Pair;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
-
-/**
- * @author Theron Virgin
- */
-public class WordImageChecker {
-
- public static void restoreOriginalValue(Attribute<String> attr, Pair<String, Boolean> originalValue) throws OseeCoreException {
- if (attr != null && originalValue != null) {
- attr.setValue(originalValue.getFirst());
- if (!originalValue.getSecond()) {
- attr.setNotDirty();
- }
- }
- }
-
- public static Pair<String, Boolean> checkForImageDiffs(Attribute<String> oldAttr, Attribute<String> newAttr) throws OseeCoreException {
- String downArrow = "";
- try {
- downArrow = new String(new byte[] {(byte) 0xE2, (byte) 0x86, (byte) 0x93}, "UTF-8");
- } catch (UnsupportedEncodingException ex) {
- }
- String MODIFIED_STRING =
- "<w:t>" + downArrow + " OSEE Detected Image Modification " + downArrow + "</w:t></w:r></w:p><w:p><w:r></w:r></w:p><w:p><w:r>";
- if (oldAttr != null && newAttr != null) {
- String oldValue = oldAttr.getValue();
- String newValue = newAttr.getValue();
- boolean attrDirty = newAttr.isDirty();
- String originalValue = new String(oldValue);
- List<WordmlPicture> oldPictures = createPictureList(oldValue, oldAttr);
- List<WordmlPicture> newPictures = createPictureList(newValue, newAttr);
- boolean modified = false;
- int count = 0;
- for (int y = 0; y < oldPictures.size(); y++) {
- if (y < newPictures.size() && oldPictures.get(y).getBinaryData() != null && newPictures.get(y).getBinaryData() != null) {
- if (!oldPictures.get(y).getBinaryData().equals(newPictures.get(y).getBinaryData())) {
- int index = oldPictures.get(y).getStartIndex() + MODIFIED_STRING.length() * count;
- oldValue = oldValue.substring(0, index) + MODIFIED_STRING + oldValue.substring(index);
- modified = true;
- count++;
- oldAttr.setValue(oldValue);
- }
- }
- }
- if (modified) {
- return new Pair<String, Boolean>(originalValue, attrDirty);
- }
- }
- return null;
- }
-
- /**
- * @param oldValue
- * @return
- */
- private static List<WordmlPicture> createPictureList(String wordml, Attribute attribute) {
- int startIndex = 0;
- List<WordmlPicture> pictures = new LinkedList<WordmlPicture>();
- while (wordml.indexOf("<w:pict>", startIndex) > 0) {
- int currentStartIndex = wordml.indexOf("<w:pict>", startIndex);
- int currentEndIndex = wordml.indexOf("</w:pict", currentStartIndex);
- if (currentEndIndex > 0) {
- try {
- pictures.add(new WordmlPicture(currentStartIndex, wordml.substring(currentStartIndex, currentEndIndex),
- wordml, attribute));
- } catch (OseeCoreException ex) {
- OseeLog.log(WordImageChecker.class, Level.WARNING, ex);
- }
- }
- startIndex = currentEndIndex;
- }
- return pictures;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.render;
+
+import java.io.UnsupportedEncodingException;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.type.Pair;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
+
+/**
+ * @author Theron Virgin
+ */
+public class WordImageChecker {
+
+ public static void restoreOriginalValue(Attribute<String> attr, Pair<String, Boolean> originalValue) throws OseeCoreException {
+ if (attr != null && originalValue != null) {
+ attr.setValue(originalValue.getFirst());
+ if (!originalValue.getSecond()) {
+ attr.setNotDirty();
+ }
+ }
+ }
+
+ public static Pair<String, Boolean> checkForImageDiffs(Attribute<String> oldAttr, Attribute<String> newAttr) throws OseeCoreException {
+ String downArrow = "";
+ try {
+ downArrow = new String(new byte[] {(byte) 0xE2, (byte) 0x86, (byte) 0x93}, "UTF-8");
+ } catch (UnsupportedEncodingException ex) {
+ }
+ String MODIFIED_STRING =
+ "<w:t>" + downArrow + " OSEE Detected Image Modification " + downArrow + "</w:t></w:r></w:p><w:p><w:r></w:r></w:p><w:p><w:r>";
+ if (oldAttr != null && newAttr != null) {
+ String oldValue = oldAttr.getValue();
+ String newValue = newAttr.getValue();
+ boolean attrDirty = newAttr.isDirty();
+ String originalValue = new String(oldValue);
+ List<WordmlPicture> oldPictures = createPictureList(oldValue, oldAttr);
+ List<WordmlPicture> newPictures = createPictureList(newValue, newAttr);
+ boolean modified = false;
+ int count = 0;
+ for (int y = 0; y < oldPictures.size(); y++) {
+ if (y < newPictures.size() && oldPictures.get(y).getBinaryData() != null && newPictures.get(y).getBinaryData() != null) {
+ if (!oldPictures.get(y).getBinaryData().equals(newPictures.get(y).getBinaryData())) {
+ int index = oldPictures.get(y).getStartIndex() + MODIFIED_STRING.length() * count;
+ oldValue = oldValue.substring(0, index) + MODIFIED_STRING + oldValue.substring(index);
+ modified = true;
+ count++;
+ oldAttr.setValue(oldValue);
+ }
+ }
+ }
+ if (modified) {
+ return new Pair<String, Boolean>(originalValue, attrDirty);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @param oldValue
+ * @return
+ */
+ private static List<WordmlPicture> createPictureList(String wordml, Attribute attribute) {
+ int startIndex = 0;
+ List<WordmlPicture> pictures = new LinkedList<WordmlPicture>();
+ while (wordml.indexOf("<w:pict>", startIndex) > 0) {
+ int currentStartIndex = wordml.indexOf("<w:pict>", startIndex);
+ int currentEndIndex = wordml.indexOf("</w:pict", currentStartIndex);
+ if (currentEndIndex > 0) {
+ try {
+ pictures.add(new WordmlPicture(currentStartIndex, wordml.substring(currentStartIndex, currentEndIndex),
+ wordml, attribute));
+ } catch (OseeCoreException ex) {
+ OseeLog.log(WordImageChecker.class, Level.WARNING, ex);
+ }
+ }
+ startIndex = currentEndIndex;
+ }
+ return pictures;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordRenderer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordRenderer.java
index 46783cba949..cc4497f9de4 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordRenderer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordRenderer.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.framework.ui.skynet.render;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-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.artifact.Artifact;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.program.Program;
-
-/**
- * @author Ryan D. Brooks
- */
-public abstract class WordRenderer extends FileSystemRenderer {
-
- // We need MS Word, so look for the program that is for .doc files
- private static final Program wordApp = Program.findProgram("doc");
-
- @Override
- public Image getImage(Artifact artifact) throws OseeCoreException {
- return ImageManager.getProgramImage("doc");
- }
-
- public static ImageDescriptor getImageDescriptor() throws OseeArgumentException {
- return ImageManager.getProgramImageDescriptor("doc");
- }
-
- @Override
- public int minimumRanking() throws OseeCoreException {
- return NO_MATCH;
- }
-
- @Override
- public String getName() {
- return "MS Word Edit";
- }
-
- @Override
- public String getAssociatedExtension(Artifact artifact) throws OseeCoreException {
- return "xml";
- }
-
- @Override
- public Program getAssociatedProgram(Artifact artifact) throws OseeCoreException {
- if (wordApp == null) {
- throw new OseeStateException("No program associated with the extension .doc");
- }
- return wordApp;
- }
-
- @Override
- public boolean supportsCompare() {
- 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.framework.ui.skynet.render;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+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.artifact.Artifact;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.program.Program;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public abstract class WordRenderer extends FileSystemRenderer {
+
+ // We need MS Word, so look for the program that is for .doc files
+ private static final Program wordApp = Program.findProgram("doc");
+
+ @Override
+ public Image getImage(Artifact artifact) throws OseeCoreException {
+ return ImageManager.getProgramImage("doc");
+ }
+
+ public static ImageDescriptor getImageDescriptor() throws OseeArgumentException {
+ return ImageManager.getProgramImageDescriptor("doc");
+ }
+
+ @Override
+ public int minimumRanking() throws OseeCoreException {
+ return NO_MATCH;
+ }
+
+ @Override
+ public String getName() {
+ return "MS Word Edit";
+ }
+
+ @Override
+ public String getAssociatedExtension(Artifact artifact) throws OseeCoreException {
+ return "xml";
+ }
+
+ @Override
+ public Program getAssociatedProgram(Artifact artifact) throws OseeCoreException {
+ if (wordApp == null) {
+ throw new OseeStateException("No program associated with the extension .doc");
+ }
+ return wordApp;
+ }
+
+ @Override
+ public boolean supportsCompare() {
+ return true;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java
index 0c9bdb1445c..4886a311310 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java
@@ -1,241 +1,241 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.render;
-
-import static org.eclipse.osee.framework.ui.skynet.render.PresentationType.GENERALIZED_EDIT;
-import static org.eclipse.osee.framework.ui.skynet.render.PresentationType.SPECIALIZED_EDIT;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-import javax.xml.namespace.QName;
-import org.apache.xml.serialize.OutputFormat;
-import org.apache.xml.serialize.XMLSerializer;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp;
-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.linking.LinkType;
-import org.eclipse.osee.framework.skynet.core.linking.OseeLinkBuilder;
-import org.eclipse.osee.framework.skynet.core.linking.WordMlLinkHandler;
-import org.eclipse.osee.framework.skynet.core.word.WordUtil;
-import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
-import org.eclipse.osee.framework.ui.skynet.render.compare.IComparator;
-import org.eclipse.osee.framework.ui.skynet.render.compare.WordTemplateCompare;
-import org.eclipse.osee.framework.ui.skynet.render.word.AttributeElement;
-import org.eclipse.osee.framework.ui.skynet.render.word.Producer;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordTemplateProcessor;
-import org.eclipse.osee.framework.ui.skynet.templates.TemplateManager;
-import org.eclipse.osee.framework.ui.skynet.util.WordUiUtil;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.w3c.dom.Element;
-
-/**
- * Renders WordML content.
- *
- * @author Jeff C. Phillips
- */
-public class WordTemplateRenderer extends WordRenderer implements ITemplateRenderer {
- public static final String RENDERER_EXTENSION = "org.eclipse.osee.framework.ui.skynet.word";
- public static final String DEFAULT_SET_NAME = "Default";
- public static final String ARTIFACT_NAME = "Word Renderer";
- public static final String TEMPLATE_ATTRIBUTE = "Word Template";
- public static final String ARTIFACT_SCHEMA = "http://eclipse.org/artifact.xsd";
- private static final String EMBEDDED_OBJECT_NO = "w:embeddedObjPresent=\"no\"";
- private static final String EMBEDDED_OBJECT_YES = "w:embeddedObjPresent=\"yes\"";
- private static final String STYLES_END = "</w:styles>";
- private static final String OLE_START = "<w:docOleData>";
- private static final String OLE_END = "</w:docOleData>";
- private static final QName fo = new QName("ns0", "unused_localname", ARTIFACT_SCHEMA);
- public static final String UPDATE_PARAGRAPH_NUMBER_OPTION = "updateParagraphNumber";
-
- private final WordTemplateProcessor templateProcessor = new WordTemplateProcessor(this);
-
- private final IComparator comparator;
-
- public WordTemplateRenderer() {
- super();
- this.comparator = new WordTemplateCompare(this);
- }
-
- @Override
- public List<String> getCommandId(PresentationType presentationType) {
- ArrayList<String> commandIds = new ArrayList<String>(2);
-
- if (presentationType == PresentationType.SPECIALIZED_EDIT) {
- commandIds.add("org.eclipse.osee.framework.ui.skynet.wordeditor.command");
- } else if (presentationType == PresentationType.PREVIEW) {
- commandIds.add("org.eclipse.osee.framework.ui.skynet.wordpreview.command");
- commandIds.add("org.eclipse.osee.framework.ui.skynet.wordpreviewChildren.command");
- }
-
- return commandIds;
- }
-
- @Override
- public WordTemplateRenderer newInstance() throws OseeCoreException {
- return new WordTemplateRenderer();
- }
-
- public void publish(VariableMap variableMap, Artifact masterTemplateArtifact, Artifact slaveTemplateArtifact, List<Artifact> artifacts) throws OseeCoreException {
- templateProcessor.publishWithExtensionTemplates(variableMap, masterTemplateArtifact, slaveTemplateArtifact,
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.render;
+
+import static org.eclipse.osee.framework.ui.skynet.render.PresentationType.GENERALIZED_EDIT;
+import static org.eclipse.osee.framework.ui.skynet.render.PresentationType.SPECIALIZED_EDIT;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import javax.xml.namespace.QName;
+import org.apache.xml.serialize.OutputFormat;
+import org.apache.xml.serialize.XMLSerializer;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp;
+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.linking.LinkType;
+import org.eclipse.osee.framework.skynet.core.linking.OseeLinkBuilder;
+import org.eclipse.osee.framework.skynet.core.linking.WordMlLinkHandler;
+import org.eclipse.osee.framework.skynet.core.word.WordUtil;
+import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
+import org.eclipse.osee.framework.ui.skynet.render.compare.IComparator;
+import org.eclipse.osee.framework.ui.skynet.render.compare.WordTemplateCompare;
+import org.eclipse.osee.framework.ui.skynet.render.word.AttributeElement;
+import org.eclipse.osee.framework.ui.skynet.render.word.Producer;
+import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
+import org.eclipse.osee.framework.ui.skynet.render.word.WordTemplateProcessor;
+import org.eclipse.osee.framework.ui.skynet.templates.TemplateManager;
+import org.eclipse.osee.framework.ui.skynet.util.WordUiUtil;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.w3c.dom.Element;
+
+/**
+ * Renders WordML content.
+ *
+ * @author Jeff C. Phillips
+ */
+public class WordTemplateRenderer extends WordRenderer implements ITemplateRenderer {
+ public static final String RENDERER_EXTENSION = "org.eclipse.osee.framework.ui.skynet.word";
+ public static final String DEFAULT_SET_NAME = "Default";
+ public static final String ARTIFACT_NAME = "Word Renderer";
+ public static final String TEMPLATE_ATTRIBUTE = "Word Template";
+ public static final String ARTIFACT_SCHEMA = "http://eclipse.org/artifact.xsd";
+ private static final String EMBEDDED_OBJECT_NO = "w:embeddedObjPresent=\"no\"";
+ private static final String EMBEDDED_OBJECT_YES = "w:embeddedObjPresent=\"yes\"";
+ private static final String STYLES_END = "</w:styles>";
+ private static final String OLE_START = "<w:docOleData>";
+ private static final String OLE_END = "</w:docOleData>";
+ private static final QName fo = new QName("ns0", "unused_localname", ARTIFACT_SCHEMA);
+ public static final String UPDATE_PARAGRAPH_NUMBER_OPTION = "updateParagraphNumber";
+
+ private final WordTemplateProcessor templateProcessor = new WordTemplateProcessor(this);
+
+ private final IComparator comparator;
+
+ public WordTemplateRenderer() {
+ super();
+ this.comparator = new WordTemplateCompare(this);
+ }
+
+ @Override
+ public List<String> getCommandId(PresentationType presentationType) {
+ ArrayList<String> commandIds = new ArrayList<String>(2);
+
+ if (presentationType == PresentationType.SPECIALIZED_EDIT) {
+ commandIds.add("org.eclipse.osee.framework.ui.skynet.wordeditor.command");
+ } else if (presentationType == PresentationType.PREVIEW) {
+ commandIds.add("org.eclipse.osee.framework.ui.skynet.wordpreview.command");
+ commandIds.add("org.eclipse.osee.framework.ui.skynet.wordpreviewChildren.command");
+ }
+
+ return commandIds;
+ }
+
+ @Override
+ public WordTemplateRenderer newInstance() throws OseeCoreException {
+ return new WordTemplateRenderer();
+ }
+
+ public void publish(VariableMap variableMap, Artifact masterTemplateArtifact, Artifact slaveTemplateArtifact, List<Artifact> artifacts) throws OseeCoreException {
+ templateProcessor.publishWithExtensionTemplates(variableMap, masterTemplateArtifact, slaveTemplateArtifact,
artifacts);
- }
-
- /**
- * Displays a list of artifacts in the Artifact Explorer that could not be multi edited because they contained
- * artifacts that had an OLEData attribute.
- *
- * @param artifacts
- */
- private void displayNotMultiEditArtifacts(final Collection<Artifact> artifacts, final String warningString) {
- if (!artifacts.isEmpty()) {
- Displays.ensureInDisplayThread(new Runnable() {
-
- @Override
- public void run() {
- WordUiUtil.displayUnhandledArtifacts(artifacts, warningString);
- }
- });
- }
- }
-
- public static QName getFoNamespace() {
- return fo;
- }
-
- public static byte[] getFormattedContent(Element formattedItemElement) {
- ByteArrayOutputStream data = new ByteArrayOutputStream((int) Math.pow(2, 10));
- OutputFormat format = Jaxp.getCompactFormat(formattedItemElement.getOwnerDocument());
- format.setOmitDocumentType(true);
- format.setOmitXMLDeclaration(true);
- XMLSerializer serializer = new XMLSerializer(data, format);
-
- try {
- for (Element e : Jaxp.getChildDirects(formattedItemElement)) {
- serializer.serialize(e);
- }
- } catch (IOException ex) {
- throw new RuntimeException(ex);
- }
-
- return data.toByteArray();
- }
-
- @Override
- public int getApplicabilityRating(PresentationType presentationType, Artifact artifact) throws OseeCoreException {
+ }
+
+ /**
+ * Displays a list of artifacts in the Artifact Explorer that could not be multi edited because they contained
+ * artifacts that had an OLEData attribute.
+ *
+ * @param artifacts
+ */
+ private void displayNotMultiEditArtifacts(final Collection<Artifact> artifacts, final String warningString) {
+ if (!artifacts.isEmpty()) {
+ Displays.ensureInDisplayThread(new Runnable() {
+
+ @Override
+ public void run() {
+ WordUiUtil.displayUnhandledArtifacts(artifacts, warningString);
+ }
+ });
+ }
+ }
+
+ public static QName getFoNamespace() {
+ return fo;
+ }
+
+ public static byte[] getFormattedContent(Element formattedItemElement) {
+ ByteArrayOutputStream data = new ByteArrayOutputStream((int) Math.pow(2, 10));
+ OutputFormat format = Jaxp.getCompactFormat(formattedItemElement.getOwnerDocument());
+ format.setOmitDocumentType(true);
+ format.setOmitXMLDeclaration(true);
+ XMLSerializer serializer = new XMLSerializer(data, format);
+
+ try {
+ for (Element e : Jaxp.getChildDirects(formattedItemElement)) {
+ serializer.serialize(e);
+ }
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);
+ }
+
+ return data.toByteArray();
+ }
+
+ @Override
+ public int getApplicabilityRating(PresentationType presentationType, Artifact artifact) throws OseeCoreException {
if (presentationType != GENERALIZED_EDIT) {
- if (artifact.isAttributeTypeValid(CoreAttributeTypes.WORD_TEMPLATE_CONTENT)) {
- return PRESENTATION_SUBTYPE_MATCH;
- }
+ if (artifact.isAttributeTypeValid(CoreAttributeTypes.WORD_TEMPLATE_CONTENT)) {
+ return PRESENTATION_SUBTYPE_MATCH;
+ }
if (presentationType != SPECIALIZED_EDIT && !artifact.isAttributeTypeValid(CoreAttributeTypes.NATIVE_CONTENT) && !artifact.isAttributeTypeValid(CoreAttributeTypes.WHOLE_WORD_CONTENT)) {
- return PRESENTATION_TYPE;
- }
- }
- return NO_MATCH;
- }
-
- @Override
- public void renderAttribute(String attributeTypeName, Artifact artifact, PresentationType presentationType, Producer producer, VariableMap map, AttributeElement attributeElement) throws OseeCoreException {
- String value = "";
- WordMLProducer wordMl = (WordMLProducer) producer;
-
- if (attributeTypeName.equals(CoreAttributeTypes.WORD_TEMPLATE_CONTENT.getName())) {
- Attribute<?> wordTempConAttr = artifact.getSoleAttribute(attributeTypeName);
- String data = (String) wordTempConAttr.getValue();
-
- if (attributeElement.getLabel().length() > 0) {
- wordMl.addParagraph(attributeElement.getLabel());
- }
-
- if (data != null) {
- value = WordUtil.stripSpellCheck(data);//TODO what is the best way to get at unknown attribute types? (because this isn't it)
- //Change the BinData Id so images do not get overridden by the other images
- value = WordUtil.reassignBinDataID(value);
-
- LinkType linkType = (LinkType) map.getValue("linkType");
- value = WordMlLinkHandler.link(linkType, artifact, value);
- }
-
- if (presentationType == PresentationType.SPECIALIZED_EDIT) {
- OseeLinkBuilder linkBuilder = new OseeLinkBuilder();
- wordMl.addParagraphNoEscape(linkBuilder.getEditArtifactLink(artifact.getGuid(), artifact.getBranch(),
+ return PRESENTATION_TYPE;
+ }
+ }
+ return NO_MATCH;
+ }
+
+ @Override
+ public void renderAttribute(String attributeTypeName, Artifact artifact, PresentationType presentationType, Producer producer, VariableMap map, AttributeElement attributeElement) throws OseeCoreException {
+ String value = "";
+ WordMLProducer wordMl = (WordMLProducer) producer;
+
+ if (attributeTypeName.equals(CoreAttributeTypes.WORD_TEMPLATE_CONTENT.getName())) {
+ Attribute<?> wordTempConAttr = artifact.getSoleAttribute(attributeTypeName);
+ String data = (String) wordTempConAttr.getValue();
+
+ if (attributeElement.getLabel().length() > 0) {
+ wordMl.addParagraph(attributeElement.getLabel());
+ }
+
+ if (data != null) {
+ value = WordUtil.stripSpellCheck(data);//TODO what is the best way to get at unknown attribute types? (because this isn't it)
+ //Change the BinData Id so images do not get overridden by the other images
+ value = WordUtil.reassignBinDataID(value);
+
+ LinkType linkType = (LinkType) map.getValue("linkType");
+ value = WordMlLinkHandler.link(linkType, artifact, value);
+ }
+
+ if (presentationType == PresentationType.SPECIALIZED_EDIT) {
+ OseeLinkBuilder linkBuilder = new OseeLinkBuilder();
+ wordMl.addParagraphNoEscape(linkBuilder.getEditArtifactLink(artifact.getGuid(), artifact.getBranch(),
"OSEE_EDIT_START"));
- wordMl.addWordMl(value);
- wordMl.addParagraphNoEscape(linkBuilder.getEditArtifactLink(artifact.getGuid(), artifact.getBranch(),
+ wordMl.addWordMl(value);
+ wordMl.addParagraphNoEscape(linkBuilder.getEditArtifactLink(artifact.getGuid(), artifact.getBranch(),
"OSEE_EDIT_END"));
- } else {
- wordMl.addWordMl(value);
- }
- wordMl.resetListValue();
-
- } else {
- super.renderAttribute(attributeTypeName, artifact, PresentationType.SPECIALIZED_EDIT, wordMl, map,
+ } else {
+ wordMl.addWordMl(value);
+ }
+ wordMl.resetListValue();
+
+ } else {
+ super.renderAttribute(attributeTypeName, artifact, PresentationType.SPECIALIZED_EDIT, wordMl, map,
attributeElement);
- }
- }
-
- @Override
- public InputStream getRenderInputStream(PresentationType presentationType, List<Artifact> artifacts) throws OseeCoreException {
- final List<Artifact> notMultiEditableArtifacts = new LinkedList<Artifact>();
- String template;
-
- if (artifacts.isEmpty()) {
- // Still need to get a default template with a null artifact list
- template = getTemplate(null, presentationType);
- } else {
- Artifact firstArtifact = artifacts.iterator().next();
- template = getTemplate(firstArtifact, presentationType);
-
- if (presentationType == PresentationType.SPECIALIZED_EDIT && artifacts.size() > 1) {
- // currently we can't support the editing of multiple artifacts with OLE data
- for (Artifact artifact : artifacts) {
- if (!artifact.getSoleAttributeValue(CoreAttributeTypes.WORD_OLE_DATA, "").equals("")) {
- notMultiEditableArtifacts.add(artifact);
- }
- }
- displayNotMultiEditArtifacts(notMultiEditableArtifacts,
+ }
+ }
+
+ @Override
+ public InputStream getRenderInputStream(PresentationType presentationType, List<Artifact> artifacts) throws OseeCoreException {
+ final List<Artifact> notMultiEditableArtifacts = new LinkedList<Artifact>();
+ String template;
+
+ if (artifacts.isEmpty()) {
+ // Still need to get a default template with a null artifact list
+ template = getTemplate(null, presentationType);
+ } else {
+ Artifact firstArtifact = artifacts.iterator().next();
+ template = getTemplate(firstArtifact, presentationType);
+
+ if (presentationType == PresentationType.SPECIALIZED_EDIT && artifacts.size() > 1) {
+ // currently we can't support the editing of multiple artifacts with OLE data
+ for (Artifact artifact : artifacts) {
+ if (!artifact.getSoleAttributeValue(CoreAttributeTypes.WORD_OLE_DATA, "").equals("")) {
+ notMultiEditableArtifacts.add(artifact);
+ }
+ }
+ displayNotMultiEditArtifacts(notMultiEditableArtifacts,
"Do not support editing of multiple artifacts with OLE data");
- artifacts.removeAll(notMultiEditableArtifacts);
- } else { // support OLE data when appropriate
- if (!firstArtifact.getSoleAttributeValue(CoreAttributeTypes.WORD_OLE_DATA, "").equals("")) {
- template = template.replaceAll(EMBEDDED_OBJECT_NO, EMBEDDED_OBJECT_YES);
- template =
+ artifacts.removeAll(notMultiEditableArtifacts);
+ } else { // support OLE data when appropriate
+ if (!firstArtifact.getSoleAttributeValue(CoreAttributeTypes.WORD_OLE_DATA, "").equals("")) {
+ template = template.replaceAll(EMBEDDED_OBJECT_NO, EMBEDDED_OBJECT_YES);
+ template =
template.replaceAll(
STYLES_END,
STYLES_END + OLE_START + firstArtifact.getSoleAttributeValue(CoreAttributeTypes.WORD_OLE_DATA, "") + OLE_END);
- }
- }
- }
-
- template = WordUtil.removeGUIDFromTemplate(template);
- return templateProcessor.applyTemplate(getOptions(), artifacts, template, null,
+ }
+ }
+ }
+
+ template = WordUtil.removeGUIDFromTemplate(template);
+ return templateProcessor.applyTemplate(getOptions(), artifacts, template, null,
getOptions() != null ? getOptions().getString("paragraphNumber") : null,
getOptions() != null ? getOptions().getString("outlineType") : null, presentationType);
- }
-
- protected String getTemplate(Artifact artifact, PresentationType presentationType) throws OseeCoreException {
- Artifact templateArtifact =
+ }
+
+ protected String getTemplate(Artifact artifact, PresentationType presentationType) throws OseeCoreException {
+ Artifact templateArtifact =
TemplateManager.getTemplate(this, artifact, presentationType.name(), getStringOption(TEMPLATE_OPTION));
- return templateArtifact.getSoleAttributeValue(CoreAttributeTypes.WHOLE_WORD_CONTENT);
- }
-
- @Override
- public IComparator getComparator() {
- return comparator;
- }
+ return templateArtifact.getSoleAttributeValue(CoreAttributeTypes.WHOLE_WORD_CONTENT);
+ }
+
+ @Override
+ public IComparator getComparator() {
+ return comparator;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordmlPicture.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordmlPicture.java
index 5464d2c3ce4..fa03d755379 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordmlPicture.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordmlPicture.java
@@ -1,78 +1,78 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.render;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
-
-/**
- * @author Theron Virgin
- */
-public class WordmlPicture {
- private int pictureStartIndex;
- private String binaryData;
- private String pictureDefinition;
- private Attribute attribute;
- private static final boolean DEBUG =
- "TRUE".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.osee.framework.ui.skynet/debug/Word"));
-
- public WordmlPicture() {
-
- }
-
- public WordmlPicture(int pictureStartIndex, String pictureDefinition, String document, Attribute attribute) throws OseeCoreException {
- this.pictureStartIndex = pictureStartIndex;
- this.pictureDefinition = pictureDefinition;
- this.attribute = attribute;
- findBinaryData(document);
- }
-
- private void findBinaryData(String document) throws OseeCoreException {
- if (pictureDefinition.contains("<v:textbox ") || pictureDefinition.contains("<v:rect ") || pictureDefinition.contains("<v:line ")) {
- //ignore this case
- } else if (pictureDefinition.contains("<w:binData")) {
- int index = pictureDefinition.indexOf(">", pictureDefinition.indexOf("<w:binData")) + 1;
- binaryData = pictureDefinition.substring(index, pictureDefinition.indexOf("<", index));
- } else if (pictureDefinition.contains("<v:imagedata")) {
- int index = pictureDefinition.indexOf("src=\"", pictureDefinition.indexOf("<v:imagedata")) + 5;
- String pictureId = pictureDefinition.substring(index, pictureDefinition.indexOf("\"", index));
- int dataIndex = document.indexOf("<w:binData w:name=\"" + pictureId + "\"");
- if (dataIndex < 0) {
- if (DEBUG) {
- System.out.println(pictureDefinition);
- }
- throw new OseeCoreException(
- "This document is missing Image Data. The Image can not be checked for modifications Artifact =>" + attribute.getArtifact().getSafeName() + " " + attribute.getArtifact().getArtId());
- }
- binaryData =
- document.substring(document.indexOf(">", dataIndex) + 1, document.indexOf("<", document.indexOf(">",
- dataIndex) + 1));
- } else {
- if (!(pictureDefinition.contains("<v:formulas>") || pictureDefinition.contains("<v:path ") || pictureDefinition.contains("<v:textbox ") || pictureDefinition.contains("<v:rect ") || pictureDefinition.contains("<v:line "))) {
- if (DEBUG) {
- System.out.println(pictureDefinition);
- }
- throw new OseeCoreException(
- "This document contains undefined picture data. Please report details to OSEE development team. Artifact=> " + attribute.getArtifact().getSafeName() + " " + attribute.getArtifact().getArtId());
- }
- }
- }
-
- public int getStartIndex() {
- return pictureStartIndex;
- }
-
- public String getBinaryData() {
- return binaryData;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.render;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
+
+/**
+ * @author Theron Virgin
+ */
+public class WordmlPicture {
+ private int pictureStartIndex;
+ private String binaryData;
+ private String pictureDefinition;
+ private Attribute attribute;
+ private static final boolean DEBUG =
+ "TRUE".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.osee.framework.ui.skynet/debug/Word"));
+
+ public WordmlPicture() {
+
+ }
+
+ public WordmlPicture(int pictureStartIndex, String pictureDefinition, String document, Attribute attribute) throws OseeCoreException {
+ this.pictureStartIndex = pictureStartIndex;
+ this.pictureDefinition = pictureDefinition;
+ this.attribute = attribute;
+ findBinaryData(document);
+ }
+
+ private void findBinaryData(String document) throws OseeCoreException {
+ if (pictureDefinition.contains("<v:textbox ") || pictureDefinition.contains("<v:rect ") || pictureDefinition.contains("<v:line ")) {
+ //ignore this case
+ } else if (pictureDefinition.contains("<w:binData")) {
+ int index = pictureDefinition.indexOf(">", pictureDefinition.indexOf("<w:binData")) + 1;
+ binaryData = pictureDefinition.substring(index, pictureDefinition.indexOf("<", index));
+ } else if (pictureDefinition.contains("<v:imagedata")) {
+ int index = pictureDefinition.indexOf("src=\"", pictureDefinition.indexOf("<v:imagedata")) + 5;
+ String pictureId = pictureDefinition.substring(index, pictureDefinition.indexOf("\"", index));
+ int dataIndex = document.indexOf("<w:binData w:name=\"" + pictureId + "\"");
+ if (dataIndex < 0) {
+ if (DEBUG) {
+ System.out.println(pictureDefinition);
+ }
+ throw new OseeCoreException(
+ "This document is missing Image Data. The Image can not be checked for modifications Artifact =>" + attribute.getArtifact().getSafeName() + " " + attribute.getArtifact().getArtId());
+ }
+ binaryData =
+ document.substring(document.indexOf(">", dataIndex) + 1, document.indexOf("<", document.indexOf(">",
+ dataIndex) + 1));
+ } else {
+ if (!(pictureDefinition.contains("<v:formulas>") || pictureDefinition.contains("<v:path ") || pictureDefinition.contains("<v:textbox ") || pictureDefinition.contains("<v:rect ") || pictureDefinition.contains("<v:line "))) {
+ if (DEBUG) {
+ System.out.println(pictureDefinition);
+ }
+ throw new OseeCoreException(
+ "This document contains undefined picture data. Please report details to OSEE development team. Artifact=> " + attribute.getArtifact().getSafeName() + " " + attribute.getArtifact().getArtId());
+ }
+ }
+ }
+
+ public int getStartIndex() {
+ return pictureStartIndex;
+ }
+
+ public String getBinaryData() {
+ return binaryData;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/artifactElement/IElementExtractor.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/artifactElement/IElementExtractor.java
index 59e246e4593..332d99713dd 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/artifactElement/IElementExtractor.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/artifactElement/IElementExtractor.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.framework.ui.skynet.render.artifactElement;
-
-import java.io.IOException;
-import java.util.Collection;
-import javax.xml.parsers.ParserConfigurationException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Element;
-import org.xml.sax.SAXException;
-
-/**
- *
- * @author Jeff C. Phillips
- *
- */
-public interface IElementExtractor {
-
- public Element getOleDataElement() ;
-
- public Collection<Element> extractElements() throws DOMException, ParserConfigurationException, SAXException, IOException, 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.framework.ui.skynet.render.artifactElement;
+
+import java.io.IOException;
+import java.util.Collection;
+import javax.xml.parsers.ParserConfigurationException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Element;
+import org.xml.sax.SAXException;
+
+/**
+ *
+ * @author Jeff C. Phillips
+ *
+ */
+public interface IElementExtractor {
+
+ public Element getOleDataElement() ;
+
+ public Collection<Element> extractElements() throws DOMException, ParserConfigurationException, SAXException, IOException, OseeCoreException;
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/artifactElement/MergeEditArtifactElementExtractor.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/artifactElement/MergeEditArtifactElementExtractor.java
index 2fa7eb5a844..74a36a89fa1 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/artifactElement/MergeEditArtifactElementExtractor.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/artifactElement/MergeEditArtifactElementExtractor.java
@@ -1,107 +1,107 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.render.artifactElement;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.LinkedList;
-import javax.xml.parsers.ParserConfigurationException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-
-/**
- * @author Jeff C. Phillips
- */
-public class MergeEditArtifactElementExtractor implements IElementExtractor {
- private Element oleDataElement;
- private final Document document;
-
- public MergeEditArtifactElementExtractor(Document document) {
- super();
- this.document = document;
- }
-
- public Element getOleDataElement() {
- return oleDataElement;
- }
-
- public Collection<Element> extractElements() throws DOMException, ParserConfigurationException, SAXException, IOException, OseeCoreException{
- final Collection<Element> artifactElements = new LinkedList<Element>();
- Collection<Element> sectList = new LinkedList<Element>();
- Element rootElement = document.getDocumentElement();
- oleDataElement = null;
-
- NodeList nodeList = rootElement.getElementsByTagName("*");
-
- for (int i = 0; i < nodeList.getLength(); i++) {
- Element element = (Element) nodeList.item(i);
- if (element.getNodeName().endsWith("wx:sect")) {
- //handle the case where there exists two wx:sext elements
- if (element != null) {
- sectList.add(element);
- }
- }
- if (element.getNodeName().endsWith("body")) {
- artifactElements.add(element);
- } else if (oleDataElement == null && element.getNodeName().endsWith("docOleData")) {
- oleDataElement = element;
- }
- }
- //When creating a three way merge the tags are not added as they create conflicts. Therefore
- //we remove template information using the listnum fldChar tag. The following code checks for the
- //attribute tags and if they are not there removes all the paragraphs following the one that contains the
- //fldChar
- if (!sectList.isEmpty()) {
- handleMultiSectTags(sectList);
- }
- return artifactElements;
- }
-
- private void handleMultiSectTags(Collection<Element> sectList) throws OseeCoreException {
- boolean containTag = false;
- // need to check all wx:sect for the listnum tag
- for (Element sectElem : sectList) {
- containTag |= cleanUpParagraph(sectElem);
- }
- if (!containTag) {
- throw new OseeCoreException("This document does not contain the approporate tags to be correctly saved.");
- }
- }
-
- //To handle the case of sub-sections
- private boolean cleanUpParagraph(Node rootNode) throws OseeCoreException {
- boolean worked = false;
- boolean delete = false;
- Node node = rootNode.getFirstChild();
- while (node != null) {
- Node nextNode = node.getNextSibling();
- if (node.getNodeName().endsWith("sub-section")) {
- worked = cleanUpParagraph(node);
- } else {
- String content = node.getTextContent();
- if (content != null && content.contains("LISTNUM\"listreset\"")) {
- delete = true;
- }
- if (delete) {
- rootNode.removeChild(node);
- }
- }
- node = nextNode;
- }
- return worked || delete;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.render.artifactElement;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.LinkedList;
+import javax.xml.parsers.ParserConfigurationException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class MergeEditArtifactElementExtractor implements IElementExtractor {
+ private Element oleDataElement;
+ private final Document document;
+
+ public MergeEditArtifactElementExtractor(Document document) {
+ super();
+ this.document = document;
+ }
+
+ public Element getOleDataElement() {
+ return oleDataElement;
+ }
+
+ public Collection<Element> extractElements() throws DOMException, ParserConfigurationException, SAXException, IOException, OseeCoreException{
+ final Collection<Element> artifactElements = new LinkedList<Element>();
+ Collection<Element> sectList = new LinkedList<Element>();
+ Element rootElement = document.getDocumentElement();
+ oleDataElement = null;
+
+ NodeList nodeList = rootElement.getElementsByTagName("*");
+
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Element element = (Element) nodeList.item(i);
+ if (element.getNodeName().endsWith("wx:sect")) {
+ //handle the case where there exists two wx:sext elements
+ if (element != null) {
+ sectList.add(element);
+ }
+ }
+ if (element.getNodeName().endsWith("body")) {
+ artifactElements.add(element);
+ } else if (oleDataElement == null && element.getNodeName().endsWith("docOleData")) {
+ oleDataElement = element;
+ }
+ }
+ //When creating a three way merge the tags are not added as they create conflicts. Therefore
+ //we remove template information using the listnum fldChar tag. The following code checks for the
+ //attribute tags and if they are not there removes all the paragraphs following the one that contains the
+ //fldChar
+ if (!sectList.isEmpty()) {
+ handleMultiSectTags(sectList);
+ }
+ return artifactElements;
+ }
+
+ private void handleMultiSectTags(Collection<Element> sectList) throws OseeCoreException {
+ boolean containTag = false;
+ // need to check all wx:sect for the listnum tag
+ for (Element sectElem : sectList) {
+ containTag |= cleanUpParagraph(sectElem);
+ }
+ if (!containTag) {
+ throw new OseeCoreException("This document does not contain the approporate tags to be correctly saved.");
+ }
+ }
+
+ //To handle the case of sub-sections
+ private boolean cleanUpParagraph(Node rootNode) throws OseeCoreException {
+ boolean worked = false;
+ boolean delete = false;
+ Node node = rootNode.getFirstChild();
+ while (node != null) {
+ Node nextNode = node.getNextSibling();
+ if (node.getNodeName().endsWith("sub-section")) {
+ worked = cleanUpParagraph(node);
+ } else {
+ String content = node.getTextContent();
+ if (content != null && content.contains("LISTNUM\"listreset\"")) {
+ delete = true;
+ }
+ if (delete) {
+ rootNode.removeChild(node);
+ }
+ }
+ node = nextNode;
+ }
+ return worked || delete;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/artifactElement/WordArtifactElementExtractor.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/artifactElement/WordArtifactElementExtractor.java
index 71736cc6e2f..6c28701a63e 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/artifactElement/WordArtifactElementExtractor.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/artifactElement/WordArtifactElementExtractor.java
@@ -1,290 +1,290 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.render.artifactElement;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import javax.xml.parsers.ParserConfigurationException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.linking.OseeLinkBuilder;
-import org.eclipse.osee.framework.skynet.core.linking.OseeLinkParser;
-import org.eclipse.osee.framework.skynet.core.word.WordUtil;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-
-/**
- * @author Jeff C. Phillips
- */
-public class WordArtifactElementExtractor implements IElementExtractor{
- private static final String SECTION_TAG = "wx:sect";
- private static final String SUB_SECTION_TAG = "wx:sub-section";
- private static final String BODY_TAG = "w:body";
- private static final OseeLinkBuilder LINK_BUILDER = new OseeLinkBuilder();
- private final Map<String, Element> pictureMap;
- private Element oleDataElement;
- private final Document document;
- private int numberOfStartTags;
- private int numberOfEndTags;
-
-
- private enum ParseState {LOOKING_FOR_START, LOOKING_FOR_END};
- private enum Side {left, right};
-
- public WordArtifactElementExtractor(Document document){
- super();
- this.document = document;
- this.numberOfEndTags = 0;
- this.numberOfStartTags = 0;
- this.pictureMap = new HashMap<String, Element>();
- }
-
- public Element getOleDataElement() {
- return oleDataElement;
- }
-
- public List<Element> extractElements() throws DOMException, ParserConfigurationException, SAXException, IOException, OseeCoreException{
- final List<Element> artifactElements = new LinkedList<Element>();
- Element rootElement = document.getDocumentElement();
- pictureMap.clear();
- oleDataElement = null;
- numberOfStartTags = 0;
- numberOfEndTags = 0;
-
- NodeList nodeList = rootElement.getElementsByTagName("*");
- Element newArtifactElement = null;
- ParseState parseState = ParseState.LOOKING_FOR_START;
-
- for (int i = 0; i < nodeList.getLength(); i++) {
- Element element = (Element) nodeList.item(i);
- if (isArtifactEditTag(element)) {
- if(parseState == ParseState.LOOKING_FOR_START){
- numberOfStartTags++;
- parseState = ParseState.LOOKING_FOR_END;
- newArtifactElement = document.createElement("WordAttribute.WORD_TEMPLATE_CONTENT");
- populateNewArtifactElementFromHlink(newArtifactElement,getHlinkDescendant(element));
- artifactElements.add(newArtifactElement);
-
- Node clonedElement = cloneWithoutArtifactEditTag(element, Side.right);
- if (elementHasGrandChildren(clonedElement)) {
- newArtifactElement.appendChild(clonedElement);
- }
- }else if(parseState == ParseState.LOOKING_FOR_END){
- numberOfEndTags++;
- parseState = ParseState.LOOKING_FOR_START;
-
- Node clonedElement = cloneWithoutArtifactEditTag(element, Side.left);
- if (elementHasGrandChildren(clonedElement)) {
- newArtifactElement.appendChild(clonedElement);
- }
- }
- }else if(parseState == ParseState.LOOKING_FOR_END && properLevelChild(element)) {
- handleImages(element);
- newArtifactElement.appendChild(element.cloneNode(true));
- }
- }
-
- validateEditTags();
- return artifactElements;
- }
-
- /**
- * @param element
- * @return
- */
- private boolean elementHasGrandChildren(Node element) {
- return element.getChildNodes().getLength() > 0 && element.getChildNodes().item(0).getChildNodes().getLength() > 0;
- }
-
- private Element getHlinkDescendant(Element element) {
- NodeList descendants = element.getElementsByTagName("*");
- for (int i=0; i<descendants.getLength(); i++) {
- Element descendant = (Element)descendants.item(i);
- if (isEditLink(descendant)) {
- return descendant;
- }
- }
-
- throw new IllegalStateException("We only called this because we found it before, should never get here");
- }
-
- /**
- * @param element
- * @param keepSide TODO
- * @param childNodes
- * @return
- */
- private Node cloneWithoutArtifactEditTag(Element element, Side keepSide) {
- Collection<Node> removals = new LinkedList<Node>();
-
- Element clonedElement = (Element)element.cloneNode(true);
- boolean beforeEditTag = true;
- NodeList descendants = clonedElement.getElementsByTagName("*");
- for (int i=0; i<descendants.getLength(); i++) {
- Node descendant = descendants.item(i);
- if (isEditLink(descendant)) {
- descendant.getParentNode().removeChild(descendant);
- removals.add(descendant);
- beforeEditTag = false;
- } else if (beforeEditTag && keepSide == Side.right || !beforeEditTag && keepSide == Side.left) {
- removals.add(descendant);
- }
- }
-
- for(Node remove : removals) {
- Node parentNode = remove.getParentNode();
- if (parentNode != null) {
- parentNode.removeChild(remove);
- }
- }
- return clonedElement;
- }
-
- /**
- * @param element
- * @return
- */
- private boolean isEditLink(Node element) {
- String HLINK_ELEMENT_NAME = WordUtil.elementNameFor("hlink");
-
- if (element.getNodeName().contains(HLINK_ELEMENT_NAME)) {
- Node destinationAttribute = element.getAttributes().getNamedItem("w:dest");
- if (destinationAttribute != null) {
- return LINK_BUILDER.isEditArtifactLink(destinationAttribute.getNodeValue());
- }
- }
-
- return false;
- }
-
- private void validateEditTags() throws OseeCoreException{
- if(numberOfStartTags == 0 || numberOfEndTags != numberOfStartTags){
- throw new OseeCoreException("This document is missing start/end edit tags, therefore the document will not be saved. You can re-edit the artifact and the edit tags should reappear.");
- }
- }
-
- /**
- * @param newArtifactElement
- * @param element
- * @throws DOMException
- * @throws OseeCoreException
- */
- private void populateNewArtifactElementFromHlink(Element newArtifactElement, Element element) throws OseeCoreException, DOMException {
- OseeLinkParser linkParser = new OseeLinkParser();
- linkParser.parse(element.getAttribute("w:dest"));
- newArtifactElement.setAttribute("guid", linkParser.getGuid());
- }
-
- /**
- * @param element
- * @return
- */
- private boolean isArtifactEditTag(Element element) {
- if (!properLevelChild(element)) {
- return false;
- }
-
- NodeList descendants = element.getElementsByTagName("*");
- for (int i=0; i<descendants.getLength(); i++) {
- Node descendant = descendants.item(i);
- if (isEditLink(descendant)) {
- return true;
- }
- }
- return false ;
- }
-
- /**
- * @param element
- * @return
- */
- private boolean properLevelChild(Element element) {
- return properLevelChildWord2003(element) || properLevelChildWord2007(element);
- }
-
- private void handleImages(Element element) {
- NodeList descendants = element.getElementsByTagName("*");
- for (int i = 0; i < descendants.getLength(); i++) {
- Node descendant = descendants.item(i);
- if (descendant.getNodeName().contains("w:pic")) {
- NodeList imageDataElement = ((Element) descendant).getElementsByTagName("v:imagedata");
- if (imageDataElement.getLength() > 0) {
- String imgKey = ((Element) imageDataElement.item(0)).getAttribute("src");
- Element storedPictureElement = pictureMap.get(imgKey);
- NodeList binDataElement = ((Element) descendant).getElementsByTagName("w:binData");
-
- if(storedPictureElement!= null){
- if(binDataElement.getLength() == 0){
- descendant.appendChild(storedPictureElement);
- }
- }else{
- pictureMap.put(imgKey, (Element)binDataElement.item(0));
- }
- }
- }
- }
- }
-
- private String getAncestorName(Element element, int level) {
- String name = "";
-
- Node parent = element;
- for (int i = 0; i < level; i++) {
- if (parent != null) {
- parent = parent.getParentNode();
- }
- }
-
- if (parent != null) {
- name = parent.getNodeName();
- }
-
- return name;
- }
-
- /**
- * @param element
- * @return
- */
- private boolean properLevelChildWord2003(Element element) {
- String grandParentName = getAncestorName(element, 2);
- String parentName = getAncestorName(element, 1);
- String myName = element.getNodeName();
-
- boolean nonSubsectionBodyChild = parentName.equals(BODY_TAG) && !myName.equals(SUB_SECTION_TAG) && !myName.equals(SECTION_TAG);
- boolean sectionChild = grandParentName.equals(BODY_TAG) && parentName.equals(SECTION_TAG) && !myName.equals(SUB_SECTION_TAG);
- boolean subsectionChild = parentName.equals(SUB_SECTION_TAG) && !myName.equals(SUB_SECTION_TAG);
-
- return nonSubsectionBodyChild || sectionChild || subsectionChild;
- }
-
- /**
- * @param element
- * @return
- */
- private boolean properLevelChildWord2007(Element element) {
- String parentName = getAncestorName(element, 1);
- String myName = element.getNodeName();
-
- boolean nonSubsectionBodyChild = parentName.equals(BODY_TAG) && !myName.equals(SUB_SECTION_TAG) && !myName.equals(SECTION_TAG);
- boolean subsectionChild = parentName.equals(SUB_SECTION_TAG) && !myName.equals(SUB_SECTION_TAG);
-
- return nonSubsectionBodyChild || subsectionChild;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.render.artifactElement;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import javax.xml.parsers.ParserConfigurationException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.linking.OseeLinkBuilder;
+import org.eclipse.osee.framework.skynet.core.linking.OseeLinkParser;
+import org.eclipse.osee.framework.skynet.core.word.WordUtil;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class WordArtifactElementExtractor implements IElementExtractor{
+ private static final String SECTION_TAG = "wx:sect";
+ private static final String SUB_SECTION_TAG = "wx:sub-section";
+ private static final String BODY_TAG = "w:body";
+ private static final OseeLinkBuilder LINK_BUILDER = new OseeLinkBuilder();
+ private final Map<String, Element> pictureMap;
+ private Element oleDataElement;
+ private final Document document;
+ private int numberOfStartTags;
+ private int numberOfEndTags;
+
+
+ private enum ParseState {LOOKING_FOR_START, LOOKING_FOR_END};
+ private enum Side {left, right};
+
+ public WordArtifactElementExtractor(Document document){
+ super();
+ this.document = document;
+ this.numberOfEndTags = 0;
+ this.numberOfStartTags = 0;
+ this.pictureMap = new HashMap<String, Element>();
+ }
+
+ public Element getOleDataElement() {
+ return oleDataElement;
+ }
+
+ public List<Element> extractElements() throws DOMException, ParserConfigurationException, SAXException, IOException, OseeCoreException{
+ final List<Element> artifactElements = new LinkedList<Element>();
+ Element rootElement = document.getDocumentElement();
+ pictureMap.clear();
+ oleDataElement = null;
+ numberOfStartTags = 0;
+ numberOfEndTags = 0;
+
+ NodeList nodeList = rootElement.getElementsByTagName("*");
+ Element newArtifactElement = null;
+ ParseState parseState = ParseState.LOOKING_FOR_START;
+
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Element element = (Element) nodeList.item(i);
+ if (isArtifactEditTag(element)) {
+ if(parseState == ParseState.LOOKING_FOR_START){
+ numberOfStartTags++;
+ parseState = ParseState.LOOKING_FOR_END;
+ newArtifactElement = document.createElement("WordAttribute.WORD_TEMPLATE_CONTENT");
+ populateNewArtifactElementFromHlink(newArtifactElement,getHlinkDescendant(element));
+ artifactElements.add(newArtifactElement);
+
+ Node clonedElement = cloneWithoutArtifactEditTag(element, Side.right);
+ if (elementHasGrandChildren(clonedElement)) {
+ newArtifactElement.appendChild(clonedElement);
+ }
+ }else if(parseState == ParseState.LOOKING_FOR_END){
+ numberOfEndTags++;
+ parseState = ParseState.LOOKING_FOR_START;
+
+ Node clonedElement = cloneWithoutArtifactEditTag(element, Side.left);
+ if (elementHasGrandChildren(clonedElement)) {
+ newArtifactElement.appendChild(clonedElement);
+ }
+ }
+ }else if(parseState == ParseState.LOOKING_FOR_END && properLevelChild(element)) {
+ handleImages(element);
+ newArtifactElement.appendChild(element.cloneNode(true));
+ }
+ }
+
+ validateEditTags();
+ return artifactElements;
+ }
+
+ /**
+ * @param element
+ * @return
+ */
+ private boolean elementHasGrandChildren(Node element) {
+ return element.getChildNodes().getLength() > 0 && element.getChildNodes().item(0).getChildNodes().getLength() > 0;
+ }
+
+ private Element getHlinkDescendant(Element element) {
+ NodeList descendants = element.getElementsByTagName("*");
+ for (int i=0; i<descendants.getLength(); i++) {
+ Element descendant = (Element)descendants.item(i);
+ if (isEditLink(descendant)) {
+ return descendant;
+ }
+ }
+
+ throw new IllegalStateException("We only called this because we found it before, should never get here");
+ }
+
+ /**
+ * @param element
+ * @param keepSide TODO
+ * @param childNodes
+ * @return
+ */
+ private Node cloneWithoutArtifactEditTag(Element element, Side keepSide) {
+ Collection<Node> removals = new LinkedList<Node>();
+
+ Element clonedElement = (Element)element.cloneNode(true);
+ boolean beforeEditTag = true;
+ NodeList descendants = clonedElement.getElementsByTagName("*");
+ for (int i=0; i<descendants.getLength(); i++) {
+ Node descendant = descendants.item(i);
+ if (isEditLink(descendant)) {
+ descendant.getParentNode().removeChild(descendant);
+ removals.add(descendant);
+ beforeEditTag = false;
+ } else if (beforeEditTag && keepSide == Side.right || !beforeEditTag && keepSide == Side.left) {
+ removals.add(descendant);
+ }
+ }
+
+ for(Node remove : removals) {
+ Node parentNode = remove.getParentNode();
+ if (parentNode != null) {
+ parentNode.removeChild(remove);
+ }
+ }
+ return clonedElement;
+ }
+
+ /**
+ * @param element
+ * @return
+ */
+ private boolean isEditLink(Node element) {
+ String HLINK_ELEMENT_NAME = WordUtil.elementNameFor("hlink");
+
+ if (element.getNodeName().contains(HLINK_ELEMENT_NAME)) {
+ Node destinationAttribute = element.getAttributes().getNamedItem("w:dest");
+ if (destinationAttribute != null) {
+ return LINK_BUILDER.isEditArtifactLink(destinationAttribute.getNodeValue());
+ }
+ }
+
+ return false;
+ }
+
+ private void validateEditTags() throws OseeCoreException{
+ if(numberOfStartTags == 0 || numberOfEndTags != numberOfStartTags){
+ throw new OseeCoreException("This document is missing start/end edit tags, therefore the document will not be saved. You can re-edit the artifact and the edit tags should reappear.");
+ }
+ }
+
+ /**
+ * @param newArtifactElement
+ * @param element
+ * @throws DOMException
+ * @throws OseeCoreException
+ */
+ private void populateNewArtifactElementFromHlink(Element newArtifactElement, Element element) throws OseeCoreException, DOMException {
+ OseeLinkParser linkParser = new OseeLinkParser();
+ linkParser.parse(element.getAttribute("w:dest"));
+ newArtifactElement.setAttribute("guid", linkParser.getGuid());
+ }
+
+ /**
+ * @param element
+ * @return
+ */
+ private boolean isArtifactEditTag(Element element) {
+ if (!properLevelChild(element)) {
+ return false;
+ }
+
+ NodeList descendants = element.getElementsByTagName("*");
+ for (int i=0; i<descendants.getLength(); i++) {
+ Node descendant = descendants.item(i);
+ if (isEditLink(descendant)) {
+ return true;
+ }
+ }
+ return false ;
+ }
+
+ /**
+ * @param element
+ * @return
+ */
+ private boolean properLevelChild(Element element) {
+ return properLevelChildWord2003(element) || properLevelChildWord2007(element);
+ }
+
+ private void handleImages(Element element) {
+ NodeList descendants = element.getElementsByTagName("*");
+ for (int i = 0; i < descendants.getLength(); i++) {
+ Node descendant = descendants.item(i);
+ if (descendant.getNodeName().contains("w:pic")) {
+ NodeList imageDataElement = ((Element) descendant).getElementsByTagName("v:imagedata");
+ if (imageDataElement.getLength() > 0) {
+ String imgKey = ((Element) imageDataElement.item(0)).getAttribute("src");
+ Element storedPictureElement = pictureMap.get(imgKey);
+ NodeList binDataElement = ((Element) descendant).getElementsByTagName("w:binData");
+
+ if(storedPictureElement!= null){
+ if(binDataElement.getLength() == 0){
+ descendant.appendChild(storedPictureElement);
+ }
+ }else{
+ pictureMap.put(imgKey, (Element)binDataElement.item(0));
+ }
+ }
+ }
+ }
+ }
+
+ private String getAncestorName(Element element, int level) {
+ String name = "";
+
+ Node parent = element;
+ for (int i = 0; i < level; i++) {
+ if (parent != null) {
+ parent = parent.getParentNode();
+ }
+ }
+
+ if (parent != null) {
+ name = parent.getNodeName();
+ }
+
+ return name;
+ }
+
+ /**
+ * @param element
+ * @return
+ */
+ private boolean properLevelChildWord2003(Element element) {
+ String grandParentName = getAncestorName(element, 2);
+ String parentName = getAncestorName(element, 1);
+ String myName = element.getNodeName();
+
+ boolean nonSubsectionBodyChild = parentName.equals(BODY_TAG) && !myName.equals(SUB_SECTION_TAG) && !myName.equals(SECTION_TAG);
+ boolean sectionChild = grandParentName.equals(BODY_TAG) && parentName.equals(SECTION_TAG) && !myName.equals(SUB_SECTION_TAG);
+ boolean subsectionChild = parentName.equals(SUB_SECTION_TAG) && !myName.equals(SUB_SECTION_TAG);
+
+ return nonSubsectionBodyChild || sectionChild || subsectionChild;
+ }
+
+ /**
+ * @param element
+ * @return
+ */
+ private boolean properLevelChildWord2007(Element element) {
+ String parentName = getAncestorName(element, 1);
+ String myName = element.getNodeName();
+
+ boolean nonSubsectionBodyChild = parentName.equals(BODY_TAG) && !myName.equals(SUB_SECTION_TAG) && !myName.equals(SECTION_TAG);
+ boolean subsectionChild = parentName.equals(SUB_SECTION_TAG) && !myName.equals(SUB_SECTION_TAG);
+
+ return nonSubsectionBodyChild || subsectionChild;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/ArtifactDeltaToFileConverter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/ArtifactDeltaToFileConverter.java
index 495bacb8c49..197f34fefc0 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/ArtifactDeltaToFileConverter.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/ArtifactDeltaToFileConverter.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.render.compare;
-
+package org.eclipse.osee.framework.ui.skynet.render.compare;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
@@ -20,50 +20,50 @@ import org.eclipse.osee.framework.skynet.core.change.ArtifactDelta;
import org.eclipse.osee.framework.ui.skynet.render.FileSystemRenderer;
import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
import org.eclipse.osee.framework.ui.skynet.render.RenderingUtil;
-
-public class ArtifactDeltaToFileConverter {
- private final FileSystemRenderer renderer;
-
- public ArtifactDeltaToFileConverter(FileSystemRenderer renderer) {
- this.renderer = renderer;
- }
-
- public FileSystemRenderer getRenderer() {
- return renderer;
- }
-
- public Pair<IFile, IFile> convertToFile(PresentationType presentationType, ArtifactDelta delta) throws OseeCoreException {
- Pair<IFile, IFile> toReturn;
- if (presentationType == PresentationType.MERGE || presentationType == PresentationType.MERGE_EDIT) {
- Branch branch = delta.getBranch();
- IFile baseFile = renderForMerge(renderer, delta.getStartArtifact(), branch, presentationType);
- IFile newerFile = renderForMerge(renderer, delta.getEndArtifact(), branch, presentationType);
- toReturn = new Pair<IFile, IFile>(baseFile, newerFile);
- } else {
- toReturn = asFiles(renderer, presentationType, delta);
- }
- return toReturn;
- }
-
- private IFile renderForMerge(FileSystemRenderer renderer, Artifact artifact, Branch branch, PresentationType presentationType) throws OseeCoreException {
- if (artifact == null) {
- throw new IllegalArgumentException("Artifact can not be null.");
- }
- IFolder baseFolder;
- if (presentationType == PresentationType.MERGE_EDIT) {
- baseFolder = RenderingUtil.getRenderFolder(artifact.getBranch(), PresentationType.MERGE_EDIT);
- } else {
- baseFolder = RenderingUtil.getRenderFolder(artifact.getBranch(), PresentationType.DIFF);
- }
- return renderer.renderToFileSystem(baseFolder, artifact, artifact.getBranch(), presentationType);
- }
-
- private Pair<IFile, IFile> asFiles(FileSystemRenderer renderer, PresentationType presentationType, ArtifactDelta delta) throws OseeCoreException {
- Pair<Artifact, Artifact> renderInput = RenderingUtil.asRenderInput(delta);
- Branch branch = delta.getBranch();
- IFolder renderingFolder = RenderingUtil.getRenderFolder(branch, presentationType);
- IFile baseFile = renderer.renderToFileSystem(renderingFolder, renderInput.getFirst(), branch, presentationType);
- IFile newerFile = renderer.renderToFileSystem(renderingFolder, renderInput.getSecond(), branch, presentationType);
- return new Pair<IFile, IFile>(baseFile, newerFile);
- }
-}
+
+public class ArtifactDeltaToFileConverter {
+ private final FileSystemRenderer renderer;
+
+ public ArtifactDeltaToFileConverter(FileSystemRenderer renderer) {
+ this.renderer = renderer;
+ }
+
+ public FileSystemRenderer getRenderer() {
+ return renderer;
+ }
+
+ public Pair<IFile, IFile> convertToFile(PresentationType presentationType, ArtifactDelta delta) throws OseeCoreException {
+ Pair<IFile, IFile> toReturn;
+ if (presentationType == PresentationType.MERGE || presentationType == PresentationType.MERGE_EDIT) {
+ Branch branch = delta.getBranch();
+ IFile baseFile = renderForMerge(renderer, delta.getStartArtifact(), branch, presentationType);
+ IFile newerFile = renderForMerge(renderer, delta.getEndArtifact(), branch, presentationType);
+ toReturn = new Pair<IFile, IFile>(baseFile, newerFile);
+ } else {
+ toReturn = asFiles(renderer, presentationType, delta);
+ }
+ return toReturn;
+ }
+
+ private IFile renderForMerge(FileSystemRenderer renderer, Artifact artifact, Branch branch, PresentationType presentationType) throws OseeCoreException {
+ if (artifact == null) {
+ throw new IllegalArgumentException("Artifact can not be null.");
+ }
+ IFolder baseFolder;
+ if (presentationType == PresentationType.MERGE_EDIT) {
+ baseFolder = RenderingUtil.getRenderFolder(artifact.getBranch(), PresentationType.MERGE_EDIT);
+ } else {
+ baseFolder = RenderingUtil.getRenderFolder(artifact.getBranch(), PresentationType.DIFF);
+ }
+ return renderer.renderToFileSystem(baseFolder, artifact, artifact.getBranch(), presentationType);
+ }
+
+ private Pair<IFile, IFile> asFiles(FileSystemRenderer renderer, PresentationType presentationType, ArtifactDelta delta) throws OseeCoreException {
+ Pair<Artifact, Artifact> renderInput = RenderingUtil.asRenderInput(delta);
+ Branch branch = delta.getBranch();
+ IFolder renderingFolder = RenderingUtil.getRenderFolder(branch, presentationType);
+ IFile baseFile = renderer.renderToFileSystem(renderingFolder, renderInput.getFirst(), branch, presentationType);
+ IFile newerFile = renderer.renderToFileSystem(renderingFolder, renderInput.getSecond(), branch, presentationType);
+ return new Pair<IFile, IFile>(baseFile, newerFile);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/DefaultArtifactCompare.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/DefaultArtifactCompare.java
index 88de47cf3ab..79a950cf1d5 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/DefaultArtifactCompare.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/DefaultArtifactCompare.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.render.compare;
-
+package org.eclipse.osee.framework.ui.skynet.render.compare;
+
import java.util.Collection;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -17,23 +17,23 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.change.ArtifactDelta;
import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
-
-public class DefaultArtifactCompare implements IComparator {
-
- @Override
- public String compare(IProgressMonitor monitor, PresentationType presentationType, ArtifactDelta delta, boolean show) throws OseeCoreException {
- throw new OseeCoreException("The default renderer does not support the compare operation");
- }
-
- @Override
- public String compare(Artifact baseVersion, Artifact newerVersion, IFile baseFile, IFile newerFile, PresentationType presentationType, boolean show) throws OseeCoreException {
- throw new OseeCoreException("The default renderer does not support the compare operation");
- }
-
- @Override
- public void compareArtifacts(IProgressMonitor monitor, PresentationType presentationType, Collection<ArtifactDelta> itemsToCompare) throws OseeCoreException {
- for (ArtifactDelta entry : itemsToCompare) {
- compare(monitor, presentationType, entry, true);
- }
- }
-}
+
+public class DefaultArtifactCompare implements IComparator {
+
+ @Override
+ public String compare(IProgressMonitor monitor, PresentationType presentationType, ArtifactDelta delta, boolean show) throws OseeCoreException {
+ throw new OseeCoreException("The default renderer does not support the compare operation");
+ }
+
+ @Override
+ public String compare(Artifact baseVersion, Artifact newerVersion, IFile baseFile, IFile newerFile, PresentationType presentationType, boolean show) throws OseeCoreException {
+ throw new OseeCoreException("The default renderer does not support the compare operation");
+ }
+
+ @Override
+ public void compareArtifacts(IProgressMonitor monitor, PresentationType presentationType, Collection<ArtifactDelta> itemsToCompare) throws OseeCoreException {
+ for (ArtifactDelta entry : itemsToCompare) {
+ compare(monitor, presentationType, entry, true);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/IComparator.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/IComparator.java
index c93dbed6e79..b8ab59385a5 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/IComparator.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/IComparator.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.render.compare;
-
+package org.eclipse.osee.framework.ui.skynet.render.compare;
+
import java.util.Collection;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -17,13 +17,13 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.change.ArtifactDelta;
import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
-
-public interface IComparator {
-
- String compare(IProgressMonitor monitor, PresentationType presentationType, ArtifactDelta artifactDelta, boolean show) throws OseeCoreException;
-
- String compare(Artifact baseVersion, Artifact newerVersion, IFile baseFile, IFile newerFile, PresentationType presentationType, boolean show) throws OseeCoreException;
-
- void compareArtifacts(IProgressMonitor monitor, PresentationType presentationType, Collection<ArtifactDelta> itemsToCompare) throws OseeCoreException;
-
-}
+
+public interface IComparator {
+
+ String compare(IProgressMonitor monitor, PresentationType presentationType, ArtifactDelta artifactDelta, boolean show) throws OseeCoreException;
+
+ String compare(Artifact baseVersion, Artifact newerVersion, IFile baseFile, IFile newerFile, PresentationType presentationType, boolean show) throws OseeCoreException;
+
+ void compareArtifacts(IProgressMonitor monitor, PresentationType presentationType, Collection<ArtifactDelta> itemsToCompare) throws OseeCoreException;
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WholeWordCompare.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WholeWordCompare.java
index db186b9e0a2..ffbd75c09eb 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WholeWordCompare.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WholeWordCompare.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.render.compare;
-
+package org.eclipse.osee.framework.ui.skynet.render.compare;
+
import java.util.Collection;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@@ -30,108 +30,108 @@ import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
import org.eclipse.osee.framework.ui.skynet.render.RenderingUtil;
import org.eclipse.osee.framework.ui.skynet.render.VbaWordDiffGenerator;
import org.eclipse.osee.framework.ui.skynet.render.WordImageChecker;
-
-public class WholeWordCompare implements IComparator {
- private static final IAttributeType ATTRIBUTE_TYPE = CoreAttributeTypes.WHOLE_WORD_CONTENT;
- private final ArtifactDeltaToFileConverter converter;
-
- public WholeWordCompare(FileSystemRenderer renderer) {
- this.converter = new ArtifactDeltaToFileConverter(renderer);
- }
-
- @Override
- public String compare(IProgressMonitor monitor, PresentationType presentationType, ArtifactDelta delta, boolean show) throws OseeCoreException {
- if (delta.getStartArtifact() == null && delta.getEndArtifact() == null) {
- throw new OseeArgumentException("baseVersion and newerVersion can't both be null.");
- }
- Pair<String, Boolean> originalValue = null;
- Pair<String, Boolean> newAnnotationValue = null;
- Pair<String, Boolean> oldAnnotationValue = null;
-
- Artifact baseArtifact = delta.getStartArtifact();
- Artifact newerArtifact = delta.getEndArtifact();
- Attribute<String> baseContent = getWordContent(baseArtifact, ATTRIBUTE_TYPE);
- Attribute<String> newerContent = getWordContent(newerArtifact, ATTRIBUTE_TYPE);
-
- if (!UserManager.getUser().getBooleanSetting(MsWordPreferencePage.REMOVE_TRACKED_CHANGES)) {
- oldAnnotationValue = removeAnnotations(baseContent);
- newAnnotationValue = removeAnnotations(newerContent);
- }
-
- if (!UserManager.getUser().getBooleanSetting(MsWordPreferencePage.IDENTFY_IMAGE_CHANGES)) {
- originalValue = WordImageChecker.checkForImageDiffs(baseContent, newerContent);
- }
-
- Pair<IFile, IFile> compareFiles = converter.convertToFile(presentationType, delta);
-
- WordImageChecker.restoreOriginalValue(baseContent,
- oldAnnotationValue != null ? oldAnnotationValue : originalValue);
- WordImageChecker.restoreOriginalValue(newerContent, newAnnotationValue);
- return compare(baseArtifact, newerArtifact, compareFiles.getFirst(), compareFiles.getSecond(), presentationType,
- show);
- }
-
- @Override
- public String compare(Artifact baseVersion, Artifact newerVersion, IFile baseFile, IFile newerFile, PresentationType presentationType, boolean show) throws OseeCoreException {
- String diffPath;
- String fileName = converter.getRenderer().getStringOption("fileName");
- if (fileName == null || fileName.equals("")) {
- if (baseVersion != null) {
- String baseFileStr = baseFile.getLocation().toOSString();
- diffPath =
- baseFileStr.substring(0, baseFileStr.lastIndexOf(')') + 1) + " to " + (newerVersion != null ? newerVersion.getTransactionNumber() : " deleted") + baseFileStr.substring(baseFileStr.lastIndexOf(')') + 1);
- } else {
- String baseFileStr = newerFile.getLocation().toOSString();
- diffPath =
- baseFileStr.substring(0, baseFileStr.lastIndexOf('(') + 1) + "new " + baseFileStr.substring(baseFileStr.lastIndexOf('(') + 1);
- }
- } else {
- diffPath =
- RenderingUtil.getRenderFolder(baseVersion.getBranch(), PresentationType.SPECIALIZED_EDIT).getLocation().toOSString() + '\\' + fileName;
- }
-
- VbaWordDiffGenerator diffGenerator = new VbaWordDiffGenerator();
- diffGenerator.initialize(presentationType == PresentationType.DIFF,
- presentationType == PresentationType.MERGE_EDIT);
- if (presentationType == PresentationType.MERGE_EDIT && baseVersion != null) {
- IFolder folder = RenderingUtil.getRenderFolder(baseVersion.getBranch(), PresentationType.MERGE_EDIT);
- converter.getRenderer().addFileToWatcher(folder, diffPath.substring(diffPath.lastIndexOf('\\') + 1));
- diffGenerator.addComparison(baseFile, newerFile, diffPath, true);
- diffGenerator.finish(diffPath.substring(0, diffPath.lastIndexOf('\\')) + "mergeDocs.vbs", show);
- } else {
- if (RenderingUtil.arePopupsAllowed()) {
- diffGenerator.addComparison(baseFile, newerFile, diffPath, false);
- diffGenerator.finish(diffPath.substring(0, diffPath.lastIndexOf('\\')) + "/compareDocs.vbs", show);
- }
- }
- return diffPath;
- }
-
- @Override
- public void compareArtifacts(IProgressMonitor monitor, PresentationType presentationType, Collection<ArtifactDelta> itemsToCompare) throws OseeCoreException {
- for (ArtifactDelta entry : itemsToCompare) {
- compare(monitor, presentationType, entry, true);
- }
- }
-
- private Pair<String, Boolean> removeAnnotations(Attribute<String> attribute) throws OseeCoreException {
- Pair<String, Boolean> annotation = null;
- if (attribute != null) {
- String value = attribute.getValue();
- if (WordAnnotationHandler.containsWordAnnotations(value)) {
- annotation = new Pair<String, Boolean>(value, attribute.isDirty());
- attribute.setFromString(WordAnnotationHandler.removeAnnotations(value));
- }
- }
- return annotation;
- }
-
- private Attribute<String> getWordContent(Artifact artifact, IAttributeType attributeType) throws OseeCoreException {
- Attribute<String> toReturn = null;
- if (artifact != null && !artifact.isDeleted()) {
- toReturn = artifact.getSoleAttribute(attributeType);
- }
- return toReturn;
- }
-
-}
+
+public class WholeWordCompare implements IComparator {
+ private static final IAttributeType ATTRIBUTE_TYPE = CoreAttributeTypes.WHOLE_WORD_CONTENT;
+ private final ArtifactDeltaToFileConverter converter;
+
+ public WholeWordCompare(FileSystemRenderer renderer) {
+ this.converter = new ArtifactDeltaToFileConverter(renderer);
+ }
+
+ @Override
+ public String compare(IProgressMonitor monitor, PresentationType presentationType, ArtifactDelta delta, boolean show) throws OseeCoreException {
+ if (delta.getStartArtifact() == null && delta.getEndArtifact() == null) {
+ throw new OseeArgumentException("baseVersion and newerVersion can't both be null.");
+ }
+ Pair<String, Boolean> originalValue = null;
+ Pair<String, Boolean> newAnnotationValue = null;
+ Pair<String, Boolean> oldAnnotationValue = null;
+
+ Artifact baseArtifact = delta.getStartArtifact();
+ Artifact newerArtifact = delta.getEndArtifact();
+ Attribute<String> baseContent = getWordContent(baseArtifact, ATTRIBUTE_TYPE);
+ Attribute<String> newerContent = getWordContent(newerArtifact, ATTRIBUTE_TYPE);
+
+ if (!UserManager.getUser().getBooleanSetting(MsWordPreferencePage.REMOVE_TRACKED_CHANGES)) {
+ oldAnnotationValue = removeAnnotations(baseContent);
+ newAnnotationValue = removeAnnotations(newerContent);
+ }
+
+ if (!UserManager.getUser().getBooleanSetting(MsWordPreferencePage.IDENTFY_IMAGE_CHANGES)) {
+ originalValue = WordImageChecker.checkForImageDiffs(baseContent, newerContent);
+ }
+
+ Pair<IFile, IFile> compareFiles = converter.convertToFile(presentationType, delta);
+
+ WordImageChecker.restoreOriginalValue(baseContent,
+ oldAnnotationValue != null ? oldAnnotationValue : originalValue);
+ WordImageChecker.restoreOriginalValue(newerContent, newAnnotationValue);
+ return compare(baseArtifact, newerArtifact, compareFiles.getFirst(), compareFiles.getSecond(), presentationType,
+ show);
+ }
+
+ @Override
+ public String compare(Artifact baseVersion, Artifact newerVersion, IFile baseFile, IFile newerFile, PresentationType presentationType, boolean show) throws OseeCoreException {
+ String diffPath;
+ String fileName = converter.getRenderer().getStringOption("fileName");
+ if (fileName == null || fileName.equals("")) {
+ if (baseVersion != null) {
+ String baseFileStr = baseFile.getLocation().toOSString();
+ diffPath =
+ baseFileStr.substring(0, baseFileStr.lastIndexOf(')') + 1) + " to " + (newerVersion != null ? newerVersion.getTransactionNumber() : " deleted") + baseFileStr.substring(baseFileStr.lastIndexOf(')') + 1);
+ } else {
+ String baseFileStr = newerFile.getLocation().toOSString();
+ diffPath =
+ baseFileStr.substring(0, baseFileStr.lastIndexOf('(') + 1) + "new " + baseFileStr.substring(baseFileStr.lastIndexOf('(') + 1);
+ }
+ } else {
+ diffPath =
+ RenderingUtil.getRenderFolder(baseVersion.getBranch(), PresentationType.SPECIALIZED_EDIT).getLocation().toOSString() + '\\' + fileName;
+ }
+
+ VbaWordDiffGenerator diffGenerator = new VbaWordDiffGenerator();
+ diffGenerator.initialize(presentationType == PresentationType.DIFF,
+ presentationType == PresentationType.MERGE_EDIT);
+ if (presentationType == PresentationType.MERGE_EDIT && baseVersion != null) {
+ IFolder folder = RenderingUtil.getRenderFolder(baseVersion.getBranch(), PresentationType.MERGE_EDIT);
+ converter.getRenderer().addFileToWatcher(folder, diffPath.substring(diffPath.lastIndexOf('\\') + 1));
+ diffGenerator.addComparison(baseFile, newerFile, diffPath, true);
+ diffGenerator.finish(diffPath.substring(0, diffPath.lastIndexOf('\\')) + "mergeDocs.vbs", show);
+ } else {
+ if (RenderingUtil.arePopupsAllowed()) {
+ diffGenerator.addComparison(baseFile, newerFile, diffPath, false);
+ diffGenerator.finish(diffPath.substring(0, diffPath.lastIndexOf('\\')) + "/compareDocs.vbs", show);
+ }
+ }
+ return diffPath;
+ }
+
+ @Override
+ public void compareArtifacts(IProgressMonitor monitor, PresentationType presentationType, Collection<ArtifactDelta> itemsToCompare) throws OseeCoreException {
+ for (ArtifactDelta entry : itemsToCompare) {
+ compare(monitor, presentationType, entry, true);
+ }
+ }
+
+ private Pair<String, Boolean> removeAnnotations(Attribute<String> attribute) throws OseeCoreException {
+ Pair<String, Boolean> annotation = null;
+ if (attribute != null) {
+ String value = attribute.getValue();
+ if (WordAnnotationHandler.containsWordAnnotations(value)) {
+ annotation = new Pair<String, Boolean>(value, attribute.isDirty());
+ attribute.setFromString(WordAnnotationHandler.removeAnnotations(value));
+ }
+ }
+ return annotation;
+ }
+
+ private Attribute<String> getWordContent(Artifact artifact, IAttributeType attributeType) throws OseeCoreException {
+ Attribute<String> toReturn = null;
+ if (artifact != null && !artifact.isDeleted()) {
+ toReturn = artifact.getSoleAttribute(attributeType);
+ }
+ return toReturn;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WordChangeReportOperation.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WordChangeReportOperation.java
index d86d4c3d68a..548216fae81 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WordChangeReportOperation.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WordChangeReportOperation.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.render.compare;
-
+package org.eclipse.osee.framework.ui.skynet.render.compare;
+
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@@ -38,128 +38,128 @@ import org.eclipse.osee.framework.ui.skynet.render.RenderingUtil;
import org.eclipse.osee.framework.ui.skynet.render.VbaWordDiffGenerator;
import org.eclipse.osee.framework.ui.skynet.render.WordImageChecker;
import org.eclipse.osee.framework.ui.skynet.util.WordUiUtil;
-
-public final class WordChangeReportOperation extends AbstractOperation {
- private final Collection<ArtifactDelta> artifactsToCompare;
-
- private final String reportDirName;
- private final String fileName;
- private final boolean isSuppressWord;
- private final IAttributeType attributeType;
- private final ArtifactDeltaToFileConverter converter;
- private IFolder changeReportFolder;
-
- public WordChangeReportOperation(Collection<ArtifactDelta> artifactsToCompare, ArtifactDeltaToFileConverter converter, String reportDirName, String fileName, boolean isSuppressWord) {
- super("Word Change Report", SkynetGuiPlugin.PLUGIN_ID);
- this.converter = converter;
- this.artifactsToCompare = artifactsToCompare;
- this.fileName = fileName;
- this.isSuppressWord = isSuppressWord;
- this.reportDirName = Strings.isValid(reportDirName) ? reportDirName : GUID.create();
-
- this.attributeType = CoreAttributeTypes.WORD_TEMPLATE_CONTENT;
- }
-
- private IFolder getChangeReportFolder() throws OseeCoreException {
- if (changeReportFolder == null) {
- RenderingUtil.ensureRenderFolderExists(PresentationType.DIFF);
- changeReportFolder = OseeData.getFolder(".diff/" + reportDirName);
- }
- return changeReportFolder;
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- if (!artifactsToCompare.isEmpty()) {
- double workPercentage = 0.70 / artifactsToCompare.size();
-
- VbaWordDiffGenerator generator = new VbaWordDiffGenerator();
- generator.initialize(false, false);
-
- String baseFileStr = getChangeReportFolder().getLocation().toOSString();
-
- Set<Artifact> artifacts = new HashSet<Artifact>();
- int countSuccessful = 0;
-
- for (ArtifactDelta delta : artifactsToCompare) {
- checkForCancelledStatus(monitor);
-
- try {
- //Remove tracked changes and display image diffs
- Pair<String, Boolean> originalValue = null;
- Pair<String, Boolean> newAnnotationValue = null;
-
- //Check for tracked changes
- artifacts.clear();
- artifacts.addAll(RenderingUtil.checkForTrackedChangesOn(delta.getStartArtifact()));
- artifacts.addAll(RenderingUtil.checkForTrackedChangesOn(delta.getEndArtifact()));
-
- if (!artifacts.isEmpty()) {
- if (RenderingUtil.arePopupsAllowed()) {
- WordUiUtil.displayWarningMessageDialog("Diff Artifacts Warning",
- "Detected tracked changes for some artifacts. Please refer to the results HTML report.");
- WordUiUtil.displayTrackedChangesOnArtifacts(artifacts);
- }
- continue;
- }
-
- Artifact baseArtifact = delta.getStartArtifact();
- Artifact newerArtifact = delta.getEndArtifact();
-
- if (baseArtifact == null && newerArtifact == null) {
- throw new OseeArgumentException("baseVersion and newerVersion can't both be null.");
- }
-
- Attribute<String> baseContent = getWordContent(baseArtifact, attributeType);
- Attribute<String> newerContent = getWordContent(newerArtifact, attributeType);
-
- if (!UserManager.getUser().getBooleanSetting(MsWordPreferencePage.IDENTFY_IMAGE_CHANGES)) {
- originalValue = WordImageChecker.checkForImageDiffs(baseContent, newerContent);
- }
- Pair<IFile, IFile> fileDeltas = converter.convertToFile(PresentationType.DIFF, delta);
-
- WordImageChecker.restoreOriginalValue(baseContent, originalValue);
- WordImageChecker.restoreOriginalValue(newerContent, newAnnotationValue);
-
- monitor.setTaskName("Adding to Diff Script: " + (newerArtifact == null ? "Unnamed Artifact" : newerArtifact.getName()));
-
- String localFileName = fileName != null ? fileName : GUID.create() + ".xml";
- localFileName = baseFileStr + "/" + localFileName;
- generator.addComparison(fileDeltas.getFirst(), fileDeltas.getSecond(), localFileName, false);
-
- countSuccessful++;
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- } finally {
- monitor.worked(calculateWork(workPercentage));
- }
- }
-
- checkForCancelledStatus(monitor);
- if (countSuccessful > 0) {
- monitor.setTaskName("Running Diff Script");
- generator.finish(baseFileStr + "/compareDocs.vbs", !isSuppressWord);
- }
- monitor.worked(calculateWork(0.20));
- checkForCancelledStatus(monitor);
- // Let the user know that these artifacts had tracked changes on and we are not handling them
- // Also, list these artifacts in an artifact explorer
- if (!artifacts.isEmpty() && RenderingUtil.arePopupsAllowed()) {
- WordUiUtil.displayWarningMessageDialog("Diff Artifacts Warning",
- "Detected tracked changes for some artifacts. Please refer to the results HTML report.");
- WordUiUtil.displayTrackedChangesOnArtifacts(artifacts);
- }
- monitor.worked(calculateWork(0.10));
- } else {
- monitor.worked(calculateWork(1.0));
- }
- }
-
- private Attribute<String> getWordContent(Artifact artifact, IAttributeType attributeType) throws OseeCoreException {
- Attribute<String> toReturn = null;
- if (artifact != null && !artifact.isDeleted()) {
- toReturn = artifact.getSoleAttribute(attributeType);
- }
- return toReturn;
- }
+
+public final class WordChangeReportOperation extends AbstractOperation {
+ private final Collection<ArtifactDelta> artifactsToCompare;
+
+ private final String reportDirName;
+ private final String fileName;
+ private final boolean isSuppressWord;
+ private final IAttributeType attributeType;
+ private final ArtifactDeltaToFileConverter converter;
+ private IFolder changeReportFolder;
+
+ public WordChangeReportOperation(Collection<ArtifactDelta> artifactsToCompare, ArtifactDeltaToFileConverter converter, String reportDirName, String fileName, boolean isSuppressWord) {
+ super("Word Change Report", SkynetGuiPlugin.PLUGIN_ID);
+ this.converter = converter;
+ this.artifactsToCompare = artifactsToCompare;
+ this.fileName = fileName;
+ this.isSuppressWord = isSuppressWord;
+ this.reportDirName = Strings.isValid(reportDirName) ? reportDirName : GUID.create();
+
+ this.attributeType = CoreAttributeTypes.WORD_TEMPLATE_CONTENT;
+ }
+
+ private IFolder getChangeReportFolder() throws OseeCoreException {
+ if (changeReportFolder == null) {
+ RenderingUtil.ensureRenderFolderExists(PresentationType.DIFF);
+ changeReportFolder = OseeData.getFolder(".diff/" + reportDirName);
+ }
+ return changeReportFolder;
+ }
+
+ @Override
+ protected void doWork(IProgressMonitor monitor) throws Exception {
+ if (!artifactsToCompare.isEmpty()) {
+ double workPercentage = 0.70 / artifactsToCompare.size();
+
+ VbaWordDiffGenerator generator = new VbaWordDiffGenerator();
+ generator.initialize(false, false);
+
+ String baseFileStr = getChangeReportFolder().getLocation().toOSString();
+
+ Set<Artifact> artifacts = new HashSet<Artifact>();
+ int countSuccessful = 0;
+
+ for (ArtifactDelta delta : artifactsToCompare) {
+ checkForCancelledStatus(monitor);
+
+ try {
+ //Remove tracked changes and display image diffs
+ Pair<String, Boolean> originalValue = null;
+ Pair<String, Boolean> newAnnotationValue = null;
+
+ //Check for tracked changes
+ artifacts.clear();
+ artifacts.addAll(RenderingUtil.checkForTrackedChangesOn(delta.getStartArtifact()));
+ artifacts.addAll(RenderingUtil.checkForTrackedChangesOn(delta.getEndArtifact()));
+
+ if (!artifacts.isEmpty()) {
+ if (RenderingUtil.arePopupsAllowed()) {
+ WordUiUtil.displayWarningMessageDialog("Diff Artifacts Warning",
+ "Detected tracked changes for some artifacts. Please refer to the results HTML report.");
+ WordUiUtil.displayTrackedChangesOnArtifacts(artifacts);
+ }
+ continue;
+ }
+
+ Artifact baseArtifact = delta.getStartArtifact();
+ Artifact newerArtifact = delta.getEndArtifact();
+
+ if (baseArtifact == null && newerArtifact == null) {
+ throw new OseeArgumentException("baseVersion and newerVersion can't both be null.");
+ }
+
+ Attribute<String> baseContent = getWordContent(baseArtifact, attributeType);
+ Attribute<String> newerContent = getWordContent(newerArtifact, attributeType);
+
+ if (!UserManager.getUser().getBooleanSetting(MsWordPreferencePage.IDENTFY_IMAGE_CHANGES)) {
+ originalValue = WordImageChecker.checkForImageDiffs(baseContent, newerContent);
+ }
+ Pair<IFile, IFile> fileDeltas = converter.convertToFile(PresentationType.DIFF, delta);
+
+ WordImageChecker.restoreOriginalValue(baseContent, originalValue);
+ WordImageChecker.restoreOriginalValue(newerContent, newAnnotationValue);
+
+ monitor.setTaskName("Adding to Diff Script: " + (newerArtifact == null ? "Unnamed Artifact" : newerArtifact.getName()));
+
+ String localFileName = fileName != null ? fileName : GUID.create() + ".xml";
+ localFileName = baseFileStr + "/" + localFileName;
+ generator.addComparison(fileDeltas.getFirst(), fileDeltas.getSecond(), localFileName, false);
+
+ countSuccessful++;
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ } finally {
+ monitor.worked(calculateWork(workPercentage));
+ }
+ }
+
+ checkForCancelledStatus(monitor);
+ if (countSuccessful > 0) {
+ monitor.setTaskName("Running Diff Script");
+ generator.finish(baseFileStr + "/compareDocs.vbs", !isSuppressWord);
+ }
+ monitor.worked(calculateWork(0.20));
+ checkForCancelledStatus(monitor);
+ // Let the user know that these artifacts had tracked changes on and we are not handling them
+ // Also, list these artifacts in an artifact explorer
+ if (!artifacts.isEmpty() && RenderingUtil.arePopupsAllowed()) {
+ WordUiUtil.displayWarningMessageDialog("Diff Artifacts Warning",
+ "Detected tracked changes for some artifacts. Please refer to the results HTML report.");
+ WordUiUtil.displayTrackedChangesOnArtifacts(artifacts);
+ }
+ monitor.worked(calculateWork(0.10));
+ } else {
+ monitor.worked(calculateWork(1.0));
+ }
+ }
+
+ private Attribute<String> getWordContent(Artifact artifact, IAttributeType attributeType) throws OseeCoreException {
+ Attribute<String> toReturn = null;
+ if (artifact != null && !artifact.isDeleted()) {
+ toReturn = artifact.getSoleAttribute(attributeType);
+ }
+ return toReturn;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WordTemplateCompare.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WordTemplateCompare.java
index 7832563553d..3da162609b3 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WordTemplateCompare.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/compare/WordTemplateCompare.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.render.compare;
-
+package org.eclipse.osee.framework.ui.skynet.render.compare;
+
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@@ -35,117 +35,117 @@ import org.eclipse.osee.framework.ui.skynet.render.RenderingUtil;
import org.eclipse.osee.framework.ui.skynet.render.VbaWordDiffGenerator;
import org.eclipse.osee.framework.ui.skynet.render.WordImageChecker;
import org.eclipse.osee.framework.ui.skynet.util.WordUiUtil;
-
-public class WordTemplateCompare implements IComparator {
- private static final IAttributeType ATTRIBUTE_TYPE = CoreAttributeTypes.WORD_TEMPLATE_CONTENT;
-
- private final ArtifactDeltaToFileConverter converter;
-
- public WordTemplateCompare(FileSystemRenderer renderer) {
- this.converter = new ArtifactDeltaToFileConverter(renderer);
- }
-
- @Override
- public String compare(IProgressMonitor monitor, PresentationType presentationType, ArtifactDelta delta, boolean show) throws OseeCoreException {
- Pair<String, Boolean> originalValue = null;
- Pair<String, Boolean> newAnnotationValue = null;
-
- Artifact baseArtifact = delta.getStartArtifact();
- Artifact newerArtifact = delta.getEndArtifact();
-
- //Check for tracked changes
- Set<Artifact> artifacts = new HashSet<Artifact>();
- artifacts.addAll(RenderingUtil.checkForTrackedChangesOn(baseArtifact));
- artifacts.addAll(RenderingUtil.checkForTrackedChangesOn(newerArtifact));
-
- if (!artifacts.isEmpty()) {
- if (RenderingUtil.arePopupsAllowed()) {
- WordUiUtil.displayWarningMessageDialog("Diff Artifacts Warning",
- "Detected tracked changes for some artifacts. Please refer to the results HTML report.");
- WordUiUtil.displayTrackedChangesOnArtifacts(artifacts);
- }
- } else {
-
- if (baseArtifact == null && newerArtifact == null) {
- throw new OseeArgumentException("baseVersion and newerVersion can't both be null.");
- }
-
- Attribute<String> baseContent = getWordContent(baseArtifact, ATTRIBUTE_TYPE);
- Attribute<String> newerContent = getWordContent(newerArtifact, ATTRIBUTE_TYPE);
-
- if (!UserManager.getUser().getBooleanSetting(MsWordPreferencePage.IDENTFY_IMAGE_CHANGES)) {
- originalValue = WordImageChecker.checkForImageDiffs(baseContent, newerContent);
- }
-
- Pair<IFile, IFile> compareFiles = converter.convertToFile(presentationType, delta);
-
- WordImageChecker.restoreOriginalValue(baseContent, originalValue);
- WordImageChecker.restoreOriginalValue(newerContent, newAnnotationValue);
-
- return compare(baseArtifact, newerArtifact, compareFiles.getFirst(), compareFiles.getSecond(),
- presentationType, show);
- }
- return "";
- }
-
- @Override
- public String compare(Artifact baseVersion, Artifact newerVersion, IFile baseFile, IFile newerFile, PresentationType presentationType, boolean show) throws OseeCoreException {
- String diffPath;
-
- String fileName = converter.getRenderer().getStringOption("fileName");
- if (!Strings.isValid(fileName)) {
- if (baseVersion != null) {
- String baseFileStr = baseFile.getLocation().toOSString();
- diffPath =
- baseFileStr.substring(0, baseFileStr.lastIndexOf(')') + 1) + " to " + (newerVersion != null ? newerVersion.getTransactionNumber() : " deleted") + baseFileStr.substring(baseFileStr.lastIndexOf(')') + 1);
- } else {
- String baseFileStr = newerFile.getLocation().toOSString();
- diffPath =
- baseFileStr.substring(0, baseFileStr.lastIndexOf('(') + 1) + "new " + baseFileStr.substring(baseFileStr.lastIndexOf('(') + 1);
- }
- } else {
- IFolder folder = RenderingUtil.getRenderFolder(baseVersion.getBranch(), PresentationType.MERGE_EDIT);
- diffPath = folder.getLocation().toOSString() + '\\' + fileName;
- }
-
- VbaWordDiffGenerator diffGenerator = new VbaWordDiffGenerator();
- diffGenerator.initialize(presentationType == PresentationType.DIFF,
- presentationType == PresentationType.MERGE_EDIT);
-
- if (presentationType == PresentationType.MERGE_EDIT && baseVersion != null) {
- IFolder folder = RenderingUtil.getRenderFolder(baseVersion.getBranch(), PresentationType.MERGE_EDIT);
- converter.getRenderer().addFileToWatcher(folder, diffPath.substring(diffPath.lastIndexOf('\\') + 1));
- diffGenerator.addComparison(baseFile, newerFile, diffPath, true);
- diffGenerator.finish(diffPath.substring(0, diffPath.lastIndexOf('\\')) + "mergeDocs.vbs", show);
- } else {
- if (RenderingUtil.arePopupsAllowed()) {
- diffGenerator.addComparison(baseFile, newerFile, diffPath, false);
- diffGenerator.finish(diffPath.substring(0, diffPath.lastIndexOf('\\')) + "/compareDocs.vbs", show);
- }
- }
- return diffPath;
- }
-
- private Attribute<String> getWordContent(Artifact artifact, IAttributeType attributeType) throws OseeCoreException {
- Attribute<String> toReturn = null;
- if (artifact != null && !artifact.isDeleted()) {
- toReturn = artifact.getSoleAttribute(attributeType);
- }
- return toReturn;
- }
-
- /**
- * Creates a difference report for each artifact between baseArtifact and newerArtifact. Then produces a single
- * report by combining each of the difference reports together for a single report.
- */
- @Override
- public void compareArtifacts(IProgressMonitor monitor, PresentationType presentationType, Collection<ArtifactDelta> artifactsToCompare) throws OseeCoreException {
- String fileName = converter.getRenderer().getStringOption("fileName");
- String reportDirName = converter.getRenderer().getStringOption("diffReportFolderName");
- boolean isSuppressWord = converter.getRenderer().getBooleanOption("suppressWord");
-
- IOperation operation =
- new WordChangeReportOperation(artifactsToCompare, converter, reportDirName, fileName, isSuppressWord);
- Operations.executeWorkAndCheckStatus(operation, monitor, 1.0);
- }
-}
+
+public class WordTemplateCompare implements IComparator {
+ private static final IAttributeType ATTRIBUTE_TYPE = CoreAttributeTypes.WORD_TEMPLATE_CONTENT;
+
+ private final ArtifactDeltaToFileConverter converter;
+
+ public WordTemplateCompare(FileSystemRenderer renderer) {
+ this.converter = new ArtifactDeltaToFileConverter(renderer);
+ }
+
+ @Override
+ public String compare(IProgressMonitor monitor, PresentationType presentationType, ArtifactDelta delta, boolean show) throws OseeCoreException {
+ Pair<String, Boolean> originalValue = null;
+ Pair<String, Boolean> newAnnotationValue = null;
+
+ Artifact baseArtifact = delta.getStartArtifact();
+ Artifact newerArtifact = delta.getEndArtifact();
+
+ //Check for tracked changes
+ Set<Artifact> artifacts = new HashSet<Artifact>();
+ artifacts.addAll(RenderingUtil.checkForTrackedChangesOn(baseArtifact));
+ artifacts.addAll(RenderingUtil.checkForTrackedChangesOn(newerArtifact));
+
+ if (!artifacts.isEmpty()) {
+ if (RenderingUtil.arePopupsAllowed()) {
+ WordUiUtil.displayWarningMessageDialog("Diff Artifacts Warning",
+ "Detected tracked changes for some artifacts. Please refer to the results HTML report.");
+ WordUiUtil.displayTrackedChangesOnArtifacts(artifacts);
+ }
+ } else {
+
+ if (baseArtifact == null && newerArtifact == null) {
+ throw new OseeArgumentException("baseVersion and newerVersion can't both be null.");
+ }
+
+ Attribute<String> baseContent = getWordContent(baseArtifact, ATTRIBUTE_TYPE);
+ Attribute<String> newerContent = getWordContent(newerArtifact, ATTRIBUTE_TYPE);
+
+ if (!UserManager.getUser().getBooleanSetting(MsWordPreferencePage.IDENTFY_IMAGE_CHANGES)) {
+ originalValue = WordImageChecker.checkForImageDiffs(baseContent, newerContent);
+ }
+
+ Pair<IFile, IFile> compareFiles = converter.convertToFile(presentationType, delta);
+
+ WordImageChecker.restoreOriginalValue(baseContent, originalValue);
+ WordImageChecker.restoreOriginalValue(newerContent, newAnnotationValue);
+
+ return compare(baseArtifact, newerArtifact, compareFiles.getFirst(), compareFiles.getSecond(),
+ presentationType, show);
+ }
+ return "";
+ }
+
+ @Override
+ public String compare(Artifact baseVersion, Artifact newerVersion, IFile baseFile, IFile newerFile, PresentationType presentationType, boolean show) throws OseeCoreException {
+ String diffPath;
+
+ String fileName = converter.getRenderer().getStringOption("fileName");
+ if (!Strings.isValid(fileName)) {
+ if (baseVersion != null) {
+ String baseFileStr = baseFile.getLocation().toOSString();
+ diffPath =
+ baseFileStr.substring(0, baseFileStr.lastIndexOf(')') + 1) + " to " + (newerVersion != null ? newerVersion.getTransactionNumber() : " deleted") + baseFileStr.substring(baseFileStr.lastIndexOf(')') + 1);
+ } else {
+ String baseFileStr = newerFile.getLocation().toOSString();
+ diffPath =
+ baseFileStr.substring(0, baseFileStr.lastIndexOf('(') + 1) + "new " + baseFileStr.substring(baseFileStr.lastIndexOf('(') + 1);
+ }
+ } else {
+ IFolder folder = RenderingUtil.getRenderFolder(baseVersion.getBranch(), PresentationType.MERGE_EDIT);
+ diffPath = folder.getLocation().toOSString() + '\\' + fileName;
+ }
+
+ VbaWordDiffGenerator diffGenerator = new VbaWordDiffGenerator();
+ diffGenerator.initialize(presentationType == PresentationType.DIFF,
+ presentationType == PresentationType.MERGE_EDIT);
+
+ if (presentationType == PresentationType.MERGE_EDIT && baseVersion != null) {
+ IFolder folder = RenderingUtil.getRenderFolder(baseVersion.getBranch(), PresentationType.MERGE_EDIT);
+ converter.getRenderer().addFileToWatcher(folder, diffPath.substring(diffPath.lastIndexOf('\\') + 1));
+ diffGenerator.addComparison(baseFile, newerFile, diffPath, true);
+ diffGenerator.finish(diffPath.substring(0, diffPath.lastIndexOf('\\')) + "mergeDocs.vbs", show);
+ } else {
+ if (RenderingUtil.arePopupsAllowed()) {
+ diffGenerator.addComparison(baseFile, newerFile, diffPath, false);
+ diffGenerator.finish(diffPath.substring(0, diffPath.lastIndexOf('\\')) + "/compareDocs.vbs", show);
+ }
+ }
+ return diffPath;
+ }
+
+ private Attribute<String> getWordContent(Artifact artifact, IAttributeType attributeType) throws OseeCoreException {
+ Attribute<String> toReturn = null;
+ if (artifact != null && !artifact.isDeleted()) {
+ toReturn = artifact.getSoleAttribute(attributeType);
+ }
+ return toReturn;
+ }
+
+ /**
+ * Creates a difference report for each artifact between baseArtifact and newerArtifact. Then produces a single
+ * report by combining each of the difference reports together for a single report.
+ */
+ @Override
+ public void compareArtifacts(IProgressMonitor monitor, PresentationType presentationType, Collection<ArtifactDelta> artifactsToCompare) throws OseeCoreException {
+ String fileName = converter.getRenderer().getStringOption("fileName");
+ String reportDirName = converter.getRenderer().getStringOption("diffReportFolderName");
+ boolean isSuppressWord = converter.getRenderer().getBooleanOption("suppressWord");
+
+ IOperation operation =
+ new WordChangeReportOperation(artifactsToCompare, converter, reportDirName, fileName, isSuppressWord);
+ Operations.executeWorkAndCheckStatus(operation, monitor, 1.0);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/AttributeElement.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/AttributeElement.java
index 9b64a881de9..c7194216039 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/AttributeElement.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/AttributeElement.java
@@ -1,77 +1,77 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.render.word;
-
-import java.util.logging.Level;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.word.WordUtil;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-
-/**
- * @author Jeff C. Phillips
- */
-public class AttributeElement {
- private static final Pattern internalAttributeElementsPattern =
- Pattern.compile("<((\\w+:)?(Label|Outline|Name|Format|Editable))>(.*?)</\\1>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
- private String outlineNumber;
- private String label;
- private String attributeName;
- private String format;
-
- public AttributeElement(String element) {
- Matcher matcher = internalAttributeElementsPattern.matcher(element);
-
- this.outlineNumber = "";
- this.label = "";
- this.attributeName = "";
- this.format = "";
-
- while (matcher.find()) {
- String elementType = matcher.group(3);
- String value = matcher.group(4).trim();
- if (elementType.equals("Outline")) {
- value = WordUtil.textOnly(value);
- if (value.length() > 0) {
- outlineNumber = value;
- } else {
- outlineNumber = "1.0";
- }
- } else if (elementType.equals("Label")) {
- label = value;
- } else if (elementType.equals("Name")) {
- attributeName = WordUtil.textOnly(value);
- } else if (elementType.equals("Format")) {
- format = value;
- } else {
- OseeLog.log(SkynetGuiPlugin.class, Level.WARNING, "Unexpected element read in Attribute:" + elementType);
- }
- }
- }
-
- public String getAttributeName() {
- return attributeName;
- }
-
- public String getFormat() {
- return format;
- }
-
- public String getLabel() {
- return label;
- }
-
- public String getOutlineNumber() {
- return outlineNumber;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.render.word;
+
+import java.util.logging.Level;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.word.WordUtil;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class AttributeElement {
+ private static final Pattern internalAttributeElementsPattern =
+ Pattern.compile("<((\\w+:)?(Label|Outline|Name|Format|Editable))>(.*?)</\\1>",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
+ private String outlineNumber;
+ private String label;
+ private String attributeName;
+ private String format;
+
+ public AttributeElement(String element) {
+ Matcher matcher = internalAttributeElementsPattern.matcher(element);
+
+ this.outlineNumber = "";
+ this.label = "";
+ this.attributeName = "";
+ this.format = "";
+
+ while (matcher.find()) {
+ String elementType = matcher.group(3);
+ String value = matcher.group(4).trim();
+ if (elementType.equals("Outline")) {
+ value = WordUtil.textOnly(value);
+ if (value.length() > 0) {
+ outlineNumber = value;
+ } else {
+ outlineNumber = "1.0";
+ }
+ } else if (elementType.equals("Label")) {
+ label = value;
+ } else if (elementType.equals("Name")) {
+ attributeName = WordUtil.textOnly(value);
+ } else if (elementType.equals("Format")) {
+ format = value;
+ } else {
+ OseeLog.log(SkynetGuiPlugin.class, Level.WARNING, "Unexpected element read in Attribute:" + elementType);
+ }
+ }
+ }
+
+ public String getAttributeName() {
+ return attributeName;
+ }
+
+ public String getFormat() {
+ return format;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public String getOutlineNumber() {
+ return outlineNumber;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/Producer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/Producer.java
index 351d8f01bb6..5b136041146 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/Producer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/Producer.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.framework.ui.skynet.render.word;
-
-/**
- * @author Jeff C. Phillips
- */
-public class Producer {
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.render.word;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class Producer {
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordChangeReportOperation.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordChangeReportOperation.java
index f1c09944899..eef3ee0cc53 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordChangeReportOperation.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordChangeReportOperation.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.render.word;
-
+package org.eclipse.osee.framework.ui.skynet.render.word;
+
import java.util.Collection;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
@@ -21,29 +21,29 @@ import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
import org.eclipse.osee.framework.ui.skynet.render.WordTemplateRenderer;
-
-public class WordChangeReportOperation extends AbstractOperation {
- private final Collection<Change> changes;
- private final boolean suppressWord;
- private final String diffReportFolderName;
-
- public WordChangeReportOperation(Collection<Change> changes, boolean suppressWord, String diffReportFolderName) {
- super("Word Change Report", SkynetGuiPlugin.PLUGIN_ID);
- this.changes = changes;
- this.suppressWord = suppressWord;
- this.diffReportFolderName = diffReportFolderName;
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws OseeCoreException {
- VariableMap variableMap = new VariableMap();
- variableMap.setValue("suppressWord", suppressWord);
- variableMap.setValue("diffReportFolderName", diffReportFolderName);
-
- Collection<ArtifactDelta> compareArtifacts = ChangeManager.getCompareArtifacts(changes);
-
- WordTemplateRenderer renderer = new WordTemplateRenderer();
- renderer.setOptions(variableMap);
- renderer.getComparator().compareArtifacts(monitor, PresentationType.DIFF, compareArtifacts);
- }
+
+public class WordChangeReportOperation extends AbstractOperation {
+ private final Collection<Change> changes;
+ private final boolean suppressWord;
+ private final String diffReportFolderName;
+
+ public WordChangeReportOperation(Collection<Change> changes, boolean suppressWord, String diffReportFolderName) {
+ super("Word Change Report", SkynetGuiPlugin.PLUGIN_ID);
+ this.changes = changes;
+ this.suppressWord = suppressWord;
+ this.diffReportFolderName = diffReportFolderName;
+ }
+
+ @Override
+ protected void doWork(IProgressMonitor monitor) throws OseeCoreException {
+ VariableMap variableMap = new VariableMap();
+ variableMap.setValue("suppressWord", suppressWord);
+ variableMap.setValue("diffReportFolderName", diffReportFolderName);
+
+ Collection<ArtifactDelta> compareArtifacts = ChangeManager.getCompareArtifacts(changes);
+
+ WordTemplateRenderer renderer = new WordTemplateRenderer();
+ renderer.setOptions(variableMap);
+ renderer.getComparator().compareArtifacts(monitor, PresentationType.DIFF, compareArtifacts);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordMLProducer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordMLProducer.java
index 5f191808e26..283320deeb5 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordMLProducer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordMLProducer.java
@@ -1,359 +1,359 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.render.word;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.core.exception.OseeWrappedException;
-import org.eclipse.osee.framework.jdk.core.util.xml.Xml;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-
-/**
- * @author Ryan D. Brooks
- */
-public class WordMLProducer extends Producer {
- public static final String RGB_RED = "FF0000";
- public static final String RGB_GREEN = "00FF00";
- public static final String RGB_BLUE = "0000FF";
-
- private static final String FILE_NAME = "fileName";
-
- public static final String LISTNUM_FIELD_HEAD = "<w:pPr><w:rPr><w:vanish/></w:rPr></w:pPr>";
- public static final String LISTNUM_FIELD_TAIL =
- "<w:r><w:rPr><w:vanish/></w:rPr><w:fldChar w:fldCharType=\"begin\"/></w:r><w:r><w:rPr><w:vanish/></w:rPr><w:instrText>LISTNUM\"listreset\"\\l1\\s0</w:instrText></w:r><w:r><w:rPr><w:vanish/></w:rPr><w:fldChar w:fldCharType=\"end\"/><wx:t wx:val=\"1.\"/></w:r>";
-
- //This regular expression pulls out all of the stuff after the inserted listnum reordering stuff. This needs to be
- //here so that we remove unwanted template information from single editing
- public static final String LISTNUM_FIELD_TAIL_REG_EXP =
- "<w:r(>| .*?>)<w:rPr><w:vanish/></w:rPr><w:fldChar w:fldCharType=\"begin\"/></w:r><w:r(>| .*?>)<w:rPr><w:vanish/></w:rPr><w:instrText> LISTNUM \"listreset\"";
- public static final String LISTNUM_FIELD = LISTNUM_FIELD_HEAD + LISTNUM_FIELD_TAIL;
- private static final String SUB_DOC =
- "<wx:sect><w:p><w:pPr><w:sectPr><w:pgSz w:w=\"12240\" w:h=\"15840\"/><w:pgMar w:top=\"1440\" w:right=\"1800\" w:bottom=\"1440\" w:left=\"1800\" w:header=\"720\" w:footer=\"720\" w:gutter=\"0\"/><w:cols w:space=\"720\"/><w:docGrid w:line-pitch=\"360\"/></w:sectPr></w:pPr></w:p><w:subDoc w:link=\"" + FILE_NAME + "\"/></wx:sect><wx:sect><wx:sub-section><w:p><w:pPr><w:pStyle w:val=\"Heading1\"/></w:pPr></w:p><w:sectPr><w:type w:val=\"continuous\"/><w:pgSz w:w=\"12240\" w:h=\"15840\"/><w:pgMar w:top=\"1440\" w:right=\"1800\" w:bottom=\"1440\" w:left=\"1800\" w:header=\"720\" w:footer=\"720\" w:gutter=\"0\"/><w:cols w:space=\"720\"/><w:docGrid w:line-pitch=\"360\"/></w:sectPr></wx:sub-section></wx:sect>";
- private static final String HYPER_LINK_DOC =
- "<w:p><w:hlink w:dest=\"fileName\"><w:r wsp:rsidRPr=\"00CE6681\"><w:rPr><w:rStyle w:val=\"Hyperlink\"/></w:rPr><w:t>fileName</w:t></w:r></w:hlink></w:p>";
- private final Appendable strB;
- private final int[] outlineNumber;
- private int outlineLevel;
- private int flattenedLevelCount;
- private boolean previousPageLandsacpe;
- private final Map<String, Integer> alphabetMap;
-
- public WordMLProducer(Appendable strB) {
- this.strB = strB;
- this.outlineNumber = new int[10]; // word supports 9 levels of outlining; index this array from 1 to 9
- this.outlineLevel = 0;
- this.flattenedLevelCount = 0;
-
- this.alphabetMap = new HashMap<String, Integer>();
-
- alphabetMap.put("A.0", 1);
- alphabetMap.put("B.0", 2);
- alphabetMap.put("C.0", 3);
- }
-
- public CharSequence startOutlineSubSection(CharSequence font, CharSequence headingText, String outlineType) throws OseeCoreException {
- if (okToStartSubsection()) {
- outlineNumber[++outlineLevel]++;
- CharSequence paragraphNumber = getOutlineNumber();
- startOutlineSubSection((outlineType != null ? outlineType : "Heading") + outlineLevel, paragraphNumber, font,
- headingText);
-
- return paragraphNumber;
- } else {
- flattenedLevelCount++;
- endOutlineSubSection(true);
- OseeLog.log(SkynetGuiPlugin.class, Level.WARNING, "Outline level flattened, outline can only go 9 levels deep");
- return startOutlineSubSection(font, headingText, outlineType);
- }
- };
-
- private void append(CharSequence value) throws OseeCoreException {
- try {
- strB.append(value);
- } catch (IOException ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- }
-
- public void startOutlineSubSection(CharSequence style, CharSequence outlineNumber, CharSequence font, CharSequence headingText) throws OseeCoreException {
- append("<wx:sub-section>");
- append("<w:p><w:pPr><w:pStyle w:val=\"");
- append(style);
- append("\"/><w:listPr><wx:t wx:val=\"");
- append(outlineNumber);
- append("\" wx:wTabBefore=\"540\" wx:wTabAfter=\"90\"/><wx:font wx:val=\"");
- append(font);
- append("\"/></w:listPr></w:pPr><w:r><w:t>");
- append(Xml.escape(headingText));
- append("</w:t></w:r></w:p>");
- }
-
- public String setHeadingNumbers(String outlineNumber, String template, String outlineType) {
- boolean appendixOutlineType = outlineType != null && outlineType.equalsIgnoreCase("APPENDIX");
- if (outlineNumber == null) {
- return template;
- }
-
- if (appendixOutlineType) {
- // Example of appendix number: A.0
- char[] chars = outlineNumber.toCharArray();
- template = setAppendixStartLetter(chars[0], template);
- } else {
- int index = 1;
- String[] numbers = outlineNumber.split("\\.");
-
- for (String number : numbers) {
- Matcher matcher =
- Pattern.compile(String.format("<w:start w:val=\"(\\d*?)\"/><w:pStyle w:val=\"Heading%d\"/>", index)).matcher(
- "");
- matcher.reset(template);
- template =
- matcher.replaceAll(String.format("<w:start w:val=\"%s\"/><w:pStyle w:val=\"Heading%d\"/>", number,
- index));
- index++;
- }
- }
- if (!appendixOutlineType) {
- setNextParagraphNumberTo(outlineNumber);
- }
- return template;
- }
-
- public String setAppendixStartLetter(char chr, String template) {
- template =
- template.replace(
- "<w:start w:val=\"1\"/><w:nfc w:val=\"3\"/><w:pStyle w:val=\"APPENDIX1\"/>",
- "<w:start w:val=\"" + (Character.toLowerCase(chr) - 'a' + 1) + "\"/><w:nfc w:val=\"3\"/><w:pStyle w:val=\"APPENDIX1\"/>");
- return template;
- }
-
- public void endOutlineSubSection() throws OseeCoreException {
- endOutlineSubSection(false);
- }
-
- private void endOutlineSubSection(boolean force) throws OseeCoreException {
- if (!force && flattenedLevelCount > 0) {
- flattenedLevelCount--;
- } else {
- append("</wx:sub-section>");
- if (outlineLevel + 1 < outlineNumber.length) {
- outlineNumber[outlineLevel + 1] = 0;
- }
- outlineLevel--;
- }
- }
-
- public void addWordMl(CharSequence wordMl) throws OseeCoreException {
- append(wordMl);
- }
-
- public void startParagraph() throws OseeCoreException {
- append("<w:p>");
- }
-
- public void startSection() throws OseeCoreException {
- append("<wx:sect>");
- }
-
- public void endSection() throws OseeCoreException {
- append("</wx:sect>");
- }
-
- public void createSubDoc(String fileName) throws OseeCoreException {
- if (fileName == null || fileName.length() == 0) {
- throw new IllegalArgumentException("The file name can not be null or empty.");
- }
-
- append(SUB_DOC.replace(FILE_NAME, fileName));
- }
-
- public void createHyperLinkDoc(String fileName) throws OseeCoreException {
- if (fileName == null || fileName.length() == 0) {
- throw new IllegalArgumentException("The file name can not be null or empty.");
- }
-
- append(HYPER_LINK_DOC.replace(FILE_NAME, fileName));
- }
-
- public void resetListValue() throws OseeCoreException {
- // extra paragraph needed to support WORD's bug to add in a trailing zero when using field codes
- startParagraph();
- endParagraph();
- startParagraph();
- //The listnum also acts a template delimiter to know when to remove unwanted content.
- addWordMl(LISTNUM_FIELD);
- endParagraph();
- }
-
- public void endParagraph() throws OseeCoreException {
- append("</w:p>");
- }
-
- public void startTable() throws OseeCoreException {
- append("<wx:sub-section><w:tbl>");
- }
-
- public void endTable() throws OseeCoreException {
- append("</w:tbl></wx:sub-section>");
- }
-
- public void startTableRow() throws OseeCoreException {
- append("<w:tr>");
- }
-
- public void endTableRow() throws OseeCoreException {
- append("</w:tr>");
- }
-
- public void startTableColumn() throws OseeCoreException {
- append("<w:tc>");
- }
-
- public void endTableColumn() throws OseeCoreException {
- append("</w:tc>");
- }
-
- public void addTableColumns(String... datas) throws OseeCoreException {
- for (String data : datas) {
- startTableColumn();
- addParagraph(data);
- endTableColumn();
- }
- }
-
- public void addTableRow(String... datas) throws OseeCoreException {
- startTableRow();
- addTableColumns(datas);
- endTableRow();
- }
-
- public void addParagraphNoEscape(CharSequence text) throws OseeCoreException {
- append("<w:p><w:r><w:t>");
- append(text);
- append("</w:t></w:r></w:p>");
- }
-
- public void addParagraph(CharSequence text) throws OseeCoreException {
- append("<w:p><w:r><w:t>");
- append(Xml.escape(text));
- append("</w:t></w:r></w:p>");
- }
-
- public void addParagraphBold(CharSequence text) throws OseeCoreException {
- append("<w:p><w:r><w:rPr><w:b/></w:rPr><w:t>");
- append(Xml.escape(text));
- append("</w:t><w:rPr><w:b/></w:rPr></w:r></w:p>");
- }
-
- /**
- * This method will escape the provided text.
- *
- * @param text
- * @throws OseeWrappedException
- */
- public void addTextInsideParagraph(CharSequence text) throws OseeCoreException {
- append("<w:r><w:t>");
- append(Xml.escape(text));
- append("</w:t></w:r>");
- }
-
- public void addTextInsideParagraph(CharSequence text, String rgbHexColor) throws OseeCoreException {
- if (rgbHexColor == null) {
- throw new IllegalArgumentException("rgbHexColor can not be null");
- }
- if (rgbHexColor.length() != 6) {
- throw new IllegalArgumentException("rgbHexColor should be a hex string 6 characters long");
- }
-
- append("<w:r><w:rPr><w:color w:val=\"");
- append(rgbHexColor);
- append("\"/></w:rPr>");
- append("<w:t>");
- append(Xml.escape(text));
- append("</w:t></w:r>");
- }
-
- public void addOleData(CharSequence oleData) throws OseeCoreException {
- append("<w:docOleData>");
- append(oleData);
- append("</w:docOleData>");
- }
-
- private CharSequence getOutlineNumber() throws OseeCoreException {
- StringBuilder strB = new StringBuilder();
- for (int i = 1; i < outlineLevel; i++) {
- strB.append(String.valueOf(outlineNumber[i]));
- strB.append(".");
- }
- strB.append(String.valueOf(outlineNumber[outlineLevel]));
- return strB;
- }
-
- public boolean okToStartSubsection() {
- return outlineLevel < 9;
- }
-
- /**
- * @param nextOutlineNumber
- */
- public void setNextParagraphNumberTo(String nextOutlineNumber) {
- String[] nextOutlineNumbers = nextOutlineNumber.split("\\.");
- Arrays.fill(outlineNumber, 0);
-
- try {
- for (int i = 0; i < nextOutlineNumbers.length; i++) {
-
- outlineNumber[i + 1] = Integer.parseInt(nextOutlineNumbers[i]);
- }
- outlineNumber[nextOutlineNumbers.length]--;
- outlineLevel = nextOutlineNumbers.length - 1;
- } catch (NumberFormatException ex) {
- //Do nothing
- }
- }
-
- /**
- * Sets the page layout to either portrait/landscape depending on the artifacts pageType attribute value. Note: This
- * call should be done after processing each artifact so if a previous artifact was landscaped the following artifact
- * would be set back to portrait.
- *
- * @throws OseeCoreException
- */
- public void setPageLayout(Artifact artifact) throws OseeCoreException {
- String pageTypeValue = null;
- if (artifact.isAttributeTypeValid("Page Type")) {
- pageTypeValue = artifact.getSoleAttributeValue("Page Type", "Portrait");
- }
-
- boolean landscape = pageTypeValue != null && pageTypeValue.equals("Landscape");
-
- if (landscape || previousPageLandsacpe) {
- append("<w:p>");
- append("<w:pPr>");
- append("<w:sectPr>");
- append(landscape ? "<w:pgSz w:w=\"15840\" w:h=\"12240\" w:orient=\"landscape\" w:code=\"1\" />" : "<w:pgSz w:w=\"12240\" w:h=\"15840\" w:code=\"1\" />");
- append("</w:sectPr>");
- append("</w:pPr>");
- append("</w:p>");
-
- previousPageLandsacpe = landscape;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.render.word;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeExceptions;
+import org.eclipse.osee.framework.core.exception.OseeWrappedException;
+import org.eclipse.osee.framework.jdk.core.util.xml.Xml;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public class WordMLProducer extends Producer {
+ public static final String RGB_RED = "FF0000";
+ public static final String RGB_GREEN = "00FF00";
+ public static final String RGB_BLUE = "0000FF";
+
+ private static final String FILE_NAME = "fileName";
+
+ public static final String LISTNUM_FIELD_HEAD = "<w:pPr><w:rPr><w:vanish/></w:rPr></w:pPr>";
+ public static final String LISTNUM_FIELD_TAIL =
+ "<w:r><w:rPr><w:vanish/></w:rPr><w:fldChar w:fldCharType=\"begin\"/></w:r><w:r><w:rPr><w:vanish/></w:rPr><w:instrText>LISTNUM\"listreset\"\\l1\\s0</w:instrText></w:r><w:r><w:rPr><w:vanish/></w:rPr><w:fldChar w:fldCharType=\"end\"/><wx:t wx:val=\"1.\"/></w:r>";
+
+ //This regular expression pulls out all of the stuff after the inserted listnum reordering stuff. This needs to be
+ //here so that we remove unwanted template information from single editing
+ public static final String LISTNUM_FIELD_TAIL_REG_EXP =
+ "<w:r(>| .*?>)<w:rPr><w:vanish/></w:rPr><w:fldChar w:fldCharType=\"begin\"/></w:r><w:r(>| .*?>)<w:rPr><w:vanish/></w:rPr><w:instrText> LISTNUM \"listreset\"";
+ public static final String LISTNUM_FIELD = LISTNUM_FIELD_HEAD + LISTNUM_FIELD_TAIL;
+ private static final String SUB_DOC =
+ "<wx:sect><w:p><w:pPr><w:sectPr><w:pgSz w:w=\"12240\" w:h=\"15840\"/><w:pgMar w:top=\"1440\" w:right=\"1800\" w:bottom=\"1440\" w:left=\"1800\" w:header=\"720\" w:footer=\"720\" w:gutter=\"0\"/><w:cols w:space=\"720\"/><w:docGrid w:line-pitch=\"360\"/></w:sectPr></w:pPr></w:p><w:subDoc w:link=\"" + FILE_NAME + "\"/></wx:sect><wx:sect><wx:sub-section><w:p><w:pPr><w:pStyle w:val=\"Heading1\"/></w:pPr></w:p><w:sectPr><w:type w:val=\"continuous\"/><w:pgSz w:w=\"12240\" w:h=\"15840\"/><w:pgMar w:top=\"1440\" w:right=\"1800\" w:bottom=\"1440\" w:left=\"1800\" w:header=\"720\" w:footer=\"720\" w:gutter=\"0\"/><w:cols w:space=\"720\"/><w:docGrid w:line-pitch=\"360\"/></w:sectPr></wx:sub-section></wx:sect>";
+ private static final String HYPER_LINK_DOC =
+ "<w:p><w:hlink w:dest=\"fileName\"><w:r wsp:rsidRPr=\"00CE6681\"><w:rPr><w:rStyle w:val=\"Hyperlink\"/></w:rPr><w:t>fileName</w:t></w:r></w:hlink></w:p>";
+ private final Appendable strB;
+ private final int[] outlineNumber;
+ private int outlineLevel;
+ private int flattenedLevelCount;
+ private boolean previousPageLandsacpe;
+ private final Map<String, Integer> alphabetMap;
+
+ public WordMLProducer(Appendable strB) {
+ this.strB = strB;
+ this.outlineNumber = new int[10]; // word supports 9 levels of outlining; index this array from 1 to 9
+ this.outlineLevel = 0;
+ this.flattenedLevelCount = 0;
+
+ this.alphabetMap = new HashMap<String, Integer>();
+
+ alphabetMap.put("A.0", 1);
+ alphabetMap.put("B.0", 2);
+ alphabetMap.put("C.0", 3);
+ }
+
+ public CharSequence startOutlineSubSection(CharSequence font, CharSequence headingText, String outlineType) throws OseeCoreException {
+ if (okToStartSubsection()) {
+ outlineNumber[++outlineLevel]++;
+ CharSequence paragraphNumber = getOutlineNumber();
+ startOutlineSubSection((outlineType != null ? outlineType : "Heading") + outlineLevel, paragraphNumber, font,
+ headingText);
+
+ return paragraphNumber;
+ } else {
+ flattenedLevelCount++;
+ endOutlineSubSection(true);
+ OseeLog.log(SkynetGuiPlugin.class, Level.WARNING, "Outline level flattened, outline can only go 9 levels deep");
+ return startOutlineSubSection(font, headingText, outlineType);
+ }
+ };
+
+ private void append(CharSequence value) throws OseeCoreException {
+ try {
+ strB.append(value);
+ } catch (IOException ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ }
+
+ public void startOutlineSubSection(CharSequence style, CharSequence outlineNumber, CharSequence font, CharSequence headingText) throws OseeCoreException {
+ append("<wx:sub-section>");
+ append("<w:p><w:pPr><w:pStyle w:val=\"");
+ append(style);
+ append("\"/><w:listPr><wx:t wx:val=\"");
+ append(outlineNumber);
+ append("\" wx:wTabBefore=\"540\" wx:wTabAfter=\"90\"/><wx:font wx:val=\"");
+ append(font);
+ append("\"/></w:listPr></w:pPr><w:r><w:t>");
+ append(Xml.escape(headingText));
+ append("</w:t></w:r></w:p>");
+ }
+
+ public String setHeadingNumbers(String outlineNumber, String template, String outlineType) {
+ boolean appendixOutlineType = outlineType != null && outlineType.equalsIgnoreCase("APPENDIX");
+ if (outlineNumber == null) {
+ return template;
+ }
+
+ if (appendixOutlineType) {
+ // Example of appendix number: A.0
+ char[] chars = outlineNumber.toCharArray();
+ template = setAppendixStartLetter(chars[0], template);
+ } else {
+ int index = 1;
+ String[] numbers = outlineNumber.split("\\.");
+
+ for (String number : numbers) {
+ Matcher matcher =
+ Pattern.compile(String.format("<w:start w:val=\"(\\d*?)\"/><w:pStyle w:val=\"Heading%d\"/>", index)).matcher(
+ "");
+ matcher.reset(template);
+ template =
+ matcher.replaceAll(String.format("<w:start w:val=\"%s\"/><w:pStyle w:val=\"Heading%d\"/>", number,
+ index));
+ index++;
+ }
+ }
+ if (!appendixOutlineType) {
+ setNextParagraphNumberTo(outlineNumber);
+ }
+ return template;
+ }
+
+ public String setAppendixStartLetter(char chr, String template) {
+ template =
+ template.replace(
+ "<w:start w:val=\"1\"/><w:nfc w:val=\"3\"/><w:pStyle w:val=\"APPENDIX1\"/>",
+ "<w:start w:val=\"" + (Character.toLowerCase(chr) - 'a' + 1) + "\"/><w:nfc w:val=\"3\"/><w:pStyle w:val=\"APPENDIX1\"/>");
+ return template;
+ }
+
+ public void endOutlineSubSection() throws OseeCoreException {
+ endOutlineSubSection(false);
+ }
+
+ private void endOutlineSubSection(boolean force) throws OseeCoreException {
+ if (!force && flattenedLevelCount > 0) {
+ flattenedLevelCount--;
+ } else {
+ append("</wx:sub-section>");
+ if (outlineLevel + 1 < outlineNumber.length) {
+ outlineNumber[outlineLevel + 1] = 0;
+ }
+ outlineLevel--;
+ }
+ }
+
+ public void addWordMl(CharSequence wordMl) throws OseeCoreException {
+ append(wordMl);
+ }
+
+ public void startParagraph() throws OseeCoreException {
+ append("<w:p>");
+ }
+
+ public void startSection() throws OseeCoreException {
+ append("<wx:sect>");
+ }
+
+ public void endSection() throws OseeCoreException {
+ append("</wx:sect>");
+ }
+
+ public void createSubDoc(String fileName) throws OseeCoreException {
+ if (fileName == null || fileName.length() == 0) {
+ throw new IllegalArgumentException("The file name can not be null or empty.");
+ }
+
+ append(SUB_DOC.replace(FILE_NAME, fileName));
+ }
+
+ public void createHyperLinkDoc(String fileName) throws OseeCoreException {
+ if (fileName == null || fileName.length() == 0) {
+ throw new IllegalArgumentException("The file name can not be null or empty.");
+ }
+
+ append(HYPER_LINK_DOC.replace(FILE_NAME, fileName));
+ }
+
+ public void resetListValue() throws OseeCoreException {
+ // extra paragraph needed to support WORD's bug to add in a trailing zero when using field codes
+ startParagraph();
+ endParagraph();
+ startParagraph();
+ //The listnum also acts a template delimiter to know when to remove unwanted content.
+ addWordMl(LISTNUM_FIELD);
+ endParagraph();
+ }
+
+ public void endParagraph() throws OseeCoreException {
+ append("</w:p>");
+ }
+
+ public void startTable() throws OseeCoreException {
+ append("<wx:sub-section><w:tbl>");
+ }
+
+ public void endTable() throws OseeCoreException {
+ append("</w:tbl></wx:sub-section>");
+ }
+
+ public void startTableRow() throws OseeCoreException {
+ append("<w:tr>");
+ }
+
+ public void endTableRow() throws OseeCoreException {
+ append("</w:tr>");
+ }
+
+ public void startTableColumn() throws OseeCoreException {
+ append("<w:tc>");
+ }
+
+ public void endTableColumn() throws OseeCoreException {
+ append("</w:tc>");
+ }
+
+ public void addTableColumns(String... datas) throws OseeCoreException {
+ for (String data : datas) {
+ startTableColumn();
+ addParagraph(data);
+ endTableColumn();
+ }
+ }
+
+ public void addTableRow(String... datas) throws OseeCoreException {
+ startTableRow();
+ addTableColumns(datas);
+ endTableRow();
+ }
+
+ public void addParagraphNoEscape(CharSequence text) throws OseeCoreException {
+ append("<w:p><w:r><w:t>");
+ append(text);
+ append("</w:t></w:r></w:p>");
+ }
+
+ public void addParagraph(CharSequence text) throws OseeCoreException {
+ append("<w:p><w:r><w:t>");
+ append(Xml.escape(text));
+ append("</w:t></w:r></w:p>");
+ }
+
+ public void addParagraphBold(CharSequence text) throws OseeCoreException {
+ append("<w:p><w:r><w:rPr><w:b/></w:rPr><w:t>");
+ append(Xml.escape(text));
+ append("</w:t><w:rPr><w:b/></w:rPr></w:r></w:p>");
+ }
+
+ /**
+ * This method will escape the provided text.
+ *
+ * @param text
+ * @throws OseeWrappedException
+ */
+ public void addTextInsideParagraph(CharSequence text) throws OseeCoreException {
+ append("<w:r><w:t>");
+ append(Xml.escape(text));
+ append("</w:t></w:r>");
+ }
+
+ public void addTextInsideParagraph(CharSequence text, String rgbHexColor) throws OseeCoreException {
+ if (rgbHexColor == null) {
+ throw new IllegalArgumentException("rgbHexColor can not be null");
+ }
+ if (rgbHexColor.length() != 6) {
+ throw new IllegalArgumentException("rgbHexColor should be a hex string 6 characters long");
+ }
+
+ append("<w:r><w:rPr><w:color w:val=\"");
+ append(rgbHexColor);
+ append("\"/></w:rPr>");
+ append("<w:t>");
+ append(Xml.escape(text));
+ append("</w:t></w:r>");
+ }
+
+ public void addOleData(CharSequence oleData) throws OseeCoreException {
+ append("<w:docOleData>");
+ append(oleData);
+ append("</w:docOleData>");
+ }
+
+ private CharSequence getOutlineNumber() throws OseeCoreException {
+ StringBuilder strB = new StringBuilder();
+ for (int i = 1; i < outlineLevel; i++) {
+ strB.append(String.valueOf(outlineNumber[i]));
+ strB.append(".");
+ }
+ strB.append(String.valueOf(outlineNumber[outlineLevel]));
+ return strB;
+ }
+
+ public boolean okToStartSubsection() {
+ return outlineLevel < 9;
+ }
+
+ /**
+ * @param nextOutlineNumber
+ */
+ public void setNextParagraphNumberTo(String nextOutlineNumber) {
+ String[] nextOutlineNumbers = nextOutlineNumber.split("\\.");
+ Arrays.fill(outlineNumber, 0);
+
+ try {
+ for (int i = 0; i < nextOutlineNumbers.length; i++) {
+
+ outlineNumber[i + 1] = Integer.parseInt(nextOutlineNumbers[i]);
+ }
+ outlineNumber[nextOutlineNumbers.length]--;
+ outlineLevel = nextOutlineNumbers.length - 1;
+ } catch (NumberFormatException ex) {
+ //Do nothing
+ }
+ }
+
+ /**
+ * Sets the page layout to either portrait/landscape depending on the artifacts pageType attribute value. Note: This
+ * call should be done after processing each artifact so if a previous artifact was landscaped the following artifact
+ * would be set back to portrait.
+ *
+ * @throws OseeCoreException
+ */
+ public void setPageLayout(Artifact artifact) throws OseeCoreException {
+ String pageTypeValue = null;
+ if (artifact.isAttributeTypeValid("Page Type")) {
+ pageTypeValue = artifact.getSoleAttributeValue("Page Type", "Portrait");
+ }
+
+ boolean landscape = pageTypeValue != null && pageTypeValue.equals("Landscape");
+
+ if (landscape || previousPageLandsacpe) {
+ append("<w:p>");
+ append("<w:pPr>");
+ append("<w:sectPr>");
+ append(landscape ? "<w:pgSz w:w=\"15840\" w:h=\"12240\" w:orient=\"landscape\" w:code=\"1\" />" : "<w:pgSz w:w=\"12240\" w:h=\"15840\" w:code=\"1\" />");
+ append("</w:sectPr>");
+ append("</w:pPr>");
+ append("</w:p>");
+
+ previousPageLandsacpe = landscape;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordTemplateFileDiffer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordTemplateFileDiffer.java
index e91e44b0221..8fa0dd5274b 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordTemplateFileDiffer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordTemplateFileDiffer.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.framework.ui.skynet.render.word;
-
-import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.EXCLUDE_DELETED;
-import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.INCLUDE_DELETED;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.TransactionDelta;
-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.skynet.core.artifact.ArtifactCache;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.skynet.core.change.ArtifactDelta;
-import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
-import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
-import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
-
-/**
- * @author Jeff C. Phillips
- */
-public class WordTemplateFileDiffer {
- private String nextParagraphNumber;
- private String outlineType;
-
- public void generateFileDifferences(String fileName, VariableMap variableMap, String nextParagraphNumber, String outlineType) throws OseeArgumentException, OseeCoreException {
- this.nextParagraphNumber = nextParagraphNumber;
- this.outlineType = outlineType;
-
- List<Artifact> newArtifacts = variableMap.getArtifacts("artifacts");
- variableMap.setValue("fileName", fileName);
- variableMap.setValue("diffReportFolderName", ".preview" + fileName);
- variableMap.setValue("inPublishMode", true);
- variableMap.setValue("suppressWord", true);
- variableMap.setValue("Publish With Attributes", true);
- variableMap.setValue("Publish As Diff", true);
- variableMap.setValue("Diff Branch", variableMap.getValue("Branch"));
- variableMap.setValue("Use Artifact Names", true);
- variableMap.setValue("inPublishMode", true);
- variableMap.setValue("suppressWord", true);
-
- Branch endBranch = variableMap.getBranch("Branch");
- Branch startBranch = variableMap.getBranch("compareBranch");
-
- if (endBranch == null || (startBranch == null && !variableMap.getBoolean("Diff from Baseline"))) {
- throw new OseeCoreException(
- "Must Select a " + endBranch == null ? "Branch" : "Date" + " to diff against when publishing as Diff");
- }
- TransactionRecord startTransaction;
-
- boolean isDiffFromBaseline = variableMap.getBoolean("Diff from Baseline");
- if (variableMap.getBoolean("Diff from Baseline")) {
- startTransaction = endBranch.getBaseTransaction();
- startBranch = endBranch;
- } else {
- startTransaction = TransactionManager.getHeadTransaction(startBranch);
- startBranch = variableMap.getBranch("compareBranch");
- }
-
- TransactionDelta txDelta =
- new TransactionDelta(startTransaction, TransactionManager.getHeadTransaction(endBranch));
-
- for (Artifact artifact : newArtifacts) {
- try {
- diff(isDiffFromBaseline, txDelta, startBranch, artifact, variableMap);
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- }
-
- private void diff(boolean isDiffFromBaseline, TransactionDelta txDelta, Branch startBranch, Artifact artifact, VariableMap variableMap) throws OseeCoreException {
- List<Artifact> endArtifacts = new ArrayList<Artifact>();
- endArtifacts.add(artifact);
-
- int transactionId;
- if (isDiffFromBaseline) {
- transactionId = txDelta.getStartTx().getId();
- } else {
- transactionId = txDelta.getEndTx().getId();
- }
- List<Artifact> startArtifacts = getStartArtifacts(endArtifacts, transactionId, startBranch.getId());
-
- Collection<ArtifactDelta> compareItems = new ArrayList<ArtifactDelta>();
- for (int index = 0; index < startArtifacts.size() && index < endArtifacts.size(); index++) {
- Artifact start = startArtifacts.get(index);
- Artifact end = endArtifacts.get(index);
- if (isDeleted(start)) {
- start = null;
- }
- if (isDeleted(end)) {
- end = null;
- }
- if (start != null || end != null) {
- compareItems.add(new ArtifactDelta(txDelta, start, end));
- }
- }
- variableMap.setValue("paragraphNumber", nextParagraphNumber);
- variableMap.setValue("outlineType", outlineType);
-
- Job job = RendererManager.diffInJob(compareItems, variableMap);
- try {
- job.join();
- } catch (InterruptedException ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- }
-
- private List<Artifact> getStartArtifacts(List<Artifact> artifacts, int transactionId, int branchId) throws OseeCoreException {
- List<Artifact> historicArtifacts = new ArrayList<Artifact>(artifacts.size());
- @SuppressWarnings("unused")
- Collection<Artifact> bulkLoadedArtifacts =
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.render.word;
+
+import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.EXCLUDE_DELETED;
+import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.INCLUDE_DELETED;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeExceptions;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.TransactionDelta;
+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.skynet.core.artifact.ArtifactCache;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.change.ArtifactDelta;
+import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
+import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
+import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class WordTemplateFileDiffer {
+ private String nextParagraphNumber;
+ private String outlineType;
+
+ public void generateFileDifferences(String fileName, VariableMap variableMap, String nextParagraphNumber, String outlineType) throws OseeArgumentException, OseeCoreException {
+ this.nextParagraphNumber = nextParagraphNumber;
+ this.outlineType = outlineType;
+
+ List<Artifact> newArtifacts = variableMap.getArtifacts("artifacts");
+ variableMap.setValue("fileName", fileName);
+ variableMap.setValue("diffReportFolderName", ".preview" + fileName);
+ variableMap.setValue("inPublishMode", true);
+ variableMap.setValue("suppressWord", true);
+ variableMap.setValue("Publish With Attributes", true);
+ variableMap.setValue("Publish As Diff", true);
+ variableMap.setValue("Diff Branch", variableMap.getValue("Branch"));
+ variableMap.setValue("Use Artifact Names", true);
+ variableMap.setValue("inPublishMode", true);
+ variableMap.setValue("suppressWord", true);
+
+ Branch endBranch = variableMap.getBranch("Branch");
+ Branch startBranch = variableMap.getBranch("compareBranch");
+
+ if (endBranch == null || (startBranch == null && !variableMap.getBoolean("Diff from Baseline"))) {
+ throw new OseeCoreException(
+ "Must Select a " + endBranch == null ? "Branch" : "Date" + " to diff against when publishing as Diff");
+ }
+ TransactionRecord startTransaction;
+
+ boolean isDiffFromBaseline = variableMap.getBoolean("Diff from Baseline");
+ if (variableMap.getBoolean("Diff from Baseline")) {
+ startTransaction = endBranch.getBaseTransaction();
+ startBranch = endBranch;
+ } else {
+ startTransaction = TransactionManager.getHeadTransaction(startBranch);
+ startBranch = variableMap.getBranch("compareBranch");
+ }
+
+ TransactionDelta txDelta =
+ new TransactionDelta(startTransaction, TransactionManager.getHeadTransaction(endBranch));
+
+ for (Artifact artifact : newArtifacts) {
+ try {
+ diff(isDiffFromBaseline, txDelta, startBranch, artifact, variableMap);
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+
+ private void diff(boolean isDiffFromBaseline, TransactionDelta txDelta, Branch startBranch, Artifact artifact, VariableMap variableMap) throws OseeCoreException {
+ List<Artifact> endArtifacts = new ArrayList<Artifact>();
+ endArtifacts.add(artifact);
+
+ int transactionId;
+ if (isDiffFromBaseline) {
+ transactionId = txDelta.getStartTx().getId();
+ } else {
+ transactionId = txDelta.getEndTx().getId();
+ }
+ List<Artifact> startArtifacts = getStartArtifacts(endArtifacts, transactionId, startBranch.getId());
+
+ Collection<ArtifactDelta> compareItems = new ArrayList<ArtifactDelta>();
+ for (int index = 0; index < startArtifacts.size() && index < endArtifacts.size(); index++) {
+ Artifact start = startArtifacts.get(index);
+ Artifact end = endArtifacts.get(index);
+ if (isDeleted(start)) {
+ start = null;
+ }
+ if (isDeleted(end)) {
+ end = null;
+ }
+ if (start != null || end != null) {
+ compareItems.add(new ArtifactDelta(txDelta, start, end));
+ }
+ }
+ variableMap.setValue("paragraphNumber", nextParagraphNumber);
+ variableMap.setValue("outlineType", outlineType);
+
+ Job job = RendererManager.diffInJob(compareItems, variableMap);
+ try {
+ job.join();
+ } catch (InterruptedException ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ }
+
+ private List<Artifact> getStartArtifacts(List<Artifact> artifacts, int transactionId, int branchId) throws OseeCoreException {
+ List<Artifact> historicArtifacts = new ArrayList<Artifact>(artifacts.size());
+ @SuppressWarnings("unused")
+ Collection<Artifact> bulkLoadedArtifacts =
ArtifactQuery.getHistoricalArtifactListFromIds(Artifacts.toGuids(artifacts),
TransactionManager.getTransactionId(transactionId), INCLUDE_DELETED);
-
- for (Artifact artifact : artifacts) {
- historicArtifacts.add(ArtifactCache.getActive(artifact.getArtId(), branchId));
- }
- return historicArtifacts;
- }
-
- private boolean isDeleted(Artifact artifact) {
- return artifact != null && artifact.isDeleted();
- }
-
- public void populateVariableMap(VariableMap variableMap) throws OseeCoreException {
- if (variableMap == null) {
- throw new IllegalArgumentException("variableMap must not be null");
- }
-
- String name = variableMap.getString("Name");
- Branch branch = variableMap.getBranch("Branch");
-
+
+ for (Artifact artifact : artifacts) {
+ historicArtifacts.add(ArtifactCache.getActive(artifact.getArtId(), branchId));
+ }
+ return historicArtifacts;
+ }
+
+ private boolean isDeleted(Artifact artifact) {
+ return artifact != null && artifact.isDeleted();
+ }
+
+ public void populateVariableMap(VariableMap variableMap) throws OseeCoreException {
+ if (variableMap == null) {
+ throw new IllegalArgumentException("variableMap must not be null");
+ }
+
+ String name = variableMap.getString("Name");
+ Branch branch = variableMap.getBranch("Branch");
+
List<Artifact> artifacts = ArtifactQuery.getArtifactListFromName(name, branch, EXCLUDE_DELETED);
- variableMap.setValue("srsProducer.objects", artifacts);
- }
-}
+ variableMap.setValue("srsProducer.objects", artifacts);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordTemplateProcessor.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordTemplateProcessor.java
index 4265624e93c..bc55ae4ee78 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordTemplateProcessor.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/WordTemplateProcessor.java
@@ -1,529 +1,529 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.render.word;
-
-import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.EXCLUDE_DELETED;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.charset.CharacterCodingException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.osee.framework.core.data.IAttributeType;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.jdk.core.util.io.CharBackedInputStream;
-import org.eclipse.osee.framework.plugin.core.util.AIFile;
-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.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
-import org.eclipse.osee.framework.skynet.core.linking.LinkType;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.skynet.core.word.WordUtil;
-import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
-import org.eclipse.osee.framework.ui.skynet.render.IRenderer;
-import org.eclipse.osee.framework.ui.skynet.render.ITemplateRenderer;
-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.render.RenderingUtil;
-import org.eclipse.osee.framework.ui.skynet.render.WordTemplateRenderer;
-import org.eclipse.osee.framework.ui.skynet.util.WordUiUtil;
-import org.eclipse.osee.framework.ui.swt.Displays;
-
-/**
- * @author Robert A. Fisher
- * @author Jeff C. Phillips
- * @author Ryan D. Brooks
- * @author Andrew M. Finkbeiner
- */
-public class WordTemplateProcessor {
- private static final String ARTIFACT = "Artifact";
- private static final String EXTENSION_PROCESSOR = "Extension_Processor";
- private static final String KEY = "Key";
-
- private static final Pattern outlineTypePattern = Pattern.compile("<((\\w+:)?(OutlineType))>(.*?)</\\1>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
- private static final Pattern outlineNumberPattern = Pattern.compile("<((\\w+:)?(Number))>(.*?)</\\1>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
- private static final Pattern argumentElementsPattern = Pattern.compile("<((\\w+:)?(Argument))>(.*?)</\\1>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
- private static final Pattern keyValueElementsPattern = Pattern.compile("<((\\w+:)?(Key|Value))>(.*?)</\\1>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
- private static final Pattern subDocElementsPattern = Pattern.compile("<((\\w+:)?(SubDoc))>(.*?)</\\1>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
-
- private static final Pattern setNamePattern = Pattern.compile("<(\\w+:)?Set_Name>(.*?)</(\\w+:)?Set_Name>",
- Pattern.DOTALL | Pattern.MULTILINE);
- private static final Pattern headElementsPattern = Pattern.compile(
- "<((\\w+:)?(" + ARTIFACT + "|" + EXTENSION_PROCESSOR + "))>(.*?)</\\1>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
- private static final Pattern attributeElementsPattern = Pattern.compile("<((\\w+:)?(Attribute))>(.*?)</\\3>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
-
- private static final Pattern outlineElementsPattern = Pattern.compile("<((\\w+:)?(Outline))>(.*?)</\\1>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
- private static final Pattern internalOutlineElementsPattern = Pattern.compile(
- "<((\\w+:)?(HeadingAttribute|RecurseChildren|Number))>(.*?)</\\1>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
-
- private String slaveTemplate;
- private String slaveTemplateName;
- private boolean outlining;
- private boolean recurseChildren;
- private String outlineNumber;
- private IAttributeType headingAttributeType;
- private final List<AttributeElement> attributeElements = new LinkedList<AttributeElement>();
- final List<Artifact> nonTemplateArtifacts = new LinkedList<Artifact>();
- private final Set<String> ignoreAttributeExtensions = new HashSet<String>();
- private final Set<Artifact> processedArtifacts = new HashSet<Artifact>();
- private final IRenderer renderer;
-
- public WordTemplateProcessor(IRenderer renderer) {
- this.renderer = renderer;
- loadIgnoreAttributeExtensions();
- }
-
- /**
- * Parse through template to find xml defining artifact sets and replace it with the result of publishing those
- * artifacts Only used by Publish SRS
- *
- * @param variableMap
- * @param masterTemplateArtifact
- * @param slaveTemplateArtifact
- * @param artifacts
- * @throws OseeCoreException
- * @throws IOException
- */
- public void publishWithExtensionTemplates(VariableMap variableMap, Artifact masterTemplateArtifact, Artifact slaveTemplateArtifact, List<Artifact> artifacts) throws OseeCoreException {
- String masterTemplate = masterTemplateArtifact.getSoleAttributeValue(CoreAttributeTypes.WHOLE_WORD_CONTENT, "");
- slaveTemplateName = "";
- slaveTemplate = "";
-
- if (slaveTemplateArtifact != null) {
- slaveTemplateName = slaveTemplateArtifact.getSafeName();
- slaveTemplate = slaveTemplateArtifact.getSoleAttributeValue(CoreAttributeTypes.WHOLE_WORD_CONTENT, "");
- }
-
- IFolder folder = RenderingUtil.ensureRenderFolderExists(PresentationType.PREVIEW);
- String fileName = String.format("%s_%s.xml", masterTemplateArtifact.getSafeName(), Lib.getDateTimeString());
- AIFile.writeToFile(folder.getFile(fileName),
- applyTemplate(variableMap, artifacts, masterTemplate, folder, null, null, PresentationType.PREVIEW));
- }
-
- /**
- * Parse through template to find xml defining artifact sets and replace it with the result of publishing those
- * artifacts. Only used by Publish SRS
- *
- * @param variableMap = will be filled with artifacts when specified in the template
- * @param artifacts = null if the template defines the artifacts to be used in the publishing
- * @param template
- * @param folder = null when not using an extension template
- * @param outlineNumber if null will find based on first artifact
- * @param outlineType
- * @return InputStream
- * @throws OseeCoreException
- */
- public InputStream applyTemplate(VariableMap variableMap, List<Artifact> artifacts, String template, IFolder folder, String outlineNumber, String outlineType, PresentationType presentationType) throws OseeCoreException {
- WordMLProducer wordMl = null;
- CharBackedInputStream charBak = null;
- try {
- charBak = new CharBackedInputStream();
- wordMl = new WordMLProducer(charBak);
- } catch (CharacterCodingException ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
-
- this.outlineNumber =
- outlineNumber == null ? peekAtFirstArtifactToGetParagraphNumber(template, null, artifacts) : outlineNumber;
- template = wordMl.setHeadingNumbers(this.outlineNumber, template, outlineType);
- template = WordUtil.stripSpellCheck(template);
-
- Matcher matcher = headElementsPattern.matcher(template);
-
- int lastEndIndex = 0;
- while (matcher.find()) {
- // Write the part of the template between the elements
- wordMl.addWordMl(template.substring(lastEndIndex, matcher.start()));
-
- lastEndIndex = matcher.end();
- String elementType = matcher.group(3);
- String elementValue = matcher.group(4);
-
- if (elementType.equals(ARTIFACT)) {
- extractOutliningOptions(elementValue);
- if (artifacts == null) { //This handles the case where artifacts selected in the template
- Matcher setNameMatcher = setNamePattern.matcher(elementValue);
- setNameMatcher.find();
- artifacts = variableMap.getArtifacts(WordUtil.textOnly(setNameMatcher.group(2)));
- }
- if (presentationType == PresentationType.SPECIALIZED_EDIT && artifacts.size() == 1) {
- // for single edit override outlining options
- outlining = false;
- }
- processArtifactSet(variableMap, elementValue, artifacts, wordMl, outlineType, presentationType);
- } else if (elementType.equals(EXTENSION_PROCESSOR)) {
- try {
- processExtensionTemplate(elementValue, variableMap, folder, wordMl, presentationType, template);
- } catch (CoreException ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- } else {
- throw new OseeArgumentException("Invalid input: " + elementType);
- }
- }
- // Write out the last of the template
- wordMl.addWordMl(template.substring(lastEndIndex));
- displayNonTemplateArtifacts(nonTemplateArtifacts,
- "Only artifacts of type Word Template Content are supported in this case.");
- return charBak;
- }
-
- protected String peekAtFirstArtifactToGetParagraphNumber(String template, String nextParagraphNumber, List<Artifact> artifacts) throws OseeCoreException {
- String startParagraphNumber = "1";
- if (artifacts != null) {
- Matcher matcher = headElementsPattern.matcher(template);
-
- if (matcher.find()) {
- String elementType = matcher.group(3);
-
- if (elementType.equals(ARTIFACT)) {
- if (!artifacts.isEmpty()) {
- Artifact artifact = artifacts.iterator().next();
- if (artifact.isAttributeTypeValid(CoreAttributeTypes.PARAGRAPH_NUMBER)) {
- String paragraphNum = artifact.getSoleAttributeValue(CoreAttributeTypes.PARAGRAPH_NUMBER, "");
- if (Strings.isValid(paragraphNum)) {
- startParagraphNumber = paragraphNum;
- }
- }
- }
- }
- }
- }
- return startParagraphNumber;
- }
-
- private void processArtifactSet(VariableMap variableMap, final String artifactElement, final List<Artifact> artifacts, final WordMLProducer wordMl, final String outlineType, PresentationType presentationType) throws OseeCoreException {
- nonTemplateArtifacts.clear();
- if (outlineNumber != null) {
- wordMl.setNextParagraphNumberTo(outlineNumber);
- }
-
- extractSkynetAttributeReferences(getArtifactSetXml(artifactElement));
-
- for (Artifact artifact : artifacts) {
- processObjectArtifact(variableMap, artifact, wordMl, outlineType, presentationType, artifacts.size() > 1);
- }
- //maintain a list of artifacts that have been processed so we do not have duplicates.
- processedArtifacts.clear();
- }
-
- /**
- * @throws CoreException
- */
- private void processExtensionTemplate(String elementValue, VariableMap variableMap, IFolder folder, WordMLProducer wordMl, PresentationType presentationType, String template) throws OseeCoreException, CoreException {
- String subdocumentName = null;
- boolean doSubDocuments = false;
- String nextParagraphNumber = null;
- String outlineType = null;
- boolean diff = variableMap.getBoolean("Publish As Diff");
-
- Matcher matcher = outlineNumberPattern.matcher(elementValue);
- if (matcher.find()) {
- nextParagraphNumber = WordUtil.textOnly(matcher.group(4));
- }
-
- matcher = outlineTypePattern.matcher(elementValue);
- if (matcher.find()) {
- outlineType = WordUtil.textOnly(matcher.group(4));
- }
-
- matcher = subDocElementsPattern.matcher(elementValue);
-
- if (matcher.find()) {
- subdocumentName = WordUtil.textOnly(matcher.group(4));
- doSubDocuments = true;
- }
-
- matcher = argumentElementsPattern.matcher(elementValue);
- VariableMap newVariableMap = doSubDocuments ? new VariableMap() : null;
-
- while (matcher.find()) {
- matcher = keyValueElementsPattern.matcher(matcher.group(4));
-
- String key = null;
- while (matcher.find()) {
- String type = WordUtil.textOnly(matcher.group(3));
-
- if (type.equalsIgnoreCase(KEY)) {
- key = WordUtil.textOnly(matcher.group(4));
- } else {
- String value = WordUtil.textOnly(matcher.group(4));
-
- if (doSubDocuments) {
- newVariableMap.setValue(key, value);
- } else {
- variableMap.setValue(key, value);
- }
- }
- }
- }
-
- if (doSubDocuments) {
- newVariableMap.setValue("Branch", variableMap.getBranch("Branch"));
- String subDocFileName = subdocumentName + ".xml";
- populateVariableMap(newVariableMap);
- newVariableMap.setValue("linkType", variableMap.getValue("linkType"));
-
- if (diff) {
- generateDocumentDiff(newVariableMap, variableMap, subDocFileName, nextParagraphNumber, outlineType);
- } else {
- AIFile.writeToFile(
- folder.getFile(subDocFileName),
- applyTemplate(newVariableMap, null, slaveTemplate, folder, nextParagraphNumber, outlineType,
- presentationType));
- }
- wordMl.createHyperLinkDoc(subDocFileName);
-
- } else {
- populateVariableMap(variableMap);
- }
- }
-
- private void generateDocumentDiff(VariableMap newVariableMap, VariableMap variableMap, String fileName, String nextParagraphNumber, String outlineType) throws OseeCoreException {
- newVariableMap.setValue("artifacts", newVariableMap.getArtifacts("srsProducer.objects"));
- newVariableMap.setValue("Diff from Baseline", variableMap.getBoolean("Diff from Baseline"));
- newVariableMap.setValue("compareBranch", variableMap.getBranch("compareBranch"));
- newVariableMap.setValue("template", slaveTemplateName);
- newVariableMap.setValue("linkType", variableMap.getValue("linkType"));
- WordTemplateFileDiffer templateFileDiffer = new WordTemplateFileDiffer();
- templateFileDiffer.generateFileDifferences(fileName, newVariableMap, nextParagraphNumber, outlineType);
- }
-
- public void populateVariableMap(VariableMap variableMap) throws OseeCoreException {
- if (variableMap == null) {
- throw new IllegalArgumentException("variableMap must not be null");
- }
-
- String name = variableMap.getString("Name");
- Branch branch = variableMap.getBranch("Branch");
- List<Artifact> artifacts = ArtifactQuery.getArtifactListFromName(name, branch, EXCLUDE_DELETED);
- variableMap.setValue("srsProducer.objects", artifacts);
- }
-
- private void extractOutliningOptions(String artifactElement) throws OseeCoreException {
- Matcher matcher = outlineElementsPattern.matcher(artifactElement);
- if (matcher.find()) {
- matcher = internalOutlineElementsPattern.matcher(matcher.group(4));
- outlining = true;
-
- // Default values for optional/unspecified parameters
- recurseChildren = false;
-
- while (matcher.find()) {
- String elementType = matcher.group(3);
- String value = WordUtil.textOnly(matcher.group(4));
-
- if (elementType.equals("HeadingAttribute")) {
- headingAttributeType = AttributeTypeManager.getType(value);
- } else if (elementType.equals("RecurseChildren")) {
- recurseChildren = Boolean.parseBoolean(value);
- } else if (elementType.equals("Number")) {
- outlineNumber = value;
- }
- }
- } else {
- outlining = false;
- recurseChildren = false;
- headingAttributeType = null;
- }
- }
-
- private void processObjectArtifact(VariableMap variableMap, Artifact artifact, WordMLProducer wordMl, String outlineType, PresentationType presentationType, boolean multipleArtifacts) throws OseeCoreException {
- if (!artifact.isAttributeTypeValid(CoreAttributeTypes.WHOLE_WORD_CONTENT) && !artifact.isAttributeTypeValid(CoreAttributeTypes.NATIVE_CONTENT)) {
- //If the artifact has not been processed
- if (!processedArtifacts.contains(artifact)) {
- if (outlining) {
- String headingText = artifact.getSoleAttributeValue(headingAttributeType, "");
- CharSequence paragraphNumber =
- wordMl.startOutlineSubSection("Times New Roman", headingText, outlineType);
-
- VariableMap options = renderer.getOptions();
- if (renderer.getBooleanOption(WordTemplateRenderer.UPDATE_PARAGRAPH_NUMBER_OPTION)) {
- if (artifact.isAttributeTypeValid(CoreAttributeTypes.PARAGRAPH_NUMBER)) {
- artifact.setSoleAttributeValue(CoreAttributeTypes.PARAGRAPH_NUMBER, paragraphNumber.toString());
- artifact.persist((SkynetTransaction) options.getValue(ITemplateRenderer.TRANSACTION_OPTION));
- }
- }
- }
- processAttributes(variableMap, artifact, wordMl, presentationType, multipleArtifacts);
- if (recurseChildren) {
- for (Artifact childArtifact : artifact.getChildren()) {
- processObjectArtifact(variableMap, childArtifact, wordMl, outlineType, presentationType,
- multipleArtifacts);
- }
- }
- if (outlining) {
- wordMl.endOutlineSubSection();
- }
- processedArtifacts.add(artifact);
- }
- } else {
- nonTemplateArtifacts.add(artifact);
- }
- }
-
- private void processAttributes(VariableMap variableMap, Artifact artifact, WordMLProducer wordMl, PresentationType presentationType, boolean multipleArtifacts) throws OseeCoreException {
- for (AttributeElement attributeElement : attributeElements) {
- String attributeName = attributeElement.getAttributeName();
-
- if (attributeName.equals("*")) {
- for (AttributeType attributeType : RendererManager.getAttributeTypeOrderList(artifact)) {
- if (!outlining || !attributeType.equals(headingAttributeType)) {
- processAttribute(variableMap, artifact, wordMl, attributeElement, attributeType, true,
- presentationType, multipleArtifacts);
- }
- }
- } else {
-
- if (artifact.isAttributeTypeValid(attributeName)) {
- AttributeType attributeType = AttributeTypeManager.getType(attributeName);
- processAttribute(variableMap, artifact, wordMl, attributeElement, attributeType, false,
- presentationType, multipleArtifacts);
- }
-
- }
- }
- wordMl.setPageLayout(artifact);
- }
-
- private void processAttribute(VariableMap variableMap, Artifact artifact, WordMLProducer wordMl, AttributeElement attributeElement, IAttributeType attributeType, boolean allAttrs, PresentationType presentationType, boolean multipleArtifacts) throws OseeCoreException {
- // This is for SRS Publishing. Do not publish unspecified attributes
- if (!allAttrs && (attributeType.equals(CoreAttributeTypes.PARTITION) || attributeType.equals(CoreAttributeTypes.SAFETY_CRITICALITY))) {
- if (artifact.isAttributeTypeValid(CoreAttributeTypes.PARTITION)) {
- for (Attribute<?> partition : artifact.getAttributes(CoreAttributeTypes.PARTITION)) {
- if (partition == null || partition.getValue() == null || partition.getValue().equals("Unspecified")) {
- return;
- }
- }
- }
- }
-
- //Create a wordTemplateContent for new guys when opening them for edit.
- if (attributeType.equals(CoreAttributeTypes.WORD_TEMPLATE_CONTENT) && presentationType == PresentationType.SPECIALIZED_EDIT) {
- artifact.getOrInitializeSoleAttributeValue(attributeType);
- }
-
- Collection<Attribute<Object>> attributes = artifact.getAttributes(attributeType);
-
- if (!attributes.isEmpty()) {
- // check if the attribute descriptor name is in the ignore list.
- if (ignoreAttributeExtensions.contains(attributeType.getName())) {
- return;
- }
- variableMap = ensureMapIsSetForDocLinks(variableMap, allAttrs);
-
- Boolean isInPublishMode =
- variableMap != null ? Boolean.TRUE.equals(variableMap.getBoolean("inPublishMode")) : false;
- if (variableMap != null && isInPublishMode) {
- // Do not publish relation order during publishing
- if (CoreAttributeTypes.RELATION_ORDER.equals(attributeType)) {
- return;
- }
- }
-
- RendererManager.renderAttribute(attributeType.getName(), presentationType, artifact, variableMap, wordMl,
- attributeElement);
- }
- }
-
- private VariableMap ensureMapIsSetForDocLinks(VariableMap variableMap, boolean allAttrs) throws OseeArgumentException {
- //Do not try to use a null map
- VariableMap theMap = variableMap;
- if (theMap == null) {
- theMap = new VariableMap();
- }
- //If someone else set the link leave it set else set it to OSEE server link
- if (theMap.getValue("linkType") == null) {
- theMap.setValue("linkType", LinkType.OSEE_SERVER_LINK);
- }
- //set all attrs
- theMap.setValue("allAttrs", allAttrs);
-
- return theMap;
- }
-
- private String getArtifactSetXml(String artifactElement) {
- artifactElement = artifactElement.replaceAll("<(\\w+:)?Artifact/?>", "");
- artifactElement = artifactElement.replaceAll("<(\\w+:)?Set_Name>.*?</(\\w+:)?Set_Name>", "");
-
- return artifactElement;
- }
-
- private void extractSkynetAttributeReferences(String artifactElementTemplate) {
- attributeElements.clear();
- Matcher matcher = attributeElementsPattern.matcher(artifactElementTemplate);
-
- while (matcher.find()) {
- attributeElements.add(new AttributeElement(matcher.group(4)));
- }
- }
-
- private void loadIgnoreAttributeExtensions() {
- IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
- if (extensionRegistry != null) {
- IExtensionPoint point =
- extensionRegistry.getExtensionPoint("org.eclipse.osee.framework.ui.skynet.IgnorePublishAttribute");
- if (point != null) {
- IExtension[] extensions = point.getExtensions();
- for (IExtension extension : extensions) {
- IConfigurationElement[] elements = extension.getConfigurationElements();
- for (IConfigurationElement element : elements) {
- ignoreAttributeExtensions.add(element.getAttribute("name"));
- }
- }
- }
- }
- }
-
- private void displayNonTemplateArtifacts(final Collection<Artifact> artifacts, final String warningString) {
- if (!artifacts.isEmpty()) {
- Displays.ensureInDisplayThread(new Runnable() {
-
- @Override
- public void run() {
- ArrayList<Artifact> nonTempArtifacts = new ArrayList<Artifact>(artifacts.size());
- nonTempArtifacts.addAll(artifacts);
- WordUiUtil.displayUnhandledArtifacts(artifacts, warningString);
- }
- });
- }
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.render.word;
+
+import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.EXCLUDE_DELETED;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.CharacterCodingException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeExceptions;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.jdk.core.util.io.CharBackedInputStream;
+import org.eclipse.osee.framework.plugin.core.util.AIFile;
+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.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
+import org.eclipse.osee.framework.skynet.core.linking.LinkType;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.skynet.core.word.WordUtil;
+import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
+import org.eclipse.osee.framework.ui.skynet.render.IRenderer;
+import org.eclipse.osee.framework.ui.skynet.render.ITemplateRenderer;
+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.render.RenderingUtil;
+import org.eclipse.osee.framework.ui.skynet.render.WordTemplateRenderer;
+import org.eclipse.osee.framework.ui.skynet.util.WordUiUtil;
+import org.eclipse.osee.framework.ui.swt.Displays;
+
+/**
+ * @author Robert A. Fisher
+ * @author Jeff C. Phillips
+ * @author Ryan D. Brooks
+ * @author Andrew M. Finkbeiner
+ */
+public class WordTemplateProcessor {
+ private static final String ARTIFACT = "Artifact";
+ private static final String EXTENSION_PROCESSOR = "Extension_Processor";
+ private static final String KEY = "Key";
+
+ private static final Pattern outlineTypePattern = Pattern.compile("<((\\w+:)?(OutlineType))>(.*?)</\\1>",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
+ private static final Pattern outlineNumberPattern = Pattern.compile("<((\\w+:)?(Number))>(.*?)</\\1>",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
+ private static final Pattern argumentElementsPattern = Pattern.compile("<((\\w+:)?(Argument))>(.*?)</\\1>",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
+ private static final Pattern keyValueElementsPattern = Pattern.compile("<((\\w+:)?(Key|Value))>(.*?)</\\1>",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
+ private static final Pattern subDocElementsPattern = Pattern.compile("<((\\w+:)?(SubDoc))>(.*?)</\\1>",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
+
+ private static final Pattern setNamePattern = Pattern.compile("<(\\w+:)?Set_Name>(.*?)</(\\w+:)?Set_Name>",
+ Pattern.DOTALL | Pattern.MULTILINE);
+ private static final Pattern headElementsPattern = Pattern.compile(
+ "<((\\w+:)?(" + ARTIFACT + "|" + EXTENSION_PROCESSOR + "))>(.*?)</\\1>",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
+ private static final Pattern attributeElementsPattern = Pattern.compile("<((\\w+:)?(Attribute))>(.*?)</\\3>",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
+
+ private static final Pattern outlineElementsPattern = Pattern.compile("<((\\w+:)?(Outline))>(.*?)</\\1>",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
+ private static final Pattern internalOutlineElementsPattern = Pattern.compile(
+ "<((\\w+:)?(HeadingAttribute|RecurseChildren|Number))>(.*?)</\\1>",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
+
+ private String slaveTemplate;
+ private String slaveTemplateName;
+ private boolean outlining;
+ private boolean recurseChildren;
+ private String outlineNumber;
+ private IAttributeType headingAttributeType;
+ private final List<AttributeElement> attributeElements = new LinkedList<AttributeElement>();
+ final List<Artifact> nonTemplateArtifacts = new LinkedList<Artifact>();
+ private final Set<String> ignoreAttributeExtensions = new HashSet<String>();
+ private final Set<Artifact> processedArtifacts = new HashSet<Artifact>();
+ private final IRenderer renderer;
+
+ public WordTemplateProcessor(IRenderer renderer) {
+ this.renderer = renderer;
+ loadIgnoreAttributeExtensions();
+ }
+
+ /**
+ * Parse through template to find xml defining artifact sets and replace it with the result of publishing those
+ * artifacts Only used by Publish SRS
+ *
+ * @param variableMap
+ * @param masterTemplateArtifact
+ * @param slaveTemplateArtifact
+ * @param artifacts
+ * @throws OseeCoreException
+ * @throws IOException
+ */
+ public void publishWithExtensionTemplates(VariableMap variableMap, Artifact masterTemplateArtifact, Artifact slaveTemplateArtifact, List<Artifact> artifacts) throws OseeCoreException {
+ String masterTemplate = masterTemplateArtifact.getSoleAttributeValue(CoreAttributeTypes.WHOLE_WORD_CONTENT, "");
+ slaveTemplateName = "";
+ slaveTemplate = "";
+
+ if (slaveTemplateArtifact != null) {
+ slaveTemplateName = slaveTemplateArtifact.getSafeName();
+ slaveTemplate = slaveTemplateArtifact.getSoleAttributeValue(CoreAttributeTypes.WHOLE_WORD_CONTENT, "");
+ }
+
+ IFolder folder = RenderingUtil.ensureRenderFolderExists(PresentationType.PREVIEW);
+ String fileName = String.format("%s_%s.xml", masterTemplateArtifact.getSafeName(), Lib.getDateTimeString());
+ AIFile.writeToFile(folder.getFile(fileName),
+ applyTemplate(variableMap, artifacts, masterTemplate, folder, null, null, PresentationType.PREVIEW));
+ }
+
+ /**
+ * Parse through template to find xml defining artifact sets and replace it with the result of publishing those
+ * artifacts. Only used by Publish SRS
+ *
+ * @param variableMap = will be filled with artifacts when specified in the template
+ * @param artifacts = null if the template defines the artifacts to be used in the publishing
+ * @param template
+ * @param folder = null when not using an extension template
+ * @param outlineNumber if null will find based on first artifact
+ * @param outlineType
+ * @return InputStream
+ * @throws OseeCoreException
+ */
+ public InputStream applyTemplate(VariableMap variableMap, List<Artifact> artifacts, String template, IFolder folder, String outlineNumber, String outlineType, PresentationType presentationType) throws OseeCoreException {
+ WordMLProducer wordMl = null;
+ CharBackedInputStream charBak = null;
+ try {
+ charBak = new CharBackedInputStream();
+ wordMl = new WordMLProducer(charBak);
+ } catch (CharacterCodingException ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+
+ this.outlineNumber =
+ outlineNumber == null ? peekAtFirstArtifactToGetParagraphNumber(template, null, artifacts) : outlineNumber;
+ template = wordMl.setHeadingNumbers(this.outlineNumber, template, outlineType);
+ template = WordUtil.stripSpellCheck(template);
+
+ Matcher matcher = headElementsPattern.matcher(template);
+
+ int lastEndIndex = 0;
+ while (matcher.find()) {
+ // Write the part of the template between the elements
+ wordMl.addWordMl(template.substring(lastEndIndex, matcher.start()));
+
+ lastEndIndex = matcher.end();
+ String elementType = matcher.group(3);
+ String elementValue = matcher.group(4);
+
+ if (elementType.equals(ARTIFACT)) {
+ extractOutliningOptions(elementValue);
+ if (artifacts == null) { //This handles the case where artifacts selected in the template
+ Matcher setNameMatcher = setNamePattern.matcher(elementValue);
+ setNameMatcher.find();
+ artifacts = variableMap.getArtifacts(WordUtil.textOnly(setNameMatcher.group(2)));
+ }
+ if (presentationType == PresentationType.SPECIALIZED_EDIT && artifacts.size() == 1) {
+ // for single edit override outlining options
+ outlining = false;
+ }
+ processArtifactSet(variableMap, elementValue, artifacts, wordMl, outlineType, presentationType);
+ } else if (elementType.equals(EXTENSION_PROCESSOR)) {
+ try {
+ processExtensionTemplate(elementValue, variableMap, folder, wordMl, presentationType, template);
+ } catch (CoreException ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ } else {
+ throw new OseeArgumentException("Invalid input: " + elementType);
+ }
+ }
+ // Write out the last of the template
+ wordMl.addWordMl(template.substring(lastEndIndex));
+ displayNonTemplateArtifacts(nonTemplateArtifacts,
+ "Only artifacts of type Word Template Content are supported in this case.");
+ return charBak;
+ }
+
+ protected String peekAtFirstArtifactToGetParagraphNumber(String template, String nextParagraphNumber, List<Artifact> artifacts) throws OseeCoreException {
+ String startParagraphNumber = "1";
+ if (artifacts != null) {
+ Matcher matcher = headElementsPattern.matcher(template);
+
+ if (matcher.find()) {
+ String elementType = matcher.group(3);
+
+ if (elementType.equals(ARTIFACT)) {
+ if (!artifacts.isEmpty()) {
+ Artifact artifact = artifacts.iterator().next();
+ if (artifact.isAttributeTypeValid(CoreAttributeTypes.PARAGRAPH_NUMBER)) {
+ String paragraphNum = artifact.getSoleAttributeValue(CoreAttributeTypes.PARAGRAPH_NUMBER, "");
+ if (Strings.isValid(paragraphNum)) {
+ startParagraphNumber = paragraphNum;
+ }
+ }
+ }
+ }
+ }
+ }
+ return startParagraphNumber;
+ }
+
+ private void processArtifactSet(VariableMap variableMap, final String artifactElement, final List<Artifact> artifacts, final WordMLProducer wordMl, final String outlineType, PresentationType presentationType) throws OseeCoreException {
+ nonTemplateArtifacts.clear();
+ if (outlineNumber != null) {
+ wordMl.setNextParagraphNumberTo(outlineNumber);
+ }
+
+ extractSkynetAttributeReferences(getArtifactSetXml(artifactElement));
+
+ for (Artifact artifact : artifacts) {
+ processObjectArtifact(variableMap, artifact, wordMl, outlineType, presentationType, artifacts.size() > 1);
+ }
+ //maintain a list of artifacts that have been processed so we do not have duplicates.
+ processedArtifacts.clear();
+ }
+
+ /**
+ * @throws CoreException
+ */
+ private void processExtensionTemplate(String elementValue, VariableMap variableMap, IFolder folder, WordMLProducer wordMl, PresentationType presentationType, String template) throws OseeCoreException, CoreException {
+ String subdocumentName = null;
+ boolean doSubDocuments = false;
+ String nextParagraphNumber = null;
+ String outlineType = null;
+ boolean diff = variableMap.getBoolean("Publish As Diff");
+
+ Matcher matcher = outlineNumberPattern.matcher(elementValue);
+ if (matcher.find()) {
+ nextParagraphNumber = WordUtil.textOnly(matcher.group(4));
+ }
+
+ matcher = outlineTypePattern.matcher(elementValue);
+ if (matcher.find()) {
+ outlineType = WordUtil.textOnly(matcher.group(4));
+ }
+
+ matcher = subDocElementsPattern.matcher(elementValue);
+
+ if (matcher.find()) {
+ subdocumentName = WordUtil.textOnly(matcher.group(4));
+ doSubDocuments = true;
+ }
+
+ matcher = argumentElementsPattern.matcher(elementValue);
+ VariableMap newVariableMap = doSubDocuments ? new VariableMap() : null;
+
+ while (matcher.find()) {
+ matcher = keyValueElementsPattern.matcher(matcher.group(4));
+
+ String key = null;
+ while (matcher.find()) {
+ String type = WordUtil.textOnly(matcher.group(3));
+
+ if (type.equalsIgnoreCase(KEY)) {
+ key = WordUtil.textOnly(matcher.group(4));
+ } else {
+ String value = WordUtil.textOnly(matcher.group(4));
+
+ if (doSubDocuments) {
+ newVariableMap.setValue(key, value);
+ } else {
+ variableMap.setValue(key, value);
+ }
+ }
+ }
+ }
+
+ if (doSubDocuments) {
+ newVariableMap.setValue("Branch", variableMap.getBranch("Branch"));
+ String subDocFileName = subdocumentName + ".xml";
+ populateVariableMap(newVariableMap);
+ newVariableMap.setValue("linkType", variableMap.getValue("linkType"));
+
+ if (diff) {
+ generateDocumentDiff(newVariableMap, variableMap, subDocFileName, nextParagraphNumber, outlineType);
+ } else {
+ AIFile.writeToFile(
+ folder.getFile(subDocFileName),
+ applyTemplate(newVariableMap, null, slaveTemplate, folder, nextParagraphNumber, outlineType,
+ presentationType));
+ }
+ wordMl.createHyperLinkDoc(subDocFileName);
+
+ } else {
+ populateVariableMap(variableMap);
+ }
+ }
+
+ private void generateDocumentDiff(VariableMap newVariableMap, VariableMap variableMap, String fileName, String nextParagraphNumber, String outlineType) throws OseeCoreException {
+ newVariableMap.setValue("artifacts", newVariableMap.getArtifacts("srsProducer.objects"));
+ newVariableMap.setValue("Diff from Baseline", variableMap.getBoolean("Diff from Baseline"));
+ newVariableMap.setValue("compareBranch", variableMap.getBranch("compareBranch"));
+ newVariableMap.setValue("template", slaveTemplateName);
+ newVariableMap.setValue("linkType", variableMap.getValue("linkType"));
+ WordTemplateFileDiffer templateFileDiffer = new WordTemplateFileDiffer();
+ templateFileDiffer.generateFileDifferences(fileName, newVariableMap, nextParagraphNumber, outlineType);
+ }
+
+ public void populateVariableMap(VariableMap variableMap) throws OseeCoreException {
+ if (variableMap == null) {
+ throw new IllegalArgumentException("variableMap must not be null");
+ }
+
+ String name = variableMap.getString("Name");
+ Branch branch = variableMap.getBranch("Branch");
+ List<Artifact> artifacts = ArtifactQuery.getArtifactListFromName(name, branch, EXCLUDE_DELETED);
+ variableMap.setValue("srsProducer.objects", artifacts);
+ }
+
+ private void extractOutliningOptions(String artifactElement) throws OseeCoreException {
+ Matcher matcher = outlineElementsPattern.matcher(artifactElement);
+ if (matcher.find()) {
+ matcher = internalOutlineElementsPattern.matcher(matcher.group(4));
+ outlining = true;
+
+ // Default values for optional/unspecified parameters
+ recurseChildren = false;
+
+ while (matcher.find()) {
+ String elementType = matcher.group(3);
+ String value = WordUtil.textOnly(matcher.group(4));
+
+ if (elementType.equals("HeadingAttribute")) {
+ headingAttributeType = AttributeTypeManager.getType(value);
+ } else if (elementType.equals("RecurseChildren")) {
+ recurseChildren = Boolean.parseBoolean(value);
+ } else if (elementType.equals("Number")) {
+ outlineNumber = value;
+ }
+ }
+ } else {
+ outlining = false;
+ recurseChildren = false;
+ headingAttributeType = null;
+ }
+ }
+
+ private void processObjectArtifact(VariableMap variableMap, Artifact artifact, WordMLProducer wordMl, String outlineType, PresentationType presentationType, boolean multipleArtifacts) throws OseeCoreException {
+ if (!artifact.isAttributeTypeValid(CoreAttributeTypes.WHOLE_WORD_CONTENT) && !artifact.isAttributeTypeValid(CoreAttributeTypes.NATIVE_CONTENT)) {
+ //If the artifact has not been processed
+ if (!processedArtifacts.contains(artifact)) {
+ if (outlining) {
+ String headingText = artifact.getSoleAttributeValue(headingAttributeType, "");
+ CharSequence paragraphNumber =
+ wordMl.startOutlineSubSection("Times New Roman", headingText, outlineType);
+
+ VariableMap options = renderer.getOptions();
+ if (renderer.getBooleanOption(WordTemplateRenderer.UPDATE_PARAGRAPH_NUMBER_OPTION)) {
+ if (artifact.isAttributeTypeValid(CoreAttributeTypes.PARAGRAPH_NUMBER)) {
+ artifact.setSoleAttributeValue(CoreAttributeTypes.PARAGRAPH_NUMBER, paragraphNumber.toString());
+ artifact.persist((SkynetTransaction) options.getValue(ITemplateRenderer.TRANSACTION_OPTION));
+ }
+ }
+ }
+ processAttributes(variableMap, artifact, wordMl, presentationType, multipleArtifacts);
+ if (recurseChildren) {
+ for (Artifact childArtifact : artifact.getChildren()) {
+ processObjectArtifact(variableMap, childArtifact, wordMl, outlineType, presentationType,
+ multipleArtifacts);
+ }
+ }
+ if (outlining) {
+ wordMl.endOutlineSubSection();
+ }
+ processedArtifacts.add(artifact);
+ }
+ } else {
+ nonTemplateArtifacts.add(artifact);
+ }
+ }
+
+ private void processAttributes(VariableMap variableMap, Artifact artifact, WordMLProducer wordMl, PresentationType presentationType, boolean multipleArtifacts) throws OseeCoreException {
+ for (AttributeElement attributeElement : attributeElements) {
+ String attributeName = attributeElement.getAttributeName();
+
+ if (attributeName.equals("*")) {
+ for (AttributeType attributeType : RendererManager.getAttributeTypeOrderList(artifact)) {
+ if (!outlining || !attributeType.equals(headingAttributeType)) {
+ processAttribute(variableMap, artifact, wordMl, attributeElement, attributeType, true,
+ presentationType, multipleArtifacts);
+ }
+ }
+ } else {
+
+ if (artifact.isAttributeTypeValid(attributeName)) {
+ AttributeType attributeType = AttributeTypeManager.getType(attributeName);
+ processAttribute(variableMap, artifact, wordMl, attributeElement, attributeType, false,
+ presentationType, multipleArtifacts);
+ }
+
+ }
+ }
+ wordMl.setPageLayout(artifact);
+ }
+
+ private void processAttribute(VariableMap variableMap, Artifact artifact, WordMLProducer wordMl, AttributeElement attributeElement, IAttributeType attributeType, boolean allAttrs, PresentationType presentationType, boolean multipleArtifacts) throws OseeCoreException {
+ // This is for SRS Publishing. Do not publish unspecified attributes
+ if (!allAttrs && (attributeType.equals(CoreAttributeTypes.PARTITION) || attributeType.equals(CoreAttributeTypes.SAFETY_CRITICALITY))) {
+ if (artifact.isAttributeTypeValid(CoreAttributeTypes.PARTITION)) {
+ for (Attribute<?> partition : artifact.getAttributes(CoreAttributeTypes.PARTITION)) {
+ if (partition == null || partition.getValue() == null || partition.getValue().equals("Unspecified")) {
+ return;
+ }
+ }
+ }
+ }
+
+ //Create a wordTemplateContent for new guys when opening them for edit.
+ if (attributeType.equals(CoreAttributeTypes.WORD_TEMPLATE_CONTENT) && presentationType == PresentationType.SPECIALIZED_EDIT) {
+ artifact.getOrInitializeSoleAttributeValue(attributeType);
+ }
+
+ Collection<Attribute<Object>> attributes = artifact.getAttributes(attributeType);
+
+ if (!attributes.isEmpty()) {
+ // check if the attribute descriptor name is in the ignore list.
+ if (ignoreAttributeExtensions.contains(attributeType.getName())) {
+ return;
+ }
+ variableMap = ensureMapIsSetForDocLinks(variableMap, allAttrs);
+
+ Boolean isInPublishMode =
+ variableMap != null ? Boolean.TRUE.equals(variableMap.getBoolean("inPublishMode")) : false;
+ if (variableMap != null && isInPublishMode) {
+ // Do not publish relation order during publishing
+ if (CoreAttributeTypes.RELATION_ORDER.equals(attributeType)) {
+ return;
+ }
+ }
+
+ RendererManager.renderAttribute(attributeType.getName(), presentationType, artifact, variableMap, wordMl,
+ attributeElement);
+ }
+ }
+
+ private VariableMap ensureMapIsSetForDocLinks(VariableMap variableMap, boolean allAttrs) throws OseeArgumentException {
+ //Do not try to use a null map
+ VariableMap theMap = variableMap;
+ if (theMap == null) {
+ theMap = new VariableMap();
+ }
+ //If someone else set the link leave it set else set it to OSEE server link
+ if (theMap.getValue("linkType") == null) {
+ theMap.setValue("linkType", LinkType.OSEE_SERVER_LINK);
+ }
+ //set all attrs
+ theMap.setValue("allAttrs", allAttrs);
+
+ return theMap;
+ }
+
+ private String getArtifactSetXml(String artifactElement) {
+ artifactElement = artifactElement.replaceAll("<(\\w+:)?Artifact/?>", "");
+ artifactElement = artifactElement.replaceAll("<(\\w+:)?Set_Name>.*?</(\\w+:)?Set_Name>", "");
+
+ return artifactElement;
+ }
+
+ private void extractSkynetAttributeReferences(String artifactElementTemplate) {
+ attributeElements.clear();
+ Matcher matcher = attributeElementsPattern.matcher(artifactElementTemplate);
+
+ while (matcher.find()) {
+ attributeElements.add(new AttributeElement(matcher.group(4)));
+ }
+ }
+
+ private void loadIgnoreAttributeExtensions() {
+ IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
+ if (extensionRegistry != null) {
+ IExtensionPoint point =
+ extensionRegistry.getExtensionPoint("org.eclipse.osee.framework.ui.skynet.IgnorePublishAttribute");
+ if (point != null) {
+ IExtension[] extensions = point.getExtensions();
+ for (IExtension extension : extensions) {
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ for (IConfigurationElement element : elements) {
+ ignoreAttributeExtensions.add(element.getAttribute("name"));
+ }
+ }
+ }
+ }
+ }
+
+ private void displayNonTemplateArtifacts(final Collection<Artifact> artifacts, final String warningString) {
+ if (!artifacts.isEmpty()) {
+ Displays.ensureInDisplayThread(new Runnable() {
+
+ @Override
+ public void run() {
+ ArrayList<Artifact> nonTempArtifacts = new ArrayList<Artifact>(artifacts.size());
+ nonTempArtifacts.addAll(artifacts);
+ WordUiUtil.displayUnhandledArtifacts(artifacts, warningString);
+ }
+ });
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/AddTemplateText.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/AddTemplateText.java
index 4831e28912b..507bd0a7758 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/AddTemplateText.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/AddTemplateText.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.render.word.template;
-
-import java.util.List;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class AddTemplateText implements ITemplateTask {
-
- private final String template;
- private final int begin;
- private final int end;
-
- /**
- * @param last
- * @param start
- * @param template
- */
- public AddTemplateText(int begin, int end, String template) {
- this.template = template;
- this.end = end;
- this.begin = begin;
- }
-
- @Override
- public void process(WordMLProducer wordMl, Artifact artifact, List<ITemplateAttributeHandler> handlers) throws OseeCoreException {
- wordMl.addWordMl(template.subSequence(begin, end));
- }
-
- @Override
- public boolean isTypeNameWildcard() {
- 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.framework.ui.skynet.render.word.template;
+
+import java.util.List;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
+
+/**
+ * @author Andrew M. Finkbeiner
+ */
+public class AddTemplateText implements ITemplateTask {
+
+ private final String template;
+ private final int begin;
+ private final int end;
+
+ /**
+ * @param last
+ * @param start
+ * @param template
+ */
+ public AddTemplateText(int begin, int end, String template) {
+ this.template = template;
+ this.end = end;
+ this.begin = begin;
+ }
+
+ @Override
+ public void process(WordMLProducer wordMl, Artifact artifact, List<ITemplateAttributeHandler> handlers) throws OseeCoreException {
+ wordMl.addWordMl(template.subSequence(begin, end));
+ }
+
+ @Override
+ public boolean isTypeNameWildcard() {
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ArtifactProcessing.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ArtifactProcessing.java
index 90140289be5..593a745b51f 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ArtifactProcessing.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ArtifactProcessing.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.framework.ui.skynet.render.word.template;
-
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.word.WordUtil;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class ArtifactProcessing implements ITemplateTask {
-
- private List<ITemplateTask> innerTasks;
- private boolean outlining;
- private boolean recurseChildren;
- private CoreRelationTypes outlineRelation;
- private String headingAttributeName;
- private String outlineNumber;
- private String cleanedText;
- private String artifactSetName;
-
- private static final Matcher outlineElementsMatcher =
- Pattern.compile("<((\\w+:)?(Outline))>(.*?)</\\1>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
- private static final Matcher internalOutlineElementsMatcher =
- Pattern.compile("<((\\w+:)?(HeadingAttribute|RecurseChildren|Number))>(.*?)</\\1>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
-
- /**
- * @param innerTasks
- * @param artifactSection
- * @param elementType
- */
- public ArtifactProcessing(List<ITemplateTask> innerTasks, String artifactSection, String elementType) {
- this.innerTasks = innerTasks;
- extractInformation(artifactSection, elementType);
- }
-
- @Override
- public boolean isTypeNameWildcard() {
- return false;
- }
-
- @Override
- public void process(WordMLProducer wordMl, Artifact artifact, List<ITemplateAttributeHandler> handlers) {
-
- }
- private static final Matcher setNameMatcher =
- Pattern.compile("<(\\w+:)?Set_Name>(.*?)</(\\w+:)?Set_Name>", Pattern.DOTALL | Pattern.MULTILINE).matcher("");
-
- public List<ITemplateTask> getTasks() {
- return innerTasks;
- }
-
- private void extractInformation(String artifactElement, String type) {
- if (type.equals("Artifact")) {
- setNameMatcher.reset(artifactElement);
- setNameMatcher.find();
- artifactSetName = WordUtil.textOnly(setNameMatcher.group(2));
- artifactElement = setNameMatcher.replaceAll("");
- }
- outlineElementsMatcher.reset(artifactElement);
-
- if (outlineElementsMatcher.find()) {
- internalOutlineElementsMatcher.reset(outlineElementsMatcher.group(4));
- outlining = true;
- recurseChildren = false;
- outlineRelation = CoreRelationTypes.Default_Hierarchical__Child;
-
- while (internalOutlineElementsMatcher.find()) {
- String elementType = internalOutlineElementsMatcher.group(3);
- String value = WordUtil.textOnly(internalOutlineElementsMatcher.group(4));
-
- if (elementType.equals("HeadingAttribute")) {
- headingAttributeName = value;
- } else if (elementType.equals("RecurseChildren")) {
- recurseChildren = Boolean.parseBoolean(value);
- } else if (elementType.equals("Number")) {
- outlineNumber = value;
- }
- }
- } else {
- outlining = false;
- recurseChildren = false;
- outlineRelation = null;
- headingAttributeName = null;
- }
- cleanedText = outlineElementsMatcher.replaceAll("");
- }
-
- /**
- * @return the innerTasks
- */
- public List<ITemplateTask> getInnerTasks() {
- return innerTasks;
- }
-
- /**
- * @return the outlining
- */
- public boolean isOutlining() {
- return outlining;
- }
-
- /**
- * @return the recurseChildren
- */
- public boolean isRecurseChildren() {
- return recurseChildren;
- }
-
- /**
- * @return the outlineRelation
- */
- public CoreRelationTypes getOutlineRelation() {
- return outlineRelation;
- }
-
- /**
- * @return the headingAttributeName
- */
- public String getHeadingAttributeName() {
- return headingAttributeName;
- }
-
- /**
- * @return the outlineNumber
- */
- public String getOutlineNumber() {
- return outlineNumber;
- }
-
- public String getText() {
- return this.cleanedText;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.render.word.template;
+
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.word.WordUtil;
+import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
+
+/**
+ * @author Andrew M. Finkbeiner
+ */
+public class ArtifactProcessing implements ITemplateTask {
+
+ private List<ITemplateTask> innerTasks;
+ private boolean outlining;
+ private boolean recurseChildren;
+ private CoreRelationTypes outlineRelation;
+ private String headingAttributeName;
+ private String outlineNumber;
+ private String cleanedText;
+ private String artifactSetName;
+
+ private static final Matcher outlineElementsMatcher =
+ Pattern.compile("<((\\w+:)?(Outline))>(.*?)</\\1>",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
+ private static final Matcher internalOutlineElementsMatcher =
+ Pattern.compile("<((\\w+:)?(HeadingAttribute|RecurseChildren|Number))>(.*?)</\\1>",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
+
+ /**
+ * @param innerTasks
+ * @param artifactSection
+ * @param elementType
+ */
+ public ArtifactProcessing(List<ITemplateTask> innerTasks, String artifactSection, String elementType) {
+ this.innerTasks = innerTasks;
+ extractInformation(artifactSection, elementType);
+ }
+
+ @Override
+ public boolean isTypeNameWildcard() {
+ return false;
+ }
+
+ @Override
+ public void process(WordMLProducer wordMl, Artifact artifact, List<ITemplateAttributeHandler> handlers) {
+
+ }
+ private static final Matcher setNameMatcher =
+ Pattern.compile("<(\\w+:)?Set_Name>(.*?)</(\\w+:)?Set_Name>", Pattern.DOTALL | Pattern.MULTILINE).matcher("");
+
+ public List<ITemplateTask> getTasks() {
+ return innerTasks;
+ }
+
+ private void extractInformation(String artifactElement, String type) {
+ if (type.equals("Artifact")) {
+ setNameMatcher.reset(artifactElement);
+ setNameMatcher.find();
+ artifactSetName = WordUtil.textOnly(setNameMatcher.group(2));
+ artifactElement = setNameMatcher.replaceAll("");
+ }
+ outlineElementsMatcher.reset(artifactElement);
+
+ if (outlineElementsMatcher.find()) {
+ internalOutlineElementsMatcher.reset(outlineElementsMatcher.group(4));
+ outlining = true;
+ recurseChildren = false;
+ outlineRelation = CoreRelationTypes.Default_Hierarchical__Child;
+
+ while (internalOutlineElementsMatcher.find()) {
+ String elementType = internalOutlineElementsMatcher.group(3);
+ String value = WordUtil.textOnly(internalOutlineElementsMatcher.group(4));
+
+ if (elementType.equals("HeadingAttribute")) {
+ headingAttributeName = value;
+ } else if (elementType.equals("RecurseChildren")) {
+ recurseChildren = Boolean.parseBoolean(value);
+ } else if (elementType.equals("Number")) {
+ outlineNumber = value;
+ }
+ }
+ } else {
+ outlining = false;
+ recurseChildren = false;
+ outlineRelation = null;
+ headingAttributeName = null;
+ }
+ cleanedText = outlineElementsMatcher.replaceAll("");
+ }
+
+ /**
+ * @return the innerTasks
+ */
+ public List<ITemplateTask> getInnerTasks() {
+ return innerTasks;
+ }
+
+ /**
+ * @return the outlining
+ */
+ public boolean isOutlining() {
+ return outlining;
+ }
+
+ /**
+ * @return the recurseChildren
+ */
+ public boolean isRecurseChildren() {
+ return recurseChildren;
+ }
+
+ /**
+ * @return the outlineRelation
+ */
+ public CoreRelationTypes getOutlineRelation() {
+ return outlineRelation;
+ }
+
+ /**
+ * @return the headingAttributeName
+ */
+ public String getHeadingAttributeName() {
+ return headingAttributeName;
+ }
+
+ /**
+ * @return the outlineNumber
+ */
+ public String getOutlineNumber() {
+ return outlineNumber;
+ }
+
+ public String getText() {
+ return this.cleanedText;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/BasicTemplateAttributeHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/BasicTemplateAttributeHandler.java
index 7132d7576ef..ba2159500ea 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/BasicTemplateAttributeHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/BasicTemplateAttributeHandler.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.framework.ui.skynet.render.word.template;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-import org.eclipse.osee.framework.jdk.core.util.Collections;
-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.attribute.AttributeTypeManager;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public final class BasicTemplateAttributeHandler implements ITemplateAttributeHandler {
-
- private final Set<String> ignoreAttributeExtensions;
-
- public BasicTemplateAttributeHandler() {
- this.ignoreAttributeExtensions = new HashSet<String>();
- }
-
- @Override
- public void process(WordMLProducer wordMl, Artifact artifact, TemplateAttribute templateAttribute) throws OseeCoreException {
- AttributeType attributeType = AttributeTypeManager.getType(templateAttribute.getName());
- Collection<Attribute<Object>> attributes = artifact.getAttributes(attributeType.getName());
- if (!attributes.isEmpty()) {
- Attribute<Object> attribute = attributes.iterator().next();
- attributeType = attribute.getAttributeType();
-
- // check if the attribute descriptor name is in the ignore list.
- if (ignoreAttributeExtensions.contains(attributeType.getName())) {
- return;
- }
-
- if (templateAttribute.isParagrapthWrap()) {
- wordMl.startParagraph();
- }
- // assumption: the label is of the form <w:r><w:t> text </w:t></w:r>
- // if (allAttrs) {
- if (templateAttribute.hasLabel()) {
- wordMl.addWordMl("<w:r><w:t> " + templateAttribute.getName() + ": </w:t></w:r>");
- }
- // } else {
- // if (templateAttribute.hasLabel()) {
- // wordMl.addParagraph(templateAttribute.getLabel());
- // }
- //
- String valueList;
- if (attributeType.equals(CoreAttributeTypes.WORD_TEMPLATE_CONTENT)) {
- wordMl.addWordMl((String) attribute.getValue());
- } else {
- valueList = Collections.toString(", ", artifact.getAttributes(templateAttribute.getName()));
- if (templateAttribute.hasFormatting()) {
- if (templateAttribute.getFormat().contains(">x<")) {
- wordMl.addWordMl(templateAttribute.getFormat().replace(">x<", ">" + valueList + "<"));
- }
- } else {
- wordMl.addTextInsideParagraph(valueList);
- }
- }
- if (templateAttribute.isParagrapthWrap()) {
- wordMl.endParagraph();
- }
-
- }
- }
-
- @Override
- public boolean canHandle(Artifact artifact, TemplateAttribute attribute) throws OseeCoreException {
- 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.framework.ui.skynet.render.word.template;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
+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.attribute.AttributeTypeManager;
+import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
+
+/**
+ * @author Andrew M. Finkbeiner
+ */
+public final class BasicTemplateAttributeHandler implements ITemplateAttributeHandler {
+
+ private final Set<String> ignoreAttributeExtensions;
+
+ public BasicTemplateAttributeHandler() {
+ this.ignoreAttributeExtensions = new HashSet<String>();
+ }
+
+ @Override
+ public void process(WordMLProducer wordMl, Artifact artifact, TemplateAttribute templateAttribute) throws OseeCoreException {
+ AttributeType attributeType = AttributeTypeManager.getType(templateAttribute.getName());
+ Collection<Attribute<Object>> attributes = artifact.getAttributes(attributeType.getName());
+ if (!attributes.isEmpty()) {
+ Attribute<Object> attribute = attributes.iterator().next();
+ attributeType = attribute.getAttributeType();
+
+ // check if the attribute descriptor name is in the ignore list.
+ if (ignoreAttributeExtensions.contains(attributeType.getName())) {
+ return;
+ }
+
+ if (templateAttribute.isParagrapthWrap()) {
+ wordMl.startParagraph();
+ }
+ // assumption: the label is of the form <w:r><w:t> text </w:t></w:r>
+ // if (allAttrs) {
+ if (templateAttribute.hasLabel()) {
+ wordMl.addWordMl("<w:r><w:t> " + templateAttribute.getName() + ": </w:t></w:r>");
+ }
+ // } else {
+ // if (templateAttribute.hasLabel()) {
+ // wordMl.addParagraph(templateAttribute.getLabel());
+ // }
+ //
+ String valueList;
+ if (attributeType.equals(CoreAttributeTypes.WORD_TEMPLATE_CONTENT)) {
+ wordMl.addWordMl((String) attribute.getValue());
+ } else {
+ valueList = Collections.toString(", ", artifact.getAttributes(templateAttribute.getName()));
+ if (templateAttribute.hasFormatting()) {
+ if (templateAttribute.getFormat().contains(">x<")) {
+ wordMl.addWordMl(templateAttribute.getFormat().replace(">x<", ">" + valueList + "<"));
+ }
+ } else {
+ wordMl.addTextInsideParagraph(valueList);
+ }
+ }
+ if (templateAttribute.isParagrapthWrap()) {
+ wordMl.endParagraph();
+ }
+
+ }
+ }
+
+ @Override
+ public boolean canHandle(Artifact artifact, TemplateAttribute attribute) throws OseeCoreException {
+ return true;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ITemplateAttributeHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ITemplateAttributeHandler.java
index 52468cba1df..43d378c348f 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ITemplateAttributeHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ITemplateAttributeHandler.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.render.word.template;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public interface ITemplateAttributeHandler {
-
- void process(WordMLProducer wordMl, Artifact artifact, TemplateAttribute attribute) throws OseeCoreException;
-
- boolean canHandle(Artifact artifact, TemplateAttribute attribute) 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.framework.ui.skynet.render.word.template;
+
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
+
+/**
+ * @author Andrew M. Finkbeiner
+ */
+public interface ITemplateAttributeHandler {
+
+ void process(WordMLProducer wordMl, Artifact artifact, TemplateAttribute attribute) throws OseeCoreException;
+
+ boolean canHandle(Artifact artifact, TemplateAttribute attribute) throws OseeCoreException;
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ITemplateTask.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ITemplateTask.java
index f154819af49..f8b5ae9447e 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ITemplateTask.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/ITemplateTask.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.framework.ui.skynet.render.word.template;
-
-import java.util.List;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public interface ITemplateTask {
-
- void process(WordMLProducer wordMl, Artifact artifact, List<ITemplateAttributeHandler> handlers) throws OseeCoreException;
-
- boolean isTypeNameWildcard();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.render.word.template;
+
+import java.util.List;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
+
+/**
+ * @author Andrew M. Finkbeiner
+ */
+public interface ITemplateTask {
+
+ void process(WordMLProducer wordMl, Artifact artifact, List<ITemplateAttributeHandler> handlers) throws OseeCoreException;
+
+ boolean isTypeNameWildcard();
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/SRSSpecialPublishingAttributeHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/SRSSpecialPublishingAttributeHandler.java
index eaecd28a58e..b613fc52555 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/SRSSpecialPublishingAttributeHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/SRSSpecialPublishingAttributeHandler.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.framework.ui.skynet.render.word.template;
-
-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.Attribute;
-import org.eclipse.osee.framework.skynet.core.utility.Requirements;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class SRSSpecialPublishingAttributeHandler implements ITemplateAttributeHandler {
-
- public SRSSpecialPublishingAttributeHandler() {
- }
-
- @Override
- public void process(WordMLProducer wordMl, Artifact artifact, TemplateAttribute attribute) {
-
- }
-
- @Override
- public boolean canHandle(Artifact artifact, TemplateAttribute attribute) throws OseeCoreException {
- // This is for SRS Publishing. Do not publish unspecified attributes
- if ((attribute.getName().equals(Requirements.PARTITION) || attribute.getName().equals("Safety Criticality"))) {
- for (Attribute<?> partition : artifact.getAttributes(Requirements.PARTITION)) {
- if (partition.getValue().equals("Unspecified")) {
- return true;
- }
- }
- }
- 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.framework.ui.skynet.render.word.template;
+
+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.Attribute;
+import org.eclipse.osee.framework.skynet.core.utility.Requirements;
+import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
+
+/**
+ * @author Andrew M. Finkbeiner
+ */
+public class SRSSpecialPublishingAttributeHandler implements ITemplateAttributeHandler {
+
+ public SRSSpecialPublishingAttributeHandler() {
+ }
+
+ @Override
+ public void process(WordMLProducer wordMl, Artifact artifact, TemplateAttribute attribute) {
+
+ }
+
+ @Override
+ public boolean canHandle(Artifact artifact, TemplateAttribute attribute) throws OseeCoreException {
+ // This is for SRS Publishing. Do not publish unspecified attributes
+ if ((attribute.getName().equals(Requirements.PARTITION) || attribute.getName().equals("Safety Criticality"))) {
+ for (Attribute<?> partition : artifact.getAttributes(Requirements.PARTITION)) {
+ if (partition.getValue().equals("Unspecified")) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/TISAttributeHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/TISAttributeHandler.java
index c7ec8e21ebb..a2e31b7aa0d 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/TISAttributeHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/TISAttributeHandler.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.render.word.template;
-
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class TISAttributeHandler implements ITemplateAttributeHandler {
-
- @Override
- public void process(WordMLProducer wordMl, Artifact artifact, TemplateAttribute attribute) throws OseeCoreException {
- for (Artifact requirement : artifact.getRelatedArtifacts(CoreRelationTypes.Verification__Requirement)) {
- wordMl.addParagraphBold(requirement.getSoleAttributeValue(CoreAttributeTypes.PARAGRAPH_NUMBER, "") + "\t" + requirement.getName());
- String str = requirement.getSoleAttributeValue(CoreAttributeTypes.WORD_TEMPLATE_CONTENT);
- wordMl.addWordMl(str);
- }
- }
-
- @Override
- public boolean canHandle(Artifact artifact, TemplateAttribute attribute) throws OseeCoreException {
- return attribute.getName().equals("TIS Traceability");
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.render.word.template;
+
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
+
+/**
+ * @author Andrew M. Finkbeiner
+ */
+public class TISAttributeHandler implements ITemplateAttributeHandler {
+
+ @Override
+ public void process(WordMLProducer wordMl, Artifact artifact, TemplateAttribute attribute) throws OseeCoreException {
+ for (Artifact requirement : artifact.getRelatedArtifacts(CoreRelationTypes.Verification__Requirement)) {
+ wordMl.addParagraphBold(requirement.getSoleAttributeValue(CoreAttributeTypes.PARAGRAPH_NUMBER, "") + "\t" + requirement.getName());
+ String str = requirement.getSoleAttributeValue(CoreAttributeTypes.WORD_TEMPLATE_CONTENT);
+ wordMl.addWordMl(str);
+ }
+ }
+
+ @Override
+ public boolean canHandle(Artifact artifact, TemplateAttribute attribute) throws OseeCoreException {
+ return attribute.getName().equals("TIS Traceability");
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/TemplateAttribute.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/TemplateAttribute.java
index 2f91d095cde..9a6cfacc8dd 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/TemplateAttribute.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/TemplateAttribute.java
@@ -1,136 +1,136 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.render.word.template;
-
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class TemplateAttribute implements ITemplateTask {
-
- private static Matcher trimTags = Pattern.compile("(<.*?>)").matcher("");
-
- private String name;
- private String label;
- private String editable;
- private String format;
- private String outline;
- private boolean paragraphWrap = true;
-
- public TemplateAttribute() {
-
- }
-
- public TemplateAttribute(TemplateAttribute copyMe, String name) {
- this.editable = copyMe.editable;
- this.format = copyMe.format;
- this.label = copyMe.label;
- this.outline = copyMe.outline;
- this.name = name;
- this.paragraphWrap = copyMe.paragraphWrap;
- }
-
- /**
- * @param group
- */
- public void addName(String name) {
- trimTags.reset(name);
- this.name = trimTags.replaceAll("");
- }
-
- /**
- * @param group
- */
- public void addLabel(String label) {
- this.label = label;
- }
-
- /**
- * @param group
- */
- public void addEditable(String editable) {
- this.editable = editable;
- }
-
- /**
- * @param group
- */
- public void addFormat(String format) {
- this.format = format;
- }
-
- /**
- * @param group
- */
- public void addNOutline(String outline) {
- this.outline = outline;
- }
-
- public String getName() {
- return this.name;
- }
-
- @Override
- public void process(WordMLProducer wordMl, Artifact artifact, List<ITemplateAttributeHandler> handlers) throws OseeCoreException {
- for (ITemplateAttributeHandler handler : handlers) {
- if (handler.canHandle(artifact, this)) {
- handler.process(wordMl, artifact, this);
- return;
- }
- }
- // throw new Exception(String.format("There was not a valid handler for Artifact[%s] and TemplateAttribute[%s].",
- // artifact.toString(), this.toString()));
- System.out.println(String.format("There was not a valid handler for Artifact[%s] and TemplateAttribute[%s].",
- artifact.toString(), this.toString()));
- }
-
- public String getLabel() {
- return this.label;
- }
-
- public String getFormat() {
- return this.format;
- }
-
- public boolean hasFormatting() {
- return this.format != null && this.format.length() > 0;
- }
-
- public boolean hasLabel() {
- return this.label != null && this.label.length() > 0;
- }
-
- @Override
- public boolean isTypeNameWildcard() {
- return getName().equals("*");
- }
-
- /**
- * @param group
- */
- public void addParagraphWrap(String group) {
- trimTags.reset(group);
- String value = trimTags.replaceAll("");
- this.paragraphWrap = Boolean.parseBoolean(value);
- }
-
- public boolean isParagrapthWrap() {
- return this.paragraphWrap;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.render.word.template;
+
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
+
+/**
+ * @author Andrew M. Finkbeiner
+ */
+public class TemplateAttribute implements ITemplateTask {
+
+ private static Matcher trimTags = Pattern.compile("(<.*?>)").matcher("");
+
+ private String name;
+ private String label;
+ private String editable;
+ private String format;
+ private String outline;
+ private boolean paragraphWrap = true;
+
+ public TemplateAttribute() {
+
+ }
+
+ public TemplateAttribute(TemplateAttribute copyMe, String name) {
+ this.editable = copyMe.editable;
+ this.format = copyMe.format;
+ this.label = copyMe.label;
+ this.outline = copyMe.outline;
+ this.name = name;
+ this.paragraphWrap = copyMe.paragraphWrap;
+ }
+
+ /**
+ * @param group
+ */
+ public void addName(String name) {
+ trimTags.reset(name);
+ this.name = trimTags.replaceAll("");
+ }
+
+ /**
+ * @param group
+ */
+ public void addLabel(String label) {
+ this.label = label;
+ }
+
+ /**
+ * @param group
+ */
+ public void addEditable(String editable) {
+ this.editable = editable;
+ }
+
+ /**
+ * @param group
+ */
+ public void addFormat(String format) {
+ this.format = format;
+ }
+
+ /**
+ * @param group
+ */
+ public void addNOutline(String outline) {
+ this.outline = outline;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ @Override
+ public void process(WordMLProducer wordMl, Artifact artifact, List<ITemplateAttributeHandler> handlers) throws OseeCoreException {
+ for (ITemplateAttributeHandler handler : handlers) {
+ if (handler.canHandle(artifact, this)) {
+ handler.process(wordMl, artifact, this);
+ return;
+ }
+ }
+ // throw new Exception(String.format("There was not a valid handler for Artifact[%s] and TemplateAttribute[%s].",
+ // artifact.toString(), this.toString()));
+ System.out.println(String.format("There was not a valid handler for Artifact[%s] and TemplateAttribute[%s].",
+ artifact.toString(), this.toString()));
+ }
+
+ public String getLabel() {
+ return this.label;
+ }
+
+ public String getFormat() {
+ return this.format;
+ }
+
+ public boolean hasFormatting() {
+ return this.format != null && this.format.length() > 0;
+ }
+
+ public boolean hasLabel() {
+ return this.label != null && this.label.length() > 0;
+ }
+
+ @Override
+ public boolean isTypeNameWildcard() {
+ return getName().equals("*");
+ }
+
+ /**
+ * @param group
+ */
+ public void addParagraphWrap(String group) {
+ trimTags.reset(group);
+ String value = trimTags.replaceAll("");
+ this.paragraphWrap = Boolean.parseBoolean(value);
+ }
+
+ public boolean isParagrapthWrap() {
+ return this.paragraphWrap;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/WordAttributeTypeAttributeHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/WordAttributeTypeAttributeHandler.java
index 8138ff463c6..edc30e7ff2f 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/WordAttributeTypeAttributeHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/WordAttributeTypeAttributeHandler.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.render.word.template;
-
-import java.util.Collection;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.xml.Xml;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public final class WordAttributeTypeAttributeHandler implements ITemplateAttributeHandler {
-
- @Override
- public void process(WordMLProducer wordMl, Artifact artifact, TemplateAttribute templateAttribute) throws OseeCoreException {
- Collection<Attribute<Object>> attributes = artifact.getAttributes(templateAttribute.getName());
-
- if (!attributes.isEmpty()) {
- Attribute<Object> attribute = attributes.iterator().next();
-
- if (templateAttribute.hasLabel()) {
- wordMl.addParagraph(templateAttribute.getLabel());
- }
-
- wordMl.addWordMl(Xml.escape(attribute.toString()));
- wordMl.resetListValue();
- }
- }
-
- @Override
- public boolean canHandle(Artifact artifact, TemplateAttribute attribute) throws OseeCoreException {
- boolean goodAttributeType = attribute.equals(CoreAttributeTypes.WORD_TEMPLATE_CONTENT);
- boolean goodArtifact = artifact.isAttributeTypeValid(CoreAttributeTypes.WORD_TEMPLATE_CONTENT);
- return goodAttributeType && goodArtifact;
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.render.word.template;
+
+import java.util.Collection;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.xml.Xml;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
+import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
+
+/**
+ * @author Andrew M. Finkbeiner
+ */
+public final class WordAttributeTypeAttributeHandler implements ITemplateAttributeHandler {
+
+ @Override
+ public void process(WordMLProducer wordMl, Artifact artifact, TemplateAttribute templateAttribute) throws OseeCoreException {
+ Collection<Attribute<Object>> attributes = artifact.getAttributes(templateAttribute.getName());
+
+ if (!attributes.isEmpty()) {
+ Attribute<Object> attribute = attributes.iterator().next();
+
+ if (templateAttribute.hasLabel()) {
+ wordMl.addParagraph(templateAttribute.getLabel());
+ }
+
+ wordMl.addWordMl(Xml.escape(attribute.toString()));
+ wordMl.resetListValue();
+ }
+ }
+
+ @Override
+ public boolean canHandle(Artifact artifact, TemplateAttribute attribute) throws OseeCoreException {
+ boolean goodAttributeType = attribute.equals(CoreAttributeTypes.WORD_TEMPLATE_CONTENT);
+ boolean goodArtifact = artifact.isAttributeTypeValid(CoreAttributeTypes.WORD_TEMPLATE_CONTENT);
+ return goodAttributeType && goodArtifact;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/WordTemplateManager.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/WordTemplateManager.java
index 76677d7498c..29c8c3bfca4 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/WordTemplateManager.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/word/template/WordTemplateManager.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.framework.ui.skynet.render.word.template;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.word.WordUtil;
-import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class WordTemplateManager {
-
- // private static final Matcher setNameMatcher =
- // Pattern.compile("<(\\w+:)?Set_Name>(.*?)</(\\w+:)?Set_Name>", Pattern.DOTALL | Pattern.MULTILINE).matcher("");
- // private static final Matcher headElementsMatcher =
- // Pattern.compile("<((\\w+:)(Artifact|Extension_Processor))>(.*?)</\\1>",
- // Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
- //
- // private static final Matcher artifactMatcher = Pattern.compile(
- // "<\\w+?:Artifact>(.*?)</\\w+?:Artifact>",
- // Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE)
- // .matcher("");
- //
- // private static final Matcher internalMatcher = Pattern.compile(
- // "<\\w*?(Label|Outline|Name|Format|Editable)>(.*?)</\\1>",
- // Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE)
- // .matcher("");
- // private static final Matcher attributeMatcher = Pattern.compile(
- // "<((\\w+:)?(Attribute))>(.*?)</\\3>",
- // Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE)
- // .matcher("");
-
- private static final Matcher nameMatcher =
- Pattern.compile("<((\\w+:)?(Name))>(.*?)</\\1>", Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher(
- "");
- private static final Matcher outlineTypeMatcher =
- Pattern.compile("<((\\w+:)?(OutlineType))>(.*?)</\\1>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
- private static final Matcher outlineNumberMatcher =
- Pattern.compile("<((\\w+:)?(Number))>(.*?)</\\1>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
- private static final Matcher argumentElementsMatcher =
- Pattern.compile("<((\\w+:)?(Argument))>(.*?)</\\1>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
- private static final Matcher keyValueElementsMatcher =
- Pattern.compile("<((\\w+:)?(Key|Value))>(.*?)</\\1>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
- private static final Matcher subDocElementsMatcher =
- Pattern.compile("<((\\w+:)?(SubDoc))>(.*?)</\\1>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
-
- private static final Matcher setNameMatcher =
- Pattern.compile("<(\\w+:)?Set_Name>(.*?)</(\\w+:)?Set_Name>", Pattern.DOTALL | Pattern.MULTILINE).matcher("");
- private static final Matcher headElementsMatcher =
- Pattern.compile("<((\\w+:)?(Artifact|Extension_Processor))>(.*?)</\\1>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
- private static final Matcher attributeElementsMatcher =
- Pattern.compile("<((\\w+:)?(Attribute))>(.*?)</\\3>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
- private static final Matcher internalAttributeElementsMatcher =
- Pattern.compile("<((\\w+:)?(Label|Outline|Name|Format|Editable|ParagraphWrap))>(.*?)</\\1>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
-
- enum XmlAttributeType {
- Label, Outline, Name, Format, Editable, ParagraphWrap
- }
-
- private String template;
- private final String artifactSetName;
- private final List<ITemplateTask> tasks = new ArrayList<ITemplateTask>();
- private final List<ITemplateAttributeHandler> attributeHandlers;
-
- public WordTemplateManager(String template, List<ITemplateAttributeHandler> attributeHandlers) {
- // this.template = sanatize(template);
- this.template = template;
- this.attributeHandlers = attributeHandlers;
- this.artifactSetName = getArtifactSetName();
- // preProcessTemplatePositions();
-
- }
-
- private String getArtifactSetName() {
- String artifactSetName = "";
- headElementsMatcher.reset(template);
-
- if (headElementsMatcher.find()) {
- String elementType = headElementsMatcher.group(3);
- String elementValue = headElementsMatcher.group(4);
-
- if (elementType.equals("Artifact")) {
- setNameMatcher.reset(elementValue);
- setNameMatcher.find();
- artifactSetName = WordUtil.textOnly(setNameMatcher.group(2));
- }
- }
- return artifactSetName;
- }
-
- private void preProcessTemplateInsideArtifactTag(String text, List<ITemplateTask> innerTasks) {
- String newtext = text;//trimUnwantedText(text);
- attributeElementsMatcher.reset(newtext);
- int last = 0;
- while (attributeElementsMatcher.find()) {
- int start = attributeElementsMatcher.start();
- innerTasks.add(new AddTemplateText(last, start, newtext));
- int end = attributeElementsMatcher.end();
- last = end;
- TemplateAttribute processAttribute = new TemplateAttribute();
- innerTasks.add(processAttribute);
- String internal = attributeElementsMatcher.group(4);
- internalAttributeElementsMatcher.reset(internal);
- while (internalAttributeElementsMatcher.find()) {
- String type = internalAttributeElementsMatcher.group(3);
- switch (XmlAttributeType.valueOf(type)) {
- case Label:
- processAttribute.addLabel(internalAttributeElementsMatcher.group(4));
- break;
- case Editable:
- processAttribute.addEditable(internalAttributeElementsMatcher.group(4));
- break;
- case Format:
- processAttribute.addFormat(internalAttributeElementsMatcher.group(4));
- break;
- case Name:
- processAttribute.addName(internalAttributeElementsMatcher.group(4));
- break;
- case Outline:
- processAttribute.addNOutline(internalAttributeElementsMatcher.group(4));
- break;
- case ParagraphWrap:
- processAttribute.addParagraphWrap(internalAttributeElementsMatcher.group(4));
- break;
- default:
- break;
- }
- }
- }
- innerTasks.add(new AddTemplateText(last, newtext.length(), newtext));
- }
-
- private String sanatize(String template) {
- Matcher matcher = Pattern.compile("<w:proofErr w:type=\".*?\"/>").matcher("");
- matcher.reset(template);
- while (matcher.find()) {
- System.out.println("sanatize " + matcher.group(0));
- }
- template = matcher.replaceAll("");
- return template;
- }
-
- private void preProcessTemplatePositions() {
- headElementsMatcher.reset(template);
- int last = 0;
- while (headElementsMatcher.find()) {
- int start = headElementsMatcher.start();
- tasks.add(new AddTemplateText(last, start, template));
- int end = headElementsMatcher.end();
- last = end;
- List<ITemplateTask> innerTasks = new ArrayList<ITemplateTask>();
- String artifactSection = headElementsMatcher.group(4);
- String elementType = headElementsMatcher.group(3);
-
- ArtifactProcessing artifactProcessing = new ArtifactProcessing(innerTasks, artifactSection, elementType);
- tasks.add(artifactProcessing);
- preProcessTemplateInsideArtifactTag(artifactProcessing.getText(), innerTasks);
-
- }
- tasks.add(new AddTemplateText(last, template.length(), template));
- }
-
- public String getArtifactSet() {
- return this.artifactSetName;
- }
-
- /**
- * @param artifacts
- * @throws Exception
- */
- public void processArtifacts(WordMLProducer wordMl, List<Artifact> artifacts) throws OseeCoreException {
- String outlineNumber = peekAtFirstArtifactToGetParagraphNumber(template, artifacts);
- template = wordMl.setHeadingNumbers(outlineNumber, template, null);
- preProcessTemplatePositions();
-
- for (ITemplateTask task : tasks) {
- if (task instanceof ArtifactProcessing) {
- ArtifactProcessing artifactProcessingTask = (ArtifactProcessing) task;
-
- if (artifactProcessingTask.isRecurseChildren()) {
- artifacts = recurseArtifactChildren(artifacts);
- }
- List<ITemplateTask> artifactAttributeTasks = ((ArtifactProcessing) task).getTasks();
- for (Artifact artifact : artifacts) {
-
- boolean performedOutLining = false;
-
- if (artifactProcessingTask.isOutlining()) {
- performedOutLining = true;
-
- String headingText =
- artifact.getSoleAttributeValue(artifactProcessingTask.getHeadingAttributeName(), "");
- CharSequence paragraphNumber = wordMl.startOutlineSubSection("Times New Roman", headingText, null);
- }
-
- List<ITemplateTask> actualTasks = preProcessTemplateTasks(artifactAttributeTasks, artifact);
- for (ITemplateTask inner : actualTasks) {
- inner.process(wordMl, artifact, attributeHandlers);
- }
-
- if (performedOutLining) {
- wordMl.endOutlineSubSection();
- }
-
- wordMl.setPageLayout(artifact);
- }
- } else {
- task.process(wordMl, null, attributeHandlers);
- }
- }
- }
-
- /**
- * @param artifacts
- * @return
- * @throws OseeCoreException
- */
- private List<Artifact> recurseArtifactChildren(List<Artifact> artifacts) throws OseeCoreException {
- List<Artifact> arts = new ArrayList<Artifact>();
- for (Artifact art : artifacts) {
- recursiveChildResolver(art, arts);
- }
- return arts;
- }
-
- private void recursiveChildResolver(Artifact artifact, List<Artifact> arts) throws OseeCoreException {
- arts.add(artifact);
- for (Artifact child : artifact.getChildren()) {
- recursiveChildResolver(child, arts);
- }
- }
-
- /**
- * This method expands wildcard(*) attribute names into all of the attribute types of a particular artifact.
- *
- * @param tasks2
- * @param artifact
- * @return
- * @throws OseeCoreException
- */
- private List<ITemplateTask> preProcessTemplateTasks(List<ITemplateTask> tasks, Artifact artifact) throws OseeCoreException {
- List<ITemplateTask> newTasks = new ArrayList<ITemplateTask>();
- for (ITemplateTask task : tasks) {
- if (task instanceof TemplateAttribute && ((TemplateAttribute) task).isTypeNameWildcard()) {
- TemplateAttribute attributeTask = (TemplateAttribute) task;
- Collection<AttributeType> attributeTypes = artifact.getAttributeTypes();
- for (AttributeType attributeType : attributeTypes) {
- newTasks.add(new TemplateAttribute(attributeTask, attributeType.getName()));
- }
- } else {
- newTasks.add(task);
- }
- }
- return newTasks;
- }
-
- private String peekAtFirstArtifactToGetParagraphNumber(String template, List<Artifact> artifacts) throws OseeCoreException {
- Pattern headElementsPattern =
- Pattern.compile("<((\\w+:)?(Artifact|Extension_Processor))>(.*?)</\\1>",
- Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
- String startParagraphNumber = "1";
- Matcher matcher = headElementsPattern.matcher(template);
-
- if (matcher.find()) {
- String elementType = matcher.group(3);
- String elementValue = matcher.group(4);
-
- if (elementType.equals("Artifact")) {
- // Matcher setNameMatcher = setNamePattern.matcher(elementValue);
- setNameMatcher.reset(elementValue);
- setNameMatcher.find();
-
- if (!artifacts.isEmpty()) {
- Artifact artifact = artifacts.iterator().next();
- if (artifact.isAttributeTypeValid(CoreAttributeTypes.PARAGRAPH_NUMBER)) {
- if (!artifact.getSoleAttributeValue(CoreAttributeTypes.PARAGRAPH_NUMBER, "").equals("")) {
- startParagraphNumber = artifact.getSoleAttributeValue(CoreAttributeTypes.PARAGRAPH_NUMBER, "");
- }
- }
- }
- }
- }
- return startParagraphNumber;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.render.word.template;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.word.WordUtil;
+import org.eclipse.osee.framework.ui.skynet.render.word.WordMLProducer;
+
+/**
+ * @author Andrew M. Finkbeiner
+ */
+public class WordTemplateManager {
+
+ // private static final Matcher setNameMatcher =
+ // Pattern.compile("<(\\w+:)?Set_Name>(.*?)</(\\w+:)?Set_Name>", Pattern.DOTALL | Pattern.MULTILINE).matcher("");
+ // private static final Matcher headElementsMatcher =
+ // Pattern.compile("<((\\w+:)(Artifact|Extension_Processor))>(.*?)</\\1>",
+ // Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
+ //
+ // private static final Matcher artifactMatcher = Pattern.compile(
+ // "<\\w+?:Artifact>(.*?)</\\w+?:Artifact>",
+ // Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE)
+ // .matcher("");
+ //
+ // private static final Matcher internalMatcher = Pattern.compile(
+ // "<\\w*?(Label|Outline|Name|Format|Editable)>(.*?)</\\1>",
+ // Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE)
+ // .matcher("");
+ // private static final Matcher attributeMatcher = Pattern.compile(
+ // "<((\\w+:)?(Attribute))>(.*?)</\\3>",
+ // Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE)
+ // .matcher("");
+
+ private static final Matcher nameMatcher =
+ Pattern.compile("<((\\w+:)?(Name))>(.*?)</\\1>", Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher(
+ "");
+ private static final Matcher outlineTypeMatcher =
+ Pattern.compile("<((\\w+:)?(OutlineType))>(.*?)</\\1>",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
+ private static final Matcher outlineNumberMatcher =
+ Pattern.compile("<((\\w+:)?(Number))>(.*?)</\\1>",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
+ private static final Matcher argumentElementsMatcher =
+ Pattern.compile("<((\\w+:)?(Argument))>(.*?)</\\1>",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
+ private static final Matcher keyValueElementsMatcher =
+ Pattern.compile("<((\\w+:)?(Key|Value))>(.*?)</\\1>",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
+ private static final Matcher subDocElementsMatcher =
+ Pattern.compile("<((\\w+:)?(SubDoc))>(.*?)</\\1>",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
+
+ private static final Matcher setNameMatcher =
+ Pattern.compile("<(\\w+:)?Set_Name>(.*?)</(\\w+:)?Set_Name>", Pattern.DOTALL | Pattern.MULTILINE).matcher("");
+ private static final Matcher headElementsMatcher =
+ Pattern.compile("<((\\w+:)?(Artifact|Extension_Processor))>(.*?)</\\1>",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
+ private static final Matcher attributeElementsMatcher =
+ Pattern.compile("<((\\w+:)?(Attribute))>(.*?)</\\3>",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
+ private static final Matcher internalAttributeElementsMatcher =
+ Pattern.compile("<((\\w+:)?(Label|Outline|Name|Format|Editable|ParagraphWrap))>(.*?)</\\1>",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE).matcher("");
+
+ enum XmlAttributeType {
+ Label, Outline, Name, Format, Editable, ParagraphWrap
+ }
+
+ private String template;
+ private final String artifactSetName;
+ private final List<ITemplateTask> tasks = new ArrayList<ITemplateTask>();
+ private final List<ITemplateAttributeHandler> attributeHandlers;
+
+ public WordTemplateManager(String template, List<ITemplateAttributeHandler> attributeHandlers) {
+ // this.template = sanatize(template);
+ this.template = template;
+ this.attributeHandlers = attributeHandlers;
+ this.artifactSetName = getArtifactSetName();
+ // preProcessTemplatePositions();
+
+ }
+
+ private String getArtifactSetName() {
+ String artifactSetName = "";
+ headElementsMatcher.reset(template);
+
+ if (headElementsMatcher.find()) {
+ String elementType = headElementsMatcher.group(3);
+ String elementValue = headElementsMatcher.group(4);
+
+ if (elementType.equals("Artifact")) {
+ setNameMatcher.reset(elementValue);
+ setNameMatcher.find();
+ artifactSetName = WordUtil.textOnly(setNameMatcher.group(2));
+ }
+ }
+ return artifactSetName;
+ }
+
+ private void preProcessTemplateInsideArtifactTag(String text, List<ITemplateTask> innerTasks) {
+ String newtext = text;//trimUnwantedText(text);
+ attributeElementsMatcher.reset(newtext);
+ int last = 0;
+ while (attributeElementsMatcher.find()) {
+ int start = attributeElementsMatcher.start();
+ innerTasks.add(new AddTemplateText(last, start, newtext));
+ int end = attributeElementsMatcher.end();
+ last = end;
+ TemplateAttribute processAttribute = new TemplateAttribute();
+ innerTasks.add(processAttribute);
+ String internal = attributeElementsMatcher.group(4);
+ internalAttributeElementsMatcher.reset(internal);
+ while (internalAttributeElementsMatcher.find()) {
+ String type = internalAttributeElementsMatcher.group(3);
+ switch (XmlAttributeType.valueOf(type)) {
+ case Label:
+ processAttribute.addLabel(internalAttributeElementsMatcher.group(4));
+ break;
+ case Editable:
+ processAttribute.addEditable(internalAttributeElementsMatcher.group(4));
+ break;
+ case Format:
+ processAttribute.addFormat(internalAttributeElementsMatcher.group(4));
+ break;
+ case Name:
+ processAttribute.addName(internalAttributeElementsMatcher.group(4));
+ break;
+ case Outline:
+ processAttribute.addNOutline(internalAttributeElementsMatcher.group(4));
+ break;
+ case ParagraphWrap:
+ processAttribute.addParagraphWrap(internalAttributeElementsMatcher.group(4));
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ innerTasks.add(new AddTemplateText(last, newtext.length(), newtext));
+ }
+
+ private String sanatize(String template) {
+ Matcher matcher = Pattern.compile("<w:proofErr w:type=\".*?\"/>").matcher("");
+ matcher.reset(template);
+ while (matcher.find()) {
+ System.out.println("sanatize " + matcher.group(0));
+ }
+ template = matcher.replaceAll("");
+ return template;
+ }
+
+ private void preProcessTemplatePositions() {
+ headElementsMatcher.reset(template);
+ int last = 0;
+ while (headElementsMatcher.find()) {
+ int start = headElementsMatcher.start();
+ tasks.add(new AddTemplateText(last, start, template));
+ int end = headElementsMatcher.end();
+ last = end;
+ List<ITemplateTask> innerTasks = new ArrayList<ITemplateTask>();
+ String artifactSection = headElementsMatcher.group(4);
+ String elementType = headElementsMatcher.group(3);
+
+ ArtifactProcessing artifactProcessing = new ArtifactProcessing(innerTasks, artifactSection, elementType);
+ tasks.add(artifactProcessing);
+ preProcessTemplateInsideArtifactTag(artifactProcessing.getText(), innerTasks);
+
+ }
+ tasks.add(new AddTemplateText(last, template.length(), template));
+ }
+
+ public String getArtifactSet() {
+ return this.artifactSetName;
+ }
+
+ /**
+ * @param artifacts
+ * @throws Exception
+ */
+ public void processArtifacts(WordMLProducer wordMl, List<Artifact> artifacts) throws OseeCoreException {
+ String outlineNumber = peekAtFirstArtifactToGetParagraphNumber(template, artifacts);
+ template = wordMl.setHeadingNumbers(outlineNumber, template, null);
+ preProcessTemplatePositions();
+
+ for (ITemplateTask task : tasks) {
+ if (task instanceof ArtifactProcessing) {
+ ArtifactProcessing artifactProcessingTask = (ArtifactProcessing) task;
+
+ if (artifactProcessingTask.isRecurseChildren()) {
+ artifacts = recurseArtifactChildren(artifacts);
+ }
+ List<ITemplateTask> artifactAttributeTasks = ((ArtifactProcessing) task).getTasks();
+ for (Artifact artifact : artifacts) {
+
+ boolean performedOutLining = false;
+
+ if (artifactProcessingTask.isOutlining()) {
+ performedOutLining = true;
+
+ String headingText =
+ artifact.getSoleAttributeValue(artifactProcessingTask.getHeadingAttributeName(), "");
+ CharSequence paragraphNumber = wordMl.startOutlineSubSection("Times New Roman", headingText, null);
+ }
+
+ List<ITemplateTask> actualTasks = preProcessTemplateTasks(artifactAttributeTasks, artifact);
+ for (ITemplateTask inner : actualTasks) {
+ inner.process(wordMl, artifact, attributeHandlers);
+ }
+
+ if (performedOutLining) {
+ wordMl.endOutlineSubSection();
+ }
+
+ wordMl.setPageLayout(artifact);
+ }
+ } else {
+ task.process(wordMl, null, attributeHandlers);
+ }
+ }
+ }
+
+ /**
+ * @param artifacts
+ * @return
+ * @throws OseeCoreException
+ */
+ private List<Artifact> recurseArtifactChildren(List<Artifact> artifacts) throws OseeCoreException {
+ List<Artifact> arts = new ArrayList<Artifact>();
+ for (Artifact art : artifacts) {
+ recursiveChildResolver(art, arts);
+ }
+ return arts;
+ }
+
+ private void recursiveChildResolver(Artifact artifact, List<Artifact> arts) throws OseeCoreException {
+ arts.add(artifact);
+ for (Artifact child : artifact.getChildren()) {
+ recursiveChildResolver(child, arts);
+ }
+ }
+
+ /**
+ * This method expands wildcard(*) attribute names into all of the attribute types of a particular artifact.
+ *
+ * @param tasks2
+ * @param artifact
+ * @return
+ * @throws OseeCoreException
+ */
+ private List<ITemplateTask> preProcessTemplateTasks(List<ITemplateTask> tasks, Artifact artifact) throws OseeCoreException {
+ List<ITemplateTask> newTasks = new ArrayList<ITemplateTask>();
+ for (ITemplateTask task : tasks) {
+ if (task instanceof TemplateAttribute && ((TemplateAttribute) task).isTypeNameWildcard()) {
+ TemplateAttribute attributeTask = (TemplateAttribute) task;
+ Collection<AttributeType> attributeTypes = artifact.getAttributeTypes();
+ for (AttributeType attributeType : attributeTypes) {
+ newTasks.add(new TemplateAttribute(attributeTask, attributeType.getName()));
+ }
+ } else {
+ newTasks.add(task);
+ }
+ }
+ return newTasks;
+ }
+
+ private String peekAtFirstArtifactToGetParagraphNumber(String template, List<Artifact> artifacts) throws OseeCoreException {
+ Pattern headElementsPattern =
+ Pattern.compile("<((\\w+:)?(Artifact|Extension_Processor))>(.*?)</\\1>",
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
+ String startParagraphNumber = "1";
+ Matcher matcher = headElementsPattern.matcher(template);
+
+ if (matcher.find()) {
+ String elementType = matcher.group(3);
+ String elementValue = matcher.group(4);
+
+ if (elementType.equals("Artifact")) {
+ // Matcher setNameMatcher = setNamePattern.matcher(elementValue);
+ setNameMatcher.reset(elementValue);
+ setNameMatcher.find();
+
+ if (!artifacts.isEmpty()) {
+ Artifact artifact = artifacts.iterator().next();
+ if (artifact.isAttributeTypeValid(CoreAttributeTypes.PARAGRAPH_NUMBER)) {
+ if (!artifact.getSoleAttributeValue(CoreAttributeTypes.PARAGRAPH_NUMBER, "").equals("")) {
+ startParagraphNumber = artifact.getSoleAttributeValue(CoreAttributeTypes.PARAGRAPH_NUMBER, "");
+ }
+ }
+ }
+ }
+ }
+ return startParagraphNumber;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/IResultsEditorProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/IResultsEditorProvider.java
index b72921f9cd9..4b9434eda85 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/IResultsEditorProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/IResultsEditorProvider.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.results;
-
-import java.util.List;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-
-/**
- * @author Donald G. Dunne
- */
-public interface IResultsEditorProvider {
-
- public String getEditorName() throws OseeCoreException;
-
- public List<IResultsEditorTab> getResultsEditorTabs() 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.framework.ui.skynet.results;
+
+import java.util.List;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IResultsEditorProvider {
+
+ public String getEditorName() throws OseeCoreException;
+
+ public List<IResultsEditorTab> getResultsEditorTabs() throws OseeCoreException;
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/IResultsEditorTab.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/IResultsEditorTab.java
index c7085fd9b82..0e957cc4b7f 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/IResultsEditorTab.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/IResultsEditorTab.java
@@ -1,24 +1,24 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.results;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @author Donald G. Dunne
- */
-public interface IResultsEditorTab {
-
- public String getTabName();
-
- public Composite createTab(Composite parent, ResultsEditor resultsEditor) 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.framework.ui.skynet.results;
+
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IResultsEditorTab {
+
+ public String getTabName();
+
+ public Composite createTab(Composite parent, ResultsEditor resultsEditor) throws OseeCoreException;
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/ResultsEditorConverter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/ResultsEditorConverter.java
index b2788ce809d..ac652b40433 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/ResultsEditorConverter.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/ResultsEditorConverter.java
@@ -1,283 +1,283 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.results;
-
-import java.io.ByteArrayOutputStream;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.core.util.TableWriterAdaptor;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.jdk.core.util.io.xml.ExcelXmlWriter;
-import org.eclipse.osee.framework.jdk.core.util.io.xml.ISheetWriter;
-import org.eclipse.osee.framework.ui.skynet.results.html.IResultsEditorHtmlTab;
-import org.eclipse.osee.framework.ui.skynet.results.table.IResultsEditorTableTab;
-import org.eclipse.osee.framework.ui.skynet.results.table.IResultsXViewerRow;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ResultsEditorConverter {
- private final List<IEditorTabConverter> converters;
-
- public ResultsEditorConverter() {
- converters = new ArrayList<IEditorTabConverter>();
- converters.add(new HTMLEditorTabConverter());
- converters.add(new ExcelEditorTabConverter());
- converters.add(new MultiTypeEditorTabConverter("PDF"));
- converters.add(new MultiTypeEditorTabConverter("RTF"));
- converters.add(new MultiTypeEditorTabConverter("HTML"));
- }
-
- private IEditorTabConverter getConverter(String type) throws OseeArgumentException {
- IEditorTabConverter toReturn = null;
- for (IEditorTabConverter converter : converters) {
- if (converter.getType().equalsIgnoreCase(type)) {
- toReturn = converter;
- break;
- }
- }
- if (toReturn == null) {
- throw new OseeArgumentException(String.format("Conversion to [%s] is not supported", type));
- }
- return toReturn;
- }
-
- private void checkForNull(String param, Object object) throws OseeArgumentException {
- if (object == null) {
- throw new OseeArgumentException(String.format("[%s] cannot be null", param));
- }
- }
-
- public void convert(String type, Writer writer, IResultsEditorProvider provider) throws OseeCoreException {
- checkForNull("Type", type);
- checkForNull("Writer", writer);
- checkForNull("IResultsEditorProvider", provider);
-
- IEditorTabConverter converter = getConverter(type);
-
- Collection<IResultsEditorTab> tabs = provider.getResultsEditorTabs();
- for (IResultsEditorTab tab : tabs) {
- converter.canConvert(tab);
- }
-
- converter.convert(writer, tabs);
- }
-
- private interface IEditorTabConverter {
-
- public String getType();
-
- public void canConvert(IResultsEditorTab tab) throws OseeCoreException;
-
- public void convert(Writer writer, Collection<IResultsEditorTab> tabs) throws OseeCoreException;
-
- }
-
- private static abstract class AbstractEditorTabConverter implements IEditorTabConverter {
- @Override
- public void canConvert(IResultsEditorTab tab) throws OseeCoreException {
- if (!(tab instanceof IResultsEditorTableTab) && !(tab instanceof IResultsEditorHtmlTab)) {
- throw new OseeArgumentException(
- String.format("%s to type [%s] is not supported", tab.getClass(), getType()));
- }
- }
-
- protected String[] getColumns(IResultsEditorTableTab tab) throws Exception {
- List<XViewerColumn> columns = tab.getTableColumns();
- String[] columnNames = new String[columns.size()];
- for (int index = 0; index < columns.size(); index++) {
- columnNames[index] = columns.get(index).getName();
- }
- return columnNames;
- }
- }
-
- private final static class HTMLEditorTabConverter extends AbstractEditorTabConverter {
- private final static String HTML_HEADER =
- "<!DOCTYPE html PUBLIC \"-//W3C//DTD html 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\n";
-
- private final static String PAGE_TITLE = "<title>%s</title>\n";
- private final static String STYLE_CSS =
- "<style type=\"text/css\">\n" + //
- " .blueBox { color: black; background-color:#999999; display: block; padding: 6px; margin-top: 8px; width:95%; cursor:pointer; border: solid; border-color:black; border-width: thin; text-align: left; vertical-align: middle; }\n" + //
- " .results { color: black; background-color:whitesmoke; display: block; padding: 6px; width:95%; cursor:pointer; border: solid; border-width: thin; text-align: left; vertical-align: middle; }\n" + //
- "</style>\n";
- private final static String JAVASCRIPT = "<script type=\"text/javascript\">\n" + //
- "function opendiv(id){\n" + //
- "var divStyle = document.getElementById(id).style;\n" + //
- "divStyle.display = (divStyle.display=='none') ? 'block':'none';\n" + //
- "}\n";
- private final static String START_HTML = "</script>\n</head>\n<body>\n";
- private final static String END_HTML = "\n</body>\n</html>\n";
-
- @Override
- public void convert(Writer writer, Collection<IResultsEditorTab> tabs) throws OseeCoreException {
- try {
- writer.write(HTML_HEADER);
- writer.write(String.format(PAGE_TITLE, "Report"));
- writer.write(STYLE_CSS);
- writer.write(String.format(JAVASCRIPT, tabs.size() + 1));
- writer.write(START_HTML);
- writer.write("<div id=\"alldivs\">\n");
- int index = 1;
- for (IResultsEditorTab rawTab : tabs) {
- String id = "div" + index++;
- writer.write("<a class=\"blueBox\" onclick=\"opendiv('" + id + "');\">\n");
- writer.write(rawTab.getTabName());
- writer.write("\n</a>\n");
-
- writer.write("<div class=\"results\" id=\"" + id + "\" style=\"display:none;\">\n");
- if (rawTab instanceof IResultsEditorTableTab) {
- IResultsEditorTableTab tab = (IResultsEditorTableTab) rawTab;
- writer.write(AHTML.beginMultiColumnTable(95, 1));
- String[] columns = getColumns(tab);
- writer.write(AHTML.addHeaderRowMultiColumnTable(columns));
- writeRows(writer, tab);
- writer.write(AHTML.endMultiColumnTable());
- } else if (rawTab instanceof IResultsEditorHtmlTab) {
- String htmlString = ((IResultsEditorHtmlTab) rawTab).getReportHtml();
- writer.write(htmlString);
- } else {
- throw new UnsupportedOperationException(String.format("%s to type %s is not supported",
- rawTab.getClass(), getType()));
- }
- writer.write("</div>\n");
- }
- writer.write(END_HTML);
- } catch (Exception ex) {
- if (!(ex instanceof OseeCoreException)) {
- OseeExceptions.wrapAndThrow(ex);
- }
- }
- }
-
- private void writeRows(Writer outputWriter, IResultsEditorTableTab tab) throws Exception {
- Collection<IResultsXViewerRow> rows = tab.getTableRows();
- for (IResultsXViewerRow row : rows) {
- outputWriter.write(AHTML.addRowMultiColumnTable(row.values()));
- }
- }
-
- @Override
- public String getType() {
- return "collapsing_html";
- }
- }
-
- private final static class ExcelEditorTabConverter extends AbstractEditorTabConverter {
-
- @Override
- public void canConvert(IResultsEditorTab tab) throws OseeCoreException {
- if (!(tab instanceof IResultsEditorTableTab)) {
- throw new OseeArgumentException(String.format("%s to type %s is not supported", tab.getClass(),
- getType().toUpperCase()));
- }
- }
-
- @Override
- public void convert(Writer writer, Collection<IResultsEditorTab> tabs) throws OseeCoreException {
- try {
- ISheetWriter sheetWriter = new ExcelXmlWriter(writer);
- for (IResultsEditorTab rawTab : tabs) {
- if (rawTab instanceof IResultsEditorTableTab) {
- IResultsEditorTableTab tab = (IResultsEditorTableTab) rawTab;
- String[] columns = getColumns(tab);
- sheetWriter.startSheet(tab.getTabName(), columns.length);
- sheetWriter.writeRow(columns);
- Collection<IResultsXViewerRow> rows = tab.getTableRows();
- for (IResultsXViewerRow row : rows) {
- sheetWriter.writeRow(row.values());
- }
- sheetWriter.endSheet();
- } else {
- throw new UnsupportedOperationException(String.format("%s to type %s is not supported",
- rawTab.getClass(), getType()));
- }
- }
- sheetWriter.endWorkbook();
- } catch (Exception ex) {
- if (!(ex instanceof OseeCoreException)) {
- OseeExceptions.wrapAndThrow(ex);
- }
- }
- }
-
- @Override
- public String getType() {
- return "EXCEL";
- }
- }
-
- private final static class MultiTypeEditorTabConverter extends AbstractEditorTabConverter {
-
- private final String type;
-
- public MultiTypeEditorTabConverter(String type) {
- this.type = type.toUpperCase();
- }
-
- @Override
- public void canConvert(IResultsEditorTab tab) throws OseeCoreException {
- if (!(tab instanceof IResultsEditorTableTab)) {
- throw new OseeArgumentException(String.format("%s to type %s is not supported", tab.getClass(),
- getType().toUpperCase()));
- }
- }
-
- @Override
- public void convert(Writer writer, Collection<IResultsEditorTab> tabs) throws OseeCoreException {
- try {
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- TableWriterAdaptor writerAdaptor = new TableWriterAdaptor(type.toLowerCase(), outputStream);
- writerAdaptor.writeTitle("Report");
- writerAdaptor.openDocument();
-
- for (IResultsEditorTab rawTab : tabs) {
- if (rawTab instanceof IResultsEditorTableTab) {
- IResultsEditorTableTab tab = (IResultsEditorTableTab) rawTab;
-
- writerAdaptor.writeTitle(tab.getTabName());
-
- String[] columns = getColumns(tab);
- writerAdaptor.writeHeader(columns);
-
- Collection<IResultsXViewerRow> rows = tab.getTableRows();
- for (IResultsXViewerRow row : rows) {
- writerAdaptor.writeRow(row.values());
- }
- writerAdaptor.writeDocument();
- } else {
- throw new UnsupportedOperationException(String.format("%s to type %s is not supported",
- rawTab.getClass(), getType()));
- }
- }
- writerAdaptor.close();
- writer.write(outputStream.toString("ISO-8859-1"));
- } catch (Exception ex) {
- if (!(ex instanceof OseeCoreException)) {
- OseeExceptions.wrapAndThrow(ex);
- }
- }
- }
-
- @Override
- public String getType() {
- return type;
- }
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.results;
+
+import java.io.ByteArrayOutputStream;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeExceptions;
+import org.eclipse.osee.framework.core.util.TableWriterAdaptor;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.jdk.core.util.io.xml.ExcelXmlWriter;
+import org.eclipse.osee.framework.jdk.core.util.io.xml.ISheetWriter;
+import org.eclipse.osee.framework.ui.skynet.results.html.IResultsEditorHtmlTab;
+import org.eclipse.osee.framework.ui.skynet.results.table.IResultsEditorTableTab;
+import org.eclipse.osee.framework.ui.skynet.results.table.IResultsXViewerRow;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ResultsEditorConverter {
+ private final List<IEditorTabConverter> converters;
+
+ public ResultsEditorConverter() {
+ converters = new ArrayList<IEditorTabConverter>();
+ converters.add(new HTMLEditorTabConverter());
+ converters.add(new ExcelEditorTabConverter());
+ converters.add(new MultiTypeEditorTabConverter("PDF"));
+ converters.add(new MultiTypeEditorTabConverter("RTF"));
+ converters.add(new MultiTypeEditorTabConverter("HTML"));
+ }
+
+ private IEditorTabConverter getConverter(String type) throws OseeArgumentException {
+ IEditorTabConverter toReturn = null;
+ for (IEditorTabConverter converter : converters) {
+ if (converter.getType().equalsIgnoreCase(type)) {
+ toReturn = converter;
+ break;
+ }
+ }
+ if (toReturn == null) {
+ throw new OseeArgumentException(String.format("Conversion to [%s] is not supported", type));
+ }
+ return toReturn;
+ }
+
+ private void checkForNull(String param, Object object) throws OseeArgumentException {
+ if (object == null) {
+ throw new OseeArgumentException(String.format("[%s] cannot be null", param));
+ }
+ }
+
+ public void convert(String type, Writer writer, IResultsEditorProvider provider) throws OseeCoreException {
+ checkForNull("Type", type);
+ checkForNull("Writer", writer);
+ checkForNull("IResultsEditorProvider", provider);
+
+ IEditorTabConverter converter = getConverter(type);
+
+ Collection<IResultsEditorTab> tabs = provider.getResultsEditorTabs();
+ for (IResultsEditorTab tab : tabs) {
+ converter.canConvert(tab);
+ }
+
+ converter.convert(writer, tabs);
+ }
+
+ private interface IEditorTabConverter {
+
+ public String getType();
+
+ public void canConvert(IResultsEditorTab tab) throws OseeCoreException;
+
+ public void convert(Writer writer, Collection<IResultsEditorTab> tabs) throws OseeCoreException;
+
+ }
+
+ private static abstract class AbstractEditorTabConverter implements IEditorTabConverter {
+ @Override
+ public void canConvert(IResultsEditorTab tab) throws OseeCoreException {
+ if (!(tab instanceof IResultsEditorTableTab) && !(tab instanceof IResultsEditorHtmlTab)) {
+ throw new OseeArgumentException(
+ String.format("%s to type [%s] is not supported", tab.getClass(), getType()));
+ }
+ }
+
+ protected String[] getColumns(IResultsEditorTableTab tab) throws Exception {
+ List<XViewerColumn> columns = tab.getTableColumns();
+ String[] columnNames = new String[columns.size()];
+ for (int index = 0; index < columns.size(); index++) {
+ columnNames[index] = columns.get(index).getName();
+ }
+ return columnNames;
+ }
+ }
+
+ private final static class HTMLEditorTabConverter extends AbstractEditorTabConverter {
+ private final static String HTML_HEADER =
+ "<!DOCTYPE html PUBLIC \"-//W3C//DTD html 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\n";
+
+ private final static String PAGE_TITLE = "<title>%s</title>\n";
+ private final static String STYLE_CSS =
+ "<style type=\"text/css\">\n" + //
+ " .blueBox { color: black; background-color:#999999; display: block; padding: 6px; margin-top: 8px; width:95%; cursor:pointer; border: solid; border-color:black; border-width: thin; text-align: left; vertical-align: middle; }\n" + //
+ " .results { color: black; background-color:whitesmoke; display: block; padding: 6px; width:95%; cursor:pointer; border: solid; border-width: thin; text-align: left; vertical-align: middle; }\n" + //
+ "</style>\n";
+ private final static String JAVASCRIPT = "<script type=\"text/javascript\">\n" + //
+ "function opendiv(id){\n" + //
+ "var divStyle = document.getElementById(id).style;\n" + //
+ "divStyle.display = (divStyle.display=='none') ? 'block':'none';\n" + //
+ "}\n";
+ private final static String START_HTML = "</script>\n</head>\n<body>\n";
+ private final static String END_HTML = "\n</body>\n</html>\n";
+
+ @Override
+ public void convert(Writer writer, Collection<IResultsEditorTab> tabs) throws OseeCoreException {
+ try {
+ writer.write(HTML_HEADER);
+ writer.write(String.format(PAGE_TITLE, "Report"));
+ writer.write(STYLE_CSS);
+ writer.write(String.format(JAVASCRIPT, tabs.size() + 1));
+ writer.write(START_HTML);
+ writer.write("<div id=\"alldivs\">\n");
+ int index = 1;
+ for (IResultsEditorTab rawTab : tabs) {
+ String id = "div" + index++;
+ writer.write("<a class=\"blueBox\" onclick=\"opendiv('" + id + "');\">\n");
+ writer.write(rawTab.getTabName());
+ writer.write("\n</a>\n");
+
+ writer.write("<div class=\"results\" id=\"" + id + "\" style=\"display:none;\">\n");
+ if (rawTab instanceof IResultsEditorTableTab) {
+ IResultsEditorTableTab tab = (IResultsEditorTableTab) rawTab;
+ writer.write(AHTML.beginMultiColumnTable(95, 1));
+ String[] columns = getColumns(tab);
+ writer.write(AHTML.addHeaderRowMultiColumnTable(columns));
+ writeRows(writer, tab);
+ writer.write(AHTML.endMultiColumnTable());
+ } else if (rawTab instanceof IResultsEditorHtmlTab) {
+ String htmlString = ((IResultsEditorHtmlTab) rawTab).getReportHtml();
+ writer.write(htmlString);
+ } else {
+ throw new UnsupportedOperationException(String.format("%s to type %s is not supported",
+ rawTab.getClass(), getType()));
+ }
+ writer.write("</div>\n");
+ }
+ writer.write(END_HTML);
+ } catch (Exception ex) {
+ if (!(ex instanceof OseeCoreException)) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ }
+ }
+
+ private void writeRows(Writer outputWriter, IResultsEditorTableTab tab) throws Exception {
+ Collection<IResultsXViewerRow> rows = tab.getTableRows();
+ for (IResultsXViewerRow row : rows) {
+ outputWriter.write(AHTML.addRowMultiColumnTable(row.values()));
+ }
+ }
+
+ @Override
+ public String getType() {
+ return "collapsing_html";
+ }
+ }
+
+ private final static class ExcelEditorTabConverter extends AbstractEditorTabConverter {
+
+ @Override
+ public void canConvert(IResultsEditorTab tab) throws OseeCoreException {
+ if (!(tab instanceof IResultsEditorTableTab)) {
+ throw new OseeArgumentException(String.format("%s to type %s is not supported", tab.getClass(),
+ getType().toUpperCase()));
+ }
+ }
+
+ @Override
+ public void convert(Writer writer, Collection<IResultsEditorTab> tabs) throws OseeCoreException {
+ try {
+ ISheetWriter sheetWriter = new ExcelXmlWriter(writer);
+ for (IResultsEditorTab rawTab : tabs) {
+ if (rawTab instanceof IResultsEditorTableTab) {
+ IResultsEditorTableTab tab = (IResultsEditorTableTab) rawTab;
+ String[] columns = getColumns(tab);
+ sheetWriter.startSheet(tab.getTabName(), columns.length);
+ sheetWriter.writeRow(columns);
+ Collection<IResultsXViewerRow> rows = tab.getTableRows();
+ for (IResultsXViewerRow row : rows) {
+ sheetWriter.writeRow(row.values());
+ }
+ sheetWriter.endSheet();
+ } else {
+ throw new UnsupportedOperationException(String.format("%s to type %s is not supported",
+ rawTab.getClass(), getType()));
+ }
+ }
+ sheetWriter.endWorkbook();
+ } catch (Exception ex) {
+ if (!(ex instanceof OseeCoreException)) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ }
+ }
+
+ @Override
+ public String getType() {
+ return "EXCEL";
+ }
+ }
+
+ private final static class MultiTypeEditorTabConverter extends AbstractEditorTabConverter {
+
+ private final String type;
+
+ public MultiTypeEditorTabConverter(String type) {
+ this.type = type.toUpperCase();
+ }
+
+ @Override
+ public void canConvert(IResultsEditorTab tab) throws OseeCoreException {
+ if (!(tab instanceof IResultsEditorTableTab)) {
+ throw new OseeArgumentException(String.format("%s to type %s is not supported", tab.getClass(),
+ getType().toUpperCase()));
+ }
+ }
+
+ @Override
+ public void convert(Writer writer, Collection<IResultsEditorTab> tabs) throws OseeCoreException {
+ try {
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ TableWriterAdaptor writerAdaptor = new TableWriterAdaptor(type.toLowerCase(), outputStream);
+ writerAdaptor.writeTitle("Report");
+ writerAdaptor.openDocument();
+
+ for (IResultsEditorTab rawTab : tabs) {
+ if (rawTab instanceof IResultsEditorTableTab) {
+ IResultsEditorTableTab tab = (IResultsEditorTableTab) rawTab;
+
+ writerAdaptor.writeTitle(tab.getTabName());
+
+ String[] columns = getColumns(tab);
+ writerAdaptor.writeHeader(columns);
+
+ Collection<IResultsXViewerRow> rows = tab.getTableRows();
+ for (IResultsXViewerRow row : rows) {
+ writerAdaptor.writeRow(row.values());
+ }
+ writerAdaptor.writeDocument();
+ } else {
+ throw new UnsupportedOperationException(String.format("%s to type %s is not supported",
+ rawTab.getClass(), getType()));
+ }
+ }
+ writerAdaptor.close();
+ writer.write(outputStream.toString("ISO-8859-1"));
+ } catch (Exception ex) {
+ if (!(ex instanceof OseeCoreException)) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ }
+ }
+
+ @Override
+ public String getType() {
+ return type;
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/XResultData.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/XResultData.java
index 404bb3b4ab1..0507b00268b 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/XResultData.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/XResultData.java
@@ -1,275 +1,275 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.results;
-
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.logging.Level;
-import java.util.regex.Pattern;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.type.CountingMap;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.logging.IHealthStatus;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.logging.SevereLoggingMonitor;
-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.BranchManager;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.results.html.XResultBrowserHyperCmd;
-import org.eclipse.osee.framework.ui.skynet.results.html.XResultPage;
-import org.eclipse.osee.framework.ui.skynet.results.html.XResultPage.Manipulations;
-import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
-import org.eclipse.osee.framework.ui.swt.Displays;
-
-/**
- * Used to log Info, Warning and Errors to multiple locations (logger, stderr/out and XResultView). Upon completion, a
- * call to report(title) will open results in the ResultsView
- *
- * @author Donald G. Dunne
- */
-public class XResultData {
-
- public static Pattern ErrorPattern = Pattern.compile("Error: ");
- public static Pattern WarningPattern = Pattern.compile("Warning: ");
- StringBuffer sb = new StringBuffer();
- private static enum Type {
- Severe, Warning, Info;
- }
- CountingMap<Type> count = new CountingMap<Type>();
- private boolean enableOseeLog;
-
- public XResultData() {
- this(true);
- }
-
- public XResultData(boolean enableOseeLog) {
- super();
- this.enableOseeLog = enableOseeLog;
- }
-
- public void addRaw(String str) {
- sb.append(str);
- }
-
- public void reportSevereLoggingMonitor(SevereLoggingMonitor monitorLog) {
- List<IHealthStatus> stats = monitorLog.getAllLogs();
- for (IHealthStatus stat : new CopyOnWriteArrayList<IHealthStatus>(stats)) {
- if (stat.getException() != null) {
- logError("Exception: " + Lib.exceptionToString(stat.getException()));
- }
- }
- }
-
- public void log(IProgressMonitor monitor, String str) {
- log(str);
- if (monitor != null) monitor.setTaskName(str);
- }
-
- public void log(String str) {
- logStr(Type.Info, str + "\n", null);
- }
-
- public void log(String str, IProgressMonitor monitor) {
- logStr(Type.Info, str + "\n", monitor);
- }
-
- public void logError(String str) {
- logStr(Type.Severe, str + "\n", null);
- }
-
- public void logWarning(String str) {
- logStr(Type.Warning, str + "\n", null);
- }
-
- public boolean isEmpty() {
- return toString().equals("");
- }
-
- public void logStr(Type type, final String str, final IProgressMonitor monitor) {
- count.put(type);
- String resultStr = "";
- if (type == Type.Warning)
- resultStr = "Warning: " + str;
- else if (type == Type.Severe)
- resultStr = "Error: " + str;
- else
- resultStr = str;
- sb.append(resultStr);
- if (enableOseeLog) {
- OseeLog.log(SkynetGuiPlugin.class, Level.parse(type.name().toUpperCase()), resultStr);
- }
- if (monitor != null) {
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- monitor.subTask(str);
- }
- });
- }
- }
-
- @Override
- public String toString() {
- return sb.toString();
- }
-
- public void report(final String title) throws OseeCoreException {
- report(title, Manipulations.ALL);
- }
-
- public void report(final String title, final Manipulations... manipulations) throws OseeCoreException {
- final String html = getReport(title, manipulations).getManipulatedHtml();
- try {
- ResultsEditor.open("Results", title, html);
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- public XResultPage getReport(final String title) {
- return getReport(title, Manipulations.ALL);
- }
-
- public XResultPage getReport(final String title, Manipulations... manipulations) {
- return new XResultPage(title + " - " + XDate.getDateNow(XDate.MMDDYYHHMM),
- (sb.toString().equals("") ? "Nothing Logged" : sb.toString()), manipulations);
- }
-
- /*
- * Creates hyperlink using hrid as name. Default editor will open.
- */
- public static String getHyperlink(Artifact art) {
- return getHyperlink(art.getHumanReadableId(), art.getHumanReadableId(), art.getBranch().getId());
- }
-
- /*
- * Creates hyperlink using name. Default editor will open.
- */
- public static String getHyperlink(String name, Artifact art) {
- return getHyperlink(name, art.getHumanReadableId(), art.getBranch().getId());
- }
-
- /*
- * Creates hyperlink using name. Default editor will open hrid for branchId given
- */
- public static String getHyperlink(String name, String hrid, int branchId) {
- return AHTML.getHyperlink(XResultBrowserHyperCmd.getHyperCmdStr(XResultBrowserHyperCmd.openArtifactBranch,
- hrid + "(" + branchId + ")"), name);
- }
-
- public static String getHyperlinkUrlExternal(String name, String url) {
- return AHTML.getHyperlink(XResultBrowserHyperCmd.getHyperCmdStr(XResultBrowserHyperCmd.browserExternal, url),
- name);
- }
-
- public static String getHyperlinkUrlInternal(String name, String url) {
- return AHTML.getHyperlink(XResultBrowserHyperCmd.getHyperCmdStr(XResultBrowserHyperCmd.browserInternal, url),
- name);
- }
-
- public static String getHyperlinkForArtifactEditor(String name, String hrid) {
- return AHTML.getHyperlink(XResultBrowserHyperCmd.getHyperCmdStr(XResultBrowserHyperCmd.openArtifactEditor, hrid),
- name);
- }
-
- public static String getHyperlinkForAction(String name, String hrid) {
- return AHTML.getHyperlink(XResultBrowserHyperCmd.getHyperCmdStr(XResultBrowserHyperCmd.openAction, hrid), name);
- }
-
- public static String getHyperlinkForAction(Artifact artifact) {
- return getHyperlinkForAction(artifact.getHumanReadableId(), artifact);
- }
-
- public static String getHyperlinkForAction(String name, Artifact art) {
- return AHTML.getHyperlink(
- XResultBrowserHyperCmd.getHyperCmdStr(XResultBrowserHyperCmd.openAction, art.getGuid()), name);
- }
-
- private int getCount(Type type) {
- return count.get(type);
- }
-
- public int getNumErrors() {
- return getCount(Type.Severe);
- }
-
- /**
- * XResultData counts number of errors logged with logError, however users can insert their own "Error: " strings to
- * produce errors. This counts based on these occurences.
- */
- public int getNumErrorsViaSearch() {
- return Lib.getMatcherCount(ErrorPattern, sb.toString());
- }
-
- /**
- * XResultData counts number of warnings logged with logWarning, however users can insert their own "Error: " strings
- * to produce errors. This counts based on these occurences.
- */
- public int getNumWarningsViaSearch() {
- return Lib.getMatcherCount(WarningPattern, sb.toString());
- }
-
- public int getNumWarnings() {
- return getCount(Type.Warning);
- }
-
- public boolean isEnableOseeLog() {
- return enableOseeLog;
- }
-
- public void setEnableOseeLog(boolean enableOseeLog) {
- this.enableOseeLog = enableOseeLog;
- }
-
- public static void runExample() {
- runExample("This is my report title");
- }
-
- public static void runExample(String title) {
- try {
- XResultData rd = new XResultData();
- rd.log("This is just a normal log message");
- rd.logWarning("This is a warning");
- rd.logError("This is an error");
-
- rd.log("\n\nExample of hyperlinked hrid: " + XResultData.getHyperlink(UserManager.getUser()));
-
- rd.log("Example of hyperlinked artifact different hyperlink string: " + XResultData.getHyperlink(
- "Different string", UserManager.getUser()));
-
- rd.log("Example of hyperlinked hrid on another branch: " + getHyperlink(
- UserManager.getUser().getHumanReadableId(), UserManager.getUser().getHumanReadableId(),
- BranchManager.getCommonBranch().getId()));
- rd.addRaw(AHTML.newline());
- rd.addRaw("Example of hyperlink that opens external browser " + getHyperlinkUrlExternal("Google",
- "http://www.google.com") + AHTML.newline());
- rd.addRaw("Example of hyperlink that opens internal browser " + getHyperlinkUrlInternal("Google",
- "http://www.google.com") + AHTML.newline());
-
- rd.log("\n\nHere is a nice table");
- rd.addRaw(AHTML.beginMultiColumnTable(95, 1));
- rd.addRaw(AHTML.addHeaderRowMultiColumnTable(new String[] {"Type", "Title", "Status"}));
- for (int x = 0; x < 3; x++)
- rd.addRaw(AHTML.addRowMultiColumnTable(new String[] {"Type " + x, "Title " + x, x + ""}));
- rd.addRaw(AHTML.addRowMultiColumnTable(new String[] {"Error / Warning in table ", "Error: this is error",
- "Warning: this is warning"}));
- rd.addRaw(AHTML.endMultiColumnTable());
- rd.report("This is my report title");
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.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.framework.ui.skynet.results;
+
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.logging.Level;
+import java.util.regex.Pattern;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.type.CountingMap;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.logging.IHealthStatus;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.logging.SevereLoggingMonitor;
+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.BranchManager;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.results.html.XResultBrowserHyperCmd;
+import org.eclipse.osee.framework.ui.skynet.results.html.XResultPage;
+import org.eclipse.osee.framework.ui.skynet.results.html.XResultPage.Manipulations;
+import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
+import org.eclipse.osee.framework.ui.swt.Displays;
+
+/**
+ * Used to log Info, Warning and Errors to multiple locations (logger, stderr/out and XResultView). Upon completion, a
+ * call to report(title) will open results in the ResultsView
+ *
+ * @author Donald G. Dunne
+ */
+public class XResultData {
+
+ public static Pattern ErrorPattern = Pattern.compile("Error: ");
+ public static Pattern WarningPattern = Pattern.compile("Warning: ");
+ StringBuffer sb = new StringBuffer();
+ private static enum Type {
+ Severe, Warning, Info;
+ }
+ CountingMap<Type> count = new CountingMap<Type>();
+ private boolean enableOseeLog;
+
+ public XResultData() {
+ this(true);
+ }
+
+ public XResultData(boolean enableOseeLog) {
+ super();
+ this.enableOseeLog = enableOseeLog;
+ }
+
+ public void addRaw(String str) {
+ sb.append(str);
+ }
+
+ public void reportSevereLoggingMonitor(SevereLoggingMonitor monitorLog) {
+ List<IHealthStatus> stats = monitorLog.getAllLogs();
+ for (IHealthStatus stat : new CopyOnWriteArrayList<IHealthStatus>(stats)) {
+ if (stat.getException() != null) {
+ logError("Exception: " + Lib.exceptionToString(stat.getException()));
+ }
+ }
+ }
+
+ public void log(IProgressMonitor monitor, String str) {
+ log(str);
+ if (monitor != null) monitor.setTaskName(str);
+ }
+
+ public void log(String str) {
+ logStr(Type.Info, str + "\n", null);
+ }
+
+ public void log(String str, IProgressMonitor monitor) {
+ logStr(Type.Info, str + "\n", monitor);
+ }
+
+ public void logError(String str) {
+ logStr(Type.Severe, str + "\n", null);
+ }
+
+ public void logWarning(String str) {
+ logStr(Type.Warning, str + "\n", null);
+ }
+
+ public boolean isEmpty() {
+ return toString().equals("");
+ }
+
+ public void logStr(Type type, final String str, final IProgressMonitor monitor) {
+ count.put(type);
+ String resultStr = "";
+ if (type == Type.Warning)
+ resultStr = "Warning: " + str;
+ else if (type == Type.Severe)
+ resultStr = "Error: " + str;
+ else
+ resultStr = str;
+ sb.append(resultStr);
+ if (enableOseeLog) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.parse(type.name().toUpperCase()), resultStr);
+ }
+ if (monitor != null) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ monitor.subTask(str);
+ }
+ });
+ }
+ }
+
+ @Override
+ public String toString() {
+ return sb.toString();
+ }
+
+ public void report(final String title) throws OseeCoreException {
+ report(title, Manipulations.ALL);
+ }
+
+ public void report(final String title, final Manipulations... manipulations) throws OseeCoreException {
+ final String html = getReport(title, manipulations).getManipulatedHtml();
+ try {
+ ResultsEditor.open("Results", title, html);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ public XResultPage getReport(final String title) {
+ return getReport(title, Manipulations.ALL);
+ }
+
+ public XResultPage getReport(final String title, Manipulations... manipulations) {
+ return new XResultPage(title + " - " + XDate.getDateNow(XDate.MMDDYYHHMM),
+ (sb.toString().equals("") ? "Nothing Logged" : sb.toString()), manipulations);
+ }
+
+ /*
+ * Creates hyperlink using hrid as name. Default editor will open.
+ */
+ public static String getHyperlink(Artifact art) {
+ return getHyperlink(art.getHumanReadableId(), art.getHumanReadableId(), art.getBranch().getId());
+ }
+
+ /*
+ * Creates hyperlink using name. Default editor will open.
+ */
+ public static String getHyperlink(String name, Artifact art) {
+ return getHyperlink(name, art.getHumanReadableId(), art.getBranch().getId());
+ }
+
+ /*
+ * Creates hyperlink using name. Default editor will open hrid for branchId given
+ */
+ public static String getHyperlink(String name, String hrid, int branchId) {
+ return AHTML.getHyperlink(XResultBrowserHyperCmd.getHyperCmdStr(XResultBrowserHyperCmd.openArtifactBranch,
+ hrid + "(" + branchId + ")"), name);
+ }
+
+ public static String getHyperlinkUrlExternal(String name, String url) {
+ return AHTML.getHyperlink(XResultBrowserHyperCmd.getHyperCmdStr(XResultBrowserHyperCmd.browserExternal, url),
+ name);
+ }
+
+ public static String getHyperlinkUrlInternal(String name, String url) {
+ return AHTML.getHyperlink(XResultBrowserHyperCmd.getHyperCmdStr(XResultBrowserHyperCmd.browserInternal, url),
+ name);
+ }
+
+ public static String getHyperlinkForArtifactEditor(String name, String hrid) {
+ return AHTML.getHyperlink(XResultBrowserHyperCmd.getHyperCmdStr(XResultBrowserHyperCmd.openArtifactEditor, hrid),
+ name);
+ }
+
+ public static String getHyperlinkForAction(String name, String hrid) {
+ return AHTML.getHyperlink(XResultBrowserHyperCmd.getHyperCmdStr(XResultBrowserHyperCmd.openAction, hrid), name);
+ }
+
+ public static String getHyperlinkForAction(Artifact artifact) {
+ return getHyperlinkForAction(artifact.getHumanReadableId(), artifact);
+ }
+
+ public static String getHyperlinkForAction(String name, Artifact art) {
+ return AHTML.getHyperlink(
+ XResultBrowserHyperCmd.getHyperCmdStr(XResultBrowserHyperCmd.openAction, art.getGuid()), name);
+ }
+
+ private int getCount(Type type) {
+ return count.get(type);
+ }
+
+ public int getNumErrors() {
+ return getCount(Type.Severe);
+ }
+
+ /**
+ * XResultData counts number of errors logged with logError, however users can insert their own "Error: " strings to
+ * produce errors. This counts based on these occurences.
+ */
+ public int getNumErrorsViaSearch() {
+ return Lib.getMatcherCount(ErrorPattern, sb.toString());
+ }
+
+ /**
+ * XResultData counts number of warnings logged with logWarning, however users can insert their own "Error: " strings
+ * to produce errors. This counts based on these occurences.
+ */
+ public int getNumWarningsViaSearch() {
+ return Lib.getMatcherCount(WarningPattern, sb.toString());
+ }
+
+ public int getNumWarnings() {
+ return getCount(Type.Warning);
+ }
+
+ public boolean isEnableOseeLog() {
+ return enableOseeLog;
+ }
+
+ public void setEnableOseeLog(boolean enableOseeLog) {
+ this.enableOseeLog = enableOseeLog;
+ }
+
+ public static void runExample() {
+ runExample("This is my report title");
+ }
+
+ public static void runExample(String title) {
+ try {
+ XResultData rd = new XResultData();
+ rd.log("This is just a normal log message");
+ rd.logWarning("This is a warning");
+ rd.logError("This is an error");
+
+ rd.log("\n\nExample of hyperlinked hrid: " + XResultData.getHyperlink(UserManager.getUser()));
+
+ rd.log("Example of hyperlinked artifact different hyperlink string: " + XResultData.getHyperlink(
+ "Different string", UserManager.getUser()));
+
+ rd.log("Example of hyperlinked hrid on another branch: " + getHyperlink(
+ UserManager.getUser().getHumanReadableId(), UserManager.getUser().getHumanReadableId(),
+ BranchManager.getCommonBranch().getId()));
+ rd.addRaw(AHTML.newline());
+ rd.addRaw("Example of hyperlink that opens external browser " + getHyperlinkUrlExternal("Google",
+ "http://www.google.com") + AHTML.newline());
+ rd.addRaw("Example of hyperlink that opens internal browser " + getHyperlinkUrlInternal("Google",
+ "http://www.google.com") + AHTML.newline());
+
+ rd.log("\n\nHere is a nice table");
+ rd.addRaw(AHTML.beginMultiColumnTable(95, 1));
+ rd.addRaw(AHTML.addHeaderRowMultiColumnTable(new String[] {"Type", "Title", "Status"}));
+ for (int x = 0; x < 3; x++)
+ rd.addRaw(AHTML.addRowMultiColumnTable(new String[] {"Type " + x, "Title " + x, x + ""}));
+ rd.addRaw(AHTML.addRowMultiColumnTable(new String[] {"Error / Warning in table ", "Error: this is error",
+ "Warning: this is warning"}));
+ rd.addRaw(AHTML.endMultiColumnTable());
+ rd.report("This is my report title");
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/chart/ChartViewerSWT.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/chart/ChartViewerSWT.java
index 75defe30050..1d5c7f807dd 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/chart/ChartViewerSWT.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/chart/ChartViewerSWT.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.framework.ui.skynet.results.chart;
-
-import java.util.logging.Level;
-import org.eclipse.birt.chart.device.IDeviceRenderer;
-import org.eclipse.birt.chart.exception.ChartException;
-import org.eclipse.birt.chart.factory.Generator;
-import org.eclipse.birt.chart.model.Chart;
-import org.eclipse.birt.chart.model.attribute.Bounds;
-import org.eclipse.birt.chart.model.attribute.impl.BoundsImpl;
-import org.eclipse.birt.chart.util.PluginSettings;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-
-public class ChartViewerSWT implements PaintListener
-
-{
-
- private IDeviceRenderer idr = null;
- private final Chart chart;
-
- public ChartViewerSWT(Chart chart) {
- this.chart = chart;
- // INITIALIZE THE SWT RENDERING DEVICE
- final PluginSettings ps = PluginSettings.instance();
- try {
- idr = ps.getDevice("dv.SWT");
- } catch (ChartException pex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, pex);
- }
- }
-
- /**
- * The SWT paint callback
- */
-
- public void paintControl(PaintEvent pe) {
-
- idr.setProperty(IDeviceRenderer.GRAPHICS_CONTEXT, pe.gc);
- Composite co = (Composite) pe.getSource();
- Rectangle re = co.getClientArea();
- Bounds bo = BoundsImpl.create(re.x, re.y, re.width, re.height);
- bo.scale(72d / idr.getDisplayServer().getDpiResolution()); // BOUNDS MUST BE SPECIFIED IN POINTS
- // BUILD AND RENDER THE CHART
-
- Generator gr = Generator.instance();
- try {
- gr.render(idr, gr.build(idr.getDisplayServer(), chart, null, bo, null));
- } catch (ChartException gex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, gex);
- }
-
- }
-
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.results.chart;
+
+import java.util.logging.Level;
+import org.eclipse.birt.chart.device.IDeviceRenderer;
+import org.eclipse.birt.chart.exception.ChartException;
+import org.eclipse.birt.chart.factory.Generator;
+import org.eclipse.birt.chart.model.Chart;
+import org.eclipse.birt.chart.model.attribute.Bounds;
+import org.eclipse.birt.chart.model.attribute.impl.BoundsImpl;
+import org.eclipse.birt.chart.util.PluginSettings;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+
+public class ChartViewerSWT implements PaintListener
+
+{
+
+ private IDeviceRenderer idr = null;
+ private final Chart chart;
+
+ public ChartViewerSWT(Chart chart) {
+ this.chart = chart;
+ // INITIALIZE THE SWT RENDERING DEVICE
+ final PluginSettings ps = PluginSettings.instance();
+ try {
+ idr = ps.getDevice("dv.SWT");
+ } catch (ChartException pex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, pex);
+ }
+ }
+
+ /**
+ * The SWT paint callback
+ */
+
+ public void paintControl(PaintEvent pe) {
+
+ idr.setProperty(IDeviceRenderer.GRAPHICS_CONTEXT, pe.gc);
+ Composite co = (Composite) pe.getSource();
+ Rectangle re = co.getClientArea();
+ Bounds bo = BoundsImpl.create(re.x, re.y, re.width, re.height);
+ bo.scale(72d / idr.getDisplayServer().getDpiResolution()); // BOUNDS MUST BE SPECIFIED IN POINTS
+ // BUILD AND RENDER THE CHART
+
+ Generator gr = Generator.instance();
+ try {
+ gr.render(idr, gr.build(idr.getDisplayServer(), chart, null, bo, null));
+ } catch (ChartException gex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, gex);
+ }
+
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/chart/IResultsEditorChartTab.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/chart/IResultsEditorChartTab.java
index 2684735d096..da21336c810 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/chart/IResultsEditorChartTab.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/chart/IResultsEditorChartTab.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.framework.ui.skynet.results.chart;
-
-import org.eclipse.birt.chart.model.Chart;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.ui.skynet.results.IResultsEditorTab;
-
-/**
- * @author Donald G. Dunne
- */
-public interface IResultsEditorChartTab extends IResultsEditorTab {
-
- public Chart getChart() 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.framework.ui.skynet.results.chart;
+
+import org.eclipse.birt.chart.model.Chart;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.ui.skynet.results.IResultsEditorTab;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IResultsEditorChartTab extends IResultsEditorTab {
+
+ public Chart getChart() throws OseeCoreException;
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/chart/ResultsEditorChartTab.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/chart/ResultsEditorChartTab.java
index dfb19d02998..f3b09835a5e 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/chart/ResultsEditorChartTab.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/chart/ResultsEditorChartTab.java
@@ -1,89 +1,89 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.results.chart;
-
-import org.eclipse.birt.chart.model.Chart;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.results.ResultsEditor;
-import org.eclipse.osee.framework.ui.skynet.util.ImageCapture;
-import org.eclipse.osee.framework.ui.swt.ALayout;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-
-/**
- * @author Donald G. Dunne
- */
-public class ResultsEditorChartTab implements IResultsEditorChartTab {
-
- private final Chart chart;
- private final String tabName;
- private Composite chartComposite;
- private Canvas chartCanvas;
-
- public ResultsEditorChartTab(String tabName, Chart chart) {
- this.tabName = tabName;
- this.chart = chart;
- }
-
- @Override
- public Chart getChart() throws OseeCoreException {
- return chart;
- }
-
- @Override
- public String getTabName() {
- return tabName;
- }
-
- @Override
- public Composite createTab(Composite parent, ResultsEditor resultsEditor) throws OseeCoreException {
- Chart chart = getChart();
- chartComposite = ALayout.createCommonPageComposite(parent);
- ToolBar toolBar = resultsEditor.createToolBar(chartComposite);
- createToolbar(toolBar);
-
- GridData gd = new GridData(GridData.FILL_BOTH);
- if (chart == null) {
- Label label = new Label(chartComposite, SWT.BORDER);
- label.setText("\n No Chart Provided");
- } else {
- chartCanvas = new Canvas(chartComposite, SWT.NONE);
- chartCanvas.setLayoutData(gd);
- chartCanvas.addPaintListener(new ChartViewerSWT(chart));
- }
-
- return chartComposite;
- }
-
- private void createToolbar(ToolBar toolBar) {
- ToolItem item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(ImageManager.getImage(FrameworkImage.PRINT));
- item.setToolTipText("Print this tab");
- item.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent event) {
- ImageCapture iCapture = new ImageCapture(chartCanvas);
- iCapture.popupDialog();
- }
- });
-
- item = new ToolItem(toolBar, SWT.SEPARATOR);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.results.chart;
+
+import org.eclipse.birt.chart.model.Chart;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.results.ResultsEditor;
+import org.eclipse.osee.framework.ui.skynet.util.ImageCapture;
+import org.eclipse.osee.framework.ui.swt.ALayout;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ResultsEditorChartTab implements IResultsEditorChartTab {
+
+ private final Chart chart;
+ private final String tabName;
+ private Composite chartComposite;
+ private Canvas chartCanvas;
+
+ public ResultsEditorChartTab(String tabName, Chart chart) {
+ this.tabName = tabName;
+ this.chart = chart;
+ }
+
+ @Override
+ public Chart getChart() throws OseeCoreException {
+ return chart;
+ }
+
+ @Override
+ public String getTabName() {
+ return tabName;
+ }
+
+ @Override
+ public Composite createTab(Composite parent, ResultsEditor resultsEditor) throws OseeCoreException {
+ Chart chart = getChart();
+ chartComposite = ALayout.createCommonPageComposite(parent);
+ ToolBar toolBar = resultsEditor.createToolBar(chartComposite);
+ createToolbar(toolBar);
+
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ if (chart == null) {
+ Label label = new Label(chartComposite, SWT.BORDER);
+ label.setText("\n No Chart Provided");
+ } else {
+ chartCanvas = new Canvas(chartComposite, SWT.NONE);
+ chartCanvas.setLayoutData(gd);
+ chartCanvas.addPaintListener(new ChartViewerSWT(chart));
+ }
+
+ return chartComposite;
+ }
+
+ private void createToolbar(ToolBar toolBar) {
+ ToolItem item = new ToolItem(toolBar, SWT.PUSH);
+ item.setImage(ImageManager.getImage(FrameworkImage.PRINT));
+ item.setToolTipText("Print this tab");
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ ImageCapture iCapture = new ImageCapture(chartCanvas);
+ iCapture.popupDialog();
+ }
+ });
+
+ item = new ToolItem(toolBar, SWT.SEPARATOR);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/html/IResultsEditorHtmlTab.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/html/IResultsEditorHtmlTab.java
index aa435adaf7a..26df983ef1a 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/html/IResultsEditorHtmlTab.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/html/IResultsEditorHtmlTab.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.framework.ui.skynet.results.html;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.ui.skynet.results.IResultsEditorTab;
-
-/**
- * @author Donald G. Dunne
- */
-public interface IResultsEditorHtmlTab extends IResultsEditorTab {
-
- public String getReportHtml() 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.framework.ui.skynet.results.html;
+
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.ui.skynet.results.IResultsEditorTab;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IResultsEditorHtmlTab extends IResultsEditorTab {
+
+ public String getReportHtml() throws OseeCoreException;
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/html/ResultsEditorHtmlTab.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/html/ResultsEditorHtmlTab.java
index 89adba3a068..30d5ebbfa76 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/html/ResultsEditorHtmlTab.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/html/ResultsEditorHtmlTab.java
@@ -1,175 +1,175 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.results.html;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-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.ui.plugin.PluginUiImage;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.action.browser.BrowserPrintAction;
-import org.eclipse.osee.framework.ui.skynet.action.browser.IBrowserActionHandler;
-import org.eclipse.osee.framework.ui.skynet.results.ResultsEditor;
-import org.eclipse.osee.framework.ui.skynet.results.html.XResultPage.Manipulations;
-import org.eclipse.osee.framework.ui.skynet.widgets.dialog.Dialogs;
-import org.eclipse.osee.framework.ui.swt.ALayout;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-
-/**
- * @author Donald G. Dunne
- */
-public class ResultsEditorHtmlTab implements IResultsEditorHtmlTab, IBrowserActionHandler {
-
- private final String tabName;
- private XResultsComposite xResultsComposite;
- private static String HELP_CONTEXT_ID = "xResultView";
- private ResultsEditor resultsEditor;
- private XResultPage xResultPage;
-
- public ResultsEditorHtmlTab(XResultPage xResultPage) {
- this.xResultPage = xResultPage;
- tabName = "Results";
- }
-
- public ResultsEditorHtmlTab(String tabName) {
- this.tabName = tabName;
- }
-
- public ResultsEditorHtmlTab(String title, String tabName, String html) {
- this(tabName);
- org.eclipse.core.runtime.Assert.isNotNull(tabName);
- setHtml(title, html);
- }
-
- public void setHtml(String title, String html) {
- org.eclipse.core.runtime.Assert.isNotNull(html);
- xResultPage = new XResultPage(title, html, Manipulations.NONE);
- }
-
- @Override
- public String getReportHtml() throws OseeCoreException {
- return xResultPage.getManipulatedHtml();
- }
-
- @Override
- public String getTabName() {
- return tabName;
- }
-
- public Composite createTab(Composite parent, ResultsEditor resultsEditor) throws OseeCoreException {
- this.resultsEditor = resultsEditor;
-
- Composite comp = ALayout.createCommonPageComposite(parent);
- ToolBar toolBar = resultsEditor.createToolBar(comp);
- createToolbar(toolBar);
-
- GridData gd = new GridData(GridData.FILL_BOTH);
- xResultsComposite = new XResultsComposite(comp, SWT.BORDER);
- xResultsComposite.setLayoutData(gd);
- xResultsComposite.setHtmlText(xResultPage.getManipulatedHtml(Arrays.asList(Manipulations.NONE)));
-
- SkynetGuiPlugin.getInstance().setHelp(xResultsComposite, HELP_CONTEXT_ID, "org.eclipse.osee.ats.help.ui");
- SkynetGuiPlugin.getInstance().setHelp(xResultsComposite.getBrowser(), HELP_CONTEXT_ID,
- "org.eclipse.osee.ats.help.ui");
- return comp;
- }
-
- private void createToolbar(ToolBar toolBar) {
-
- new ActionContributionItem(new BrowserPrintAction(this)).fill(toolBar, -1);
-
- ToolItem item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(ImageManager.getImage(FrameworkImage.EMAIL));
- item.setToolTipText("Email");
- item.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent event) {
- Set<Manipulations> manipulations = new HashSet<Manipulations>();
- manipulations.add(Manipulations.NONE);
- Dialogs.emailDialog(resultsEditor.getTitle(), xResultPage.getManipulatedHtml(manipulations));
- }
- });
-
- new ToolItem(toolBar, SWT.SEPARATOR);
-
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(ImageManager.getProgramImage("csv"));
- item.setToolTipText("Export as CSV");
- item.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent event) {
- xResultPage.handleExport();
- }
- });
-
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(ImageManager.getProgramImage("html"));
- item.setToolTipText("Export as HTML");
- item.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent event) {
- xResultPage.saveToFile();
- }
- });
-
- new ToolItem(toolBar, SWT.SEPARATOR);
-
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(ImageManager.getImage(PluginUiImage.FOLDER));
- item.setToolTipText("Import Saved Results Report");
- item.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent event) {
- try {
- final FileDialog dialog = new FileDialog(Displays.getActiveShell().getShell(), SWT.OPEN);
- dialog.setFilterExtensions(new String[] {"*.html"});
- String filename = dialog.open();
- if (filename == null || filename.equals("")) {
- return;
- }
- String html = AFile.readFile(filename);
- if (html == null) {
- throw new IllegalStateException("Can't load file");
- }
- if (html.equals("")) {
- throw new IllegalStateException("Empty file");
- }
- resultsEditor.addResultsTab(new ResultsEditorHtmlTab(new XResultPage(filename, html,
- Manipulations.RAW_HTML)));
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- });
- }
-
- @Override
- public Browser getBrowser() {
- return xResultsComposite.getBrowser();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.results.html;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+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.ui.plugin.PluginUiImage;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.action.browser.BrowserPrintAction;
+import org.eclipse.osee.framework.ui.skynet.action.browser.IBrowserActionHandler;
+import org.eclipse.osee.framework.ui.skynet.results.ResultsEditor;
+import org.eclipse.osee.framework.ui.skynet.results.html.XResultPage.Manipulations;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.Dialogs;
+import org.eclipse.osee.framework.ui.swt.ALayout;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ResultsEditorHtmlTab implements IResultsEditorHtmlTab, IBrowserActionHandler {
+
+ private final String tabName;
+ private XResultsComposite xResultsComposite;
+ private static String HELP_CONTEXT_ID = "xResultView";
+ private ResultsEditor resultsEditor;
+ private XResultPage xResultPage;
+
+ public ResultsEditorHtmlTab(XResultPage xResultPage) {
+ this.xResultPage = xResultPage;
+ tabName = "Results";
+ }
+
+ public ResultsEditorHtmlTab(String tabName) {
+ this.tabName = tabName;
+ }
+
+ public ResultsEditorHtmlTab(String title, String tabName, String html) {
+ this(tabName);
+ org.eclipse.core.runtime.Assert.isNotNull(tabName);
+ setHtml(title, html);
+ }
+
+ public void setHtml(String title, String html) {
+ org.eclipse.core.runtime.Assert.isNotNull(html);
+ xResultPage = new XResultPage(title, html, Manipulations.NONE);
+ }
+
+ @Override
+ public String getReportHtml() throws OseeCoreException {
+ return xResultPage.getManipulatedHtml();
+ }
+
+ @Override
+ public String getTabName() {
+ return tabName;
+ }
+
+ public Composite createTab(Composite parent, ResultsEditor resultsEditor) throws OseeCoreException {
+ this.resultsEditor = resultsEditor;
+
+ Composite comp = ALayout.createCommonPageComposite(parent);
+ ToolBar toolBar = resultsEditor.createToolBar(comp);
+ createToolbar(toolBar);
+
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ xResultsComposite = new XResultsComposite(comp, SWT.BORDER);
+ xResultsComposite.setLayoutData(gd);
+ xResultsComposite.setHtmlText(xResultPage.getManipulatedHtml(Arrays.asList(Manipulations.NONE)));
+
+ SkynetGuiPlugin.getInstance().setHelp(xResultsComposite, HELP_CONTEXT_ID, "org.eclipse.osee.ats.help.ui");
+ SkynetGuiPlugin.getInstance().setHelp(xResultsComposite.getBrowser(), HELP_CONTEXT_ID,
+ "org.eclipse.osee.ats.help.ui");
+ return comp;
+ }
+
+ private void createToolbar(ToolBar toolBar) {
+
+ new ActionContributionItem(new BrowserPrintAction(this)).fill(toolBar, -1);
+
+ ToolItem item = new ToolItem(toolBar, SWT.PUSH);
+ item.setImage(ImageManager.getImage(FrameworkImage.EMAIL));
+ item.setToolTipText("Email");
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ Set<Manipulations> manipulations = new HashSet<Manipulations>();
+ manipulations.add(Manipulations.NONE);
+ Dialogs.emailDialog(resultsEditor.getTitle(), xResultPage.getManipulatedHtml(manipulations));
+ }
+ });
+
+ new ToolItem(toolBar, SWT.SEPARATOR);
+
+ item = new ToolItem(toolBar, SWT.PUSH);
+ item.setImage(ImageManager.getProgramImage("csv"));
+ item.setToolTipText("Export as CSV");
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ xResultPage.handleExport();
+ }
+ });
+
+ item = new ToolItem(toolBar, SWT.PUSH);
+ item.setImage(ImageManager.getProgramImage("html"));
+ item.setToolTipText("Export as HTML");
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ xResultPage.saveToFile();
+ }
+ });
+
+ new ToolItem(toolBar, SWT.SEPARATOR);
+
+ item = new ToolItem(toolBar, SWT.PUSH);
+ item.setImage(ImageManager.getImage(PluginUiImage.FOLDER));
+ item.setToolTipText("Import Saved Results Report");
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ try {
+ final FileDialog dialog = new FileDialog(Displays.getActiveShell().getShell(), SWT.OPEN);
+ dialog.setFilterExtensions(new String[] {"*.html"});
+ String filename = dialog.open();
+ if (filename == null || filename.equals("")) {
+ return;
+ }
+ String html = AFile.readFile(filename);
+ if (html == null) {
+ throw new IllegalStateException("Can't load file");
+ }
+ if (html.equals("")) {
+ throw new IllegalStateException("Empty file");
+ }
+ resultsEditor.addResultsTab(new ResultsEditorHtmlTab(new XResultPage(filename, html,
+ Manipulations.RAW_HTML)));
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ });
+ }
+
+ @Override
+ public Browser getBrowser() {
+ return xResultsComposite.getBrowser();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/IResultsEditorTableTab.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/IResultsEditorTableTab.java
index 67c4799e4ce..be35ebef036 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/IResultsEditorTableTab.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/IResultsEditorTableTab.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.framework.ui.skynet.results.table;
-
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.ui.skynet.results.IResultsEditorTab;
-
-/**
- * @author Donald G. Dunne
- */
-public interface IResultsEditorTableTab extends IResultsEditorTab {
-
- public List<XViewerColumn> getTableColumns() throws OseeCoreException;
-
- public Collection<IResultsXViewerRow> getTableRows() 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.framework.ui.skynet.results.table;
+
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.ui.skynet.results.IResultsEditorTab;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IResultsEditorTableTab extends IResultsEditorTab {
+
+ public List<XViewerColumn> getTableColumns() throws OseeCoreException;
+
+ public Collection<IResultsXViewerRow> getTableRows() throws OseeCoreException;
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/IResultsXViewerRow.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/IResultsXViewerRow.java
index aec9186e050..3e9916bbc3a 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/IResultsXViewerRow.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/IResultsXViewerRow.java
@@ -1,21 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.results.table;
-
-/**
- * @author Donald G. Dunne
- */
-public interface IResultsXViewerRow {
-
- public String getValue(int col);
-
- public String[] values();
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.results.table;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IResultsXViewerRow {
+
+ public String getValue(int col);
+
+ public String[] values();
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/ResultsEditorTableTab.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/ResultsEditorTableTab.java
index 2950eb75d51..c4adb2b8b66 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/ResultsEditorTableTab.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/ResultsEditorTableTab.java
@@ -1,192 +1,192 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.results.table;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.nebula.widgets.xviewer.XViewerTreeReport;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.util.TableWriterAdaptor;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.plugin.core.util.OseeData;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.results.ResultsEditor;
-import org.eclipse.osee.framework.ui.skynet.results.table.xresults.ResultsXViewer;
-import org.eclipse.osee.framework.ui.skynet.results.table.xresults.ResultsXViewerContentProvider;
-import org.eclipse.osee.framework.ui.skynet.results.table.xresults.ResultsXViewerLabelProvider;
-import org.eclipse.osee.framework.ui.skynet.util.HtmlExportTable;
-import org.eclipse.osee.framework.ui.swt.ALayout;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.program.Program;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-
-/**
- * @author Donald G. Dunne
- */
-public class ResultsEditorTableTab implements IResultsEditorTableTab {
-
- private final String tabName;
- private List<XViewerColumn> columns;
- private Collection<IResultsXViewerRow> rows;
- private ResultsXViewer resultsXViewer;
-
- public ResultsEditorTableTab(String tabName) {
- this(tabName, null, null);
- this.columns = new ArrayList<XViewerColumn>();
- this.rows = new ArrayList<IResultsXViewerRow>();
- }
-
- public ResultsEditorTableTab(String tabName, List<XViewerColumn> columns, Collection<IResultsXViewerRow> rows) {
- this.tabName = tabName;
- this.columns = columns;
- this.rows = rows;
- }
-
- public void addColumn(XViewerColumn xViewerColumn) {
- this.columns.add(xViewerColumn);
- }
-
- public void addRow(IResultsXViewerRow resultsXViewerRow) {
- this.rows.add(resultsXViewerRow);
- }
-
- @Override
- public List<XViewerColumn> getTableColumns() throws OseeCoreException {
- return columns;
- }
-
- @Override
- public Collection<IResultsXViewerRow> getTableRows() throws OseeCoreException {
- return rows;
- }
-
- @Override
- public String getTabName() {
- return tabName;
- }
-
- @Override
- public Composite createTab(Composite parent, ResultsEditor resultsEditor) throws OseeCoreException {
- Composite comp = ALayout.createCommonPageComposite(parent);
- ToolBar toolBar = resultsEditor.createToolBar(comp);
- addToolBarItems(toolBar);
-
- GridData gd = new GridData(GridData.FILL_BOTH);
- resultsXViewer = new ResultsXViewer(comp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, getTableColumns());
- resultsXViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
- resultsXViewer.setContentProvider(new ResultsXViewerContentProvider());
- resultsXViewer.setLabelProvider(new ResultsXViewerLabelProvider(resultsXViewer));
- resultsXViewer.setInput(getTableRows());
- resultsXViewer.getTree().setLayoutData(gd);
- return comp;
- }
-
- private void addToolBarItems(ToolBar toolBar) {
- ToolItem item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(ImageManager.getProgramImage("html"));
- item.setToolTipText("Export as HTML");
- item.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent event) {
- XViewerTreeReport report = resultsXViewer.getXViewerFactory().getXViewerTreeReport(resultsXViewer);
- if (report != null) {
- report.open();
- } else {
- new XViewerTreeReport(resultsXViewer).open(tabName + ".html");
- }
- }
- });
-
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(ImageManager.getProgramImage("csv"));
- item.setToolTipText("Export as CSV (comma seperated value)");
- item.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent event) {
- try {
- new HtmlExportTable(tabName, new XViewerTreeReport(resultsXViewer).getHtml(), true).exportCsv();
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- });
-
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(ImageManager.getProgramImage("csv"));
- item.setToolTipText("Export as TSV (tab seperated value)");
- item.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent event) {
- try {
- new HtmlExportTable(tabName, new XViewerTreeReport(resultsXViewer).getHtml(), true).exportTsv();
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- });
-
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(ImageManager.getProgramImage("pdf"));
- item.setToolTipText("Export to PDF");
- item.addSelectionListener(new SelectionAdapter() {
-
- private List<String> getColumns() {
- List<String> cols = new ArrayList<String>();
- for (XViewerColumn col : columns) {
- cols.add(col.getName());
- }
- return cols;
- }
-
- private void writeRows(TableWriterAdaptor writerAdaptor) {
- List<String> rws = new ArrayList<String>();
- for (IResultsXViewerRow row : rows) {
- for (int i = 0; i < columns.size(); i++) {
- rws.add(row.getValue(i));
- }
- writerAdaptor.writeRow(rws.toArray(new String[rws.size()]));
- rws.clear();
- }
- }
-
- @Override
- public void widgetSelected(SelectionEvent event) {
- try {
- File TableResultsFile = OseeData.getFile(tabName + ".pdf");
- OutputStream outputStream = new FileOutputStream(TableResultsFile, true);
- TableWriterAdaptor writerAdaptor = new TableWriterAdaptor("pdf", outputStream);
- writerAdaptor.writeHeader(getColumns().toArray(new String[getColumns().size()]));
- writeRows(writerAdaptor);
- writerAdaptor.writeTitle(tabName);
- writerAdaptor.openDocument();
- writerAdaptor.writeDocument();
- writerAdaptor.close();
- Program.launch(TableResultsFile.getAbsolutePath());
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.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.framework.ui.skynet.results.table;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.XViewerTreeReport;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.util.TableWriterAdaptor;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.plugin.core.util.OseeData;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.results.ResultsEditor;
+import org.eclipse.osee.framework.ui.skynet.results.table.xresults.ResultsXViewer;
+import org.eclipse.osee.framework.ui.skynet.results.table.xresults.ResultsXViewerContentProvider;
+import org.eclipse.osee.framework.ui.skynet.results.table.xresults.ResultsXViewerLabelProvider;
+import org.eclipse.osee.framework.ui.skynet.util.HtmlExportTable;
+import org.eclipse.osee.framework.ui.swt.ALayout;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.program.Program;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ResultsEditorTableTab implements IResultsEditorTableTab {
+
+ private final String tabName;
+ private List<XViewerColumn> columns;
+ private Collection<IResultsXViewerRow> rows;
+ private ResultsXViewer resultsXViewer;
+
+ public ResultsEditorTableTab(String tabName) {
+ this(tabName, null, null);
+ this.columns = new ArrayList<XViewerColumn>();
+ this.rows = new ArrayList<IResultsXViewerRow>();
+ }
+
+ public ResultsEditorTableTab(String tabName, List<XViewerColumn> columns, Collection<IResultsXViewerRow> rows) {
+ this.tabName = tabName;
+ this.columns = columns;
+ this.rows = rows;
+ }
+
+ public void addColumn(XViewerColumn xViewerColumn) {
+ this.columns.add(xViewerColumn);
+ }
+
+ public void addRow(IResultsXViewerRow resultsXViewerRow) {
+ this.rows.add(resultsXViewerRow);
+ }
+
+ @Override
+ public List<XViewerColumn> getTableColumns() throws OseeCoreException {
+ return columns;
+ }
+
+ @Override
+ public Collection<IResultsXViewerRow> getTableRows() throws OseeCoreException {
+ return rows;
+ }
+
+ @Override
+ public String getTabName() {
+ return tabName;
+ }
+
+ @Override
+ public Composite createTab(Composite parent, ResultsEditor resultsEditor) throws OseeCoreException {
+ Composite comp = ALayout.createCommonPageComposite(parent);
+ ToolBar toolBar = resultsEditor.createToolBar(comp);
+ addToolBarItems(toolBar);
+
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ resultsXViewer = new ResultsXViewer(comp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, getTableColumns());
+ resultsXViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
+ resultsXViewer.setContentProvider(new ResultsXViewerContentProvider());
+ resultsXViewer.setLabelProvider(new ResultsXViewerLabelProvider(resultsXViewer));
+ resultsXViewer.setInput(getTableRows());
+ resultsXViewer.getTree().setLayoutData(gd);
+ return comp;
+ }
+
+ private void addToolBarItems(ToolBar toolBar) {
+ ToolItem item = new ToolItem(toolBar, SWT.PUSH);
+ item.setImage(ImageManager.getProgramImage("html"));
+ item.setToolTipText("Export as HTML");
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ XViewerTreeReport report = resultsXViewer.getXViewerFactory().getXViewerTreeReport(resultsXViewer);
+ if (report != null) {
+ report.open();
+ } else {
+ new XViewerTreeReport(resultsXViewer).open(tabName + ".html");
+ }
+ }
+ });
+
+ item = new ToolItem(toolBar, SWT.PUSH);
+ item.setImage(ImageManager.getProgramImage("csv"));
+ item.setToolTipText("Export as CSV (comma seperated value)");
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ try {
+ new HtmlExportTable(tabName, new XViewerTreeReport(resultsXViewer).getHtml(), true).exportCsv();
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ });
+
+ item = new ToolItem(toolBar, SWT.PUSH);
+ item.setImage(ImageManager.getProgramImage("csv"));
+ item.setToolTipText("Export as TSV (tab seperated value)");
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ try {
+ new HtmlExportTable(tabName, new XViewerTreeReport(resultsXViewer).getHtml(), true).exportTsv();
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ });
+
+ item = new ToolItem(toolBar, SWT.PUSH);
+ item.setImage(ImageManager.getProgramImage("pdf"));
+ item.setToolTipText("Export to PDF");
+ item.addSelectionListener(new SelectionAdapter() {
+
+ private List<String> getColumns() {
+ List<String> cols = new ArrayList<String>();
+ for (XViewerColumn col : columns) {
+ cols.add(col.getName());
+ }
+ return cols;
+ }
+
+ private void writeRows(TableWriterAdaptor writerAdaptor) {
+ List<String> rws = new ArrayList<String>();
+ for (IResultsXViewerRow row : rows) {
+ for (int i = 0; i < columns.size(); i++) {
+ rws.add(row.getValue(i));
+ }
+ writerAdaptor.writeRow(rws.toArray(new String[rws.size()]));
+ rws.clear();
+ }
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ try {
+ File TableResultsFile = OseeData.getFile(tabName + ".pdf");
+ OutputStream outputStream = new FileOutputStream(TableResultsFile, true);
+ TableWriterAdaptor writerAdaptor = new TableWriterAdaptor("pdf", outputStream);
+ writerAdaptor.writeHeader(getColumns().toArray(new String[getColumns().size()]));
+ writeRows(writerAdaptor);
+ writerAdaptor.writeTitle(tabName);
+ writerAdaptor.openDocument();
+ writerAdaptor.writeDocument();
+ writerAdaptor.close();
+ Program.launch(TableResultsFile.getAbsolutePath());
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ });
+
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/ResultsXViewerRow.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/ResultsXViewerRow.java
index 0ce2223fc73..5e5a82dead1 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/ResultsXViewerRow.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/ResultsXViewerRow.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.framework.ui.skynet.results.table;
-
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-
-/**
- * @author Donald G. Dunne
- */
-public class ResultsXViewerRow implements IResultsXViewerRow {
-
- private final List<String> values;
- private final Artifact doubleClickOpenArtifact;
-
- public ResultsXViewerRow(List<String> values, Artifact doubleClickOpenArtifact) {
- this.doubleClickOpenArtifact = doubleClickOpenArtifact;
- this.values = values;
- }
-
- public ResultsXViewerRow(List<String> values) {
- this(values, null);
- }
-
- public ResultsXViewerRow(String[] values, Artifact doubleClickOpenArtifact) {
- this(Arrays.asList(values), doubleClickOpenArtifact);
- }
-
- public ResultsXViewerRow(String[] values) {
- this(Arrays.asList(values), null);
- }
-
- @Override
- public String getValue(int col) {
- return values.get(col);
- }
-
- @Override
- public String[] values() {
- return values.toArray(new String[values.size()]);
- }
-
- /**
- * @return the doubleClickOpenArtifact
- */
- public Artifact getDoubleClickOpenArtifact() {
- return doubleClickOpenArtifact;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.results.table;
+
+import java.util.Arrays;
+import java.util.List;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ResultsXViewerRow implements IResultsXViewerRow {
+
+ private final List<String> values;
+ private final Artifact doubleClickOpenArtifact;
+
+ public ResultsXViewerRow(List<String> values, Artifact doubleClickOpenArtifact) {
+ this.doubleClickOpenArtifact = doubleClickOpenArtifact;
+ this.values = values;
+ }
+
+ public ResultsXViewerRow(List<String> values) {
+ this(values, null);
+ }
+
+ public ResultsXViewerRow(String[] values, Artifact doubleClickOpenArtifact) {
+ this(Arrays.asList(values), doubleClickOpenArtifact);
+ }
+
+ public ResultsXViewerRow(String[] values) {
+ this(Arrays.asList(values), null);
+ }
+
+ @Override
+ public String getValue(int col) {
+ return values.get(col);
+ }
+
+ @Override
+ public String[] values() {
+ return values.toArray(new String[values.size()]);
+ }
+
+ /**
+ * @return the doubleClickOpenArtifact
+ */
+ public Artifact getDoubleClickOpenArtifact() {
+ return doubleClickOpenArtifact;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/xresults/ResultsXViewer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/xresults/ResultsXViewer.java
index 1d59b609a05..43c30fc0d1b 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/xresults/ResultsXViewer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/xresults/ResultsXViewer.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.framework.ui.skynet.results.table.xresults;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.nebula.widgets.xviewer.XViewer;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
-import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
-import org.eclipse.osee.framework.ui.skynet.results.table.ResultsXViewerRow;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.TreeItem;
-
-/**
- * @author Donald G. Dunne
- */
-public class ResultsXViewer extends XViewer {
-
- /**
- * @param parent
- * @param style
- * @param namespace
- * @param viewerFactory
- */
- public ResultsXViewer(Composite parent, int style, List<XViewerColumn> xColumns) {
- super(parent, style, new ResultsXViewerFactory(xColumns));
- }
-
- @Override
- public void handleDoubleClick() {
- if (getSelectedRows().size() > 0) {
- Artifact art = getSelectedRows().iterator().next().getDoubleClickOpenArtifact();
- if (art != null) {
- RendererManager.openInJob(art, PresentationType.GENERALIZED_EDIT);
- }
- }
- }
-
- public ArrayList<ResultsXViewerRow> getSelectedRows() {
- ArrayList<ResultsXViewerRow> arts = new ArrayList<ResultsXViewerRow>();
- TreeItem items[] = getTree().getSelection();
- for (TreeItem item : items)
- arts.add((ResultsXViewerRow) item.getData());
- return arts;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.results.table.xresults;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.nebula.widgets.xviewer.XViewer;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
+import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
+import org.eclipse.osee.framework.ui.skynet.results.table.ResultsXViewerRow;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ResultsXViewer extends XViewer {
+
+ /**
+ * @param parent
+ * @param style
+ * @param namespace
+ * @param viewerFactory
+ */
+ public ResultsXViewer(Composite parent, int style, List<XViewerColumn> xColumns) {
+ super(parent, style, new ResultsXViewerFactory(xColumns));
+ }
+
+ @Override
+ public void handleDoubleClick() {
+ if (getSelectedRows().size() > 0) {
+ Artifact art = getSelectedRows().iterator().next().getDoubleClickOpenArtifact();
+ if (art != null) {
+ RendererManager.openInJob(art, PresentationType.GENERALIZED_EDIT);
+ }
+ }
+ }
+
+ public ArrayList<ResultsXViewerRow> getSelectedRows() {
+ ArrayList<ResultsXViewerRow> arts = new ArrayList<ResultsXViewerRow>();
+ TreeItem items[] = getTree().getSelection();
+ for (TreeItem item : items)
+ arts.add((ResultsXViewerRow) item.getData());
+ return arts;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/xresults/ResultsXViewerFactory.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/xresults/ResultsXViewerFactory.java
index 359ab20641e..59a2b62a605 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/xresults/ResultsXViewerFactory.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/results/table/xresults/ResultsXViewerFactory.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.framework.ui.skynet.results.table.xresults;
-
-import java.util.List;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.nebula.widgets.xviewer.XViewerFactory;
-import org.eclipse.nebula.widgets.xviewer.customize.IXViewerCustomizations;
-import org.eclipse.nebula.widgets.xviewer.customize.XViewerCustomizations;
-
-/**
- * @author Donald G. Dunne
- */
-public class ResultsXViewerFactory extends XViewerFactory {
-
- private static String COLUMN_NAMESPACE = "org.eclipse.osee.table";
- private final List<XViewerColumn> columns;
-
- public ResultsXViewerFactory(List<XViewerColumn> columns) {
- super("xviewer.test");
- this.columns = columns;
- for (XViewerColumn xCol : columns) {
- registerColumns(xCol);
- }
- }
-
- @Override
- public IXViewerCustomizations getXViewerCustomizations() {
- return new XViewerCustomizations();
- }
-
- @Override
- public boolean isAdmin() {
- 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.framework.ui.skynet.results.table.xresults;
+
+import java.util.List;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.XViewerFactory;
+import org.eclipse.nebula.widgets.xviewer.customize.IXViewerCustomizations;
+import org.eclipse.nebula.widgets.xviewer.customize.XViewerCustomizations;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ResultsXViewerFactory extends XViewerFactory {
+
+ private static String COLUMN_NAMESPACE = "org.eclipse.osee.table";
+ private final List<XViewerColumn> columns;
+
+ public ResultsXViewerFactory(List<XViewerColumn> columns) {
+ super("xviewer.test");
+ this.columns = columns;
+ for (XViewerColumn xCol : columns) {
+ registerColumns(xCol);
+ }
+ }
+
+ @Override
+ public IXViewerCustomizations getXViewerCustomizations() {
+ return new XViewerCustomizations();
+ }
+
+ @Override
+ public boolean isAdmin() {
+ return true;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertContentProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertContentProvider.java
index 936ee68d73c..12da7345ac8 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertContentProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertContentProvider.java
@@ -1,75 +1,75 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.revert;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.osee.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-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.ui.skynet.ArtifactContentProvider;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.swt.widgets.Combo;
-
-/**
- * @author Theron Virgin
- */
-public class RevertContentProvider extends ArtifactContentProvider {
- private static Object[] EMPTY_ARRAY = new Object[0];
- private Combo artifactSelectionBox = null;
- private List<List<Artifact>> artifacts = null;
-
- public RevertContentProvider(Combo artifactSelectionBox, List<List<Artifact>> artifacts) {
- super();
- this.artifactSelectionBox = artifactSelectionBox;
- this.artifacts = artifacts;
- }
-
- @Override
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof Artifact) {
- Artifact parentItem = (Artifact) parentElement;
- if (!RevertDeletionCheck.isRootArtifact(parentItem, artifactSelectionBox, artifacts)) {
- return EMPTY_ARRAY;
- }
- try {
- if (AccessControlManager.hasPermission(parentItem, PermissionEnum.READ)) {
- Collection<Artifact> children = parentItem.getChildren();
- if (children != null) {
- List<Artifact> childs = new ArrayList<Artifact>();
- for (Artifact artifact : children) {
- if (RevertDeletionCheck.relationWillBeReverted(artifact)) {
- childs.add(artifact);
- }
- }
- return childs.toArray();
- }
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- } else if (parentElement instanceof Collection) {
- return ((Collection<?>) parentElement).toArray();
- }
-
- return EMPTY_ARRAY;
- }
-
- @Override
- public boolean hasChildren(Object element) {
- return getChildren(element).length > 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.framework.ui.skynet.revert;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.osee.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
+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.ui.skynet.ArtifactContentProvider;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.swt.widgets.Combo;
+
+/**
+ * @author Theron Virgin
+ */
+public class RevertContentProvider extends ArtifactContentProvider {
+ private static Object[] EMPTY_ARRAY = new Object[0];
+ private Combo artifactSelectionBox = null;
+ private List<List<Artifact>> artifacts = null;
+
+ public RevertContentProvider(Combo artifactSelectionBox, List<List<Artifact>> artifacts) {
+ super();
+ this.artifactSelectionBox = artifactSelectionBox;
+ this.artifacts = artifacts;
+ }
+
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof Artifact) {
+ Artifact parentItem = (Artifact) parentElement;
+ if (!RevertDeletionCheck.isRootArtifact(parentItem, artifactSelectionBox, artifacts)) {
+ return EMPTY_ARRAY;
+ }
+ try {
+ if (AccessControlManager.hasPermission(parentItem, PermissionEnum.READ)) {
+ Collection<Artifact> children = parentItem.getChildren();
+ if (children != null) {
+ List<Artifact> childs = new ArrayList<Artifact>();
+ for (Artifact artifact : children) {
+ if (RevertDeletionCheck.relationWillBeReverted(artifact)) {
+ childs.add(artifact);
+ }
+ }
+ return childs.toArray();
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ } else if (parentElement instanceof Collection) {
+ return ((Collection<?>) parentElement).toArray();
+ }
+
+ return EMPTY_ARRAY;
+ }
+
+ @Override
+ public boolean hasChildren(Object element) {
+ return getChildren(element).length > 0;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertDeletionCheck.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertDeletionCheck.java
index 700e1aebe2c..424496183db 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertDeletionCheck.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertDeletionCheck.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.framework.ui.skynet.revert;
-
-import java.util.List;
-import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-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.ArtifactPersistenceManager;
-import org.eclipse.osee.framework.skynet.core.relation.RelationLink;
-import org.eclipse.swt.widgets.Combo;
-
-/**
- * @author Theron Virgin
- */
-public class RevertDeletionCheck {
-
- public static boolean relationWillBeReverted(Artifact artifact) throws OseeCoreException {
- RelationLink relation;
- boolean linkToDelete = false;
- List<RelationLink> childLinks = artifact.getRelations(CoreRelationTypes.Default_Hierarchical__Parent);
- if (childLinks != null && !childLinks.isEmpty()) {
- relation = childLinks.get(0);
- linkToDelete = ArtifactPersistenceManager.isRelationNewOnBranch(relation);
- }
- return linkToDelete;
- }
-
- public static boolean isRootArtifact(Artifact artifact, Combo selBox, List<List<Artifact>> artifacts) {
- int index = selBox.getSelectionIndex() == -1 ? 0 : selBox.getSelectionIndex();
- Artifact HeadArtifact = artifacts.get(index).get(0);
- boolean rootArtifact = false;
- if (artifact.equals(HeadArtifact)) {
- rootArtifact = true;
- }
- return rootArtifact;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.revert;
+
+import java.util.List;
+import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
+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.ArtifactPersistenceManager;
+import org.eclipse.osee.framework.skynet.core.relation.RelationLink;
+import org.eclipse.swt.widgets.Combo;
+
+/**
+ * @author Theron Virgin
+ */
+public class RevertDeletionCheck {
+
+ public static boolean relationWillBeReverted(Artifact artifact) throws OseeCoreException {
+ RelationLink relation;
+ boolean linkToDelete = false;
+ List<RelationLink> childLinks = artifact.getRelations(CoreRelationTypes.Default_Hierarchical__Parent);
+ if (childLinks != null && !childLinks.isEmpty()) {
+ relation = childLinks.get(0);
+ linkToDelete = ArtifactPersistenceManager.isRelationNewOnBranch(relation);
+ }
+ return linkToDelete;
+ }
+
+ public static boolean isRootArtifact(Artifact artifact, Combo selBox, List<List<Artifact>> artifacts) {
+ int index = selBox.getSelectionIndex() == -1 ? 0 : selBox.getSelectionIndex();
+ Artifact HeadArtifact = artifacts.get(index).get(0);
+ boolean rootArtifact = false;
+ if (artifact.equals(HeadArtifact)) {
+ rootArtifact = true;
+ }
+ return rootArtifact;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertLabelProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertLabelProvider.java
index 1b2b89ac739..06d48ff4d1a 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertLabelProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertLabelProvider.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.framework.ui.skynet.revert;
-
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.jface.viewers.LabelProvider;
-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.artifact.ArtifactPersistenceManager;
-import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
-import org.eclipse.search.ui.text.Match;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Combo;
-
-public class RevertLabelProvider extends LabelProvider {
- private Combo artifactSelectionBox = null;
- private List<List<Artifact>> artifacts = null;
-
- public RevertLabelProvider(Combo artifactSelectionBox, List<List<Artifact>> artifacts) {
- super();
- this.artifactSelectionBox = artifactSelectionBox;
- this.artifacts = artifacts;
- }
-
- /*
- * @see ILabelProvider#getImage(Object)
- */
- @Override
- public Image getImage(Object element) {
- if (element instanceof Artifact) {
- return ArtifactImageManager.getImage((Artifact) element);
- } else if (element instanceof Match && ((Match) element).getElement() instanceof Artifact) {
- return ArtifactImageManager.getImage((Artifact) ((Match) element).getElement());
- }
- return super.getImage(element);
- }
-
- /*
- * @see ILabelProvider#getText(Object)
- */
- @Override
- public String getText(Object element) {
- if (element instanceof Match) {
- element = ((Match) element).getElement();
- }
-
- if (element instanceof Artifact) {
- Artifact artifact = (Artifact) element;
-
- String name = artifact.getName();
- boolean toDelete = false;
- boolean linkToDelete = false;
- boolean rootArtifact = RevertDeletionCheck.isRootArtifact(artifact, artifactSelectionBox, artifacts);
- try {
- linkToDelete = RevertDeletionCheck.relationWillBeReverted(artifact);
- toDelete = ArtifactPersistenceManager.isArtifactNewOnBranch(artifact);
- } catch (OseeCoreException ex) {
- OseeLog.log(getClass(), Level.SEVERE, ex);
- }
- if (rootArtifact) {
- if (toDelete) {
- name += " --<Will be Deleted>--";
- } else {
- if (artifact.isDeleted()) {
- name += " --<Will be Undeleted>--";
- } else {
- name += " --<Will Revert to Begining Value>--";
- }
- }
- }
- if (!rootArtifact) {
- if (linkToDelete && !rootArtifact) {
- name += " --<Will be Orphaned>--";
- } else {
- }
- }
- return name;
- } else {
- return element.toString();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.revert;
+
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.jface.viewers.LabelProvider;
+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.artifact.ArtifactPersistenceManager;
+import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
+import org.eclipse.search.ui.text.Match;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Combo;
+
+public class RevertLabelProvider extends LabelProvider {
+ private Combo artifactSelectionBox = null;
+ private List<List<Artifact>> artifacts = null;
+
+ public RevertLabelProvider(Combo artifactSelectionBox, List<List<Artifact>> artifacts) {
+ super();
+ this.artifactSelectionBox = artifactSelectionBox;
+ this.artifacts = artifacts;
+ }
+
+ /*
+ * @see ILabelProvider#getImage(Object)
+ */
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof Artifact) {
+ return ArtifactImageManager.getImage((Artifact) element);
+ } else if (element instanceof Match && ((Match) element).getElement() instanceof Artifact) {
+ return ArtifactImageManager.getImage((Artifact) ((Match) element).getElement());
+ }
+ return super.getImage(element);
+ }
+
+ /*
+ * @see ILabelProvider#getText(Object)
+ */
+ @Override
+ public String getText(Object element) {
+ if (element instanceof Match) {
+ element = ((Match) element).getElement();
+ }
+
+ if (element instanceof Artifact) {
+ Artifact artifact = (Artifact) element;
+
+ String name = artifact.getName();
+ boolean toDelete = false;
+ boolean linkToDelete = false;
+ boolean rootArtifact = RevertDeletionCheck.isRootArtifact(artifact, artifactSelectionBox, artifacts);
+ try {
+ linkToDelete = RevertDeletionCheck.relationWillBeReverted(artifact);
+ toDelete = ArtifactPersistenceManager.isArtifactNewOnBranch(artifact);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(getClass(), Level.SEVERE, ex);
+ }
+ if (rootArtifact) {
+ if (toDelete) {
+ name += " --<Will be Deleted>--";
+ } else {
+ if (artifact.isDeleted()) {
+ name += " --<Will be Undeleted>--";
+ } else {
+ name += " --<Will Revert to Begining Value>--";
+ }
+ }
+ }
+ if (!rootArtifact) {
+ if (linkToDelete && !rootArtifact) {
+ name += " --<Will be Orphaned>--";
+ } else {
+ }
+ }
+ return name;
+ } else {
+ return element.toString();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertWizard.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertWizard.java
index 7605a9d9d99..e186041bb6e 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertWizard.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertWizard.java
@@ -1,64 +1,64 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.revert;
-
-import java.util.List;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-
-/**
- * @author Theron Virgin
- */
-public class RevertWizard extends Wizard {
- private final List<List<Artifact>> artifacts;
- private RevertWizardPage revertWizardPage;
-
- public RevertWizard(List<List<Artifact>> artifacts) {
- this.artifacts = artifacts;
- }
-
- @Override
- public void addPages() {
- revertWizardPage = new RevertWizardPage(artifacts);
- addPage(revertWizardPage);
- }
-
- @Override
- public boolean performFinish() {
- return revertWizardPage.closingPage();
- }
-
- @Override
- public boolean canFinish() {
- return true;
- }
-
- public boolean getResolved() {
- return true;
- }
-
- @Override
- public IWizardPage getStartingPage() {
- return getPage(revertWizardPage.TITLE);
- }
-
- @Override
- public IWizardPage getPreviousPage(IWizardPage page) {
- return null;
- }
-
- @Override
- public boolean performCancel() {
- return super.performCancel();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.revert;
+
+import java.util.List;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+
+/**
+ * @author Theron Virgin
+ */
+public class RevertWizard extends Wizard {
+ private final List<List<Artifact>> artifacts;
+ private RevertWizardPage revertWizardPage;
+
+ public RevertWizard(List<List<Artifact>> artifacts) {
+ this.artifacts = artifacts;
+ }
+
+ @Override
+ public void addPages() {
+ revertWizardPage = new RevertWizardPage(artifacts);
+ addPage(revertWizardPage);
+ }
+
+ @Override
+ public boolean performFinish() {
+ return revertWizardPage.closingPage();
+ }
+
+ @Override
+ public boolean canFinish() {
+ return true;
+ }
+
+ public boolean getResolved() {
+ return true;
+ }
+
+ @Override
+ public IWizardPage getStartingPage() {
+ return getPage(revertWizardPage.TITLE);
+ }
+
+ @Override
+ public IWizardPage getPreviousPage(IWizardPage page) {
+ return null;
+ }
+
+ @Override
+ public boolean performCancel() {
+ return super.performCancel();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertWizardPage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertWizardPage.java
index 6afd871f60c..f8a772f495d 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertWizardPage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/revert/RevertWizardPage.java
@@ -1,175 +1,175 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.revert;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.wizard.WizardPage;
-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.skynet.ArtifactDoubleClick;
-import org.eclipse.osee.framework.ui.skynet.commandHandlers.RevertJob;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StackLayout;
-import org.eclipse.swt.custom.TreeEditor;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Tree;
-
-/**
- * @author Theron Virgin
- */
-public class RevertWizardPage extends WizardPage {
-
- private final List<List<Artifact>> artifacts;
- public static final String VIEW_ID = "org.eclipse.osee.framework.ui.skynet.revert.RevertWizardPage";
- public static final String TITLE = "Revert Artifacts Page";
- private TreeViewer treeViewer;
- private Button revertSelectedButton;
- private Button revertAllButton;
- private Combo artifactSelectionBox;
- private final Listener listener = new Listener() {
- public void handleEvent(Event event) {
- try {
- if (event.widget == revertAllButton) {
- List<Artifact> revertList = new LinkedList<Artifact>();
- for (List<Artifact> artList : artifacts) {
- if (!artList.isEmpty()) {
- revertList.add(artList.get(0));
- }
- }
- Jobs.startJob(new RevertJob(revertList));
- artifactSelectionBox.setItems(new String[] {});
- treeViewer.setInput(null);
- }
- if (event.widget == revertSelectedButton) {
- int index = artifactSelectionBox.getSelectionIndex();
- Jobs.startJob(new RevertJob(artifacts.get(index)));
- artifacts.remove(index);
- artifactSelectionBox.remove(index);
- if (artifacts.isEmpty()) {
- treeViewer.setInput(null);
- } else {
- treeViewer.setInput(artifacts.get(0));
- artifactSelectionBox.select(0);
- }
- }
- if (event.widget == revertAllButton || event.widget == revertSelectedButton) {
- }
- if (event.widget == artifactSelectionBox) {
- treeViewer.setInput(artifacts.get(artifactSelectionBox.getSelectionIndex()));
- }
- } catch (Exception ex) {
- OseeLog.log(RevertWizardPage.class, Level.WARNING, ex);
- }
- getWizard().getContainer().updateButtons();
- }
- };
-
- public RevertWizardPage(List<List<Artifact>> artifacts) {
- super(TITLE);
- this.artifacts = artifacts;
- }
-
- @Override
- public void createControl(Composite parent) {
- setTitle("The Revert Wizard");
- // Composite composite = new Composite(parent, SWT.NONE);
-
- GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- gridData.heightHint = 300;
- gridData.widthHint = 100;
-
- parent.setLayout(new GridLayout(1, false));
- parent.setLayoutData(gridData);
-
- new Label(parent, SWT.LEFT).setText("Artifact to Revert");
- gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- gridData.heightHint = 200;
- gridData.widthHint = 75;
-
- artifactSelectionBox = new Combo(parent, SWT.READ_ONLY);
- List<String> comboValues = new ArrayList<String>();
- for (List<Artifact> artList : artifacts) {
- comboValues.add(artList.get(0).getName());
- }
- artifactSelectionBox.setItems(comboValues.toArray(new String[comboValues.size()]));
- artifactSelectionBox.addListener(SWT.Selection, listener);
-
- new Label(parent, SWT.LEFT).setText("Revert Effects");
-
- Composite stackComposite = new Composite(parent, SWT.NONE);
- StackLayout stackLayout = new StackLayout();
- stackComposite.setLayout(stackLayout);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- data.minimumHeight = 100;
- stackComposite.setLayoutData(data);
-
- treeViewer = new TreeViewer(stackComposite);
- Tree tree = treeViewer.getTree();
- treeViewer.setContentProvider(new RevertContentProvider(artifactSelectionBox, artifacts));
- treeViewer.setLabelProvider(new RevertLabelProvider(artifactSelectionBox, artifacts));
- treeViewer.addDoubleClickListener(new ArtifactDoubleClick());
- treeViewer.getControl().setLayoutData(gridData);
-
- treeViewer.setUseHashlookup(false);
- treeViewer.setInput(artifacts != null ? artifacts.get(0) : null);
-
- TreeEditor myTreeEditor = new TreeEditor(tree);
- myTreeEditor.horizontalAlignment = SWT.LEFT;
- myTreeEditor.grabHorizontal = true;
- myTreeEditor.minimumWidth = 50;
- stackLayout.topControl = treeViewer.getTree();
- stackComposite.layout();
- stackComposite.getParent().layout();
-
- gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- gridData.heightHint = 200;
- gridData.widthHint = 75;
- Composite buttonComposite = new Composite(parent, SWT.NONE);
- buttonComposite.setLayout(new GridLayout(2, false));
-
- revertSelectedButton = createButton("Revert Selected Artifact", "Show Previous Revert Artifact", buttonComposite);
- revertAllButton = createButton("Revert All Artifacts", "Show Next Revert Artifact", buttonComposite);
-
- new Label(parent, SWT.LEFT).setText("Cycle through the artifacts and expand the tree to see any unintended \nconsequences of reverting. \n\nYou must restart OSEE to see the results of the revert.");
- artifactSelectionBox.select(0);
- setControl(parent);
-
- }
-
- private Button createButton(String text, String tooltip, Composite composite) {
- Button button = new Button(composite, SWT.PUSH);
- button.addListener(SWT.Selection, listener);
- button.setText(text);
- button.setToolTipText(tooltip);
- return button;
- }
-
- public boolean canFinish() {
- return true;
- }
-
- public boolean closingPage() {
- 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.framework.ui.skynet.revert;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.wizard.WizardPage;
+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.skynet.ArtifactDoubleClick;
+import org.eclipse.osee.framework.ui.skynet.commandHandlers.RevertJob;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StackLayout;
+import org.eclipse.swt.custom.TreeEditor;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Tree;
+
+/**
+ * @author Theron Virgin
+ */
+public class RevertWizardPage extends WizardPage {
+
+ private final List<List<Artifact>> artifacts;
+ public static final String VIEW_ID = "org.eclipse.osee.framework.ui.skynet.revert.RevertWizardPage";
+ public static final String TITLE = "Revert Artifacts Page";
+ private TreeViewer treeViewer;
+ private Button revertSelectedButton;
+ private Button revertAllButton;
+ private Combo artifactSelectionBox;
+ private final Listener listener = new Listener() {
+ public void handleEvent(Event event) {
+ try {
+ if (event.widget == revertAllButton) {
+ List<Artifact> revertList = new LinkedList<Artifact>();
+ for (List<Artifact> artList : artifacts) {
+ if (!artList.isEmpty()) {
+ revertList.add(artList.get(0));
+ }
+ }
+ Jobs.startJob(new RevertJob(revertList));
+ artifactSelectionBox.setItems(new String[] {});
+ treeViewer.setInput(null);
+ }
+ if (event.widget == revertSelectedButton) {
+ int index = artifactSelectionBox.getSelectionIndex();
+ Jobs.startJob(new RevertJob(artifacts.get(index)));
+ artifacts.remove(index);
+ artifactSelectionBox.remove(index);
+ if (artifacts.isEmpty()) {
+ treeViewer.setInput(null);
+ } else {
+ treeViewer.setInput(artifacts.get(0));
+ artifactSelectionBox.select(0);
+ }
+ }
+ if (event.widget == revertAllButton || event.widget == revertSelectedButton) {
+ }
+ if (event.widget == artifactSelectionBox) {
+ treeViewer.setInput(artifacts.get(artifactSelectionBox.getSelectionIndex()));
+ }
+ } catch (Exception ex) {
+ OseeLog.log(RevertWizardPage.class, Level.WARNING, ex);
+ }
+ getWizard().getContainer().updateButtons();
+ }
+ };
+
+ public RevertWizardPage(List<List<Artifact>> artifacts) {
+ super(TITLE);
+ this.artifacts = artifacts;
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ setTitle("The Revert Wizard");
+ // Composite composite = new Composite(parent, SWT.NONE);
+
+ GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gridData.heightHint = 300;
+ gridData.widthHint = 100;
+
+ parent.setLayout(new GridLayout(1, false));
+ parent.setLayoutData(gridData);
+
+ new Label(parent, SWT.LEFT).setText("Artifact to Revert");
+ gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gridData.heightHint = 200;
+ gridData.widthHint = 75;
+
+ artifactSelectionBox = new Combo(parent, SWT.READ_ONLY);
+ List<String> comboValues = new ArrayList<String>();
+ for (List<Artifact> artList : artifacts) {
+ comboValues.add(artList.get(0).getName());
+ }
+ artifactSelectionBox.setItems(comboValues.toArray(new String[comboValues.size()]));
+ artifactSelectionBox.addListener(SWT.Selection, listener);
+
+ new Label(parent, SWT.LEFT).setText("Revert Effects");
+
+ Composite stackComposite = new Composite(parent, SWT.NONE);
+ StackLayout stackLayout = new StackLayout();
+ stackComposite.setLayout(stackLayout);
+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
+ data.minimumHeight = 100;
+ stackComposite.setLayoutData(data);
+
+ treeViewer = new TreeViewer(stackComposite);
+ Tree tree = treeViewer.getTree();
+ treeViewer.setContentProvider(new RevertContentProvider(artifactSelectionBox, artifacts));
+ treeViewer.setLabelProvider(new RevertLabelProvider(artifactSelectionBox, artifacts));
+ treeViewer.addDoubleClickListener(new ArtifactDoubleClick());
+ treeViewer.getControl().setLayoutData(gridData);
+
+ treeViewer.setUseHashlookup(false);
+ treeViewer.setInput(artifacts != null ? artifacts.get(0) : null);
+
+ TreeEditor myTreeEditor = new TreeEditor(tree);
+ myTreeEditor.horizontalAlignment = SWT.LEFT;
+ myTreeEditor.grabHorizontal = true;
+ myTreeEditor.minimumWidth = 50;
+ stackLayout.topControl = treeViewer.getTree();
+ stackComposite.layout();
+ stackComposite.getParent().layout();
+
+ gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gridData.heightHint = 200;
+ gridData.widthHint = 75;
+ Composite buttonComposite = new Composite(parent, SWT.NONE);
+ buttonComposite.setLayout(new GridLayout(2, false));
+
+ revertSelectedButton = createButton("Revert Selected Artifact", "Show Previous Revert Artifact", buttonComposite);
+ revertAllButton = createButton("Revert All Artifacts", "Show Next Revert Artifact", buttonComposite);
+
+ new Label(parent, SWT.LEFT).setText("Cycle through the artifacts and expand the tree to see any unintended \nconsequences of reverting. \n\nYou must restart OSEE to see the results of the revert.");
+ artifactSelectionBox.select(0);
+ setControl(parent);
+
+ }
+
+ private Button createButton(String text, String tooltip, Composite composite) {
+ Button button = new Button(composite, SWT.PUSH);
+ button.addListener(SWT.Selection, listener);
+ button.setText(text);
+ button.setToolTipText(tooltip);
+ return button;
+ }
+
+ public boolean canFinish() {
+ return true;
+ }
+
+ public boolean closingPage() {
+ return true;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AbstractArtifactSearchQuery.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AbstractArtifactSearchQuery.java
index 9ee1d2a9bd3..656474b26bf 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AbstractArtifactSearchQuery.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AbstractArtifactSearchQuery.java
@@ -1,57 +1,57 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.search;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.search.ui.ISearchQuery;
-import org.eclipse.search.ui.ISearchResult;
-
-public abstract class AbstractArtifactSearchQuery implements ISearchQuery {
- protected ArtifactSearchResult aResult;
- private boolean doneRunning;
-
- public boolean canRunInBackground() {
- return true;
- }
-
- public String getLabel() {
- return "Artifact Search";
- }
-
- protected void setIsDoneRunning(boolean isDoneRunning) {
- this.doneRunning = isDoneRunning;
- }
-
- public abstract IStatus run(final IProgressMonitor pm);
-
- public String getResultLabel() {
- String branch = "";
- if (aResult.getArtifactResults() != null && !aResult.getArtifactResults().isEmpty()) {
- branch = " on Branch: \"" + aResult.getArtifactResults().get(0).getBranch().getShortName() + "\"";
- }
- return getCriteriaLabel() + " - " + (doneRunning ? (aResult.getMatchCount() + " matches" + branch) : "busy");
- }
-
- public abstract String getCriteriaLabel();
-
- public boolean canRerun() {
- return true;
- }
-
- public ISearchResult getSearchResult() {
- if (aResult == null) {
- aResult = new ArtifactSearchResult(this);
- }
- return aResult;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.search;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.search.ui.ISearchQuery;
+import org.eclipse.search.ui.ISearchResult;
+
+public abstract class AbstractArtifactSearchQuery implements ISearchQuery {
+ protected ArtifactSearchResult aResult;
+ private boolean doneRunning;
+
+ public boolean canRunInBackground() {
+ return true;
+ }
+
+ public String getLabel() {
+ return "Artifact Search";
+ }
+
+ protected void setIsDoneRunning(boolean isDoneRunning) {
+ this.doneRunning = isDoneRunning;
+ }
+
+ public abstract IStatus run(final IProgressMonitor pm);
+
+ public String getResultLabel() {
+ String branch = "";
+ if (aResult.getArtifactResults() != null && !aResult.getArtifactResults().isEmpty()) {
+ branch = " on Branch: \"" + aResult.getArtifactResults().get(0).getBranch().getShortName() + "\"";
+ }
+ return getCriteriaLabel() + " - " + (doneRunning ? (aResult.getMatchCount() + " matches" + branch) : "busy");
+ }
+
+ public abstract String getCriteriaLabel();
+
+ public boolean canRerun() {
+ return true;
+ }
+
+ public ISearchResult getSearchResult() {
+ if (aResult == null) {
+ aResult = new ArtifactSearchResult(this);
+ }
+ return aResult;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AbstractLegacyArtifactSearchQuery.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AbstractLegacyArtifactSearchQuery.java
index 5606a885f9a..5d9676c77a0 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AbstractLegacyArtifactSearchQuery.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AbstractLegacyArtifactSearchQuery.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.search;
-
+package org.eclipse.osee.framework.ui.skynet.search;
+
import java.util.Collection;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -19,27 +19,27 @@ import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.search.ui.NewSearchUI;
import org.eclipse.search.ui.text.Match;
-
-/**
- * @author Roberto E. Escobar
- */
-public abstract class AbstractLegacyArtifactSearchQuery extends AbstractArtifactSearchQuery {
-
- protected abstract Collection<Artifact> getArtifacts() throws Exception;
-
- public IStatus run(final IProgressMonitor pm) {
- setIsDoneRunning(false);
- aResult.removeAll();
- try {
- for (Artifact artifact : getArtifacts()) {
- Match match = new Match(artifact, 1, 2);
- aResult.addMatch(match);
- }
- } catch (Exception ex) {
- OseeLog.log(getClass(), OseeLevel.SEVERE_POPUP, ex);
- }
-
- setIsDoneRunning(true);
- return new MultiStatus(NewSearchUI.PLUGIN_ID, IStatus.OK, "OK", null);
- }
-}
+
+/**
+ * @author Roberto E. Escobar
+ */
+public abstract class AbstractLegacyArtifactSearchQuery extends AbstractArtifactSearchQuery {
+
+ protected abstract Collection<Artifact> getArtifacts() throws Exception;
+
+ public IStatus run(final IProgressMonitor pm) {
+ setIsDoneRunning(false);
+ aResult.removeAll();
+ try {
+ for (Artifact artifact : getArtifacts()) {
+ Match match = new Match(artifact, 1, 2);
+ aResult.addMatch(match);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(getClass(), OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ setIsDoneRunning(true);
+ return new MultiStatus(NewSearchUI.PLUGIN_ID, IStatus.OK, "OK", null);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactSearchPage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactSearchPage.java
index c72bf21b0a1..7e570a17512 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactSearchPage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactSearchPage.java
@@ -1,603 +1,603 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.search;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.logging.Level;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.type.ArtifactType;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-import org.eclipse.osee.framework.core.model.type.RelationType;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
-import org.eclipse.osee.framework.skynet.core.relation.RelationTypeManager;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.search.filter.FilterModel;
-import org.eclipse.osee.framework.ui.skynet.search.filter.FilterModelList;
-import org.eclipse.osee.framework.ui.skynet.search.filter.FilterTableViewer;
-import org.eclipse.osee.framework.ui.skynet.search.page.AbstractArtifactSearchViewPage;
-import org.eclipse.osee.framework.ui.skynet.util.DbConnectionExceptionComposite;
-import org.eclipse.osee.framework.ui.skynet.widgets.XBranchSelectWidget;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.HyperLinkLabel;
-import org.eclipse.search.ui.IReplacePage;
-import org.eclipse.search.ui.ISearchPage;
-import org.eclipse.search.ui.ISearchPageContainer;
-import org.eclipse.search.ui.ISearchResultPage;
-import org.eclipse.search.ui.ISearchResultViewPart;
-import org.eclipse.search.ui.NewSearchUI;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StackLayout;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * @author Michael S. Rodgers
- */
-public class ArtifactSearchPage extends DialogPage implements ISearchPage, IReplacePage {
- private static final Pattern storageStringPattern = Pattern.compile("(.*?);(.*?);(.*?);(.*)");
- private static final Pattern notSearchPrimitivePattern = Pattern.compile("Not \\[(.*)\\]");
- private static final String FILTERS_STORAGE_KEY = ".filters";
-
- private static ISearchPageContainer aContainer;
-
- private Button addButton;
- private Button allButton;
- private Button atLeastOneButton;
- private ComboViewer searchTypeList;
- private Button notButton;
-
- private StackLayout selectionLayout;
- private static FilterTableViewer filterviewer;
- private Composite artifactTypeControls;
- private ListViewer artifactTypeList;
-
- private XBranchSelectWidget branchSelect;
-
- private SearchFilter HRID_VALUE_FILTER;
- private SearchFilter ATTRIBUTE_VALUE_FILTER;
- private static int lastSearchTypeListSelected = 2; // Attribute
- private static int lastAttributeTypeListSelected = 0; // Name
-
- private final Matcher storageStringMatcher = storageStringPattern.matcher("");
- private final Matcher notSearchPrimitiveMatcher = notSearchPrimitivePattern.matcher("");
-
- public void createControl(Composite parent) {
- initializeDialogUnits(parent);
- boolean isConnectionOk = DbConnectionExceptionComposite.dbConnectionIsOk(parent);
- if (isConnectionOk != false) {
- Composite mainComposite = new Composite(parent, SWT.NONE);
- mainComposite.setFont(parent.getFont());
- mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- mainComposite.setLayout(new GridLayout());
-
- branchSelect = new XBranchSelectWidget("Branch To Search");
- branchSelect.setDisplayLabel(false);
- branchSelect.setSelection(BranchManager.getLastBranch());
- branchSelect.createWidgets(mainComposite, 2);
-
- addFilterControls(mainComposite);
- addTableControls(mainComposite);
- addSearchScope(mainComposite);
- addFilterListeners();
-
- setControl(parent);
- aContainer.setPerformActionEnabled(false);
-
- SkynetGuiPlugin.getInstance().setHelp(mainComposite, "artifact_search", "org.eclipse.osee.framework.help.ui");
-
- updateWidgets();
-
- loadState();
- } else {
- setControl(parent);
- }
- }
-
- private Branch getSelectedBranch() {
- Branch branch = branchSelect.getData();
- if (branch == null) {
- branch = BranchManager.getLastBranch();
- }
- try {
- if (branch == null) {
- branch = BranchManager.getCommonBranch();
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- return branch;
- }
-
- /**
- * Controls to allow the user to select wether all the filters are combined using AND or OR
- */
- private void addSearchScope(Composite composite) {
- Group allSelectionGroup = new Group(composite, SWT.NONE);
- allSelectionGroup.setText("Artifacts that match");
- allSelectionGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- allSelectionGroup.setLayout(new GridLayout(2, false));
-
- allButton = new Button(allSelectionGroup, SWT.RADIO);
- allButton.setText("All filters (AND)");
- allButton.setSelection(true);
-
- atLeastOneButton = new Button(allSelectionGroup, SWT.RADIO);
- atLeastOneButton.setText("At least one filter (OR)");
- }
-
- private void createArtifactTypeSearchControls(Composite optionsComposite) {
- artifactTypeControls = new Composite(optionsComposite, SWT.NONE);
- artifactTypeControls.setLayout(new GridLayout(1, true));
-
- artifactTypeList = new ListViewer(artifactTypeControls);
- GridData gd = new GridData();
- gd.heightHint = 100;
- artifactTypeList.getList().setLayoutData(gd);
- artifactTypeList.setContentProvider(new SearchContentProvider());
- artifactTypeList.setLabelProvider(new SearchLabelProvider());
- artifactTypeList.setSorter(new SearchSorter());
-
- try {
- for (ArtifactType descriptor : ArtifactTypeManager.getValidArtifactTypes(getSelectedBranch())) {
- artifactTypeList.add(descriptor.getName());
- artifactTypeList.setData(descriptor.getName(), descriptor);
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP,
- "Error encountered while getting list of artifact types", ex);
- }
- addToSearchTypeList(new ArtifactTypeFilter(artifactTypeControls, artifactTypeList));
- }
-
- private void createOrphanSearchControls(Composite optionsComposite) {
- //uses the artifactTypeList from Artifact_type_filter
- artifactTypeList.getList().select(0);
- addToSearchTypeList(new OrphanSearchFilter("Orphan Search", artifactTypeControls, artifactTypeList));
- }
-
- private void addToSearchTypeList(SearchFilter filter) {
- searchTypeList.add(filter.getFilterName());
- searchTypeList.setData(filter.getFilterName(), filter);
- }
-
- private void createRelationSearchControls(Composite optionsComposite) {
- Composite relationControls = new Composite(optionsComposite, SWT.NONE);
- relationControls.setLayout(new GridLayout(2, true));
-
- final ComboViewer relationTypeList = new ComboViewer(relationControls, SWT.DROP_DOWN | SWT.READ_ONLY);
- relationTypeList.setContentProvider(new SearchContentProvider());
- relationTypeList.setLabelProvider(new SearchLabelProvider());
- relationTypeList.setSorter(new SearchSorter());
- final ComboViewer relationSideList = new ComboViewer(relationControls, SWT.DROP_DOWN | SWT.READ_ONLY);
- relationSideList.setContentProvider(new SearchContentProvider());
- relationSideList.setLabelProvider(new SearchLabelProvider());
- relationSideList.setSorter(new SearchSorter());
-
- try {
- for (RelationType linkDescriptor : RelationTypeManager.getValidTypes(getSelectedBranch())) {
- relationTypeList.add(linkDescriptor.getName());
- relationTypeList.setData(linkDescriptor.getName(), linkDescriptor);
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
-
- relationTypeList.getCombo().addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- relationSideList.getCombo().removeAll();
- RelationType linkDescriptor =
- (RelationType) relationTypeList.getData(relationTypeList.getCombo().getText());
- relationSideList.add(linkDescriptor.getSideAName());
- relationSideList.add(linkDescriptor.getSideBName());
- relationSideList.getCombo().select(0);
- }
- });
- relationTypeList.getCombo().setVisibleItemCount(Math.min(relationTypeList.getCombo().getItemCount(), 15));
-
- if (relationTypeList.getCombo().getItemCount() > 0) { // ensure we don't get a null pointer
- // exception when there are no relation types in the db
- relationTypeList.getCombo().select(0);
- RelationType linkDescriptor = (RelationType) relationTypeList.getData(relationTypeList.getCombo().getText());
- relationSideList.add(linkDescriptor.getSideAName());
- relationSideList.add(linkDescriptor.getSideBName());
- relationSideList.getCombo().select(0);
- }
-
- addToSearchTypeList(new InRelationFilter(relationControls, relationTypeList, relationSideList));
- }
-
- private void createHridSearchControls(Composite optionsComposite) {
- Composite hridControls = new Composite(optionsComposite, SWT.NONE);
- hridControls.setLayout(new GridLayout(2, false));
-
- Label typeLabel = new Label(hridControls, SWT.HORIZONTAL);
- typeLabel.setText("Human Readable ID:");
- Text hridValue = new Text(hridControls, SWT.BORDER);
- hridValue.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
-
- hridValue.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- addButton.setEnabled(HRID_VALUE_FILTER.isValid());
- }
- });
-
- new Label(hridControls, SWT.NONE);
-
- Label wildLabel = new Label(hridControls, SWT.NONE);
- wildLabel.setText("(* = any string, \\* = literal *)");
-
- HRID_VALUE_FILTER = new HridValueFilter(hridControls, hridValue);
- addToSearchTypeList(HRID_VALUE_FILTER);
- }
-
- private void createAttributeSearchControls(Composite optionsComposite) {
- Composite attributeControls = new Composite(optionsComposite, SWT.NONE);
- attributeControls.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- attributeControls.setLayout(new GridLayout(2, false));
-
- Label typeLabel = new Label(attributeControls, SWT.HORIZONTAL);
- typeLabel.setText("Attribute Type:");
-
- final ComboViewer attributeTypeList = new ComboViewer(attributeControls, SWT.DROP_DOWN | SWT.READ_ONLY);
- attributeTypeList.setContentProvider(new SearchContentProvider());
- attributeTypeList.setLabelProvider(new SearchLabelProvider());
- attributeTypeList.setSorter(new SearchSorter());
-
- Label valueLabel = new Label(attributeControls, SWT.HORIZONTAL);
- valueLabel.setText("Attribute Value:");
-
- Text attributeValue = new Text(attributeControls, SWT.BORDER);
- attributeValue.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- try {
- for (AttributeType type : AttributeTypeManager.getValidAttributeTypes(getSelectedBranch())) {
- attributeTypeList.add(type.getName());
- attributeTypeList.setData(type.getName(), type);
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP,
- "Error encountered while getting list of attribute types", ex);
- }
- attributeTypeList.getCombo().setVisibleItemCount(Math.min(attributeTypeList.getCombo().getItemCount(), 15));
- attributeTypeList.getCombo().select(lastAttributeTypeListSelected);
- attributeTypeList.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- lastAttributeTypeListSelected = attributeTypeList.getCombo().getSelectionIndex();
- }
- });
-
- attributeValue.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- addButton.setEnabled(ATTRIBUTE_VALUE_FILTER.isValid());
- }
- });
-
- new Label(attributeControls, SWT.NONE); // spacerLabelSoTheNextOneWillBeInColumnTwo
-
- Label wildLabel = new Label(attributeControls, SWT.NONE);
- wildLabel.setText("(* = any string, \\* = literal *)");
-
- ATTRIBUTE_VALUE_FILTER = new AttributeValueFilter(attributeControls, attributeTypeList, attributeValue);
- addToSearchTypeList(ATTRIBUTE_VALUE_FILTER);
- }
-
- private void addFilterControls(Composite mainComposite) {
- Group filterGroup = new Group(mainComposite, SWT.NONE);
- filterGroup.setText("Create a Filter");
- filterGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- filterGroup.setLayout(new GridLayout());
-
- Composite composite = new Composite(filterGroup, SWT.BORDER);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- composite.setLayout(new GridLayout(2, false));
-
- searchTypeList = new ComboViewer(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
- searchTypeList.setContentProvider(new SearchContentProvider());
- searchTypeList.setLabelProvider(new SearchLabelProvider());
- searchTypeList.setSorter(new SearchSorter());
-
- notButton = new Button(composite, SWT.CHECK);
- notButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.FILL, true, false));
- notButton.setText("Not Equal");
-
- selectionLayout = new StackLayout();
-
- Composite optionsComposite = new Composite(filterGroup, SWT.BORDER);
- optionsComposite.setLayout(new GridLayout());
- optionsComposite.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
-
- optionsComposite.setLayout(selectionLayout);
- createAttributeSearchControls(optionsComposite);
- createArtifactTypeSearchControls(optionsComposite);
- createOrphanSearchControls(optionsComposite);
- createRelationSearchControls(optionsComposite);
- createHridSearchControls(optionsComposite);
-
- searchTypeList.getCombo().setVisibleItemCount(7);
- searchTypeList.getCombo().select(lastSearchTypeListSelected);
- searchTypeList.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- lastSearchTypeListSelected = searchTypeList.getCombo().getSelectionIndex();
- }
- });
- addButton = new Button(filterGroup, SWT.PUSH);
- addButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false));
- addButton.setText("Add Filter");
- }
-
- private void addFilterListeners() {
- addButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- SearchFilter searchFilter = (SearchFilter) searchTypeList.getData(searchTypeList.getCombo().getText());
- searchFilter.setNot(notButton.getSelection());
- searchFilter.addFilterTo(filterviewer);
- updateOKStatus();
- }
- });
-
- searchTypeList.getCombo().addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- updateWidgets();
- }
- });
- }
-
- private void updateWidgets() {
- SearchFilter searchFilter = (SearchFilter) searchTypeList.getData(searchTypeList.getCombo().getText());
- addButton.setEnabled(searchFilter.isValid());
- selectionLayout.topControl = searchFilter.optionsControl;
- selectionLayout.topControl.getParent().layout();
- }
-
- private void addTableControls(Composite composite) {
- Composite filterComposite = new Composite(composite, SWT.NONE);
- filterComposite.setFont(composite.getFont());
- filterComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- filterComposite.setLayout(new GridLayout(2, false));
-
- Label tableLabel = new Label(filterComposite, SWT.FILL);
- tableLabel.setText("Filters ");
-
- HyperLinkLabel clearAllLabel = new HyperLinkLabel(filterComposite, SWT.NONE);
- clearAllLabel.setText("clear all");
- clearAllLabel.addListener(SWT.MouseUp, new Listener() {
- @Override
- public void handleEvent(Event event) {
- for (FilterModel filterModel : new CopyOnWriteArrayList<FilterModel>(
- filterviewer.getFilterList().getFilters())) {
- filterviewer.removeFilter(filterModel);
- }
- filterviewer.refresh();
- }
- });
-
- Table table = new Table(composite, SWT.BORDER | SWT.V_SCROLL | SWT.HIDE_SELECTION);
- filterviewer = new FilterTableViewer(table);
- GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- gridData.heightHint = 100;
- gridData.widthHint = 500;
- table.setLayoutData(gridData);
- }
-
- public void setContainer(ISearchPageContainer container) {
- ArtifactSearchPage.aContainer = container;
- }
-
- /**
- * @return Returns the aContainer.
- */
- public static ISearchPageContainer getContainer() {
- return aContainer;
- }
-
- public boolean performAction() {
- NewSearchUI.activateSearchResultView();
- filterviewer.getFilterList().setAllSelected(allButton.getSelection());
- AbstractArtifactSearchQuery searchQuery =
- new FilterArtifactSearchQuery(filterviewer.getFilterList(), getSelectedBranch());
- NewSearchUI.runQueryInBackground(searchQuery);
- saveState();
- return true;
- }
-
- public boolean performReplace() {
- filterviewer.getFilterList().setAllSelected(allButton.getSelection());
- AbstractArtifactSearchQuery searchQuery =
- new FilterArtifactSearchQuery(filterviewer.getFilterList(), getSelectedBranch());
-
- IStatus status = NewSearchUI.runQueryInForeground(getContainer().getRunnableContext(), searchQuery);
- if (status.matches(IStatus.CANCEL)) {
- return false;
- }
-
- ISearchResultViewPart view = NewSearchUI.activateSearchResultView();
- if (view != null) {
- final ISearchResultPage page = view.getActivePage();
- if (page instanceof AbstractArtifactSearchViewPage) {
- runAttributeFindReplaceDialog(page);
- }
- }
- return true;
- }
-
- private void runAttributeFindReplaceDialog(final ISearchResultPage page) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (page instanceof AbstractArtifactSearchViewPage) {
- AbstractArtifactSearchViewPage artifactPage = (AbstractArtifactSearchViewPage) page;
- List<Artifact> artifacts = artifactPage.getInput().getArtifactResults();
- new AttributeFindReplaceDialog(page.getSite().getShell(), artifacts).open();
- }
- }
- });
- }
-
- /*
- * Implements method from IDialogPage
- */
- @Override
- public void setVisible(boolean visible) {
- updateOKStatus();
- super.setVisible(visible);
- }
-
- public static void updateOKStatus() {
- if (filterviewer == null || filterviewer.getFilterList().getFilters().isEmpty()) {
- getContainer().setPerformActionEnabled(false);
- } else {
- getContainer().setPerformActionEnabled(true);
- }
- }
-
- private String asString(FilterModel model) {
- StringBuilder builder = new StringBuilder();
- builder.append(model.getSearch());
- builder.append(";");
- builder.append(model.getType());
- builder.append(";");
- builder.append(model.getValue());
- builder.append(";");
- builder.append(model.getSearchPrimitive().getStorageString());
- return builder.toString();
- }
-
- private void processStoredFilter(String entry) {
- storageStringMatcher.reset(entry);
- if (storageStringMatcher.find()) {
- String searchPrimitive = storageStringMatcher.group(1);
- String type = storageStringMatcher.group(2);
- String value = storageStringMatcher.group(3);
- String storageString = storageStringMatcher.group(4);
- boolean isNotEnabled = false;
- notSearchPrimitiveMatcher.reset(storageString);
- if (notSearchPrimitiveMatcher.find()) {
- isNotEnabled = true;
- storageString = notSearchPrimitiveMatcher.group(1);
- }
- SearchFilter searchFilter = (SearchFilter) searchTypeList.getData(searchPrimitive);
- searchFilter.loadFromStorageString(filterviewer, type, value, storageString, isNotEnabled);
- searchFilter.getFilterName();
- }
- }
-
- protected void saveState() {
- IDialogSettings dialogSettings = SkynetGuiPlugin.getInstance().getDialogSettings();
- if (dialogSettings != null) {
-
- List<String> filterString = new ArrayList<String>();
- FilterModelList filterList = filterviewer.getFilterList();
- for (FilterModel model : filterList.getFilters()) {
- filterString.add(asString(model));
- }
- dialogSettings.put(SkynetGuiPlugin.PLUGIN_ID + FILTERS_STORAGE_KEY,
- filterString.toArray(new String[filterString.size()]));
- }
- }
-
- protected void loadState() {
- IDialogSettings dialogSettings = SkynetGuiPlugin.getInstance().getDialogSettings();
- if (dialogSettings != null) {
- String[] filters = dialogSettings.getArray(SkynetGuiPlugin.PLUGIN_ID + FILTERS_STORAGE_KEY);
- if (filters != null) {
- for (String entry : filters) {
- processStoredFilter(entry);
- }
- }
- }
- }
-
- public class SearchLabelProvider implements ILabelProvider {
-
- public Image getImage(Object arg0) {
- return null;
- }
-
- public String getText(Object arg0) {
- return (String) arg0;
- }
-
- public void addListener(ILabelProviderListener arg0) {
- }
-
- public void dispose() {
- }
-
- public boolean isLabelProperty(Object arg0, String arg1) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener arg0) {
- }
- }
-
- public class SearchContentProvider implements IStructuredContentProvider {
- @SuppressWarnings("unchecked")
- public Object[] getElements(Object arg0) {
- return ((ArrayList) arg0).toArray();
- }
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
- }
- }
-
- public class SearchSorter extends ViewerSorter {
- @SuppressWarnings("unchecked")
- @Override
- public int compare(Viewer viewer, Object e1, Object e2) {
- return getComparator().compare(e1, e2);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.search;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.logging.Level;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.type.ArtifactType;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.core.model.type.RelationType;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
+import org.eclipse.osee.framework.skynet.core.relation.RelationTypeManager;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.search.filter.FilterModel;
+import org.eclipse.osee.framework.ui.skynet.search.filter.FilterModelList;
+import org.eclipse.osee.framework.ui.skynet.search.filter.FilterTableViewer;
+import org.eclipse.osee.framework.ui.skynet.search.page.AbstractArtifactSearchViewPage;
+import org.eclipse.osee.framework.ui.skynet.util.DbConnectionExceptionComposite;
+import org.eclipse.osee.framework.ui.skynet.widgets.XBranchSelectWidget;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.HyperLinkLabel;
+import org.eclipse.search.ui.IReplacePage;
+import org.eclipse.search.ui.ISearchPage;
+import org.eclipse.search.ui.ISearchPageContainer;
+import org.eclipse.search.ui.ISearchResultPage;
+import org.eclipse.search.ui.ISearchResultViewPart;
+import org.eclipse.search.ui.NewSearchUI;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StackLayout;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @author Michael S. Rodgers
+ */
+public class ArtifactSearchPage extends DialogPage implements ISearchPage, IReplacePage {
+ private static final Pattern storageStringPattern = Pattern.compile("(.*?);(.*?);(.*?);(.*)");
+ private static final Pattern notSearchPrimitivePattern = Pattern.compile("Not \\[(.*)\\]");
+ private static final String FILTERS_STORAGE_KEY = ".filters";
+
+ private static ISearchPageContainer aContainer;
+
+ private Button addButton;
+ private Button allButton;
+ private Button atLeastOneButton;
+ private ComboViewer searchTypeList;
+ private Button notButton;
+
+ private StackLayout selectionLayout;
+ private static FilterTableViewer filterviewer;
+ private Composite artifactTypeControls;
+ private ListViewer artifactTypeList;
+
+ private XBranchSelectWidget branchSelect;
+
+ private SearchFilter HRID_VALUE_FILTER;
+ private SearchFilter ATTRIBUTE_VALUE_FILTER;
+ private static int lastSearchTypeListSelected = 2; // Attribute
+ private static int lastAttributeTypeListSelected = 0; // Name
+
+ private final Matcher storageStringMatcher = storageStringPattern.matcher("");
+ private final Matcher notSearchPrimitiveMatcher = notSearchPrimitivePattern.matcher("");
+
+ public void createControl(Composite parent) {
+ initializeDialogUnits(parent);
+ boolean isConnectionOk = DbConnectionExceptionComposite.dbConnectionIsOk(parent);
+ if (isConnectionOk != false) {
+ Composite mainComposite = new Composite(parent, SWT.NONE);
+ mainComposite.setFont(parent.getFont());
+ mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ mainComposite.setLayout(new GridLayout());
+
+ branchSelect = new XBranchSelectWidget("Branch To Search");
+ branchSelect.setDisplayLabel(false);
+ branchSelect.setSelection(BranchManager.getLastBranch());
+ branchSelect.createWidgets(mainComposite, 2);
+
+ addFilterControls(mainComposite);
+ addTableControls(mainComposite);
+ addSearchScope(mainComposite);
+ addFilterListeners();
+
+ setControl(parent);
+ aContainer.setPerformActionEnabled(false);
+
+ SkynetGuiPlugin.getInstance().setHelp(mainComposite, "artifact_search", "org.eclipse.osee.framework.help.ui");
+
+ updateWidgets();
+
+ loadState();
+ } else {
+ setControl(parent);
+ }
+ }
+
+ private Branch getSelectedBranch() {
+ Branch branch = branchSelect.getData();
+ if (branch == null) {
+ branch = BranchManager.getLastBranch();
+ }
+ try {
+ if (branch == null) {
+ branch = BranchManager.getCommonBranch();
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ return branch;
+ }
+
+ /**
+ * Controls to allow the user to select wether all the filters are combined using AND or OR
+ */
+ private void addSearchScope(Composite composite) {
+ Group allSelectionGroup = new Group(composite, SWT.NONE);
+ allSelectionGroup.setText("Artifacts that match");
+ allSelectionGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ allSelectionGroup.setLayout(new GridLayout(2, false));
+
+ allButton = new Button(allSelectionGroup, SWT.RADIO);
+ allButton.setText("All filters (AND)");
+ allButton.setSelection(true);
+
+ atLeastOneButton = new Button(allSelectionGroup, SWT.RADIO);
+ atLeastOneButton.setText("At least one filter (OR)");
+ }
+
+ private void createArtifactTypeSearchControls(Composite optionsComposite) {
+ artifactTypeControls = new Composite(optionsComposite, SWT.NONE);
+ artifactTypeControls.setLayout(new GridLayout(1, true));
+
+ artifactTypeList = new ListViewer(artifactTypeControls);
+ GridData gd = new GridData();
+ gd.heightHint = 100;
+ artifactTypeList.getList().setLayoutData(gd);
+ artifactTypeList.setContentProvider(new SearchContentProvider());
+ artifactTypeList.setLabelProvider(new SearchLabelProvider());
+ artifactTypeList.setSorter(new SearchSorter());
+
+ try {
+ for (ArtifactType descriptor : ArtifactTypeManager.getValidArtifactTypes(getSelectedBranch())) {
+ artifactTypeList.add(descriptor.getName());
+ artifactTypeList.setData(descriptor.getName(), descriptor);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP,
+ "Error encountered while getting list of artifact types", ex);
+ }
+ addToSearchTypeList(new ArtifactTypeFilter(artifactTypeControls, artifactTypeList));
+ }
+
+ private void createOrphanSearchControls(Composite optionsComposite) {
+ //uses the artifactTypeList from Artifact_type_filter
+ artifactTypeList.getList().select(0);
+ addToSearchTypeList(new OrphanSearchFilter("Orphan Search", artifactTypeControls, artifactTypeList));
+ }
+
+ private void addToSearchTypeList(SearchFilter filter) {
+ searchTypeList.add(filter.getFilterName());
+ searchTypeList.setData(filter.getFilterName(), filter);
+ }
+
+ private void createRelationSearchControls(Composite optionsComposite) {
+ Composite relationControls = new Composite(optionsComposite, SWT.NONE);
+ relationControls.setLayout(new GridLayout(2, true));
+
+ final ComboViewer relationTypeList = new ComboViewer(relationControls, SWT.DROP_DOWN | SWT.READ_ONLY);
+ relationTypeList.setContentProvider(new SearchContentProvider());
+ relationTypeList.setLabelProvider(new SearchLabelProvider());
+ relationTypeList.setSorter(new SearchSorter());
+ final ComboViewer relationSideList = new ComboViewer(relationControls, SWT.DROP_DOWN | SWT.READ_ONLY);
+ relationSideList.setContentProvider(new SearchContentProvider());
+ relationSideList.setLabelProvider(new SearchLabelProvider());
+ relationSideList.setSorter(new SearchSorter());
+
+ try {
+ for (RelationType linkDescriptor : RelationTypeManager.getValidTypes(getSelectedBranch())) {
+ relationTypeList.add(linkDescriptor.getName());
+ relationTypeList.setData(linkDescriptor.getName(), linkDescriptor);
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ relationTypeList.getCombo().addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ relationSideList.getCombo().removeAll();
+ RelationType linkDescriptor =
+ (RelationType) relationTypeList.getData(relationTypeList.getCombo().getText());
+ relationSideList.add(linkDescriptor.getSideAName());
+ relationSideList.add(linkDescriptor.getSideBName());
+ relationSideList.getCombo().select(0);
+ }
+ });
+ relationTypeList.getCombo().setVisibleItemCount(Math.min(relationTypeList.getCombo().getItemCount(), 15));
+
+ if (relationTypeList.getCombo().getItemCount() > 0) { // ensure we don't get a null pointer
+ // exception when there are no relation types in the db
+ relationTypeList.getCombo().select(0);
+ RelationType linkDescriptor = (RelationType) relationTypeList.getData(relationTypeList.getCombo().getText());
+ relationSideList.add(linkDescriptor.getSideAName());
+ relationSideList.add(linkDescriptor.getSideBName());
+ relationSideList.getCombo().select(0);
+ }
+
+ addToSearchTypeList(new InRelationFilter(relationControls, relationTypeList, relationSideList));
+ }
+
+ private void createHridSearchControls(Composite optionsComposite) {
+ Composite hridControls = new Composite(optionsComposite, SWT.NONE);
+ hridControls.setLayout(new GridLayout(2, false));
+
+ Label typeLabel = new Label(hridControls, SWT.HORIZONTAL);
+ typeLabel.setText("Human Readable ID:");
+ Text hridValue = new Text(hridControls, SWT.BORDER);
+ hridValue.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+
+ hridValue.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ addButton.setEnabled(HRID_VALUE_FILTER.isValid());
+ }
+ });
+
+ new Label(hridControls, SWT.NONE);
+
+ Label wildLabel = new Label(hridControls, SWT.NONE);
+ wildLabel.setText("(* = any string, \\* = literal *)");
+
+ HRID_VALUE_FILTER = new HridValueFilter(hridControls, hridValue);
+ addToSearchTypeList(HRID_VALUE_FILTER);
+ }
+
+ private void createAttributeSearchControls(Composite optionsComposite) {
+ Composite attributeControls = new Composite(optionsComposite, SWT.NONE);
+ attributeControls.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ attributeControls.setLayout(new GridLayout(2, false));
+
+ Label typeLabel = new Label(attributeControls, SWT.HORIZONTAL);
+ typeLabel.setText("Attribute Type:");
+
+ final ComboViewer attributeTypeList = new ComboViewer(attributeControls, SWT.DROP_DOWN | SWT.READ_ONLY);
+ attributeTypeList.setContentProvider(new SearchContentProvider());
+ attributeTypeList.setLabelProvider(new SearchLabelProvider());
+ attributeTypeList.setSorter(new SearchSorter());
+
+ Label valueLabel = new Label(attributeControls, SWT.HORIZONTAL);
+ valueLabel.setText("Attribute Value:");
+
+ Text attributeValue = new Text(attributeControls, SWT.BORDER);
+ attributeValue.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ try {
+ for (AttributeType type : AttributeTypeManager.getValidAttributeTypes(getSelectedBranch())) {
+ attributeTypeList.add(type.getName());
+ attributeTypeList.setData(type.getName(), type);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP,
+ "Error encountered while getting list of attribute types", ex);
+ }
+ attributeTypeList.getCombo().setVisibleItemCount(Math.min(attributeTypeList.getCombo().getItemCount(), 15));
+ attributeTypeList.getCombo().select(lastAttributeTypeListSelected);
+ attributeTypeList.addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ lastAttributeTypeListSelected = attributeTypeList.getCombo().getSelectionIndex();
+ }
+ });
+
+ attributeValue.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ addButton.setEnabled(ATTRIBUTE_VALUE_FILTER.isValid());
+ }
+ });
+
+ new Label(attributeControls, SWT.NONE); // spacerLabelSoTheNextOneWillBeInColumnTwo
+
+ Label wildLabel = new Label(attributeControls, SWT.NONE);
+ wildLabel.setText("(* = any string, \\* = literal *)");
+
+ ATTRIBUTE_VALUE_FILTER = new AttributeValueFilter(attributeControls, attributeTypeList, attributeValue);
+ addToSearchTypeList(ATTRIBUTE_VALUE_FILTER);
+ }
+
+ private void addFilterControls(Composite mainComposite) {
+ Group filterGroup = new Group(mainComposite, SWT.NONE);
+ filterGroup.setText("Create a Filter");
+ filterGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ filterGroup.setLayout(new GridLayout());
+
+ Composite composite = new Composite(filterGroup, SWT.BORDER);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ composite.setLayout(new GridLayout(2, false));
+
+ searchTypeList = new ComboViewer(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
+ searchTypeList.setContentProvider(new SearchContentProvider());
+ searchTypeList.setLabelProvider(new SearchLabelProvider());
+ searchTypeList.setSorter(new SearchSorter());
+
+ notButton = new Button(composite, SWT.CHECK);
+ notButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.FILL, true, false));
+ notButton.setText("Not Equal");
+
+ selectionLayout = new StackLayout();
+
+ Composite optionsComposite = new Composite(filterGroup, SWT.BORDER);
+ optionsComposite.setLayout(new GridLayout());
+ optionsComposite.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
+
+ optionsComposite.setLayout(selectionLayout);
+ createAttributeSearchControls(optionsComposite);
+ createArtifactTypeSearchControls(optionsComposite);
+ createOrphanSearchControls(optionsComposite);
+ createRelationSearchControls(optionsComposite);
+ createHridSearchControls(optionsComposite);
+
+ searchTypeList.getCombo().setVisibleItemCount(7);
+ searchTypeList.getCombo().select(lastSearchTypeListSelected);
+ searchTypeList.addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ lastSearchTypeListSelected = searchTypeList.getCombo().getSelectionIndex();
+ }
+ });
+ addButton = new Button(filterGroup, SWT.PUSH);
+ addButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false));
+ addButton.setText("Add Filter");
+ }
+
+ private void addFilterListeners() {
+ addButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ SearchFilter searchFilter = (SearchFilter) searchTypeList.getData(searchTypeList.getCombo().getText());
+ searchFilter.setNot(notButton.getSelection());
+ searchFilter.addFilterTo(filterviewer);
+ updateOKStatus();
+ }
+ });
+
+ searchTypeList.getCombo().addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateWidgets();
+ }
+ });
+ }
+
+ private void updateWidgets() {
+ SearchFilter searchFilter = (SearchFilter) searchTypeList.getData(searchTypeList.getCombo().getText());
+ addButton.setEnabled(searchFilter.isValid());
+ selectionLayout.topControl = searchFilter.optionsControl;
+ selectionLayout.topControl.getParent().layout();
+ }
+
+ private void addTableControls(Composite composite) {
+ Composite filterComposite = new Composite(composite, SWT.NONE);
+ filterComposite.setFont(composite.getFont());
+ filterComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ filterComposite.setLayout(new GridLayout(2, false));
+
+ Label tableLabel = new Label(filterComposite, SWT.FILL);
+ tableLabel.setText("Filters ");
+
+ HyperLinkLabel clearAllLabel = new HyperLinkLabel(filterComposite, SWT.NONE);
+ clearAllLabel.setText("clear all");
+ clearAllLabel.addListener(SWT.MouseUp, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ for (FilterModel filterModel : new CopyOnWriteArrayList<FilterModel>(
+ filterviewer.getFilterList().getFilters())) {
+ filterviewer.removeFilter(filterModel);
+ }
+ filterviewer.refresh();
+ }
+ });
+
+ Table table = new Table(composite, SWT.BORDER | SWT.V_SCROLL | SWT.HIDE_SELECTION);
+ filterviewer = new FilterTableViewer(table);
+ GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gridData.heightHint = 100;
+ gridData.widthHint = 500;
+ table.setLayoutData(gridData);
+ }
+
+ public void setContainer(ISearchPageContainer container) {
+ ArtifactSearchPage.aContainer = container;
+ }
+
+ /**
+ * @return Returns the aContainer.
+ */
+ public static ISearchPageContainer getContainer() {
+ return aContainer;
+ }
+
+ public boolean performAction() {
+ NewSearchUI.activateSearchResultView();
+ filterviewer.getFilterList().setAllSelected(allButton.getSelection());
+ AbstractArtifactSearchQuery searchQuery =
+ new FilterArtifactSearchQuery(filterviewer.getFilterList(), getSelectedBranch());
+ NewSearchUI.runQueryInBackground(searchQuery);
+ saveState();
+ return true;
+ }
+
+ public boolean performReplace() {
+ filterviewer.getFilterList().setAllSelected(allButton.getSelection());
+ AbstractArtifactSearchQuery searchQuery =
+ new FilterArtifactSearchQuery(filterviewer.getFilterList(), getSelectedBranch());
+
+ IStatus status = NewSearchUI.runQueryInForeground(getContainer().getRunnableContext(), searchQuery);
+ if (status.matches(IStatus.CANCEL)) {
+ return false;
+ }
+
+ ISearchResultViewPart view = NewSearchUI.activateSearchResultView();
+ if (view != null) {
+ final ISearchResultPage page = view.getActivePage();
+ if (page instanceof AbstractArtifactSearchViewPage) {
+ runAttributeFindReplaceDialog(page);
+ }
+ }
+ return true;
+ }
+
+ private void runAttributeFindReplaceDialog(final ISearchResultPage page) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (page instanceof AbstractArtifactSearchViewPage) {
+ AbstractArtifactSearchViewPage artifactPage = (AbstractArtifactSearchViewPage) page;
+ List<Artifact> artifacts = artifactPage.getInput().getArtifactResults();
+ new AttributeFindReplaceDialog(page.getSite().getShell(), artifacts).open();
+ }
+ }
+ });
+ }
+
+ /*
+ * Implements method from IDialogPage
+ */
+ @Override
+ public void setVisible(boolean visible) {
+ updateOKStatus();
+ super.setVisible(visible);
+ }
+
+ public static void updateOKStatus() {
+ if (filterviewer == null || filterviewer.getFilterList().getFilters().isEmpty()) {
+ getContainer().setPerformActionEnabled(false);
+ } else {
+ getContainer().setPerformActionEnabled(true);
+ }
+ }
+
+ private String asString(FilterModel model) {
+ StringBuilder builder = new StringBuilder();
+ builder.append(model.getSearch());
+ builder.append(";");
+ builder.append(model.getType());
+ builder.append(";");
+ builder.append(model.getValue());
+ builder.append(";");
+ builder.append(model.getSearchPrimitive().getStorageString());
+ return builder.toString();
+ }
+
+ private void processStoredFilter(String entry) {
+ storageStringMatcher.reset(entry);
+ if (storageStringMatcher.find()) {
+ String searchPrimitive = storageStringMatcher.group(1);
+ String type = storageStringMatcher.group(2);
+ String value = storageStringMatcher.group(3);
+ String storageString = storageStringMatcher.group(4);
+ boolean isNotEnabled = false;
+ notSearchPrimitiveMatcher.reset(storageString);
+ if (notSearchPrimitiveMatcher.find()) {
+ isNotEnabled = true;
+ storageString = notSearchPrimitiveMatcher.group(1);
+ }
+ SearchFilter searchFilter = (SearchFilter) searchTypeList.getData(searchPrimitive);
+ searchFilter.loadFromStorageString(filterviewer, type, value, storageString, isNotEnabled);
+ searchFilter.getFilterName();
+ }
+ }
+
+ protected void saveState() {
+ IDialogSettings dialogSettings = SkynetGuiPlugin.getInstance().getDialogSettings();
+ if (dialogSettings != null) {
+
+ List<String> filterString = new ArrayList<String>();
+ FilterModelList filterList = filterviewer.getFilterList();
+ for (FilterModel model : filterList.getFilters()) {
+ filterString.add(asString(model));
+ }
+ dialogSettings.put(SkynetGuiPlugin.PLUGIN_ID + FILTERS_STORAGE_KEY,
+ filterString.toArray(new String[filterString.size()]));
+ }
+ }
+
+ protected void loadState() {
+ IDialogSettings dialogSettings = SkynetGuiPlugin.getInstance().getDialogSettings();
+ if (dialogSettings != null) {
+ String[] filters = dialogSettings.getArray(SkynetGuiPlugin.PLUGIN_ID + FILTERS_STORAGE_KEY);
+ if (filters != null) {
+ for (String entry : filters) {
+ processStoredFilter(entry);
+ }
+ }
+ }
+ }
+
+ public class SearchLabelProvider implements ILabelProvider {
+
+ public Image getImage(Object arg0) {
+ return null;
+ }
+
+ public String getText(Object arg0) {
+ return (String) arg0;
+ }
+
+ public void addListener(ILabelProviderListener arg0) {
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isLabelProperty(Object arg0, String arg1) {
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener arg0) {
+ }
+ }
+
+ public class SearchContentProvider implements IStructuredContentProvider {
+ @SuppressWarnings("unchecked")
+ public Object[] getElements(Object arg0) {
+ return ((ArrayList) arg0).toArray();
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
+ }
+ }
+
+ public class SearchSorter extends ViewerSorter {
+ @SuppressWarnings("unchecked")
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ return getComparator().compare(e1, e2);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactTypeFilter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactTypeFilter.java
index 8e15ed8ea90..5df89333fd8 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactTypeFilter.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactTypeFilter.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.search;
-
-import static org.eclipse.osee.framework.skynet.core.artifact.search.DeprecatedOperator.EQUAL;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactTypeSearch;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ISearchPrimitive;
-import org.eclipse.osee.framework.skynet.core.artifact.search.NotSearch;
-import org.eclipse.osee.framework.ui.skynet.search.filter.FilterTableViewer;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * @author Ryan D. Brooks
- */
-public class ArtifactTypeFilter extends SearchFilter {
- private ListViewer searchTypeList;
-
- public ArtifactTypeFilter(Control optionsControl, ListViewer searchTypeList) {
- super("Artifact Type", optionsControl);
- this.searchTypeList = searchTypeList;
- }
-
- @Override
- public void addFilterTo(FilterTableViewer filterViewer) {
- for (String type : searchTypeList.getList().getSelection()) {
- ISearchPrimitive primitive = new ArtifactTypeSearch(type, EQUAL);
- if (not) primitive = new NotSearch(primitive);
- filterViewer.addItem(primitive, getFilterName(), type, "");
- }
- }
-
- @Override
- public boolean isValid() {
- return true;
- }
-
- @Override
- public void loadFromStorageString(FilterTableViewer filterViewer, String type, String value, String storageString, boolean isNotEnabled) {
- ISearchPrimitive primitive = ArtifactTypeSearch.getPrimitive(storageString);
- if (isNotEnabled) primitive = new NotSearch(primitive);
- filterViewer.addItem(primitive, getFilterName(), type, 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.framework.ui.skynet.search;
+
+import static org.eclipse.osee.framework.skynet.core.artifact.search.DeprecatedOperator.EQUAL;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactTypeSearch;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ISearchPrimitive;
+import org.eclipse.osee.framework.skynet.core.artifact.search.NotSearch;
+import org.eclipse.osee.framework.ui.skynet.search.filter.FilterTableViewer;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public class ArtifactTypeFilter extends SearchFilter {
+ private ListViewer searchTypeList;
+
+ public ArtifactTypeFilter(Control optionsControl, ListViewer searchTypeList) {
+ super("Artifact Type", optionsControl);
+ this.searchTypeList = searchTypeList;
+ }
+
+ @Override
+ public void addFilterTo(FilterTableViewer filterViewer) {
+ for (String type : searchTypeList.getList().getSelection()) {
+ ISearchPrimitive primitive = new ArtifactTypeSearch(type, EQUAL);
+ if (not) primitive = new NotSearch(primitive);
+ filterViewer.addItem(primitive, getFilterName(), type, "");
+ }
+ }
+
+ @Override
+ public boolean isValid() {
+ return true;
+ }
+
+ @Override
+ public void loadFromStorageString(FilterTableViewer filterViewer, String type, String value, String storageString, boolean isNotEnabled) {
+ ISearchPrimitive primitive = ArtifactTypeSearch.getPrimitive(storageString);
+ if (isNotEnabled) primitive = new NotSearch(primitive);
+ filterViewer.addItem(primitive, getFilterName(), type, value);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeFindReplaceDialog.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeFindReplaceDialog.java
index 8b1e1a46445..3582c04e2a1 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeFindReplaceDialog.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeFindReplaceDialog.java
@@ -1,231 +1,231 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.search;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-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.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-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.Attribute;
-import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * Dialog for performing find/replace of attribute values on a set of <code>Artifact</code>'s.
- *
- * @see org.eclipse.osee.framework.skynet.core.artifact.Artifact
- * @see org.eclipse.osee.framework.skynet.core.artifact.Attribute
- * @author Robert A. Fisher
- */
-public class AttributeFindReplaceDialog extends Dialog {
- private ComboViewer cmbAttributeDescriptors;
- private Text txtFindRegEx;
- private Text txtReplaceStr;
- private Branch branch;
-
- private final List<Artifact> artifacts;
-
- public AttributeFindReplaceDialog(Shell parentShell, List<Artifact> artifacts) {
- super(parentShell);
-
- this.artifacts = artifacts;
- if (artifacts != null && !artifacts.isEmpty()) {
- this.branch = artifacts.get(0).getBranch();
- }
- setShellStyle(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | getDefaultOrientation() | SWT.RESIZE);
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- getShell().setText("Find/Replace Attribute Value");
-
- Composite mainComposite = new Composite(parent, SWT.NONE);
- mainComposite.setFont(parent.getFont());
- mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- mainComposite.setLayout(new GridLayout(1, false));
-
- addDialogControls(mainComposite);
- addListeners();
- setInputs();
-
- return mainComposite;
- }
-
- @Override
- protected void createButtonsForButtonBar(Composite parent) {
- super.createButtonsForButtonBar(parent);
- checkEnabled();
- }
-
- private void setInputs() {
- try {
- Collection<AttributeType> attributeTypes = AttributeTypeManager.getValidAttributeTypes(branch);
- cmbAttributeDescriptors.setInput(attributeTypes.toArray(new AttributeType[attributeTypes.size()]));
- cmbAttributeDescriptors.getCombo().select(0);
- } catch (OseeCoreException ex) {
- cmbAttributeDescriptors.setInput(new Object[] {ex});
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
-
- private void addListeners() {
- txtFindRegEx.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- checkEnabled();
- }
- });
- }
-
- private void addDialogControls(Composite mainComposite) {
- Label label;
- label = new Label(mainComposite, SWT.LEFT);
- label.setText("Attribute Type");
- label.setToolTipText("The attribute to perform the find/replace logic against");
-
- cmbAttributeDescriptors = new ComboViewer(mainComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
- cmbAttributeDescriptors.setContentProvider(new ArrayContentProvider());
- cmbAttributeDescriptors.setLabelProvider(new ArtifactTypeLabelProvider());
- cmbAttributeDescriptors.setSorter(new ViewerSorter() {
- @SuppressWarnings("unchecked")
- @Override
- public int compare(Viewer viewer, Object e1, Object e2) {
- return getComparator().compare(((AttributeType) e1).getName(), ((AttributeType) e2).getName());
- }
- });
-
- label = new Label(mainComposite, SWT.LEFT);
- label.setText("Find (regex):");
- label.setToolTipText("The regular expression to perform matching with against the attribute value");
- txtFindRegEx = new Text(mainComposite, SWT.BORDER);
-
- label = new Label(mainComposite, SWT.LEFT);
- label.setText("Replace With:");
- label.setToolTipText("The value to put in place of the value matched by the Find regular expression");
- txtReplaceStr = new Text(mainComposite, SWT.BORDER);
-
- }
-
- private void checkEnabled() {
- boolean enable =
- cmbAttributeDescriptors.getInput() instanceof AttributeType[] && txtFindRegEx.getText().length() > 0 && !artifacts.isEmpty();
-
- getButton(IDialogConstants.OK_ID).setEnabled(enable);
- }
-
- @Override
- protected void okPressed() {
- final Pattern pattern = Pattern.compile(txtFindRegEx.getText());
- final String replaceText = txtReplaceStr.getText();
- final String attributeName =
- ((AttributeType) ((IStructuredSelection) cmbAttributeDescriptors.getSelection()).getFirstElement()).getName();
-
- Job job = new Job("Find/Replace") {
-
- @Override
- protected IStatus run(final IProgressMonitor monitor) {
- IStatus toReturn = Status.CANCEL_STATUS;
- Branch branch = artifacts.get(0).getBranch();
- try {
- monitor.beginTask("Find/Replace " + attributeName + " Attribute Value", artifacts.size());
-
- SkynetTransaction transaction = new SkynetTransaction(branch, "Attribute find replace dialog");
- for (Artifact artifact : artifacts) {
- monitor.subTask("Modifying " + artifact.getName());
- for (Attribute<?> attribute : artifact.getAttributes(attributeName)) {
- Matcher matcher = pattern.matcher(attribute.toString());
- attribute.setFromString(matcher.replaceAll(replaceText));
- }
- artifact.persist(transaction);
- monitor.worked(1);
- if (monitor.isCanceled()) {
- throw new IllegalStateException("USER_PURPLE CANCELLED");
- }
- }
-
- transaction.execute();
- toReturn = Status.OK_STATUS;
- } catch (Exception ex) {
- if (ex.getMessage().equals("USER_PURPLE CANCELLED")) {
- toReturn = Status.CANCEL_STATUS;
- } else {
- toReturn = new Status(Status.ERROR, SkynetGuiPlugin.PLUGIN_ID, Status.OK, ex.getMessage(), ex);
- }
- } finally {
- monitor.done();
- }
-
- return toReturn;
- }
- };
- Jobs.startJob(job);
- super.okPressed();
- }
- private static class ArtifactTypeLabelProvider implements ILabelProvider {
-
- public Image getImage(Object element) {
- return null;
- }
-
- public String getText(Object element) {
- if (element instanceof AttributeType) {
- return ((AttributeType) element).getName();
- } else {
- return element.toString();
- }
- }
-
- public void addListener(ILabelProviderListener listener) {
- }
-
- public void dispose() {
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return true;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.search;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+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.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+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.Attribute;
+import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * Dialog for performing find/replace of attribute values on a set of <code>Artifact</code>'s.
+ *
+ * @see org.eclipse.osee.framework.skynet.core.artifact.Artifact
+ * @see org.eclipse.osee.framework.skynet.core.artifact.Attribute
+ * @author Robert A. Fisher
+ */
+public class AttributeFindReplaceDialog extends Dialog {
+ private ComboViewer cmbAttributeDescriptors;
+ private Text txtFindRegEx;
+ private Text txtReplaceStr;
+ private Branch branch;
+
+ private final List<Artifact> artifacts;
+
+ public AttributeFindReplaceDialog(Shell parentShell, List<Artifact> artifacts) {
+ super(parentShell);
+
+ this.artifacts = artifacts;
+ if (artifacts != null && !artifacts.isEmpty()) {
+ this.branch = artifacts.get(0).getBranch();
+ }
+ setShellStyle(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | getDefaultOrientation() | SWT.RESIZE);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ getShell().setText("Find/Replace Attribute Value");
+
+ Composite mainComposite = new Composite(parent, SWT.NONE);
+ mainComposite.setFont(parent.getFont());
+ mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ mainComposite.setLayout(new GridLayout(1, false));
+
+ addDialogControls(mainComposite);
+ addListeners();
+ setInputs();
+
+ return mainComposite;
+ }
+
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ super.createButtonsForButtonBar(parent);
+ checkEnabled();
+ }
+
+ private void setInputs() {
+ try {
+ Collection<AttributeType> attributeTypes = AttributeTypeManager.getValidAttributeTypes(branch);
+ cmbAttributeDescriptors.setInput(attributeTypes.toArray(new AttributeType[attributeTypes.size()]));
+ cmbAttributeDescriptors.getCombo().select(0);
+ } catch (OseeCoreException ex) {
+ cmbAttributeDescriptors.setInput(new Object[] {ex});
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ private void addListeners() {
+ txtFindRegEx.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ checkEnabled();
+ }
+ });
+ }
+
+ private void addDialogControls(Composite mainComposite) {
+ Label label;
+ label = new Label(mainComposite, SWT.LEFT);
+ label.setText("Attribute Type");
+ label.setToolTipText("The attribute to perform the find/replace logic against");
+
+ cmbAttributeDescriptors = new ComboViewer(mainComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
+ cmbAttributeDescriptors.setContentProvider(new ArrayContentProvider());
+ cmbAttributeDescriptors.setLabelProvider(new ArtifactTypeLabelProvider());
+ cmbAttributeDescriptors.setSorter(new ViewerSorter() {
+ @SuppressWarnings("unchecked")
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ return getComparator().compare(((AttributeType) e1).getName(), ((AttributeType) e2).getName());
+ }
+ });
+
+ label = new Label(mainComposite, SWT.LEFT);
+ label.setText("Find (regex):");
+ label.setToolTipText("The regular expression to perform matching with against the attribute value");
+ txtFindRegEx = new Text(mainComposite, SWT.BORDER);
+
+ label = new Label(mainComposite, SWT.LEFT);
+ label.setText("Replace With:");
+ label.setToolTipText("The value to put in place of the value matched by the Find regular expression");
+ txtReplaceStr = new Text(mainComposite, SWT.BORDER);
+
+ }
+
+ private void checkEnabled() {
+ boolean enable =
+ cmbAttributeDescriptors.getInput() instanceof AttributeType[] && txtFindRegEx.getText().length() > 0 && !artifacts.isEmpty();
+
+ getButton(IDialogConstants.OK_ID).setEnabled(enable);
+ }
+
+ @Override
+ protected void okPressed() {
+ final Pattern pattern = Pattern.compile(txtFindRegEx.getText());
+ final String replaceText = txtReplaceStr.getText();
+ final String attributeName =
+ ((AttributeType) ((IStructuredSelection) cmbAttributeDescriptors.getSelection()).getFirstElement()).getName();
+
+ Job job = new Job("Find/Replace") {
+
+ @Override
+ protected IStatus run(final IProgressMonitor monitor) {
+ IStatus toReturn = Status.CANCEL_STATUS;
+ Branch branch = artifacts.get(0).getBranch();
+ try {
+ monitor.beginTask("Find/Replace " + attributeName + " Attribute Value", artifacts.size());
+
+ SkynetTransaction transaction = new SkynetTransaction(branch, "Attribute find replace dialog");
+ for (Artifact artifact : artifacts) {
+ monitor.subTask("Modifying " + artifact.getName());
+ for (Attribute<?> attribute : artifact.getAttributes(attributeName)) {
+ Matcher matcher = pattern.matcher(attribute.toString());
+ attribute.setFromString(matcher.replaceAll(replaceText));
+ }
+ artifact.persist(transaction);
+ monitor.worked(1);
+ if (monitor.isCanceled()) {
+ throw new IllegalStateException("USER_PURPLE CANCELLED");
+ }
+ }
+
+ transaction.execute();
+ toReturn = Status.OK_STATUS;
+ } catch (Exception ex) {
+ if (ex.getMessage().equals("USER_PURPLE CANCELLED")) {
+ toReturn = Status.CANCEL_STATUS;
+ } else {
+ toReturn = new Status(Status.ERROR, SkynetGuiPlugin.PLUGIN_ID, Status.OK, ex.getMessage(), ex);
+ }
+ } finally {
+ monitor.done();
+ }
+
+ return toReturn;
+ }
+ };
+ Jobs.startJob(job);
+ super.okPressed();
+ }
+ private static class ArtifactTypeLabelProvider implements ILabelProvider {
+
+ public Image getImage(Object element) {
+ return null;
+ }
+
+ public String getText(Object element) {
+ if (element instanceof AttributeType) {
+ return ((AttributeType) element).getName();
+ } else {
+ return element.toString();
+ }
+ }
+
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return true;
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/FilterArtifactSearchQuery.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/FilterArtifactSearchQuery.java
index fbd81b47fb6..e616794cd5a 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/FilterArtifactSearchQuery.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/FilterArtifactSearchQuery.java
@@ -1,74 +1,74 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.search;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-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.ArtifactPersistenceManager;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ISearchPrimitive;
-import org.eclipse.osee.framework.ui.skynet.search.filter.FilterModel;
-import org.eclipse.osee.framework.ui.skynet.search.filter.FilterModelList;
-
-/**
- * @author Ryan D. Brooks
- */
-public class FilterArtifactSearchQuery extends AbstractLegacyArtifactSearchQuery {
- private final FilterModelList filterList;
- private final Branch branch;
- private String criteriaLabel = "";
-
- /**
- * @param filterList
- * @param branch
- */
- public FilterArtifactSearchQuery(FilterModelList filterList, Branch branch) {
- this.filterList = filterList;
- this.branch = branch;
- }
-
- @Override
- public Collection<Artifact> getArtifacts() throws OseeCoreException {
- boolean firstTime = true;
- List<ISearchPrimitive> criteria = new LinkedList<ISearchPrimitive>();
-
- for (FilterModel model : filterList.getFilters()) {
- criteria.add(model.getSearchPrimitive());
-
- if (!firstTime) {
- if (filterList.isAllSelected())
- criteriaLabel += " and ";
- else
- criteriaLabel += " or ";
- }
-
- criteriaLabel += model;
- firstTime = false;
- }
-
- MaxMatchCountConfirmer confirmer = new MaxMatchCountConfirmer();
- Collection<Artifact> artifacts =
- ArtifactPersistenceManager.getArtifacts(criteria, filterList.isAllSelected(), branch, confirmer);
- if (confirmer.isConfirmed()) {
- return artifacts;
- }
- return Collections.emptyList();
- }
-
- @Override
- public String getCriteriaLabel() {
- return criteriaLabel;
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.search;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+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.ArtifactPersistenceManager;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ISearchPrimitive;
+import org.eclipse.osee.framework.ui.skynet.search.filter.FilterModel;
+import org.eclipse.osee.framework.ui.skynet.search.filter.FilterModelList;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public class FilterArtifactSearchQuery extends AbstractLegacyArtifactSearchQuery {
+ private final FilterModelList filterList;
+ private final Branch branch;
+ private String criteriaLabel = "";
+
+ /**
+ * @param filterList
+ * @param branch
+ */
+ public FilterArtifactSearchQuery(FilterModelList filterList, Branch branch) {
+ this.filterList = filterList;
+ this.branch = branch;
+ }
+
+ @Override
+ public Collection<Artifact> getArtifacts() throws OseeCoreException {
+ boolean firstTime = true;
+ List<ISearchPrimitive> criteria = new LinkedList<ISearchPrimitive>();
+
+ for (FilterModel model : filterList.getFilters()) {
+ criteria.add(model.getSearchPrimitive());
+
+ if (!firstTime) {
+ if (filterList.isAllSelected())
+ criteriaLabel += " and ";
+ else
+ criteriaLabel += " or ";
+ }
+
+ criteriaLabel += model;
+ firstTime = false;
+ }
+
+ MaxMatchCountConfirmer confirmer = new MaxMatchCountConfirmer();
+ Collection<Artifact> artifacts =
+ ArtifactPersistenceManager.getArtifacts(criteria, filterList.isAllSelected(), branch, confirmer);
+ if (confirmer.isConfirmed()) {
+ return artifacts;
+ }
+ return Collections.emptyList();
+ }
+
+ @Override
+ public String getCriteriaLabel() {
+ return criteriaLabel;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/HistoricalArtifactSearchQuery.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/HistoricalArtifactSearchQuery.java
index 454c70bb435..1711c0c51fa 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/HistoricalArtifactSearchQuery.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/HistoricalArtifactSearchQuery.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.search;
-
-import java.util.Collection;
-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.search.ArtifactQuery;
-
-/**
- * @author Ryan D. Brooks
- */
-public class HistoricalArtifactSearchQuery extends AbstractLegacyArtifactSearchQuery {
- private String attributePattern;
- private final Branch branch;
-
- public HistoricalArtifactSearchQuery(String attributePattern, Branch branch) {
- this.attributePattern = attributePattern;
- this.branch = branch;
- }
-
- @Override
- public Collection<Artifact> getArtifacts() throws OseeCoreException {
- return ArtifactQuery.getArtifactListFromHistoricalAttributeValue(attributePattern, branch);
- }
-
- public String getCriteriaLabel() {
- return attributePattern;
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.search;
+
+import java.util.Collection;
+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.search.ArtifactQuery;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public class HistoricalArtifactSearchQuery extends AbstractLegacyArtifactSearchQuery {
+ private String attributePattern;
+ private final Branch branch;
+
+ public HistoricalArtifactSearchQuery(String attributePattern, Branch branch) {
+ this.attributePattern = attributePattern;
+ this.branch = branch;
+ }
+
+ @Override
+ public Collection<Artifact> getArtifacts() throws OseeCoreException {
+ return ArtifactQuery.getArtifactListFromHistoricalAttributeValue(attributePattern, branch);
+ }
+
+ public String getCriteriaLabel() {
+ return attributePattern;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/HridValueFilter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/HridValueFilter.java
index 55ec06b42c9..91a9c0a350e 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/HridValueFilter.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/HridValueFilter.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.search;
-
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactHridSearch;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ISearchPrimitive;
-import org.eclipse.osee.framework.skynet.core.artifact.search.NotSearch;
-import org.eclipse.osee.framework.ui.skynet.search.filter.FilterTableViewer;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * @author Ryan D. Brooks
- */
-public class HridValueFilter extends SearchFilter {
- private Text hridValue;
-
- public HridValueFilter(Control optionsControl, Text hridValue) {
- super("Human Readable ID", optionsControl);
- this.hridValue = hridValue;
- }
-
- @Override
- public void addFilterTo(FilterTableViewer filterViewer) {
- OperatorAndValue result = handleWildCard(hridValue.getText());
- ISearchPrimitive primitive = new ArtifactHridSearch(result.value, result.operator);
- if (not) primitive = new NotSearch(primitive);
- filterViewer.addItem(primitive, getFilterName(), "huid", result.value);
- }
-
- @Override
- public boolean isValid() {
- return !hridValue.getText().equals("");
- }
-
- @Override
- public void loadFromStorageString(FilterTableViewer filterViewer, String type, String value, String storageString, boolean isNotEnabled) {
- ISearchPrimitive primitive = ArtifactHridSearch.getPrimitive(storageString);
- if (isNotEnabled) primitive = new NotSearch(primitive);
- filterViewer.addItem(primitive, getFilterName(), type, 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.framework.ui.skynet.search;
+
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactHridSearch;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ISearchPrimitive;
+import org.eclipse.osee.framework.skynet.core.artifact.search.NotSearch;
+import org.eclipse.osee.framework.ui.skynet.search.filter.FilterTableViewer;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public class HridValueFilter extends SearchFilter {
+ private Text hridValue;
+
+ public HridValueFilter(Control optionsControl, Text hridValue) {
+ super("Human Readable ID", optionsControl);
+ this.hridValue = hridValue;
+ }
+
+ @Override
+ public void addFilterTo(FilterTableViewer filterViewer) {
+ OperatorAndValue result = handleWildCard(hridValue.getText());
+ ISearchPrimitive primitive = new ArtifactHridSearch(result.value, result.operator);
+ if (not) primitive = new NotSearch(primitive);
+ filterViewer.addItem(primitive, getFilterName(), "huid", result.value);
+ }
+
+ @Override
+ public boolean isValid() {
+ return !hridValue.getText().equals("");
+ }
+
+ @Override
+ public void loadFromStorageString(FilterTableViewer filterViewer, String type, String value, String storageString, boolean isNotEnabled) {
+ ISearchPrimitive primitive = ArtifactHridSearch.getPrimitive(storageString);
+ if (isNotEnabled) primitive = new NotSearch(primitive);
+ filterViewer.addItem(primitive, getFilterName(), type, value);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/IdArtifactSearch.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/IdArtifactSearch.java
index c0b639590bd..0c046f5d9b7 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/IdArtifactSearch.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/IdArtifactSearch.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.search;
-
-import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.INCLUDE_DELETED;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-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.DeletionFlag;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-
-/**
- * @author Roberto E. Escobar
- */
-final class IdArtifactSearch extends AbstractLegacyArtifactSearchQuery {
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.search;
+
+import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.INCLUDE_DELETED;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+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.DeletionFlag;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+
+/**
+ * @author Roberto E. Escobar
+ */
+final class IdArtifactSearch extends AbstractLegacyArtifactSearchQuery {
private final List<String> idsToSearch;
private final Branch branchToSearch;
private final DeletionFlag allowDeleted;
-
+
IdArtifactSearch(String searchString, Branch branchToSearch, DeletionFlag allowDeleted) {
- super();
- this.idsToSearch = new ArrayList<String>();
- this.branchToSearch = branchToSearch;
- this.allowDeleted = allowDeleted;
-
- this.idsToSearch.addAll(Arrays.asList(searchString.split("[\\s,]+")));
- }
-
- @Override
- public Collection<Artifact> getArtifacts() throws Exception {
- return ArtifactQuery.getArtifactListFromIds(idsToSearch, branchToSearch, allowDeleted);
- }
-
- @Override
- public String getCriteriaLabel() {
+ super();
+ this.idsToSearch = new ArrayList<String>();
+ this.branchToSearch = branchToSearch;
+ this.allowDeleted = allowDeleted;
+
+ this.idsToSearch.addAll(Arrays.asList(searchString.split("[\\s,]+")));
+ }
+
+ @Override
+ public Collection<Artifact> getArtifacts() throws Exception {
+ return ArtifactQuery.getArtifactListFromIds(idsToSearch, branchToSearch, allowDeleted);
+ }
+
+ @Override
+ public String getCriteriaLabel() {
return String.format("%s%s", idsToSearch.toString(),
allowDeleted == INCLUDE_DELETED ? " - Options:[Include Deleted]" : "");
- }
-}
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/MaxMatchCountConfirmer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/MaxMatchCountConfirmer.java
index b75adfc11b3..f7a57ff50c2 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/MaxMatchCountConfirmer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/MaxMatchCountConfirmer.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.framework.ui.skynet.search;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.osee.framework.jdk.core.type.MutableBoolean;
-import org.eclipse.osee.framework.skynet.core.artifact.ISearchConfirmer;
-import org.eclipse.osee.framework.ui.swt.Displays;
-
-/**
- * @author Ryan D. Brooks
- */
-public class MaxMatchCountConfirmer implements ISearchConfirmer {
- private static final int MAX_RESULTS = 2000;
- final MutableBoolean result = new MutableBoolean(false);
-
- public boolean canProceed(final int count) {
- if (count < MAX_RESULTS) {
- result.setValue(true);
- } else {
- Displays.pendInDisplayThread(new Runnable() {
- @Override
- public void run() {
- result.setValue(MessageDialog.openConfirm(Displays.getActiveShell(), "Confirm Search",
- "The search returned " + count + " results and may take a long time to load, continue?"));
- }
- });
- }
- return result.getValue();
- }
-
- public boolean isConfirmed() {
- return result.getValue();
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.search;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osee.framework.jdk.core.type.MutableBoolean;
+import org.eclipse.osee.framework.skynet.core.artifact.ISearchConfirmer;
+import org.eclipse.osee.framework.ui.swt.Displays;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public class MaxMatchCountConfirmer implements ISearchConfirmer {
+ private static final int MAX_RESULTS = 2000;
+ final MutableBoolean result = new MutableBoolean(false);
+
+ public boolean canProceed(final int count) {
+ if (count < MAX_RESULTS) {
+ result.setValue(true);
+ } else {
+ Displays.pendInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ result.setValue(MessageDialog.openConfirm(Displays.getActiveShell(), "Confirm Search",
+ "The search returned " + count + " results and may take a long time to load, continue?"));
+ }
+ });
+ }
+ return result.getValue();
+ }
+
+ public boolean isConfirmed() {
+ return result.getValue();
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/QuickSearchOptionComposite.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/QuickSearchOptionComposite.java
index ac7437514cb..b2185ad9513 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/QuickSearchOptionComposite.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/QuickSearchOptionComposite.java
@@ -1,548 +1,548 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.search;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.logging.Level;
-import org.apache.commons.lang.StringUtils;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osee.framework.core.data.IAttributeType;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.widgets.dialog.AttributeTypeFilteredCheckTreeDialog;
-import org.eclipse.osee.framework.ui.swt.ALayout;
-import org.eclipse.osee.framework.ui.swt.HidingComposite;
-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.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IMemento;
-
-/**
- * @author Roberto E. Escobar
- */
-public class QuickSearchOptionComposite extends Composite {
- private static final String CONFIG_BUTTON_TOOLTIP = "Select to configure option.";
-
- private static final String OPTIONS_KEY_ID = "searchOption";
- private static final String OPTION_CONFIGS_KEY_ID = "optionConfigs";
- private static final String ENTRY_SEPARATOR = "##";
-
- private Group optionGroup;
- private final Map<String, Button> optionsButtons;
- private final Map<String, Text> textAreas;
- private final Map<String, Boolean> optionsMap;
-
- private final Set<String> mutuallyExclusiveOptionSet;
- private final Map<String, IOptionConfigurationHandler<?>> configurableOptionSet;
- private Composite wordOrderComposite;
-
- public QuickSearchOptionComposite(Composite parent, int style) {
- super(parent, style);
- this.optionsButtons = new LinkedHashMap<String, Button>();
- this.textAreas = new HashMap<String, Text>();
- this.optionsMap = new LinkedHashMap<String, Boolean>();
- this.mutuallyExclusiveOptionSet = new HashSet<String>();
- this.configurableOptionSet = new HashMap<String, IOptionConfigurationHandler<?>>();
-
- for (String option : SearchOption.asLabels()) {
- this.optionsMap.put(option, false);
- }
- for (String option : SearchOption.getMutuallyExclusiveOptions()) {
- this.optionsMap.put(option, false);
- this.mutuallyExclusiveOptionSet.add(option);
- }
- for (String option : SearchOption.getConfigurableOptions().keySet()) {
- this.optionsMap.put(option, false);
- this.configurableOptionSet.put(option, SearchOption.getConfigurableOptions().get(option));
- }
- createControl(this);
- }
-
- private void createControl(Composite parent) {
- this.optionGroup = new Group(parent, SWT.NONE);
- this.optionGroup.setLayout(new GridLayout());
- this.optionGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- this.optionGroup.setText("Options");
-
- initializeOptions(optionsMap);
-
- for (SearchOption option : SearchOption.values()) {
- setHelpContextForOption(option.asLabel(), option.getHelpContext());
- setToolTipForOption(option.asLabel(), option.getToolTip());
- }
-
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(ALayout.getZeroMarginLayout());
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- }
-
- public boolean isOptionSelected(String key) {
- Boolean value = optionsMap.get(key);
- return value != null ? value.booleanValue() : false;
- }
-
- public IOptionConfigurationHandler<?> getConfiguration(String key) {
- return this.configurableOptionSet.get(key);
- }
-
- private void initializeOptions(Map<String, Boolean> options) {
- for (String option : options.keySet()) {
- Boolean isSelected = options.get(option);
- Button button = getOrCreateOptionsButton(option);
- button.setSelection(isSelected);
- this.optionsMap.put(option, isSelected);
- }
- updateMatchWordOrderOptions();
- }
-
- private void updateMatchWordOrderOptions() {
- boolean setEnabled = isMatchWordOrderEnabled();
- if (Widgets.isAccessible(wordOrderComposite)) {
- wordOrderComposite.setVisible(setEnabled);
- wordOrderComposite.setEnabled(setEnabled);
- if (!setEnabled) {
- optionsMap.put(SearchOption.Case_Sensitive.asLabel(), setEnabled);
- optionsMap.put(SearchOption.All_Match_Locations.asLabel(), setEnabled);
- } else {
- optionsMap.put(SearchOption.Case_Sensitive.asLabel(),
- optionsButtons.get(SearchOption.Case_Sensitive.asLabel()).getSelection());
- optionsMap.put(SearchOption.All_Match_Locations.asLabel(),
- optionsButtons.get(SearchOption.All_Match_Locations.asLabel()).getSelection());
- }
- optionGroup.getParent().layout();
- }
- }
-
- private Button getOrCreateOptionsButton(String option) {
- Button toReturn = this.optionsButtons.get(option);
- if (toReturn == null) {
- toReturn = createButton(this.optionGroup, option);
- this.optionsButtons.put(option, toReturn);
- }
- return toReturn;
- }
-
- private Button createButton(Composite parent, String option) {
- final IOptionConfigurationHandler<?> configHandler = configurableOptionSet.get(option);
- Composite mainComposite = parent;
- if (configHandler != null) {
- mainComposite = new Composite(parent, SWT.NONE);
- mainComposite.setLayout(ALayout.getZeroMarginLayout(4, false));
- mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- } else if (option.equals(SearchOption.All_Match_Locations.asLabel()) || option.equals(SearchOption.Case_Sensitive.asLabel())) {
- if (wordOrderComposite == null) {
- wordOrderComposite = new HidingComposite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginLeft = 15;
- wordOrderComposite.setLayout(layout);
- wordOrderComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- }
- mainComposite = wordOrderComposite;
- }
-
- Button toReturn = new Button(mainComposite, SWT.CHECK);
- toReturn.setData(option);
- toReturn.setFont(getFont());
- toReturn.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- Object object = e.getSource();
- if (object instanceof Button) {
- Button button = (Button) object;
- if (mutuallyExclusiveOptionSet.contains(button.getData())) {
- if (button.getSelection()) {
- for (String entry : mutuallyExclusiveOptionSet) {
- Button other = optionsButtons.get(entry);
- if (!other.equals(button)) {
- other.setSelection(false);
- }
- optionsMap.put((String) other.getData(), other.getSelection());
- }
- }
- }
- optionsMap.put((String) button.getData(), button.getSelection());
-
- Object data = button.getData();
- boolean selection = optionsMap.get(SearchOption.By_Id.asLabel()).booleanValue();
- if (data.equals(SearchOption.By_Id.asLabel()) && selection) {
- optionsMap.put(SearchOption.Match_Word_Order.asLabel(), false);
- optionsButtons.get(SearchOption.Match_Word_Order.asLabel()).setSelection(false);
- } else if (data.equals(SearchOption.Match_Word_Order.asLabel()) && selection) {
- optionsMap.put(SearchOption.By_Id.asLabel(), false);
- optionsButtons.get(SearchOption.By_Id.asLabel()).setSelection(false);
- }
- updateMatchWordOrderOptions();
- }
- }
- });
-
- if (configHandler != null) {
- Label label = new Label(mainComposite, SWT.NONE);
- label.setText(option + ":");
-
- final Text text = new Text(mainComposite, SWT.READ_ONLY | SWT.BORDER);
- text.setText(configHandler.toString());
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
- data.minimumWidth = 100;
- text.setLayoutData(data);
- textAreas.put(option, text);
-
- Button filterConfig = new Button(mainComposite, SWT.PUSH);
- String configToolTip = configHandler.getConfigToolTip();
- filterConfig.setToolTipText(Strings.isValid(configToolTip) ? configToolTip : CONFIG_BUTTON_TOOLTIP);
- filterConfig.setImage(ImageManager.getImage(FrameworkImage.GEAR));
- filterConfig.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (configHandler != null) {
- configHandler.configure();
- text.setText(configHandler.toString());
- }
- }
- });
- } else {
- toReturn.setText(option);
- }
- return toReturn;
- }
-
- public boolean isSearchByIdEnabled() {
- return isOptionSelected(SearchOption.By_Id.asLabel());
- }
-
- public boolean isIncludeDeletedEnabled() {
- return isOptionSelected(SearchOption.Include_Deleted.asLabel());
- }
-
- public boolean isMatchWordOrderEnabled() {
- return isOptionSelected(SearchOption.Match_Word_Order.asLabel());
- }
-
- public boolean isMatchAllLocationsEnabled() {
- return isOptionSelected(SearchOption.All_Match_Locations.asLabel());
- }
-
- public boolean isCaseSensitiveEnabled() {
- return isOptionSelected(SearchOption.Case_Sensitive.asLabel());
- }
-
- public boolean isAttributeTypeFilterEnabled() {
- return isOptionSelected(SearchOption.Attribute_Type_Filter.asLabel());
- }
-
- public IAttributeType[] getAttributeTypeFilter() {
- IOptionConfigurationHandler<?> handler = getConfiguration(SearchOption.Attribute_Type_Filter.asLabel());
- IAttributeType[] types = (IAttributeType[]) handler.getConfigData();
- return isAttributeTypeFilterEnabled() ? types : new IAttributeType[0];
- }
-
- public void saveState(IMemento memento) {
- for (String option : optionsMap.keySet()) {
- memento.putString(OPTIONS_KEY_ID + option.replaceAll(" ", "_"), optionsMap.get(option).toString());
- }
-
- for (Entry<String, IOptionConfigurationHandler<?>> entry : configurableOptionSet.entrySet()) {
- IOptionConfigurationHandler<?> handler = entry.getValue();
- String[] config = handler.toStore();
- if (config != null && config.length > 0) {
- memento.putString(OPTION_CONFIGS_KEY_ID + entry.getKey().replaceAll(" ", "_"),
- StringUtils.join(config, ENTRY_SEPARATOR));
- }
- }
- }
-
- public void loadState(IMemento memento) {
- Map<String, String[]> configs = new HashMap<String, String[]>();
- Map<String, Boolean> options = new HashMap<String, Boolean>();
-
- for (SearchOption option : SearchOption.values()) {
- options.put(option.asLabel(), new Boolean(memento.getString(OPTIONS_KEY_ID + option.name())));
-
- if (option.isConfigurable()) {
- String configuration = memento.getString(OPTION_CONFIGS_KEY_ID + option.name());
- if (Strings.isValid(configuration)) {
- String[] values = configuration.split(ENTRY_SEPARATOR);
- configs.put(option.asLabel(), values);
- }
- }
- }
- initializeOptions(options);
- initializeConfigurations(configs);
- }
-
- private void initializeConfigurations(Map<String, String[]> items) {
- for (String key : items.keySet()) {
- IOptionConfigurationHandler<?> handler = configurableOptionSet.get(key);
- if (handler != null) {
- handler.loadFrom(items.get(key));
- Text text = textAreas.get(key);
- if (text != null) {
- text.setText(handler.toString());
- }
- }
- }
- }
-
- private void setHelpContextForOption(String optionId, String helpContext) {
- Control control = getOrCreateOptionsButton(optionId);
- if (Widgets.isAccessible(control)) {
- SkynetGuiPlugin.getInstance().setHelp(control, helpContext, "org.eclipse.osee.framework.help.ui");
- }
- }
-
- private void setToolTipForOption(String optionId, String toolTip) {
- Control control = getOrCreateOptionsButton(optionId);
- if (Widgets.isAccessible(control)) {
- control.setToolTipText(toolTip);
- }
- }
-
- private interface IOptionConfigurationHandler<T> {
-
- public void loadFrom(String[] strings);
-
- public String[] toStore();
-
- public String toString();
-
- public void configure();
-
- public T[] getConfigData();
-
- public String getConfigToolTip();
-
- }
-
- private enum SearchOption {
- Attribute_Type_Filter("quick_search_attribute_type_filter", "When selected, searches only through the artifact's containing the selected attribute types.", true, new AttributeTypeFilterConfigHandler()),
- By_Id("quick_search_by_id_option", "When selected, searches by GUID(s) or HRID(s). Accepts comma or space separated ids.", true),
- Include_Deleted("quick_search_deleted_option", "When selected, does not filter out deleted artifacts from search results.", false),
- Match_Word_Order("quick_search_word_order_option", "When selected, search will match query word order.", false),
- All_Match_Locations("quick_search_all_match_locations_option", "When selected, returns all match locations. NOTE: If the search matches many artifacts, performance may be slow.", false),
- Case_Sensitive("quick_search_case_sensitive_option", "When selected, performs a case sensitive search. NOTE: This is only applicable if match word order is also selected.", false);
-
- private static String[] labels = null;
- private static String[] mutuallyExclusive = null;
- private static Map<String, IOptionConfigurationHandler<?>> configurable = null;
- private final String helpContext;
- private final String toolTip;
- private final boolean isRadio;
- private final IOptionConfigurationHandler<?> configHandler;
-
- SearchOption(String helpContext, String toolTip, boolean isRadio) {
- this(helpContext, toolTip, isRadio, null);
- }
-
- SearchOption(String helpContext, String toolTip, boolean isRadio, IOptionConfigurationHandler<?> configHandler) {
- this.helpContext = "";
- this.toolTip = toolTip;
- this.isRadio = isRadio;
- this.configHandler = configHandler;
- }
-
- public String asLabel() {
- return name().replaceAll("_", " ");
- }
-
- public String getHelpContext() {
- return helpContext;
- }
-
- public String getToolTip() {
- return toolTip;
- }
-
- public boolean isConfigurable() {
- return configHandler != null;
- }
-
- public IOptionConfigurationHandler<?> getConfigHandler() {
- return configHandler;
- }
-
- public static String[] getMutuallyExclusiveOptions() {
- if (mutuallyExclusive == null) {
- List<String> exclusiveOptions = new ArrayList<String>();
- for (SearchOption option : SearchOption.values()) {
- if (option.isRadio) {
- exclusiveOptions.add(option.asLabel());
- }
- }
- mutuallyExclusive = exclusiveOptions.toArray(new String[exclusiveOptions.size()]);
- }
- return mutuallyExclusive;
- }
-
- public static Map<String, IOptionConfigurationHandler<?>> getConfigurableOptions() {
- if (configurable == null) {
- configurable = new HashMap<String, IOptionConfigurationHandler<?>>();
- for (SearchOption option : SearchOption.values()) {
- if (option.isConfigurable()) {
- configurable.put(option.asLabel(), option.getConfigHandler());
- }
- }
- }
- return configurable;
- }
-
- public static String[] asLabels() {
- if (labels == null) {
- SearchOption[] options = SearchOption.values();
- labels = new String[options.length];
- for (int index = 0; index < options.length; index++) {
- labels[index] = options[index].asLabel();
- }
- }
- return labels;
- }
- }
-
- private final static class AttributeTypeComparator implements Comparator<IAttributeType> {
-
- @Override
- public int compare(IAttributeType o1, IAttributeType o2) {
- return o1.getName().compareTo(o2.getName());
- }
-
- }
- private final static class AttributeTypeFilterConfigHandler implements IOptionConfigurationHandler<IAttributeType> {
- private final List<IAttributeType> configuration;
- private final Comparator<IAttributeType> attrTypeComparator;
-
- public AttributeTypeFilterConfigHandler() {
- this.attrTypeComparator = new AttributeTypeComparator();
- this.configuration = new ArrayList<IAttributeType>();
- this.configuration.add(getDefault());
- }
-
- @Override
- public void configure() {
- try {
- Collection<AttributeType> taggableItems = AttributeTypeManager.getTaggableTypes();
- AttributeTypeFilteredCheckTreeDialog dialog =
- new AttributeTypeFilteredCheckTreeDialog("Attribute Type Filter Selection",
- "Select attribute types to search in.");
- dialog.setSelectableTypes(taggableItems);
-
- List<AttributeType> selectedElements = new ArrayList<AttributeType>();
- for (AttributeType type : taggableItems) {
- if (configuration.contains(type)) {
- selectedElements.add(type);
- }
- }
- dialog.setInitialSelections(selectedElements);
-
- int result = dialog.open();
- if (result == Window.OK) {
- configuration.clear();
- Collection<AttributeType> results = dialog.getChecked();
- for (AttributeType selected : results) {
- configuration.add(selected);
- }
- if (configuration.isEmpty()) {
- configuration.add(getDefault());
- }
- }
- Collections.sort(configuration, attrTypeComparator);
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
-
- @Override
- public String getConfigToolTip() {
- return "Select to configure attribute type filter.";
- }
-
- @Override
- public IAttributeType[] getConfigData() {
- if (configuration.isEmpty()) {
- configuration.add(getDefault());
- }
- return configuration.toArray(new IAttributeType[configuration.size()]);
- }
-
- public IAttributeType getDefault() {
- return CoreAttributeTypes.NAME;
- }
-
- @Override
- public void loadFrom(String[] items) {
- if (items != null && items.length > 0) {
- configuration.clear();
- for (String entry : items) {
- try {
- AttributeType type = AttributeTypeManager.getTypeByGuid(entry);
- configuration.add(type);
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- }
- if (configuration.isEmpty()) {
- configuration.add(getDefault());
- }
- }
-
- @Override
- public String toString() {
- Collection<AttributeType> taggableItems;
- try {
- taggableItems = AttributeTypeManager.getTaggableTypes();
- if (taggableItems.size() == configuration.size()) {
- return "All";
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- return StringUtils.join(configuration, ", ");
- }
-
- @Override
- public String[] toStore() {
- String[] guids = new String[configuration.size()];
- int index = 0;
- for (IAttributeType type : configuration) {
- guids[index++] = type.getGuid();
- }
- return guids;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.search;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.logging.Level;
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.jface.window.Window;
+import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.AttributeTypeFilteredCheckTreeDialog;
+import org.eclipse.osee.framework.ui.swt.ALayout;
+import org.eclipse.osee.framework.ui.swt.HidingComposite;
+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.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IMemento;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class QuickSearchOptionComposite extends Composite {
+ private static final String CONFIG_BUTTON_TOOLTIP = "Select to configure option.";
+
+ private static final String OPTIONS_KEY_ID = "searchOption";
+ private static final String OPTION_CONFIGS_KEY_ID = "optionConfigs";
+ private static final String ENTRY_SEPARATOR = "##";
+
+ private Group optionGroup;
+ private final Map<String, Button> optionsButtons;
+ private final Map<String, Text> textAreas;
+ private final Map<String, Boolean> optionsMap;
+
+ private final Set<String> mutuallyExclusiveOptionSet;
+ private final Map<String, IOptionConfigurationHandler<?>> configurableOptionSet;
+ private Composite wordOrderComposite;
+
+ public QuickSearchOptionComposite(Composite parent, int style) {
+ super(parent, style);
+ this.optionsButtons = new LinkedHashMap<String, Button>();
+ this.textAreas = new HashMap<String, Text>();
+ this.optionsMap = new LinkedHashMap<String, Boolean>();
+ this.mutuallyExclusiveOptionSet = new HashSet<String>();
+ this.configurableOptionSet = new HashMap<String, IOptionConfigurationHandler<?>>();
+
+ for (String option : SearchOption.asLabels()) {
+ this.optionsMap.put(option, false);
+ }
+ for (String option : SearchOption.getMutuallyExclusiveOptions()) {
+ this.optionsMap.put(option, false);
+ this.mutuallyExclusiveOptionSet.add(option);
+ }
+ for (String option : SearchOption.getConfigurableOptions().keySet()) {
+ this.optionsMap.put(option, false);
+ this.configurableOptionSet.put(option, SearchOption.getConfigurableOptions().get(option));
+ }
+ createControl(this);
+ }
+
+ private void createControl(Composite parent) {
+ this.optionGroup = new Group(parent, SWT.NONE);
+ this.optionGroup.setLayout(new GridLayout());
+ this.optionGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ this.optionGroup.setText("Options");
+
+ initializeOptions(optionsMap);
+
+ for (SearchOption option : SearchOption.values()) {
+ setHelpContextForOption(option.asLabel(), option.getHelpContext());
+ setToolTipForOption(option.asLabel(), option.getToolTip());
+ }
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(ALayout.getZeroMarginLayout());
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ }
+
+ public boolean isOptionSelected(String key) {
+ Boolean value = optionsMap.get(key);
+ return value != null ? value.booleanValue() : false;
+ }
+
+ public IOptionConfigurationHandler<?> getConfiguration(String key) {
+ return this.configurableOptionSet.get(key);
+ }
+
+ private void initializeOptions(Map<String, Boolean> options) {
+ for (String option : options.keySet()) {
+ Boolean isSelected = options.get(option);
+ Button button = getOrCreateOptionsButton(option);
+ button.setSelection(isSelected);
+ this.optionsMap.put(option, isSelected);
+ }
+ updateMatchWordOrderOptions();
+ }
+
+ private void updateMatchWordOrderOptions() {
+ boolean setEnabled = isMatchWordOrderEnabled();
+ if (Widgets.isAccessible(wordOrderComposite)) {
+ wordOrderComposite.setVisible(setEnabled);
+ wordOrderComposite.setEnabled(setEnabled);
+ if (!setEnabled) {
+ optionsMap.put(SearchOption.Case_Sensitive.asLabel(), setEnabled);
+ optionsMap.put(SearchOption.All_Match_Locations.asLabel(), setEnabled);
+ } else {
+ optionsMap.put(SearchOption.Case_Sensitive.asLabel(),
+ optionsButtons.get(SearchOption.Case_Sensitive.asLabel()).getSelection());
+ optionsMap.put(SearchOption.All_Match_Locations.asLabel(),
+ optionsButtons.get(SearchOption.All_Match_Locations.asLabel()).getSelection());
+ }
+ optionGroup.getParent().layout();
+ }
+ }
+
+ private Button getOrCreateOptionsButton(String option) {
+ Button toReturn = this.optionsButtons.get(option);
+ if (toReturn == null) {
+ toReturn = createButton(this.optionGroup, option);
+ this.optionsButtons.put(option, toReturn);
+ }
+ return toReturn;
+ }
+
+ private Button createButton(Composite parent, String option) {
+ final IOptionConfigurationHandler<?> configHandler = configurableOptionSet.get(option);
+ Composite mainComposite = parent;
+ if (configHandler != null) {
+ mainComposite = new Composite(parent, SWT.NONE);
+ mainComposite.setLayout(ALayout.getZeroMarginLayout(4, false));
+ mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ } else if (option.equals(SearchOption.All_Match_Locations.asLabel()) || option.equals(SearchOption.Case_Sensitive.asLabel())) {
+ if (wordOrderComposite == null) {
+ wordOrderComposite = new HidingComposite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginLeft = 15;
+ wordOrderComposite.setLayout(layout);
+ wordOrderComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ }
+ mainComposite = wordOrderComposite;
+ }
+
+ Button toReturn = new Button(mainComposite, SWT.CHECK);
+ toReturn.setData(option);
+ toReturn.setFont(getFont());
+ toReturn.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Object object = e.getSource();
+ if (object instanceof Button) {
+ Button button = (Button) object;
+ if (mutuallyExclusiveOptionSet.contains(button.getData())) {
+ if (button.getSelection()) {
+ for (String entry : mutuallyExclusiveOptionSet) {
+ Button other = optionsButtons.get(entry);
+ if (!other.equals(button)) {
+ other.setSelection(false);
+ }
+ optionsMap.put((String) other.getData(), other.getSelection());
+ }
+ }
+ }
+ optionsMap.put((String) button.getData(), button.getSelection());
+
+ Object data = button.getData();
+ boolean selection = optionsMap.get(SearchOption.By_Id.asLabel()).booleanValue();
+ if (data.equals(SearchOption.By_Id.asLabel()) && selection) {
+ optionsMap.put(SearchOption.Match_Word_Order.asLabel(), false);
+ optionsButtons.get(SearchOption.Match_Word_Order.asLabel()).setSelection(false);
+ } else if (data.equals(SearchOption.Match_Word_Order.asLabel()) && selection) {
+ optionsMap.put(SearchOption.By_Id.asLabel(), false);
+ optionsButtons.get(SearchOption.By_Id.asLabel()).setSelection(false);
+ }
+ updateMatchWordOrderOptions();
+ }
+ }
+ });
+
+ if (configHandler != null) {
+ Label label = new Label(mainComposite, SWT.NONE);
+ label.setText(option + ":");
+
+ final Text text = new Text(mainComposite, SWT.READ_ONLY | SWT.BORDER);
+ text.setText(configHandler.toString());
+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
+ data.minimumWidth = 100;
+ text.setLayoutData(data);
+ textAreas.put(option, text);
+
+ Button filterConfig = new Button(mainComposite, SWT.PUSH);
+ String configToolTip = configHandler.getConfigToolTip();
+ filterConfig.setToolTipText(Strings.isValid(configToolTip) ? configToolTip : CONFIG_BUTTON_TOOLTIP);
+ filterConfig.setImage(ImageManager.getImage(FrameworkImage.GEAR));
+ filterConfig.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (configHandler != null) {
+ configHandler.configure();
+ text.setText(configHandler.toString());
+ }
+ }
+ });
+ } else {
+ toReturn.setText(option);
+ }
+ return toReturn;
+ }
+
+ public boolean isSearchByIdEnabled() {
+ return isOptionSelected(SearchOption.By_Id.asLabel());
+ }
+
+ public boolean isIncludeDeletedEnabled() {
+ return isOptionSelected(SearchOption.Include_Deleted.asLabel());
+ }
+
+ public boolean isMatchWordOrderEnabled() {
+ return isOptionSelected(SearchOption.Match_Word_Order.asLabel());
+ }
+
+ public boolean isMatchAllLocationsEnabled() {
+ return isOptionSelected(SearchOption.All_Match_Locations.asLabel());
+ }
+
+ public boolean isCaseSensitiveEnabled() {
+ return isOptionSelected(SearchOption.Case_Sensitive.asLabel());
+ }
+
+ public boolean isAttributeTypeFilterEnabled() {
+ return isOptionSelected(SearchOption.Attribute_Type_Filter.asLabel());
+ }
+
+ public IAttributeType[] getAttributeTypeFilter() {
+ IOptionConfigurationHandler<?> handler = getConfiguration(SearchOption.Attribute_Type_Filter.asLabel());
+ IAttributeType[] types = (IAttributeType[]) handler.getConfigData();
+ return isAttributeTypeFilterEnabled() ? types : new IAttributeType[0];
+ }
+
+ public void saveState(IMemento memento) {
+ for (String option : optionsMap.keySet()) {
+ memento.putString(OPTIONS_KEY_ID + option.replaceAll(" ", "_"), optionsMap.get(option).toString());
+ }
+
+ for (Entry<String, IOptionConfigurationHandler<?>> entry : configurableOptionSet.entrySet()) {
+ IOptionConfigurationHandler<?> handler = entry.getValue();
+ String[] config = handler.toStore();
+ if (config != null && config.length > 0) {
+ memento.putString(OPTION_CONFIGS_KEY_ID + entry.getKey().replaceAll(" ", "_"),
+ StringUtils.join(config, ENTRY_SEPARATOR));
+ }
+ }
+ }
+
+ public void loadState(IMemento memento) {
+ Map<String, String[]> configs = new HashMap<String, String[]>();
+ Map<String, Boolean> options = new HashMap<String, Boolean>();
+
+ for (SearchOption option : SearchOption.values()) {
+ options.put(option.asLabel(), new Boolean(memento.getString(OPTIONS_KEY_ID + option.name())));
+
+ if (option.isConfigurable()) {
+ String configuration = memento.getString(OPTION_CONFIGS_KEY_ID + option.name());
+ if (Strings.isValid(configuration)) {
+ String[] values = configuration.split(ENTRY_SEPARATOR);
+ configs.put(option.asLabel(), values);
+ }
+ }
+ }
+ initializeOptions(options);
+ initializeConfigurations(configs);
+ }
+
+ private void initializeConfigurations(Map<String, String[]> items) {
+ for (String key : items.keySet()) {
+ IOptionConfigurationHandler<?> handler = configurableOptionSet.get(key);
+ if (handler != null) {
+ handler.loadFrom(items.get(key));
+ Text text = textAreas.get(key);
+ if (text != null) {
+ text.setText(handler.toString());
+ }
+ }
+ }
+ }
+
+ private void setHelpContextForOption(String optionId, String helpContext) {
+ Control control = getOrCreateOptionsButton(optionId);
+ if (Widgets.isAccessible(control)) {
+ SkynetGuiPlugin.getInstance().setHelp(control, helpContext, "org.eclipse.osee.framework.help.ui");
+ }
+ }
+
+ private void setToolTipForOption(String optionId, String toolTip) {
+ Control control = getOrCreateOptionsButton(optionId);
+ if (Widgets.isAccessible(control)) {
+ control.setToolTipText(toolTip);
+ }
+ }
+
+ private interface IOptionConfigurationHandler<T> {
+
+ public void loadFrom(String[] strings);
+
+ public String[] toStore();
+
+ public String toString();
+
+ public void configure();
+
+ public T[] getConfigData();
+
+ public String getConfigToolTip();
+
+ }
+
+ private enum SearchOption {
+ Attribute_Type_Filter("quick_search_attribute_type_filter", "When selected, searches only through the artifact's containing the selected attribute types.", true, new AttributeTypeFilterConfigHandler()),
+ By_Id("quick_search_by_id_option", "When selected, searches by GUID(s) or HRID(s). Accepts comma or space separated ids.", true),
+ Include_Deleted("quick_search_deleted_option", "When selected, does not filter out deleted artifacts from search results.", false),
+ Match_Word_Order("quick_search_word_order_option", "When selected, search will match query word order.", false),
+ All_Match_Locations("quick_search_all_match_locations_option", "When selected, returns all match locations. NOTE: If the search matches many artifacts, performance may be slow.", false),
+ Case_Sensitive("quick_search_case_sensitive_option", "When selected, performs a case sensitive search. NOTE: This is only applicable if match word order is also selected.", false);
+
+ private static String[] labels = null;
+ private static String[] mutuallyExclusive = null;
+ private static Map<String, IOptionConfigurationHandler<?>> configurable = null;
+ private final String helpContext;
+ private final String toolTip;
+ private final boolean isRadio;
+ private final IOptionConfigurationHandler<?> configHandler;
+
+ SearchOption(String helpContext, String toolTip, boolean isRadio) {
+ this(helpContext, toolTip, isRadio, null);
+ }
+
+ SearchOption(String helpContext, String toolTip, boolean isRadio, IOptionConfigurationHandler<?> configHandler) {
+ this.helpContext = "";
+ this.toolTip = toolTip;
+ this.isRadio = isRadio;
+ this.configHandler = configHandler;
+ }
+
+ public String asLabel() {
+ return name().replaceAll("_", " ");
+ }
+
+ public String getHelpContext() {
+ return helpContext;
+ }
+
+ public String getToolTip() {
+ return toolTip;
+ }
+
+ public boolean isConfigurable() {
+ return configHandler != null;
+ }
+
+ public IOptionConfigurationHandler<?> getConfigHandler() {
+ return configHandler;
+ }
+
+ public static String[] getMutuallyExclusiveOptions() {
+ if (mutuallyExclusive == null) {
+ List<String> exclusiveOptions = new ArrayList<String>();
+ for (SearchOption option : SearchOption.values()) {
+ if (option.isRadio) {
+ exclusiveOptions.add(option.asLabel());
+ }
+ }
+ mutuallyExclusive = exclusiveOptions.toArray(new String[exclusiveOptions.size()]);
+ }
+ return mutuallyExclusive;
+ }
+
+ public static Map<String, IOptionConfigurationHandler<?>> getConfigurableOptions() {
+ if (configurable == null) {
+ configurable = new HashMap<String, IOptionConfigurationHandler<?>>();
+ for (SearchOption option : SearchOption.values()) {
+ if (option.isConfigurable()) {
+ configurable.put(option.asLabel(), option.getConfigHandler());
+ }
+ }
+ }
+ return configurable;
+ }
+
+ public static String[] asLabels() {
+ if (labels == null) {
+ SearchOption[] options = SearchOption.values();
+ labels = new String[options.length];
+ for (int index = 0; index < options.length; index++) {
+ labels[index] = options[index].asLabel();
+ }
+ }
+ return labels;
+ }
+ }
+
+ private final static class AttributeTypeComparator implements Comparator<IAttributeType> {
+
+ @Override
+ public int compare(IAttributeType o1, IAttributeType o2) {
+ return o1.getName().compareTo(o2.getName());
+ }
+
+ }
+ private final static class AttributeTypeFilterConfigHandler implements IOptionConfigurationHandler<IAttributeType> {
+ private final List<IAttributeType> configuration;
+ private final Comparator<IAttributeType> attrTypeComparator;
+
+ public AttributeTypeFilterConfigHandler() {
+ this.attrTypeComparator = new AttributeTypeComparator();
+ this.configuration = new ArrayList<IAttributeType>();
+ this.configuration.add(getDefault());
+ }
+
+ @Override
+ public void configure() {
+ try {
+ Collection<AttributeType> taggableItems = AttributeTypeManager.getTaggableTypes();
+ AttributeTypeFilteredCheckTreeDialog dialog =
+ new AttributeTypeFilteredCheckTreeDialog("Attribute Type Filter Selection",
+ "Select attribute types to search in.");
+ dialog.setSelectableTypes(taggableItems);
+
+ List<AttributeType> selectedElements = new ArrayList<AttributeType>();
+ for (AttributeType type : taggableItems) {
+ if (configuration.contains(type)) {
+ selectedElements.add(type);
+ }
+ }
+ dialog.setInitialSelections(selectedElements);
+
+ int result = dialog.open();
+ if (result == Window.OK) {
+ configuration.clear();
+ Collection<AttributeType> results = dialog.getChecked();
+ for (AttributeType selected : results) {
+ configuration.add(selected);
+ }
+ if (configuration.isEmpty()) {
+ configuration.add(getDefault());
+ }
+ }
+ Collections.sort(configuration, attrTypeComparator);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ @Override
+ public String getConfigToolTip() {
+ return "Select to configure attribute type filter.";
+ }
+
+ @Override
+ public IAttributeType[] getConfigData() {
+ if (configuration.isEmpty()) {
+ configuration.add(getDefault());
+ }
+ return configuration.toArray(new IAttributeType[configuration.size()]);
+ }
+
+ public IAttributeType getDefault() {
+ return CoreAttributeTypes.NAME;
+ }
+
+ @Override
+ public void loadFrom(String[] items) {
+ if (items != null && items.length > 0) {
+ configuration.clear();
+ for (String entry : items) {
+ try {
+ AttributeType type = AttributeTypeManager.getTypeByGuid(entry);
+ configuration.add(type);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ if (configuration.isEmpty()) {
+ configuration.add(getDefault());
+ }
+ }
+
+ @Override
+ public String toString() {
+ Collection<AttributeType> taggableItems;
+ try {
+ taggableItems = AttributeTypeManager.getTaggableTypes();
+ if (taggableItems.size() == configuration.size()) {
+ return "All";
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ return StringUtils.join(configuration, ", ");
+ }
+
+ @Override
+ public String[] toStore() {
+ String[] guids = new String[configuration.size()];
+ int index = 0;
+ for (IAttributeType type : configuration) {
+ guids[index++] = type.getGuid();
+ }
+ return guids;
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/QuickSearchView.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/QuickSearchView.java
index cdd69e05c17..926044df457 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/QuickSearchView.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/QuickSearchView.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.framework.ui.skynet.search;
-
-import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.EXCLUDE_DELETED;
-import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.INCLUDE_DELETED;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.jface.action.Action;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.plugin.core.IActionable;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag;
-import org.eclipse.osee.framework.ui.plugin.OseeUiActions;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.OseeContributionItem;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.panels.SearchComposite;
-import org.eclipse.osee.framework.ui.skynet.util.DbConnectionExceptionComposite;
-import org.eclipse.osee.framework.ui.skynet.widgets.XBranchSelectWidget;
-import org.eclipse.osee.framework.ui.swt.ALayout;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.osee.framework.ui.swt.Widgets;
-import org.eclipse.search.ui.NewSearchUI;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * @author Robert A. Fisher
- * @author Ryan D. Brooks
- */
-public class QuickSearchView extends ViewPart implements IActionable, Listener {
- public static final String VIEW_ID = "org.eclipse.osee.framework.ui.skynet.QuickSearchView";
-
- private static final String ENTRY_SEPARATOR = "##";
- private static final String LAST_QUERY_KEY_ID = "lastQuery";
- private static final String LAST_BRANCH_GUID = "lastBranch";
- private static final String QUERY_HISTORY_KEY_ID = "queryHistory";
-
- private static final String MAIN_HELP_CONTEXT = "quick_search_text";
-
- private Label branchLabel;
- private XBranchSelectWidget branchSelect;
- private SearchComposite searchComposite;
- private QuickSearchOptionComposite optionsComposite;
- private IMemento memento;
-
- @Override
- public void init(IViewSite site, IMemento memento) throws PartInitException {
- super.init(site, memento);
- if (memento != null) {
- this.memento = memento;
- }
- }
-
- @Override
- public void saveState(IMemento memento) {
- if (memento != null) {
- if (Widgets.isAccessible(searchComposite)) {
- memento.putString(LAST_QUERY_KEY_ID, searchComposite.getQuery());
- Branch branch = branchSelect.getData();
- if (branch != null) {
- memento.putString(LAST_BRANCH_GUID, branch.getGuid());
- }
- StringBuilder builder = new StringBuilder();
- String[] queries = searchComposite.getQueryHistory();
- for (int index = 0; index < queries.length; index++) {
- try {
- builder.append(URLEncoder.encode(queries[index], "UTF-8"));
- if (index + 1 < queries.length) {
- builder.append(ENTRY_SEPARATOR);
- }
- } catch (UnsupportedEncodingException ex) {
- // DO NOTHING
- }
- }
- memento.putString(QUERY_HISTORY_KEY_ID, builder.toString());
- }
- if (Widgets.isAccessible(optionsComposite)) {
- optionsComposite.saveState(memento);
- }
- }
- }
-
- private void loadState() {
- if (memento != null) {
- if (Widgets.isAccessible(searchComposite)) {
- String lastQuery = memento.getString(LAST_QUERY_KEY_ID);
- List<String> queries = new ArrayList<String>();
- String rawHistory = memento.getString(QUERY_HISTORY_KEY_ID);
- if (rawHistory != null) {
- String[] values = rawHistory.split(ENTRY_SEPARATOR);
- for (String value : values) {
- try {
- queries.add(URLDecoder.decode(value, "UTF-8"));
- } catch (UnsupportedEncodingException ex) {
- // DO NOTHING
- }
- }
- }
- searchComposite.restoreWidgetValues(queries, lastQuery, null, null);
- }
- if (Widgets.isAccessible(optionsComposite)) {
- optionsComposite.loadState(memento);
- }
- if (branchSelect != null) {
- String guid = memento.getString(LAST_BRANCH_GUID);
- if (Strings.isValid(guid)) {
- try {
- Branch branch = BranchManager.getBranchByGuid(guid);
- branchSelect.setSelection(branch);
- } catch (OseeCoreException ex) {
- // do nothing
- }
- }
- }
- }
- }
-
- @Override
- public void createPartControl(Composite parent) {
- if (!DbConnectionExceptionComposite.dbConnectionIsOk(parent)) {
- return;
- }
-
- parent.setLayout(new GridLayout());
- parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- branchSelect = new XBranchSelectWidget("");
- branchSelect.setDisplayLabel(false);
- branchSelect.createWidgets(parent, 2);
- branchSelect.addListener(this);
- // allow user to double click the branch text area to select the branch
- if (Widgets.isAccessible(branchSelect.getSelectComposite())) {
- if (Widgets.isAccessible(branchSelect.getSelectComposite().getBranchSelectText())) {
- branchSelect.getSelectComposite().getBranchSelectText().setDoubleClickEnabled(true);
- }
- }
- OseeContributionItem.addTo(this, true);
-
- createActions();
-
- Composite panel = new Composite(parent, SWT.NONE);
- GridLayout gL = new GridLayout();
- gL.marginHeight = 0;
- gL.marginWidth = 0;
- panel.setLayout(gL);
- panel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- searchComposite = new SearchComposite(panel, SWT.NONE);
- searchComposite.addListener(this);
-
- optionsComposite = new QuickSearchOptionComposite(panel, SWT.NONE);
- optionsComposite.setLayout(ALayout.getZeroMarginLayout());
- optionsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- loadState();
- compositeEnablement(searchComposite, false);
- searchComposite.setHelpContext(MAIN_HELP_CONTEXT);
-
- branchLabel = new Label(parent, SWT.NONE);
- branchLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- branchLabel.setText("");
-
- createClearHistoryAction();
- }
-
- private void createClearHistoryAction() {
- Action action = new Action("Clear Search History") {
- @Override
- public void run() {
- if (searchComposite != null) {
- searchComposite.clearHistory();
- }
- }
- };
- action.setToolTipText("Clears search history");
- action.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.REMOVE));
- getViewSite().getActionBars().getMenuManager().add(action);
- }
-
- private void createActions() {
- OseeUiActions.addBugToViewToolbar(this, this, SkynetGuiPlugin.getInstance(), VIEW_ID, "Quick Search");
- }
-
- private void compositeEnablement(SearchComposite composite, boolean enable) {
- if (Widgets.isAccessible(composite)) {
- for (Control cntrl : composite.getSearchChildren()) {
- cntrl.setEnabled(enable);
- }
- }
- }
-
- @Override
- public void setFocus() {
- if (searchComposite != null) {
- searchComposite.setFocus();
- }
- }
-
- public String getActionDescription() {
- return "";
- }
-
- public void setBranch(Branch branch) {
- if (branchSelect != null) {
- branchSelect.setSelection(branch);
- // branch has been selected; allow user to set up search string
- compositeEnablement(searchComposite, true);
- }
- }
-
- public void handleEvent(Event event) {
- if (Widgets.isAccessible(branchLabel) && branchSelect != null) {
- branchLabel.setText("");
- final Branch branch = branchSelect.getData();
- if (branch == null) {
- branchLabel.setText("Error: Must Select a Branch");
- } else if (Widgets.isAccessible(searchComposite) && searchComposite.isExecuteSearchEvent(event) && Widgets.isAccessible(optionsComposite)) {
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.search;
+
+import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.EXCLUDE_DELETED;
+import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.INCLUDE_DELETED;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.jface.action.Action;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.plugin.core.IActionable;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag;
+import org.eclipse.osee.framework.ui.plugin.OseeUiActions;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.OseeContributionItem;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.panels.SearchComposite;
+import org.eclipse.osee.framework.ui.skynet.util.DbConnectionExceptionComposite;
+import org.eclipse.osee.framework.ui.skynet.widgets.XBranchSelectWidget;
+import org.eclipse.osee.framework.ui.swt.ALayout;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.osee.framework.ui.swt.Widgets;
+import org.eclipse.search.ui.NewSearchUI;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * @author Robert A. Fisher
+ * @author Ryan D. Brooks
+ */
+public class QuickSearchView extends ViewPart implements IActionable, Listener {
+ public static final String VIEW_ID = "org.eclipse.osee.framework.ui.skynet.QuickSearchView";
+
+ private static final String ENTRY_SEPARATOR = "##";
+ private static final String LAST_QUERY_KEY_ID = "lastQuery";
+ private static final String LAST_BRANCH_GUID = "lastBranch";
+ private static final String QUERY_HISTORY_KEY_ID = "queryHistory";
+
+ private static final String MAIN_HELP_CONTEXT = "quick_search_text";
+
+ private Label branchLabel;
+ private XBranchSelectWidget branchSelect;
+ private SearchComposite searchComposite;
+ private QuickSearchOptionComposite optionsComposite;
+ private IMemento memento;
+
+ @Override
+ public void init(IViewSite site, IMemento memento) throws PartInitException {
+ super.init(site, memento);
+ if (memento != null) {
+ this.memento = memento;
+ }
+ }
+
+ @Override
+ public void saveState(IMemento memento) {
+ if (memento != null) {
+ if (Widgets.isAccessible(searchComposite)) {
+ memento.putString(LAST_QUERY_KEY_ID, searchComposite.getQuery());
+ Branch branch = branchSelect.getData();
+ if (branch != null) {
+ memento.putString(LAST_BRANCH_GUID, branch.getGuid());
+ }
+ StringBuilder builder = new StringBuilder();
+ String[] queries = searchComposite.getQueryHistory();
+ for (int index = 0; index < queries.length; index++) {
+ try {
+ builder.append(URLEncoder.encode(queries[index], "UTF-8"));
+ if (index + 1 < queries.length) {
+ builder.append(ENTRY_SEPARATOR);
+ }
+ } catch (UnsupportedEncodingException ex) {
+ // DO NOTHING
+ }
+ }
+ memento.putString(QUERY_HISTORY_KEY_ID, builder.toString());
+ }
+ if (Widgets.isAccessible(optionsComposite)) {
+ optionsComposite.saveState(memento);
+ }
+ }
+ }
+
+ private void loadState() {
+ if (memento != null) {
+ if (Widgets.isAccessible(searchComposite)) {
+ String lastQuery = memento.getString(LAST_QUERY_KEY_ID);
+ List<String> queries = new ArrayList<String>();
+ String rawHistory = memento.getString(QUERY_HISTORY_KEY_ID);
+ if (rawHistory != null) {
+ String[] values = rawHistory.split(ENTRY_SEPARATOR);
+ for (String value : values) {
+ try {
+ queries.add(URLDecoder.decode(value, "UTF-8"));
+ } catch (UnsupportedEncodingException ex) {
+ // DO NOTHING
+ }
+ }
+ }
+ searchComposite.restoreWidgetValues(queries, lastQuery, null, null);
+ }
+ if (Widgets.isAccessible(optionsComposite)) {
+ optionsComposite.loadState(memento);
+ }
+ if (branchSelect != null) {
+ String guid = memento.getString(LAST_BRANCH_GUID);
+ if (Strings.isValid(guid)) {
+ try {
+ Branch branch = BranchManager.getBranchByGuid(guid);
+ branchSelect.setSelection(branch);
+ } catch (OseeCoreException ex) {
+ // do nothing
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public void createPartControl(Composite parent) {
+ if (!DbConnectionExceptionComposite.dbConnectionIsOk(parent)) {
+ return;
+ }
+
+ parent.setLayout(new GridLayout());
+ parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ branchSelect = new XBranchSelectWidget("");
+ branchSelect.setDisplayLabel(false);
+ branchSelect.createWidgets(parent, 2);
+ branchSelect.addListener(this);
+ // allow user to double click the branch text area to select the branch
+ if (Widgets.isAccessible(branchSelect.getSelectComposite())) {
+ if (Widgets.isAccessible(branchSelect.getSelectComposite().getBranchSelectText())) {
+ branchSelect.getSelectComposite().getBranchSelectText().setDoubleClickEnabled(true);
+ }
+ }
+ OseeContributionItem.addTo(this, true);
+
+ createActions();
+
+ Composite panel = new Composite(parent, SWT.NONE);
+ GridLayout gL = new GridLayout();
+ gL.marginHeight = 0;
+ gL.marginWidth = 0;
+ panel.setLayout(gL);
+ panel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ searchComposite = new SearchComposite(panel, SWT.NONE);
+ searchComposite.addListener(this);
+
+ optionsComposite = new QuickSearchOptionComposite(panel, SWT.NONE);
+ optionsComposite.setLayout(ALayout.getZeroMarginLayout());
+ optionsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ loadState();
+ compositeEnablement(searchComposite, false);
+ searchComposite.setHelpContext(MAIN_HELP_CONTEXT);
+
+ branchLabel = new Label(parent, SWT.NONE);
+ branchLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ branchLabel.setText("");
+
+ createClearHistoryAction();
+ }
+
+ private void createClearHistoryAction() {
+ Action action = new Action("Clear Search History") {
+ @Override
+ public void run() {
+ if (searchComposite != null) {
+ searchComposite.clearHistory();
+ }
+ }
+ };
+ action.setToolTipText("Clears search history");
+ action.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.REMOVE));
+ getViewSite().getActionBars().getMenuManager().add(action);
+ }
+
+ private void createActions() {
+ OseeUiActions.addBugToViewToolbar(this, this, SkynetGuiPlugin.getInstance(), VIEW_ID, "Quick Search");
+ }
+
+ private void compositeEnablement(SearchComposite composite, boolean enable) {
+ if (Widgets.isAccessible(composite)) {
+ for (Control cntrl : composite.getSearchChildren()) {
+ cntrl.setEnabled(enable);
+ }
+ }
+ }
+
+ @Override
+ public void setFocus() {
+ if (searchComposite != null) {
+ searchComposite.setFocus();
+ }
+ }
+
+ public String getActionDescription() {
+ return "";
+ }
+
+ public void setBranch(Branch branch) {
+ if (branchSelect != null) {
+ branchSelect.setSelection(branch);
+ // branch has been selected; allow user to set up search string
+ compositeEnablement(searchComposite, true);
+ }
+ }
+
+ public void handleEvent(Event event) {
+ if (Widgets.isAccessible(branchLabel) && branchSelect != null) {
+ branchLabel.setText("");
+ final Branch branch = branchSelect.getData();
+ if (branch == null) {
+ branchLabel.setText("Error: Must Select a Branch");
+ } else if (Widgets.isAccessible(searchComposite) && searchComposite.isExecuteSearchEvent(event) && Widgets.isAccessible(optionsComposite)) {
DeletionFlag allowDeleted =
optionsComposite.isIncludeDeletedEnabled() ? INCLUDE_DELETED : EXCLUDE_DELETED;
- NewSearchUI.activateSearchResultView();
- if (optionsComposite.isSearchByIdEnabled()) {
+ NewSearchUI.activateSearchResultView();
+ if (optionsComposite.isSearchByIdEnabled()) {
NewSearchUI.runQueryInBackground(new IdArtifactSearch(searchComposite.getQuery(), branch, allowDeleted));
- } else {
- NewSearchUI.runQueryInBackground(new RemoteArtifactSearch(searchComposite.getQuery(), //
- branch, //
+ } else {
+ NewSearchUI.runQueryInBackground(new RemoteArtifactSearch(searchComposite.getQuery(), //
+ branch, //
allowDeleted, //
- optionsComposite.isMatchWordOrderEnabled(), //
- optionsComposite.isMatchAllLocationsEnabled(),//
- optionsComposite.isCaseSensitiveEnabled(),//
- optionsComposite.getAttributeTypeFilter()));
- }
- } else {
- // branch has been selected; allow user to set up search string
- compositeEnablement(searchComposite, true);
- }
- }
- }
-
- @Override
- public void dispose() {
- super.dispose();
- }
-}
+ optionsComposite.isMatchWordOrderEnabled(), //
+ optionsComposite.isMatchAllLocationsEnabled(),//
+ optionsComposite.isCaseSensitiveEnabled(),//
+ optionsComposite.getAttributeTypeFilter()));
+ }
+ } else {
+ // branch has been selected; allow user to set up search string
+ compositeEnablement(searchComposite, true);
+ }
+ }
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/RemoteArtifactSearch.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/RemoteArtifactSearch.java
index 89f10da9b1b..0259be51928 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/RemoteArtifactSearch.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/RemoteArtifactSearch.java
@@ -1,278 +1,278 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.search;
-
-import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.INCLUDE_DELETED;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.osee.framework.core.data.IAttributeType;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.jdk.core.type.HashCollection;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.jdk.core.util.io.xml.XmlTextInputStream;
-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.Attribute;
-import org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactMatch;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactXmlQueryResultParser.MatchLocation;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.search.page.AttributeLineElement;
-import org.eclipse.osee.framework.ui.skynet.search.page.AttributeMatch;
-import org.eclipse.search.ui.NewSearchUI;
-import org.eclipse.search.ui.text.AbstractTextSearchResult;
-import org.eclipse.search.ui.text.Match;
-
-/**
- * @author Roberto E. Escobar
- */
-final class RemoteArtifactSearch extends AbstractArtifactSearchQuery {
- private final String queryString;
- private final IAttributeType[] attributeTypes;
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.search;
+
+import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.INCLUDE_DELETED;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.jdk.core.type.HashCollection;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.jdk.core.util.io.xml.XmlTextInputStream;
+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.Attribute;
+import org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactMatch;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactXmlQueryResultParser.MatchLocation;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.search.page.AttributeLineElement;
+import org.eclipse.osee.framework.ui.skynet.search.page.AttributeMatch;
+import org.eclipse.search.ui.NewSearchUI;
+import org.eclipse.search.ui.text.AbstractTextSearchResult;
+import org.eclipse.search.ui.text.Match;
+
+/**
+ * @author Roberto E. Escobar
+ */
+final class RemoteArtifactSearch extends AbstractArtifactSearchQuery {
+ private final String queryString;
+ private final IAttributeType[] attributeTypes;
private final DeletionFlag includeDeleted;
- private final boolean matchWordOrder;
- private final Branch branch;
- private final boolean findAllMatchLocations;
- private final boolean isCaseSensitive;
-
+ private final boolean matchWordOrder;
+ private final Branch branch;
+ private final boolean findAllMatchLocations;
+ private final boolean isCaseSensitive;
+
RemoteArtifactSearch(String queryString, Branch branch, DeletionFlag includeDeleted, boolean matchWordOrder, boolean findAllMatchLocations, boolean isCaseSensitive, IAttributeType... attributeTypes) {
- this.branch = branch;
- this.includeDeleted = includeDeleted;
- this.attributeTypes = attributeTypes;
- this.queryString = queryString;
- this.matchWordOrder = matchWordOrder;
- this.findAllMatchLocations = findAllMatchLocations;
- this.isCaseSensitive = isCaseSensitive;
- }
-
- @Override
- public String getCriteriaLabel() {
- List<String> optionsList = new ArrayList<String>();
+ this.branch = branch;
+ this.includeDeleted = includeDeleted;
+ this.attributeTypes = attributeTypes;
+ this.queryString = queryString;
+ this.matchWordOrder = matchWordOrder;
+ this.findAllMatchLocations = findAllMatchLocations;
+ this.isCaseSensitive = isCaseSensitive;
+ }
+
+ @Override
+ public String getCriteriaLabel() {
+ List<String> optionsList = new ArrayList<String>();
if (includeDeleted == INCLUDE_DELETED) {
- optionsList.add("Include Deleted");
- }
-
- if (matchWordOrder) {
- optionsList.add("Match Word Order");
- if (findAllMatchLocations) {
- optionsList.add("All Matches");
- } else {
- optionsList.add("1st Match Only");
- }
- }
-
- if (isCaseSensitive) {
- optionsList.add("Case Sensitive");
- }
-
- if (attributeTypes != null && attributeTypes.length > 0) {
- optionsList.add(String.format("Attribute Type Filter:%s", Arrays.deepToString(attributeTypes)));
- }
-
- String options =
- String.format(" - Options:[%s]", org.eclipse.osee.framework.jdk.core.util.Collections.toString(optionsList,
- ", "));
- return String.format("%s%s", queryString, optionsList.size() > 0 ? options : "");
- }
-
- @Override
- public IStatus run(IProgressMonitor pm) {
- setIsDoneRunning(false);
- aResult.removeAll();
- long startTime = System.currentTimeMillis();
- int artifactCount = 0;
- long startCollectTime = startTime;
- long endOfloadTime = startTime;
- int lineMatches = 0;
- try {
- List<ArtifactMatch> matches =
- ArtifactQuery.getArtifactMatchesFromAttributeKeywords(branch, queryString, matchWordOrder,
- includeDeleted, findAllMatchLocations, isCaseSensitive, attributeTypes);
-
- endOfloadTime = System.currentTimeMillis();
-
- startCollectTime = System.currentTimeMillis();
- ResultCollector resultCollector = new ResultCollector(aResult);
-
- for (ArtifactMatch artifactMatch : matches) {
- resultCollector.beginReporting();
- if (artifactMatch.hasMatchData()) {
- try {
- Artifact artifact = artifactMatch.getArtifact();
- HashCollection<Attribute<?>, MatchLocation> matchData = artifactMatch.getMatchData();
- for (Attribute<?> attribute : matchData.keySet()) {
- for (MatchLocation matchLocation : matchData.getValues(attribute)) {
- resultCollector.acceptMatchData(artifact, attribute, matchLocation);
- lineMatches++;
- }
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, String.format(
- "Error processing attribute line matches for [%s]", artifactMatch.getArtifact()), ex);
- resultCollector.acceptArtifactMatch(artifactMatch);
- }
- } else {
- resultCollector.acceptArtifactMatch(artifactMatch);
- }
- resultCollector.endReporting();
- artifactCount++;
- }
- } catch (Exception ex) {
- OseeLog.log(getClass(), OseeLevel.SEVERE_POPUP, ex);
- } finally {
- OseeLog.log(SkynetGuiPlugin.class, Level.INFO, String.format(
- "Quick Search: [%s] artifacts with [%s] location matches loaded in [%s secs] collected in [%s]",
- artifactCount, lineMatches, (endOfloadTime - startTime) / 1000.0, Lib.getElapseString(startCollectTime)));
- }
- setIsDoneRunning(true);
- return new MultiStatus(NewSearchUI.PLUGIN_ID, IStatus.OK, "OK", null);
- }
-
- private final class ResultCollector {
-
- private final AbstractTextSearchResult fResult;
- private ArrayList<Match> fCachedMatches;
-
- private ResultCollector(AbstractTextSearchResult result) {
- fResult = result;
- }
-
- public boolean acceptArtifactMatch(ArtifactMatch artifactMatch) {
- fResult.addMatch(new Match(artifactMatch.getArtifact(), 1, 2));
- flushMatches();
- return true;
- }
-
- public boolean acceptMatchData(Artifact artifact, Attribute<?> attribute, MatchLocation matchLocation) {
- int matchOffset = matchLocation.getStartPosition() - 1;
- if (matchOffset < 0) {
- matchOffset = 0;
- }
- int matchEnd = matchLocation.getEndPosition();
- int matchLength = matchEnd - matchOffset;
-
- AttributeLineElement lineElement = getLineElement(matchOffset, matchEnd, artifact, attribute);
- if (lineElement != null) {
- AttributeMatch match = new AttributeMatch(artifact, matchOffset, matchLength, lineElement);
- fCachedMatches.add(match);
- }
- return true;
- }
-
- private AttributeLineElement getLineElement(int offset, int matchEnd, Artifact artifact, Attribute<?> attribute) {
- int lineNumber = 1;
- int lineStart = 0;
- if (!fCachedMatches.isEmpty()) {
- AttributeMatch last = (AttributeMatch) fCachedMatches.get(fCachedMatches.size() - 1);
- AttributeLineElement lineElement = last.getLineElement();
- if (lineElement.contains(offset) && lineElement.getAttribute().equals(attribute)) {
- return lineElement;
- }
- lineStart = lineElement.getOffset() + lineElement.getLength();
- lineNumber = lineElement.getLine() + 1;
- }
- if (offset < lineStart) {
- return null; // offset before the last line
- }
-
- int i = lineStart;
- String content = getContentFromAttribute(attribute);
- int contentLength = content.length();
- int charCount = 0;
- while (i < contentLength) {
- char ch = content.charAt(i++);
- charCount++;
- if (charCount >= 40 && Character.isWhitespace(ch) && matchEnd < i) {
- ch = '\n';
- charCount = 0;
- }
- if (ch == '\n' || ch == '\r') {
- if (ch == '\r' && i < contentLength && content.charAt(i) == '\n') {
- i++;
- }
- if (offset < i) {
- String lineContent = getContents(content, lineStart, i); // include line delimiter
- return new AttributeLineElement(artifact, attribute, lineNumber, lineStart, lineContent);
- }
- lineNumber++;
- lineStart = i;
- }
- }
- if (offset < i) {
- String lineContent = getContents(attribute, lineStart, i);
- return new AttributeLineElement(artifact, attribute, lineNumber, lineStart, lineContent);
- }
- return null; // offset outside of range
- }
-
- public String getContents(Attribute<?> attribute, int start, int end) {
- String contents = getContentFromAttribute(attribute);
- if (Strings.isValid(contents)) {
- contents = getContents(contents, start, end);
- }
- return contents;
- }
-
- private String getContentFromAttribute(Attribute<?> attribute) {
- try {
- Object value = attribute.getValue();
- if (!attribute.getAttributeType().getTaggerId().contains("Default")) {
- return Lib.inputStreamToString(new XmlTextInputStream((String) value));
- } else if (value instanceof String) {
- return (String) value;
- } else {
- return attribute.getDisplayableString();
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- return "";
- }
-
- private String getContents(String content, int start, int end) {
- StringBuffer buf = new StringBuffer();
- for (int i = start; i < end; i++) {
- char ch = content.charAt(i);
- if (Character.isWhitespace(ch) || Character.isISOControl(ch)) {
- buf.append(' ');
- } else {
- buf.append(ch);
- }
- }
- return buf.toString();
- }
-
- public void beginReporting() {
- fCachedMatches = new ArrayList<Match>();
- }
-
- public void endReporting() {
- flushMatches();
- fCachedMatches = null;
- }
-
- private void flushMatches() {
- if (fCachedMatches != null && !fCachedMatches.isEmpty()) {
- fResult.addMatches(fCachedMatches.toArray(new Match[fCachedMatches.size()]));
- fCachedMatches.clear();
- }
- }
- }
-}
+ optionsList.add("Include Deleted");
+ }
+
+ if (matchWordOrder) {
+ optionsList.add("Match Word Order");
+ if (findAllMatchLocations) {
+ optionsList.add("All Matches");
+ } else {
+ optionsList.add("1st Match Only");
+ }
+ }
+
+ if (isCaseSensitive) {
+ optionsList.add("Case Sensitive");
+ }
+
+ if (attributeTypes != null && attributeTypes.length > 0) {
+ optionsList.add(String.format("Attribute Type Filter:%s", Arrays.deepToString(attributeTypes)));
+ }
+
+ String options =
+ String.format(" - Options:[%s]", org.eclipse.osee.framework.jdk.core.util.Collections.toString(optionsList,
+ ", "));
+ return String.format("%s%s", queryString, optionsList.size() > 0 ? options : "");
+ }
+
+ @Override
+ public IStatus run(IProgressMonitor pm) {
+ setIsDoneRunning(false);
+ aResult.removeAll();
+ long startTime = System.currentTimeMillis();
+ int artifactCount = 0;
+ long startCollectTime = startTime;
+ long endOfloadTime = startTime;
+ int lineMatches = 0;
+ try {
+ List<ArtifactMatch> matches =
+ ArtifactQuery.getArtifactMatchesFromAttributeKeywords(branch, queryString, matchWordOrder,
+ includeDeleted, findAllMatchLocations, isCaseSensitive, attributeTypes);
+
+ endOfloadTime = System.currentTimeMillis();
+
+ startCollectTime = System.currentTimeMillis();
+ ResultCollector resultCollector = new ResultCollector(aResult);
+
+ for (ArtifactMatch artifactMatch : matches) {
+ resultCollector.beginReporting();
+ if (artifactMatch.hasMatchData()) {
+ try {
+ Artifact artifact = artifactMatch.getArtifact();
+ HashCollection<Attribute<?>, MatchLocation> matchData = artifactMatch.getMatchData();
+ for (Attribute<?> attribute : matchData.keySet()) {
+ for (MatchLocation matchLocation : matchData.getValues(attribute)) {
+ resultCollector.acceptMatchData(artifact, attribute, matchLocation);
+ lineMatches++;
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, String.format(
+ "Error processing attribute line matches for [%s]", artifactMatch.getArtifact()), ex);
+ resultCollector.acceptArtifactMatch(artifactMatch);
+ }
+ } else {
+ resultCollector.acceptArtifactMatch(artifactMatch);
+ }
+ resultCollector.endReporting();
+ artifactCount++;
+ }
+ } catch (Exception ex) {
+ OseeLog.log(getClass(), OseeLevel.SEVERE_POPUP, ex);
+ } finally {
+ OseeLog.log(SkynetGuiPlugin.class, Level.INFO, String.format(
+ "Quick Search: [%s] artifacts with [%s] location matches loaded in [%s secs] collected in [%s]",
+ artifactCount, lineMatches, (endOfloadTime - startTime) / 1000.0, Lib.getElapseString(startCollectTime)));
+ }
+ setIsDoneRunning(true);
+ return new MultiStatus(NewSearchUI.PLUGIN_ID, IStatus.OK, "OK", null);
+ }
+
+ private final class ResultCollector {
+
+ private final AbstractTextSearchResult fResult;
+ private ArrayList<Match> fCachedMatches;
+
+ private ResultCollector(AbstractTextSearchResult result) {
+ fResult = result;
+ }
+
+ public boolean acceptArtifactMatch(ArtifactMatch artifactMatch) {
+ fResult.addMatch(new Match(artifactMatch.getArtifact(), 1, 2));
+ flushMatches();
+ return true;
+ }
+
+ public boolean acceptMatchData(Artifact artifact, Attribute<?> attribute, MatchLocation matchLocation) {
+ int matchOffset = matchLocation.getStartPosition() - 1;
+ if (matchOffset < 0) {
+ matchOffset = 0;
+ }
+ int matchEnd = matchLocation.getEndPosition();
+ int matchLength = matchEnd - matchOffset;
+
+ AttributeLineElement lineElement = getLineElement(matchOffset, matchEnd, artifact, attribute);
+ if (lineElement != null) {
+ AttributeMatch match = new AttributeMatch(artifact, matchOffset, matchLength, lineElement);
+ fCachedMatches.add(match);
+ }
+ return true;
+ }
+
+ private AttributeLineElement getLineElement(int offset, int matchEnd, Artifact artifact, Attribute<?> attribute) {
+ int lineNumber = 1;
+ int lineStart = 0;
+ if (!fCachedMatches.isEmpty()) {
+ AttributeMatch last = (AttributeMatch) fCachedMatches.get(fCachedMatches.size() - 1);
+ AttributeLineElement lineElement = last.getLineElement();
+ if (lineElement.contains(offset) && lineElement.getAttribute().equals(attribute)) {
+ return lineElement;
+ }
+ lineStart = lineElement.getOffset() + lineElement.getLength();
+ lineNumber = lineElement.getLine() + 1;
+ }
+ if (offset < lineStart) {
+ return null; // offset before the last line
+ }
+
+ int i = lineStart;
+ String content = getContentFromAttribute(attribute);
+ int contentLength = content.length();
+ int charCount = 0;
+ while (i < contentLength) {
+ char ch = content.charAt(i++);
+ charCount++;
+ if (charCount >= 40 && Character.isWhitespace(ch) && matchEnd < i) {
+ ch = '\n';
+ charCount = 0;
+ }
+ if (ch == '\n' || ch == '\r') {
+ if (ch == '\r' && i < contentLength && content.charAt(i) == '\n') {
+ i++;
+ }
+ if (offset < i) {
+ String lineContent = getContents(content, lineStart, i); // include line delimiter
+ return new AttributeLineElement(artifact, attribute, lineNumber, lineStart, lineContent);
+ }
+ lineNumber++;
+ lineStart = i;
+ }
+ }
+ if (offset < i) {
+ String lineContent = getContents(attribute, lineStart, i);
+ return new AttributeLineElement(artifact, attribute, lineNumber, lineStart, lineContent);
+ }
+ return null; // offset outside of range
+ }
+
+ public String getContents(Attribute<?> attribute, int start, int end) {
+ String contents = getContentFromAttribute(attribute);
+ if (Strings.isValid(contents)) {
+ contents = getContents(contents, start, end);
+ }
+ return contents;
+ }
+
+ private String getContentFromAttribute(Attribute<?> attribute) {
+ try {
+ Object value = attribute.getValue();
+ if (!attribute.getAttributeType().getTaggerId().contains("Default")) {
+ return Lib.inputStreamToString(new XmlTextInputStream((String) value));
+ } else if (value instanceof String) {
+ return (String) value;
+ } else {
+ return attribute.getDisplayableString();
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ return "";
+ }
+
+ private String getContents(String content, int start, int end) {
+ StringBuffer buf = new StringBuffer();
+ for (int i = start; i < end; i++) {
+ char ch = content.charAt(i);
+ if (Character.isWhitespace(ch) || Character.isISOControl(ch)) {
+ buf.append(' ');
+ } else {
+ buf.append(ch);
+ }
+ }
+ return buf.toString();
+ }
+
+ public void beginReporting() {
+ fCachedMatches = new ArrayList<Match>();
+ }
+
+ public void endReporting() {
+ flushMatches();
+ fCachedMatches = null;
+ }
+
+ private void flushMatches() {
+ if (fCachedMatches != null && !fCachedMatches.isEmpty()) {
+ fResult.addMatches(fCachedMatches.toArray(new Match[fCachedMatches.size()]));
+ fCachedMatches.clear();
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/AbstractArtifactSearchViewPage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/AbstractArtifactSearchViewPage.java
index 232d8b4f154..9a2c68342d9 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/AbstractArtifactSearchViewPage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/AbstractArtifactSearchViewPage.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.search.page;
-
-import org.eclipse.osee.framework.ui.skynet.search.AbstractArtifactSearchResult;
-import org.eclipse.search.ui.text.AbstractTextSearchViewPage;
-
-/**
- * @author Roberto E. Escobar
- */
-public abstract class AbstractArtifactSearchViewPage extends AbstractTextSearchViewPage {
-
- public AbstractArtifactSearchResult getInput() {
- return (AbstractArtifactSearchResult) super.getInput();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.search.page;
+
+import org.eclipse.osee.framework.ui.skynet.search.AbstractArtifactSearchResult;
+import org.eclipse.search.ui.text.AbstractTextSearchViewPage;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public abstract class AbstractArtifactSearchViewPage extends AbstractTextSearchViewPage {
+
+ public AbstractArtifactSearchResult getInput() {
+ return (AbstractArtifactSearchResult) super.getInput();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/ArtifactSearchLabelProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/ArtifactSearchLabelProvider.java
index 7bff62f2761..1127a0a7349 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/ArtifactSearchLabelProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/ArtifactSearchLabelProvider.java
@@ -1,280 +1,280 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.search.page;
-
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Level;
-import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.StyledString;
-import org.eclipse.jface.viewers.StyledString.Styler;
-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.skynet.ArtifactDecorator;
-import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.IArtifactDecoratorPreferences;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.search.AbstractArtifactSearchResult;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.search.ui.text.Match;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ArtifactSearchLabelProvider extends LabelProvider implements IStyledLabelProvider {
- private static final String HIGHLIGHT_BG_COLOR_NAME = "org.eclipse.jdt.ui.ColoredLabels.match_highlight"; //$NON-NLS-1$
-
- private static final Styler HIGHLIGHT_STYLE = StyledString.createColorRegistryStyler(null, HIGHLIGHT_BG_COLOR_NAME);
- private static final Styler DELETED_ARTIFACT_STYLE = StyledString.createColorRegistryStyler("red", null);
-
- private static final String fgEllipses = " ... "; //$NON-NLS-1$
-
- private final AbstractArtifactSearchViewPage fPage;
- private final Comparator fMatchComparator;
- private final ArtifactDecorator artifactDecorator;
-
- private final Map<Image, Image> disabledImageMap;
-
- public ArtifactSearchLabelProvider(AbstractArtifactSearchViewPage page, ArtifactDecorator artifactDecorator) {
- this.artifactDecorator = artifactDecorator;
- this.disabledImageMap = new HashMap<Image, Image>();
- fPage = page;
- fMatchComparator = new Comparator() {
- public int compare(Object o1, Object o2) {
- return ((AttributeMatch) o1).getOriginalOffset() - ((AttributeMatch) o2).getOriginalOffset();
- }
- };
- }
-
- @Override
- public String getText(Object object) {
- return getStyledText(object).getString();
- }
-
- public StyledString getStyledText(Object element) {
- if (element instanceof AttributeLineElement) {
- return getLineElementLabel((AttributeLineElement) element);
- }
-
- if (!(element instanceof Artifact)) {
- return new StyledString(String.format("Undefined: %s %s", element.getClass(), element));
- }
-
- Artifact artifact = (Artifact) element;
- String name = artifact.getName();
- int matchCount = getMatchCount(artifact);
- if (matchCount > 0) {
- StyledString artifactString = getColoredLabelWithCounts(artifact, matchCount, new StyledString(name));
- return getArtifactText(artifactDecorator, artifact, artifactString);
- } else {
- return new StyledString(name, StyledString.DECORATIONS_STYLER);
- }
- }
-
- private int getMatchCount(Object element) {
- AbstractArtifactSearchResult result = fPage.getInput();
- if (result == null) {
- return -1;
- }
- return result.getMatchCount(element);
- }
-
- private StyledString getArtifactText(IArtifactDecoratorPreferences decoration, Artifact artifact, StyledString coloredName) {
- if (artifact.isDeleted()) {
- coloredName.append(' ').append("<Deleted>", DELETED_ARTIFACT_STYLE);
- }
- if (decoration != null) {
-
- if (decoration.showArtIds() && decoration.showArtVersion()) {
- coloredName.append(' ').append("[" + artifact.getArtId() + " rev." + artifact.getGammaId() + "]",
- StyledString.DECORATIONS_STYLER);
- } else if (decoration.showArtIds() && !decoration.showArtVersion()) {
- coloredName.append(' ').append("[id " + artifact.getArtId() + "]", StyledString.DECORATIONS_STYLER);
- } else if (!decoration.showArtIds() && decoration.showArtVersion()) {
- coloredName.append(' ').append("[rev." + artifact.getGammaId() + "]", StyledString.DECORATIONS_STYLER);
- }
-
- if (decoration.showArtType()) {
- coloredName.append(' ').append("<" + artifact.getArtifactTypeName() + ">", StyledString.DECORATIONS_STYLER);
- }
-
- if (decoration.showArtBranch()) {
- coloredName.append(' ').append("[" + artifact.getBranch().getShortName() + "]",
- StyledString.DECORATIONS_STYLER);
- }
-
- try {
- String selectedAttributes = decoration.getSelectedAttributeData(artifact);
- if (Strings.isValid(selectedAttributes)) {
- coloredName.append(' ').append(selectedAttributes, StyledString.DECORATIONS_STYLER);
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- coloredName.append(' ').append(ex.getLocalizedMessage());
- }
- }
- return coloredName;
- }
-
- @SuppressWarnings("unchecked")
- private StyledString getLineElementLabel(AttributeLineElement lineElement) {
- String lineNumberString = String.format("%s, %s ", lineElement.getLine(), lineElement.getOffset());
- StyledString str = new StyledString(lineNumberString, StyledString.QUALIFIER_STYLER);
-
- Match[] matches = lineElement.getMatches(fPage.getInput());
- Arrays.sort(matches, fMatchComparator);
-
- String content = lineElement.getContents();
-
- int pos = evaluateLineStart(matches, content, lineElement.getOffset());
-
- int length = content.length();
-
- int charsToCut = getCharsToCut(length, matches); // number of characters to leave away if the line is too long
- for (int i = 0; i < matches.length; i++) {
- AttributeMatch match = (AttributeMatch) matches[i];
- int start = Math.max(match.getOriginalOffset() - lineElement.getOffset(), 0);
- // append gap between last match and the new one
- if (pos < start) {
- if (charsToCut > 0) {
- charsToCut = appendShortenedGap(content, pos, start, charsToCut, i == 0, str);
- } else {
- str.append(content.substring(pos, start));
- }
- }
- // append match
- int end =
- Math.min(match.getOriginalOffset() + match.getOriginalLength() - lineElement.getOffset(),
- lineElement.getLength());
- str.append(content.substring(start, end), HIGHLIGHT_STYLE);
- pos = end;
- }
- // append rest of the line
- if (charsToCut > 0) {
- appendShortenedGap(content, pos, length, charsToCut, false, str);
- } else {
- str.append(content.substring(pos));
- }
- return str;
- }
-
- private static final int MIN_MATCH_CONTEXT = 10; // minimal number of characters shown after and before a match
-
- private int appendShortenedGap(String content, int start, int end, int charsToCut, boolean isFirst, StyledString str) {
- int gapLength = end - start;
- if (!isFirst) {
- gapLength -= MIN_MATCH_CONTEXT;
- }
- if (end < content.length()) {
- gapLength -= MIN_MATCH_CONTEXT;
- }
- if (gapLength < MIN_MATCH_CONTEXT) { // don't cut, gap is too small
- str.append(content.substring(start, end));
- return charsToCut;
- }
-
- int context = MIN_MATCH_CONTEXT;
- if (gapLength > charsToCut) {
- context += gapLength - charsToCut;
- }
-
- if (!isFirst) {
- str.append(content.substring(start, start + context)); // give all extra context to the right side of a match
- context = MIN_MATCH_CONTEXT;
- }
-
- str.append(fgEllipses, StyledString.QUALIFIER_STYLER);
-
- if (end < content.length()) {
- str.append(content.substring(end - context, end));
- }
- return charsToCut - gapLength + fgEllipses.length();
- }
-
- private int getCharsToCut(int contentLength, Match[] matches) {
- if (contentLength <= 256 || !"win32".equals(SWT.getPlatform()) || matches.length == 0) { //$NON-NLS-1$
- return 0; // no shortening required
- }
- // XXX: workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=38519
- return contentLength - 256 + Math.max(matches.length * fgEllipses.length(), 100);
- }
-
- private int evaluateLineStart(Match[] matches, String lineContent, int lineOffset) {
- int max = lineContent.length();
- if (matches.length > 0) {
- AttributeMatch match = (AttributeMatch) matches[0];
- max = match.getOriginalOffset() - lineOffset;
- if (max < 0) {
- return 0;
- }
- }
- for (int i = 0; i < max; i++) {
- char ch = lineContent.charAt(i);
- if (!Character.isWhitespace(ch) || ch == '\n' || ch == '\r') {
- return i;
- }
- }
- return max;
- }
-
- private StyledString getColoredLabelWithCounts(Object element, int matchCount, StyledString coloredName) {
- String countInfo = String.format("(%s match%s)", matchCount, matchCount > 1 ? "es" : "");
- coloredName.append(' ').append(countInfo, StyledString.COUNTER_STYLER);
- return coloredName;
- }
-
- @Override
- public Image getImage(Object element) {
- Image toReturn = null;
- if (element instanceof AttributeLineElement) {
- toReturn = ImageManager.getImage(FrameworkImage.LINE_MATCH);
- } else if (element instanceof Artifact) {
- Image artImage = ArtifactImageManager.getImage((Artifact) element);
- int matchCount = getMatchCount(element);
- if (matchCount > 0) {
- toReturn = artImage;
- } else {
- Image disabledImage = disabledImageMap.get(artImage);
- if (disabledImage == null) {
- disabledImage = new Image(artImage.getDevice(), artImage, SWT.IMAGE_DISABLE);
- disabledImageMap.put(artImage, disabledImage);
- }
- toReturn = disabledImage;
- }
- }
- return toReturn;
- }
-
- private static StyledString decorateColoredString(StyledString string, String decorated, Styler color) {
- String label = string.getString();
- int originalStart = decorated.indexOf(label);
- if (originalStart == -1) {
- return new StyledString(decorated); // the decorator did something wild
- }
- if (originalStart > 0) {
- StyledString newString = new StyledString(decorated.substring(0, originalStart), color);
- newString.append(string);
- string = newString;
- }
- if (decorated.length() > originalStart + label.length()) { // decorator appended something
- return string.append(decorated.substring(originalStart + label.length()), color);
- }
- return string; // no change
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.search.page;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.StyledString;
+import org.eclipse.jface.viewers.StyledString.Styler;
+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.skynet.ArtifactDecorator;
+import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.IArtifactDecoratorPreferences;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.search.AbstractArtifactSearchResult;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.search.ui.text.Match;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ArtifactSearchLabelProvider extends LabelProvider implements IStyledLabelProvider {
+ private static final String HIGHLIGHT_BG_COLOR_NAME = "org.eclipse.jdt.ui.ColoredLabels.match_highlight"; //$NON-NLS-1$
+
+ private static final Styler HIGHLIGHT_STYLE = StyledString.createColorRegistryStyler(null, HIGHLIGHT_BG_COLOR_NAME);
+ private static final Styler DELETED_ARTIFACT_STYLE = StyledString.createColorRegistryStyler("red", null);
+
+ private static final String fgEllipses = " ... "; //$NON-NLS-1$
+
+ private final AbstractArtifactSearchViewPage fPage;
+ private final Comparator fMatchComparator;
+ private final ArtifactDecorator artifactDecorator;
+
+ private final Map<Image, Image> disabledImageMap;
+
+ public ArtifactSearchLabelProvider(AbstractArtifactSearchViewPage page, ArtifactDecorator artifactDecorator) {
+ this.artifactDecorator = artifactDecorator;
+ this.disabledImageMap = new HashMap<Image, Image>();
+ fPage = page;
+ fMatchComparator = new Comparator() {
+ public int compare(Object o1, Object o2) {
+ return ((AttributeMatch) o1).getOriginalOffset() - ((AttributeMatch) o2).getOriginalOffset();
+ }
+ };
+ }
+
+ @Override
+ public String getText(Object object) {
+ return getStyledText(object).getString();
+ }
+
+ public StyledString getStyledText(Object element) {
+ if (element instanceof AttributeLineElement) {
+ return getLineElementLabel((AttributeLineElement) element);
+ }
+
+ if (!(element instanceof Artifact)) {
+ return new StyledString(String.format("Undefined: %s %s", element.getClass(), element));
+ }
+
+ Artifact artifact = (Artifact) element;
+ String name = artifact.getName();
+ int matchCount = getMatchCount(artifact);
+ if (matchCount > 0) {
+ StyledString artifactString = getColoredLabelWithCounts(artifact, matchCount, new StyledString(name));
+ return getArtifactText(artifactDecorator, artifact, artifactString);
+ } else {
+ return new StyledString(name, StyledString.DECORATIONS_STYLER);
+ }
+ }
+
+ private int getMatchCount(Object element) {
+ AbstractArtifactSearchResult result = fPage.getInput();
+ if (result == null) {
+ return -1;
+ }
+ return result.getMatchCount(element);
+ }
+
+ private StyledString getArtifactText(IArtifactDecoratorPreferences decoration, Artifact artifact, StyledString coloredName) {
+ if (artifact.isDeleted()) {
+ coloredName.append(' ').append("<Deleted>", DELETED_ARTIFACT_STYLE);
+ }
+ if (decoration != null) {
+
+ if (decoration.showArtIds() && decoration.showArtVersion()) {
+ coloredName.append(' ').append("[" + artifact.getArtId() + " rev." + artifact.getGammaId() + "]",
+ StyledString.DECORATIONS_STYLER);
+ } else if (decoration.showArtIds() && !decoration.showArtVersion()) {
+ coloredName.append(' ').append("[id " + artifact.getArtId() + "]", StyledString.DECORATIONS_STYLER);
+ } else if (!decoration.showArtIds() && decoration.showArtVersion()) {
+ coloredName.append(' ').append("[rev." + artifact.getGammaId() + "]", StyledString.DECORATIONS_STYLER);
+ }
+
+ if (decoration.showArtType()) {
+ coloredName.append(' ').append("<" + artifact.getArtifactTypeName() + ">", StyledString.DECORATIONS_STYLER);
+ }
+
+ if (decoration.showArtBranch()) {
+ coloredName.append(' ').append("[" + artifact.getBranch().getShortName() + "]",
+ StyledString.DECORATIONS_STYLER);
+ }
+
+ try {
+ String selectedAttributes = decoration.getSelectedAttributeData(artifact);
+ if (Strings.isValid(selectedAttributes)) {
+ coloredName.append(' ').append(selectedAttributes, StyledString.DECORATIONS_STYLER);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ coloredName.append(' ').append(ex.getLocalizedMessage());
+ }
+ }
+ return coloredName;
+ }
+
+ @SuppressWarnings("unchecked")
+ private StyledString getLineElementLabel(AttributeLineElement lineElement) {
+ String lineNumberString = String.format("%s, %s ", lineElement.getLine(), lineElement.getOffset());
+ StyledString str = new StyledString(lineNumberString, StyledString.QUALIFIER_STYLER);
+
+ Match[] matches = lineElement.getMatches(fPage.getInput());
+ Arrays.sort(matches, fMatchComparator);
+
+ String content = lineElement.getContents();
+
+ int pos = evaluateLineStart(matches, content, lineElement.getOffset());
+
+ int length = content.length();
+
+ int charsToCut = getCharsToCut(length, matches); // number of characters to leave away if the line is too long
+ for (int i = 0; i < matches.length; i++) {
+ AttributeMatch match = (AttributeMatch) matches[i];
+ int start = Math.max(match.getOriginalOffset() - lineElement.getOffset(), 0);
+ // append gap between last match and the new one
+ if (pos < start) {
+ if (charsToCut > 0) {
+ charsToCut = appendShortenedGap(content, pos, start, charsToCut, i == 0, str);
+ } else {
+ str.append(content.substring(pos, start));
+ }
+ }
+ // append match
+ int end =
+ Math.min(match.getOriginalOffset() + match.getOriginalLength() - lineElement.getOffset(),
+ lineElement.getLength());
+ str.append(content.substring(start, end), HIGHLIGHT_STYLE);
+ pos = end;
+ }
+ // append rest of the line
+ if (charsToCut > 0) {
+ appendShortenedGap(content, pos, length, charsToCut, false, str);
+ } else {
+ str.append(content.substring(pos));
+ }
+ return str;
+ }
+
+ private static final int MIN_MATCH_CONTEXT = 10; // minimal number of characters shown after and before a match
+
+ private int appendShortenedGap(String content, int start, int end, int charsToCut, boolean isFirst, StyledString str) {
+ int gapLength = end - start;
+ if (!isFirst) {
+ gapLength -= MIN_MATCH_CONTEXT;
+ }
+ if (end < content.length()) {
+ gapLength -= MIN_MATCH_CONTEXT;
+ }
+ if (gapLength < MIN_MATCH_CONTEXT) { // don't cut, gap is too small
+ str.append(content.substring(start, end));
+ return charsToCut;
+ }
+
+ int context = MIN_MATCH_CONTEXT;
+ if (gapLength > charsToCut) {
+ context += gapLength - charsToCut;
+ }
+
+ if (!isFirst) {
+ str.append(content.substring(start, start + context)); // give all extra context to the right side of a match
+ context = MIN_MATCH_CONTEXT;
+ }
+
+ str.append(fgEllipses, StyledString.QUALIFIER_STYLER);
+
+ if (end < content.length()) {
+ str.append(content.substring(end - context, end));
+ }
+ return charsToCut - gapLength + fgEllipses.length();
+ }
+
+ private int getCharsToCut(int contentLength, Match[] matches) {
+ if (contentLength <= 256 || !"win32".equals(SWT.getPlatform()) || matches.length == 0) { //$NON-NLS-1$
+ return 0; // no shortening required
+ }
+ // XXX: workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=38519
+ return contentLength - 256 + Math.max(matches.length * fgEllipses.length(), 100);
+ }
+
+ private int evaluateLineStart(Match[] matches, String lineContent, int lineOffset) {
+ int max = lineContent.length();
+ if (matches.length > 0) {
+ AttributeMatch match = (AttributeMatch) matches[0];
+ max = match.getOriginalOffset() - lineOffset;
+ if (max < 0) {
+ return 0;
+ }
+ }
+ for (int i = 0; i < max; i++) {
+ char ch = lineContent.charAt(i);
+ if (!Character.isWhitespace(ch) || ch == '\n' || ch == '\r') {
+ return i;
+ }
+ }
+ return max;
+ }
+
+ private StyledString getColoredLabelWithCounts(Object element, int matchCount, StyledString coloredName) {
+ String countInfo = String.format("(%s match%s)", matchCount, matchCount > 1 ? "es" : "");
+ coloredName.append(' ').append(countInfo, StyledString.COUNTER_STYLER);
+ return coloredName;
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ Image toReturn = null;
+ if (element instanceof AttributeLineElement) {
+ toReturn = ImageManager.getImage(FrameworkImage.LINE_MATCH);
+ } else if (element instanceof Artifact) {
+ Image artImage = ArtifactImageManager.getImage((Artifact) element);
+ int matchCount = getMatchCount(element);
+ if (matchCount > 0) {
+ toReturn = artImage;
+ } else {
+ Image disabledImage = disabledImageMap.get(artImage);
+ if (disabledImage == null) {
+ disabledImage = new Image(artImage.getDevice(), artImage, SWT.IMAGE_DISABLE);
+ disabledImageMap.put(artImage, disabledImage);
+ }
+ toReturn = disabledImage;
+ }
+ }
+ return toReturn;
+ }
+
+ private static StyledString decorateColoredString(StyledString string, String decorated, Styler color) {
+ String label = string.getString();
+ int originalStart = decorated.indexOf(label);
+ if (originalStart == -1) {
+ return new StyledString(decorated); // the decorator did something wild
+ }
+ if (originalStart > 0) {
+ StyledString newString = new StyledString(decorated.substring(0, originalStart), color);
+ newString.append(string);
+ string = newString;
+ }
+ if (decorated.length() > originalStart + label.length()) { // decorator appended something
+ return string.append(decorated.substring(originalStart + label.length()), color);
+ }
+ return string; // no change
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/ArtifactSearchPage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/ArtifactSearchPage.java
index bdd7ec125bb..c295d85496b 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/ArtifactSearchPage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/ArtifactSearchPage.java
@@ -1,585 +1,585 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.search.page;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerComparator;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.IBranchProvider;
-import org.eclipse.osee.framework.skynet.core.event.FrameworkTransactionData;
-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.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.skynet.core.utility.LoadedArtifacts;
-import org.eclipse.osee.framework.ui.skynet.ArtifactDecorator;
-import org.eclipse.osee.framework.ui.skynet.ArtifactDoubleClick;
-import org.eclipse.osee.framework.ui.skynet.OseeContributionItem;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.listener.IRebuildMenuListener;
-import org.eclipse.osee.framework.ui.skynet.search.AbstractArtifactSearchResult;
-import org.eclipse.osee.framework.ui.skynet.util.SkynetDragAndDrop;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.search.ui.IContextMenuConstants;
-import org.eclipse.search.ui.ISearchResultViewPart;
-import org.eclipse.search.ui.text.Match;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PreferencesUtil;
-import org.eclipse.ui.part.IPageSite;
-
-/**
- * <REM2>
- *
- * @author Roberto E. Escobar
- */
-public class ArtifactSearchPage extends AbstractArtifactSearchViewPage implements IAdaptable, IRebuildMenuListener, IArtifactEventListener, IFrameworkTransactionEventListener, IArtifactsPurgedEventListener, IBranchProvider {
- private static final String VIEW_ID = "org.eclipse.osee.framework.ui.skynet.ArtifactSearchView";
-
- protected static final Match[] EMPTY_MATCH_ARRAY = new Match[0];
- public static class DecoratorIgnoringViewerSorter extends ViewerComparator {
- private final ILabelProvider fLabelProvider;
-
- public DecoratorIgnoringViewerSorter(ILabelProvider labelProvider) {
- fLabelProvider = labelProvider;
- }
-
- @Override
- public int category(Object element) {
- if (element instanceof Artifact) {
- return 4;
- } else if (element instanceof AttributeLineElement) {
- return 3;
- } else if (element instanceof AttributeMatch) {
- return 2;
- }
- return 1;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public int compare(Viewer viewer, Object e1, Object e2) {
- int cat1 = category(e1);
- int cat2 = category(e2);
-
- if (cat1 != cat2) {
- return cat1 - cat2;
- }
-
- if (e1 instanceof AttributeLineElement && e2 instanceof AttributeLineElement) {
- AttributeLineElement m1 = (AttributeLineElement) e1;
- AttributeLineElement m2 = (AttributeLineElement) e2;
- return m1.getOffset() - m2.getOffset();
- }
-
- String name1 = fLabelProvider.getText(e1);
- String name2 = fLabelProvider.getText(e2);
- if (name1 == null) {
- name1 = "";//$NON-NLS-1$
- }
- if (name2 == null) {
- name2 = "";//$NON-NLS-1$
- }
- return getComparator().compare(name1, name2);
- }
- }
-
- private static final String KEY_LIMIT = "org.eclipse.search.resultpage.limit"; //$NON-NLS-1$
- private static final int DEFAULT_ELEMENT_LIMIT = 1000;
-
- private IArtifactSearchContentProvider fContentProvider;
- private ISelectionProvider selectionProvider;
- private final ArtifactDecorator artifactDecorator = new ArtifactDecorator(
- SkynetGuiPlugin.ARTIFACT_SEARCH_RESULTS_ATTRIBUTES_PREF);
-
- public ArtifactSearchPage() {
- setElementLimit(new Integer(DEFAULT_ELEMENT_LIMIT));
- }
-
- @Override
- public void setElementLimit(Integer elementLimit) {
- super.setElementLimit(elementLimit);
- int limit = elementLimit.intValue();
- getSettings().put(KEY_LIMIT, limit);
- }
-
- @Override
- public StructuredViewer getViewer() {
- return super.getViewer();
- }
-
- private void addDragAdapters(StructuredViewer viewer) {
- new SearchDragAndDrop(viewer.getControl(), VIEW_ID);
- }
-
- @Override
- public void createControl(Composite parent) {
- super.createControl(parent);
- artifactDecorator.addActions(getSite().getActionBars().getMenuManager(), this);
- }
-
- private ISelectionProvider getSearchSelectionProvider() {
- if (selectionProvider == null) {
- selectionProvider = new SearchSelectionProvider();
- }
- return selectionProvider;
- }
-
- @Override
- protected void configureTableViewer(TableViewer viewer) {
- viewer.setUseHashlookup(true);
- artifactDecorator.setViewer(viewer);
-
- ArtifactSearchLabelProvider innerLabelProvider = new ArtifactSearchLabelProvider(this, artifactDecorator);
- viewer.setLabelProvider(new DecoratingArtifactSearchLabelProvider(innerLabelProvider));
- viewer.setContentProvider(new ArtifactTableContentProvider(this));
- viewer.setComparator(new DecoratorIgnoringViewerSorter(innerLabelProvider));
- fContentProvider = (IArtifactSearchContentProvider) viewer.getContentProvider();
- addDragAdapters(viewer);
- }
-
- @Override
- protected void configureTreeViewer(TreeViewer viewer) {
- viewer.setUseHashlookup(true);
- artifactDecorator.setViewer(viewer);
-
- ArtifactSearchLabelProvider innerLabelProvider = new ArtifactSearchLabelProvider(this, artifactDecorator);
- viewer.setLabelProvider(new DecoratingArtifactSearchLabelProvider(innerLabelProvider));
- viewer.setContentProvider(new ArtifactTreeContentProvider(this, viewer));
- viewer.setComparator(new DecoratorIgnoringViewerSorter(innerLabelProvider));
- fContentProvider = (IArtifactSearchContentProvider) viewer.getContentProvider();
- addDragAdapters(viewer);
- }
-
- @Override
- protected void fillContextMenu(IMenuManager mgr) {
- mgr.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- getSite().setSelectionProvider(getSearchSelectionProvider());
-
- mgr.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, new Action("Open Search Preferences") {
- @Override
- public void run() {
- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- PreferencesUtil.createPreferenceDialogOn(shell, "org.eclipse.search.preferences.SearchPreferencePage",
- null, null).open();
- }
- });
- }
-
- @Override
- public void setViewPart(ISearchResultViewPart part) {
- super.setViewPart(part);
- }
-
- @Override
- public void init(IPageSite site) {
- super.init(site);
- setID(VIEW_ID);
- OseeContributionItem.addTo(getSite(), false);
- getSite().getActionBars().updateActionBars();
- OseeEventManager.addListener(this);
- }
-
- @Override
- public void dispose() {
- OseeEventManager.removeListener(this);
- super.dispose();
- }
-
- @Override
- protected void elementsChanged(Object[] objects) {
- if (fContentProvider != null) {
- fContentProvider.elementsChanged(objects);
- }
- }
-
- @Override
- protected void clear() {
- if (fContentProvider != null) {
- fContentProvider.clear();
- }
- }
-
- @Override
- public void restoreState(IMemento memento) {
- super.restoreState(memento);
-
- int elementLimit = DEFAULT_ELEMENT_LIMIT;
- try {
- elementLimit = getSettings().getInt(KEY_LIMIT);
- } catch (NumberFormatException e) {
- }
- if (memento != null) {
- Integer value = memento.getInteger(KEY_LIMIT);
- if (value != null) {
- elementLimit = value.intValue();
- }
- }
- setElementLimit(new Integer(elementLimit));
- }
-
- @Override
- public void saveState(IMemento memento) {
- super.saveState(memento);
- memento.putInteger(KEY_LIMIT, getElementLimit().intValue());
- }
-
- @SuppressWarnings("rawtypes")
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- @Override
- public String getLabel() {
- String label = super.getLabel();
- StructuredViewer viewer = getViewer();
- if (viewer instanceof TableViewer) {
- TableViewer tv = (TableViewer) viewer;
-
- AbstractArtifactSearchResult result = getInput();
- if (result != null) {
- int itemCount = ((IStructuredContentProvider) tv.getContentProvider()).getElements(getInput()).length;
- if (showLineMatches()) {
- int matchCount = getInput().getMatchCount();
- if (itemCount < matchCount) {
- return String.format("%s (showing %s of %s matches)", label, itemCount, matchCount);
- }
- } else {
- int fileCount = getInput().getElements().length;
- if (itemCount < fileCount) {
- return String.format("%s (showing %s of %s files)", label, itemCount, fileCount);
- }
- }
- }
- }
- return label;
- }
-
- @Override
- public int getDisplayedMatchCount(Object element) {
- if (showLineMatches()) {
- if (element instanceof AttributeLineElement) {
- AttributeLineElement lineEntry = (AttributeLineElement) element;
- return lineEntry.getNumberOfMatches(getInput());
- }
- return 0;
- }
- return super.getDisplayedMatchCount(element);
- }
-
- @Override
- public Match[] getDisplayedMatches(Object element) {
- if (showLineMatches()) {
- if (element instanceof AttributeLineElement) {
- AttributeLineElement lineEntry = (AttributeLineElement) element;
- return lineEntry.getMatches(getInput());
- }
- return new Match[0];
- }
- return getInternalDisplayedMatches(element);
- }
-
- public Match[] getInternalDisplayedMatches(Object element) {
- AbstractArtifactSearchResult result = getInput();
- if (result == null) {
- return EMPTY_MATCH_ARRAY;
- }
- Match[] matches = result.getMatches(element);
- if (result.getActiveMatchFilters() == null) {
- return matches;
- }
-
- int count = 0;
- for (int i = 0; i < matches.length; i++) {
- if (matches[i].isFiltered()) {
- matches[i] = null;
- } else {
- count++;
- }
- }
- if (count == matches.length) {
- return matches;
- }
-
- Match[] filteredMatches = new Match[count];
- for (int i = 0, k = 0; i < matches.length; i++) {
- if (matches[i] != null) {
- filteredMatches[k++] = matches[i];
- }
- }
- return filteredMatches;
- }
-
- @Override
- @SuppressWarnings({"unchecked", "rawtypes"})
- protected void evaluateChangedElements(Match[] matches, Set changedElements) {
- if (showLineMatches()) {
- for (int i = 0; i < matches.length; i++) {
- if (matches[i] instanceof AttributeMatch) {
- changedElements.add(((AttributeMatch) matches[i]).getLineElement());
- } else {
- changedElements.add(matches[i].getElement());
- }
- }
- } else {
- evaluateInternalChangedElements(matches, changedElements);
- }
- }
-
- @SuppressWarnings({"unchecked", "rawtypes"})
- protected void evaluateInternalChangedElements(Match[] matches, Set changedElements) {
- for (int i = 0; i < matches.length; i++) {
- changedElements.add(matches[i].getElement());
- }
- }
-
- @Override
- protected void handleOpen(OpenEvent event) {
- ArtifactDoubleClick.openArtifact(getSearchSelectionProvider().getSelection());
- }
-
- private boolean showLineMatches() {
- AbstractArtifactSearchResult input = getInput();
- return getLayout() == FLAG_LAYOUT_TREE && input != null && input.hasAttributeMatches();
- }
-
- private Collection<Artifact> getSelectedArtifacts() {
- IStructuredSelection selection = (IStructuredSelection) getViewer().getSelection();
-
- Object[] objects = selection.toArray();
- if (objects.length == 0) {
- return Collections.emptyList();
- }
-
- AbstractArtifactSearchResult resultInput = getInput();
- if (resultInput == null) {
- return Collections.emptyList();
- }
-
- Set<Artifact> artifacts = new HashSet<Artifact>();
- for (Object object : objects) {
- Artifact toAdd = null;
- if (object instanceof AttributeLineElement) {
- toAdd = (Artifact) ((IAdaptable) object).getAdapter(Artifact.class);
- artifacts.add(toAdd);
- } else if (object instanceof IAdaptable) {
- toAdd = (Artifact) ((IAdaptable) object).getAdapter(Artifact.class);
- } else if (object instanceof Match) {
- toAdd = (Artifact) ((Match) object).getElement();
- }
- if (toAdd != null) {
- artifacts.add(toAdd);
- }
- }
- return artifacts;
- }
- private class SearchDragAndDrop extends SkynetDragAndDrop {
-
- public SearchDragAndDrop(Control control, String viewId) {
- super(control, viewId);
- }
-
- @Override
- public Artifact[] getArtifacts() {
- Collection<Artifact> artifacts = getSelectedArtifacts();
- return artifacts.toArray(new Artifact[artifacts.size()]);
- }
-
- @Override
- public void performDragOver(DropTargetEvent event) {
- event.detail = DND.DROP_NONE;
- }
- }
-
- @Override
- public void rebuildMenu() {
- // Do Nothing
- }
-
- @Override
- public void handleFrameworkTransactionEvent(final Sender sender, final FrameworkTransactionData transData) throws OseeCoreException {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (getViewer() != null) {
- AbstractArtifactSearchResult results = getInput();
- if (results != null) {
- for (Artifact artifact : transData.cacheDeletedArtifacts) {
- for (Match match : results.getMatches(artifact)) {
- results.removeMatch(match);
- }
- }
- getViewer().refresh();
- }
- }
- }
- });
-
- }
-
- @Override
- public void handleArtifactsPurgedEvent(Sender sender, final LoadedArtifacts loadedArtifacts) throws OseeCoreException {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- try {
- if (getViewer() != null) {
- AbstractArtifactSearchResult results = getInput();
- if (results != null) {
- for (Artifact artifact : loadedArtifacts.getLoadedArtifacts()) {
- for (Match match : results.getMatches(artifact)) {
- results.removeMatch(match);
- }
- }
- getViewer().refresh();
- }
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- });
-
- }
-
- private class SearchSelectionProvider implements ISelectionProvider {
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
-
- }
-
- public ISelection getSelection() {
- return new ArtifactSelection(getSelectedArtifacts());
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
-
- }
-
- public void setSelection(ISelection selection) {
-
- }
- }
-
- public Branch getBranch(IProgressMonitor monitor) {
- if (getInput() != null && getInput().getArtifactResults() != null && !getInput().getArtifactResults().isEmpty()) {
- return getInput().getArtifactResults().get(0).getBranch();
- }
- return null;
- }
-
- private final class ArtifactSelection implements IStructuredSelection {
- private final Collection<Artifact> collection;
-
- private ArtifactSelection(Collection<Artifact> collection) {
- this.collection = collection;
- }
-
- @Override
- public boolean isEmpty() {
- return collection.isEmpty();
- }
-
- @Override
- public Object getFirstElement() {
- return collection.isEmpty() ? null : iterator().next();
- }
-
- @SuppressWarnings("rawtypes")
- @Override
- public Iterator iterator() {
- return collection.iterator();
- }
-
- @Override
- public int size() {
- return collection.size();
- }
-
- @Override
- public Object[] toArray() {
- return collection.toArray();
- }
-
- @SuppressWarnings("rawtypes")
- @Override
- public List toList() {
- return new ArrayList<Artifact>(collection);
- }
- }
-
- @Override
- public List<? extends IEventFilter> getEventFilters() {
- return null;
- }
-
- @Override
- public void handleArtifactEvent(ArtifactEvent artifactEvent, Sender sender) {
- final Collection<EventBasicGuidArtifact> deletedPurgedArts =
- artifactEvent.get(EventModType.Deleted, EventModType.Purged);
- if (deletedPurgedArts.isEmpty()) {
- return;
- }
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (getViewer() != null) {
- AbstractArtifactSearchResult results = getInput();
- if (results != null) {
- for (EventBasicGuidArtifact guidArt : deletedPurgedArts) {
- for (Match match : results.getMatches(guidArt)) {
- results.removeMatch(match);
- }
- }
- getViewer().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.framework.ui.skynet.search.page;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.OpenEvent;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.IBranchProvider;
+import org.eclipse.osee.framework.skynet.core.event.FrameworkTransactionData;
+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.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.skynet.core.utility.LoadedArtifacts;
+import org.eclipse.osee.framework.ui.skynet.ArtifactDecorator;
+import org.eclipse.osee.framework.ui.skynet.ArtifactDoubleClick;
+import org.eclipse.osee.framework.ui.skynet.OseeContributionItem;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.listener.IRebuildMenuListener;
+import org.eclipse.osee.framework.ui.skynet.search.AbstractArtifactSearchResult;
+import org.eclipse.osee.framework.ui.skynet.util.SkynetDragAndDrop;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.search.ui.IContextMenuConstants;
+import org.eclipse.search.ui.ISearchResultViewPart;
+import org.eclipse.search.ui.text.Match;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.eclipse.ui.part.IPageSite;
+
+/**
+ * <REM2>
+ *
+ * @author Roberto E. Escobar
+ */
+public class ArtifactSearchPage extends AbstractArtifactSearchViewPage implements IAdaptable, IRebuildMenuListener, IArtifactEventListener, IFrameworkTransactionEventListener, IArtifactsPurgedEventListener, IBranchProvider {
+ private static final String VIEW_ID = "org.eclipse.osee.framework.ui.skynet.ArtifactSearchView";
+
+ protected static final Match[] EMPTY_MATCH_ARRAY = new Match[0];
+ public static class DecoratorIgnoringViewerSorter extends ViewerComparator {
+ private final ILabelProvider fLabelProvider;
+
+ public DecoratorIgnoringViewerSorter(ILabelProvider labelProvider) {
+ fLabelProvider = labelProvider;
+ }
+
+ @Override
+ public int category(Object element) {
+ if (element instanceof Artifact) {
+ return 4;
+ } else if (element instanceof AttributeLineElement) {
+ return 3;
+ } else if (element instanceof AttributeMatch) {
+ return 2;
+ }
+ return 1;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ int cat1 = category(e1);
+ int cat2 = category(e2);
+
+ if (cat1 != cat2) {
+ return cat1 - cat2;
+ }
+
+ if (e1 instanceof AttributeLineElement && e2 instanceof AttributeLineElement) {
+ AttributeLineElement m1 = (AttributeLineElement) e1;
+ AttributeLineElement m2 = (AttributeLineElement) e2;
+ return m1.getOffset() - m2.getOffset();
+ }
+
+ String name1 = fLabelProvider.getText(e1);
+ String name2 = fLabelProvider.getText(e2);
+ if (name1 == null) {
+ name1 = "";//$NON-NLS-1$
+ }
+ if (name2 == null) {
+ name2 = "";//$NON-NLS-1$
+ }
+ return getComparator().compare(name1, name2);
+ }
+ }
+
+ private static final String KEY_LIMIT = "org.eclipse.search.resultpage.limit"; //$NON-NLS-1$
+ private static final int DEFAULT_ELEMENT_LIMIT = 1000;
+
+ private IArtifactSearchContentProvider fContentProvider;
+ private ISelectionProvider selectionProvider;
+ private final ArtifactDecorator artifactDecorator = new ArtifactDecorator(
+ SkynetGuiPlugin.ARTIFACT_SEARCH_RESULTS_ATTRIBUTES_PREF);
+
+ public ArtifactSearchPage() {
+ setElementLimit(new Integer(DEFAULT_ELEMENT_LIMIT));
+ }
+
+ @Override
+ public void setElementLimit(Integer elementLimit) {
+ super.setElementLimit(elementLimit);
+ int limit = elementLimit.intValue();
+ getSettings().put(KEY_LIMIT, limit);
+ }
+
+ @Override
+ public StructuredViewer getViewer() {
+ return super.getViewer();
+ }
+
+ private void addDragAdapters(StructuredViewer viewer) {
+ new SearchDragAndDrop(viewer.getControl(), VIEW_ID);
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ super.createControl(parent);
+ artifactDecorator.addActions(getSite().getActionBars().getMenuManager(), this);
+ }
+
+ private ISelectionProvider getSearchSelectionProvider() {
+ if (selectionProvider == null) {
+ selectionProvider = new SearchSelectionProvider();
+ }
+ return selectionProvider;
+ }
+
+ @Override
+ protected void configureTableViewer(TableViewer viewer) {
+ viewer.setUseHashlookup(true);
+ artifactDecorator.setViewer(viewer);
+
+ ArtifactSearchLabelProvider innerLabelProvider = new ArtifactSearchLabelProvider(this, artifactDecorator);
+ viewer.setLabelProvider(new DecoratingArtifactSearchLabelProvider(innerLabelProvider));
+ viewer.setContentProvider(new ArtifactTableContentProvider(this));
+ viewer.setComparator(new DecoratorIgnoringViewerSorter(innerLabelProvider));
+ fContentProvider = (IArtifactSearchContentProvider) viewer.getContentProvider();
+ addDragAdapters(viewer);
+ }
+
+ @Override
+ protected void configureTreeViewer(TreeViewer viewer) {
+ viewer.setUseHashlookup(true);
+ artifactDecorator.setViewer(viewer);
+
+ ArtifactSearchLabelProvider innerLabelProvider = new ArtifactSearchLabelProvider(this, artifactDecorator);
+ viewer.setLabelProvider(new DecoratingArtifactSearchLabelProvider(innerLabelProvider));
+ viewer.setContentProvider(new ArtifactTreeContentProvider(this, viewer));
+ viewer.setComparator(new DecoratorIgnoringViewerSorter(innerLabelProvider));
+ fContentProvider = (IArtifactSearchContentProvider) viewer.getContentProvider();
+ addDragAdapters(viewer);
+ }
+
+ @Override
+ protected void fillContextMenu(IMenuManager mgr) {
+ mgr.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ getSite().setSelectionProvider(getSearchSelectionProvider());
+
+ mgr.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, new Action("Open Search Preferences") {
+ @Override
+ public void run() {
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ PreferencesUtil.createPreferenceDialogOn(shell, "org.eclipse.search.preferences.SearchPreferencePage",
+ null, null).open();
+ }
+ });
+ }
+
+ @Override
+ public void setViewPart(ISearchResultViewPart part) {
+ super.setViewPart(part);
+ }
+
+ @Override
+ public void init(IPageSite site) {
+ super.init(site);
+ setID(VIEW_ID);
+ OseeContributionItem.addTo(getSite(), false);
+ getSite().getActionBars().updateActionBars();
+ OseeEventManager.addListener(this);
+ }
+
+ @Override
+ public void dispose() {
+ OseeEventManager.removeListener(this);
+ super.dispose();
+ }
+
+ @Override
+ protected void elementsChanged(Object[] objects) {
+ if (fContentProvider != null) {
+ fContentProvider.elementsChanged(objects);
+ }
+ }
+
+ @Override
+ protected void clear() {
+ if (fContentProvider != null) {
+ fContentProvider.clear();
+ }
+ }
+
+ @Override
+ public void restoreState(IMemento memento) {
+ super.restoreState(memento);
+
+ int elementLimit = DEFAULT_ELEMENT_LIMIT;
+ try {
+ elementLimit = getSettings().getInt(KEY_LIMIT);
+ } catch (NumberFormatException e) {
+ }
+ if (memento != null) {
+ Integer value = memento.getInteger(KEY_LIMIT);
+ if (value != null) {
+ elementLimit = value.intValue();
+ }
+ }
+ setElementLimit(new Integer(elementLimit));
+ }
+
+ @Override
+ public void saveState(IMemento memento) {
+ super.saveState(memento);
+ memento.putInteger(KEY_LIMIT, getElementLimit().intValue());
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+ @Override
+ public String getLabel() {
+ String label = super.getLabel();
+ StructuredViewer viewer = getViewer();
+ if (viewer instanceof TableViewer) {
+ TableViewer tv = (TableViewer) viewer;
+
+ AbstractArtifactSearchResult result = getInput();
+ if (result != null) {
+ int itemCount = ((IStructuredContentProvider) tv.getContentProvider()).getElements(getInput()).length;
+ if (showLineMatches()) {
+ int matchCount = getInput().getMatchCount();
+ if (itemCount < matchCount) {
+ return String.format("%s (showing %s of %s matches)", label, itemCount, matchCount);
+ }
+ } else {
+ int fileCount = getInput().getElements().length;
+ if (itemCount < fileCount) {
+ return String.format("%s (showing %s of %s files)", label, itemCount, fileCount);
+ }
+ }
+ }
+ }
+ return label;
+ }
+
+ @Override
+ public int getDisplayedMatchCount(Object element) {
+ if (showLineMatches()) {
+ if (element instanceof AttributeLineElement) {
+ AttributeLineElement lineEntry = (AttributeLineElement) element;
+ return lineEntry.getNumberOfMatches(getInput());
+ }
+ return 0;
+ }
+ return super.getDisplayedMatchCount(element);
+ }
+
+ @Override
+ public Match[] getDisplayedMatches(Object element) {
+ if (showLineMatches()) {
+ if (element instanceof AttributeLineElement) {
+ AttributeLineElement lineEntry = (AttributeLineElement) element;
+ return lineEntry.getMatches(getInput());
+ }
+ return new Match[0];
+ }
+ return getInternalDisplayedMatches(element);
+ }
+
+ public Match[] getInternalDisplayedMatches(Object element) {
+ AbstractArtifactSearchResult result = getInput();
+ if (result == null) {
+ return EMPTY_MATCH_ARRAY;
+ }
+ Match[] matches = result.getMatches(element);
+ if (result.getActiveMatchFilters() == null) {
+ return matches;
+ }
+
+ int count = 0;
+ for (int i = 0; i < matches.length; i++) {
+ if (matches[i].isFiltered()) {
+ matches[i] = null;
+ } else {
+ count++;
+ }
+ }
+ if (count == matches.length) {
+ return matches;
+ }
+
+ Match[] filteredMatches = new Match[count];
+ for (int i = 0, k = 0; i < matches.length; i++) {
+ if (matches[i] != null) {
+ filteredMatches[k++] = matches[i];
+ }
+ }
+ return filteredMatches;
+ }
+
+ @Override
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ protected void evaluateChangedElements(Match[] matches, Set changedElements) {
+ if (showLineMatches()) {
+ for (int i = 0; i < matches.length; i++) {
+ if (matches[i] instanceof AttributeMatch) {
+ changedElements.add(((AttributeMatch) matches[i]).getLineElement());
+ } else {
+ changedElements.add(matches[i].getElement());
+ }
+ }
+ } else {
+ evaluateInternalChangedElements(matches, changedElements);
+ }
+ }
+
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ protected void evaluateInternalChangedElements(Match[] matches, Set changedElements) {
+ for (int i = 0; i < matches.length; i++) {
+ changedElements.add(matches[i].getElement());
+ }
+ }
+
+ @Override
+ protected void handleOpen(OpenEvent event) {
+ ArtifactDoubleClick.openArtifact(getSearchSelectionProvider().getSelection());
+ }
+
+ private boolean showLineMatches() {
+ AbstractArtifactSearchResult input = getInput();
+ return getLayout() == FLAG_LAYOUT_TREE && input != null && input.hasAttributeMatches();
+ }
+
+ private Collection<Artifact> getSelectedArtifacts() {
+ IStructuredSelection selection = (IStructuredSelection) getViewer().getSelection();
+
+ Object[] objects = selection.toArray();
+ if (objects.length == 0) {
+ return Collections.emptyList();
+ }
+
+ AbstractArtifactSearchResult resultInput = getInput();
+ if (resultInput == null) {
+ return Collections.emptyList();
+ }
+
+ Set<Artifact> artifacts = new HashSet<Artifact>();
+ for (Object object : objects) {
+ Artifact toAdd = null;
+ if (object instanceof AttributeLineElement) {
+ toAdd = (Artifact) ((IAdaptable) object).getAdapter(Artifact.class);
+ artifacts.add(toAdd);
+ } else if (object instanceof IAdaptable) {
+ toAdd = (Artifact) ((IAdaptable) object).getAdapter(Artifact.class);
+ } else if (object instanceof Match) {
+ toAdd = (Artifact) ((Match) object).getElement();
+ }
+ if (toAdd != null) {
+ artifacts.add(toAdd);
+ }
+ }
+ return artifacts;
+ }
+ private class SearchDragAndDrop extends SkynetDragAndDrop {
+
+ public SearchDragAndDrop(Control control, String viewId) {
+ super(control, viewId);
+ }
+
+ @Override
+ public Artifact[] getArtifacts() {
+ Collection<Artifact> artifacts = getSelectedArtifacts();
+ return artifacts.toArray(new Artifact[artifacts.size()]);
+ }
+
+ @Override
+ public void performDragOver(DropTargetEvent event) {
+ event.detail = DND.DROP_NONE;
+ }
+ }
+
+ @Override
+ public void rebuildMenu() {
+ // Do Nothing
+ }
+
+ @Override
+ public void handleFrameworkTransactionEvent(final Sender sender, final FrameworkTransactionData transData) throws OseeCoreException {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (getViewer() != null) {
+ AbstractArtifactSearchResult results = getInput();
+ if (results != null) {
+ for (Artifact artifact : transData.cacheDeletedArtifacts) {
+ for (Match match : results.getMatches(artifact)) {
+ results.removeMatch(match);
+ }
+ }
+ getViewer().refresh();
+ }
+ }
+ }
+ });
+
+ }
+
+ @Override
+ public void handleArtifactsPurgedEvent(Sender sender, final LoadedArtifacts loadedArtifacts) throws OseeCoreException {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ if (getViewer() != null) {
+ AbstractArtifactSearchResult results = getInput();
+ if (results != null) {
+ for (Artifact artifact : loadedArtifacts.getLoadedArtifacts()) {
+ for (Match match : results.getMatches(artifact)) {
+ results.removeMatch(match);
+ }
+ }
+ getViewer().refresh();
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ });
+
+ }
+
+ private class SearchSelectionProvider implements ISelectionProvider {
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+
+ }
+
+ public ISelection getSelection() {
+ return new ArtifactSelection(getSelectedArtifacts());
+ }
+
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {
+
+ }
+
+ public void setSelection(ISelection selection) {
+
+ }
+ }
+
+ public Branch getBranch(IProgressMonitor monitor) {
+ if (getInput() != null && getInput().getArtifactResults() != null && !getInput().getArtifactResults().isEmpty()) {
+ return getInput().getArtifactResults().get(0).getBranch();
+ }
+ return null;
+ }
+
+ private final class ArtifactSelection implements IStructuredSelection {
+ private final Collection<Artifact> collection;
+
+ private ArtifactSelection(Collection<Artifact> collection) {
+ this.collection = collection;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return collection.isEmpty();
+ }
+
+ @Override
+ public Object getFirstElement() {
+ return collection.isEmpty() ? null : iterator().next();
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Iterator iterator() {
+ return collection.iterator();
+ }
+
+ @Override
+ public int size() {
+ return collection.size();
+ }
+
+ @Override
+ public Object[] toArray() {
+ return collection.toArray();
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public List toList() {
+ return new ArrayList<Artifact>(collection);
+ }
+ }
+
+ @Override
+ public List<? extends IEventFilter> getEventFilters() {
+ return null;
+ }
+
+ @Override
+ public void handleArtifactEvent(ArtifactEvent artifactEvent, Sender sender) {
+ final Collection<EventBasicGuidArtifact> deletedPurgedArts =
+ artifactEvent.get(EventModType.Deleted, EventModType.Purged);
+ if (deletedPurgedArts.isEmpty()) {
+ return;
+ }
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (getViewer() != null) {
+ AbstractArtifactSearchResult results = getInput();
+ if (results != null) {
+ for (EventBasicGuidArtifact guidArt : deletedPurgedArts) {
+ for (Match match : results.getMatches(guidArt)) {
+ results.removeMatch(match);
+ }
+ }
+ getViewer().refresh();
+ }
+ }
+ }
+ });
+
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/ArtifactTableContentProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/ArtifactTableContentProvider.java
index b4c9969181a..d7d43fee16b 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/ArtifactTableContentProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/ArtifactTableContentProvider.java
@@ -1,83 +1,83 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.search.page;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.osee.framework.ui.skynet.search.AbstractArtifactSearchResult;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ArtifactTableContentProvider implements IStructuredContentProvider, IArtifactSearchContentProvider {
-
- private final Object[] EMPTY_ARR = new Object[0];
-
- private ArtifactSearchPage fPage;
- private AbstractArtifactSearchResult fResult;
-
- public ArtifactTableContentProvider(ArtifactSearchPage page) {
- fPage = page;
- }
-
- public void dispose() {
- // nothing to do
- }
-
- public Object[] getElements(Object inputElement) {
- if (inputElement instanceof AbstractArtifactSearchResult) {
- int elementLimit = getElementLimit();
- Object[] elements = ((AbstractArtifactSearchResult) inputElement).getElements();
- if (elementLimit != -1 && elements.length > elementLimit) {
- Object[] shownElements = new Object[elementLimit];
- System.arraycopy(elements, 0, shownElements, 0, elementLimit);
- return shownElements;
- }
- return elements;
- }
- return EMPTY_ARR;
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (newInput instanceof AbstractArtifactSearchResult) {
- fResult = (AbstractArtifactSearchResult) newInput;
- }
- }
-
- public void elementsChanged(Object[] updatedElements) {
- TableViewer viewer = getViewer();
- int elementLimit = getElementLimit();
- boolean tableLimited = elementLimit != -1;
- for (int i = 0; i < updatedElements.length; i++) {
- if (fResult.getMatchCount(updatedElements[i]) > 0) {
- if (viewer.testFindItem(updatedElements[i]) != null)
- viewer.update(updatedElements[i], null);
- else {
- if (!tableLimited || viewer.getTable().getItemCount() < elementLimit) viewer.add(updatedElements[i]);
- }
- } else
- viewer.remove(updatedElements[i]);
- }
- }
-
- private int getElementLimit() {
- return fPage.getElementLimit().intValue();
- }
-
- private TableViewer getViewer() {
- return (TableViewer) fPage.getViewer();
- }
-
- public void clear() {
- getViewer().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.framework.ui.skynet.search.page;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.osee.framework.ui.skynet.search.AbstractArtifactSearchResult;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ArtifactTableContentProvider implements IStructuredContentProvider, IArtifactSearchContentProvider {
+
+ private final Object[] EMPTY_ARR = new Object[0];
+
+ private ArtifactSearchPage fPage;
+ private AbstractArtifactSearchResult fResult;
+
+ public ArtifactTableContentProvider(ArtifactSearchPage page) {
+ fPage = page;
+ }
+
+ public void dispose() {
+ // nothing to do
+ }
+
+ public Object[] getElements(Object inputElement) {
+ if (inputElement instanceof AbstractArtifactSearchResult) {
+ int elementLimit = getElementLimit();
+ Object[] elements = ((AbstractArtifactSearchResult) inputElement).getElements();
+ if (elementLimit != -1 && elements.length > elementLimit) {
+ Object[] shownElements = new Object[elementLimit];
+ System.arraycopy(elements, 0, shownElements, 0, elementLimit);
+ return shownElements;
+ }
+ return elements;
+ }
+ return EMPTY_ARR;
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ if (newInput instanceof AbstractArtifactSearchResult) {
+ fResult = (AbstractArtifactSearchResult) newInput;
+ }
+ }
+
+ public void elementsChanged(Object[] updatedElements) {
+ TableViewer viewer = getViewer();
+ int elementLimit = getElementLimit();
+ boolean tableLimited = elementLimit != -1;
+ for (int i = 0; i < updatedElements.length; i++) {
+ if (fResult.getMatchCount(updatedElements[i]) > 0) {
+ if (viewer.testFindItem(updatedElements[i]) != null)
+ viewer.update(updatedElements[i], null);
+ else {
+ if (!tableLimited || viewer.getTable().getItemCount() < elementLimit) viewer.add(updatedElements[i]);
+ }
+ } else
+ viewer.remove(updatedElements[i]);
+ }
+ }
+
+ private int getElementLimit() {
+ return fPage.getElementLimit().intValue();
+ }
+
+ private TableViewer getViewer() {
+ return (TableViewer) fPage.getViewer();
+ }
+
+ public void clear() {
+ getViewer().refresh();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/ArtifactTreeContentProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/ArtifactTreeContentProvider.java
index 1d7c64acda1..d39134a5aed 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/ArtifactTreeContentProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/ArtifactTreeContentProvider.java
@@ -1,239 +1,239 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.search.page;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-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.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.search.AbstractArtifactSearchResult;
-import org.eclipse.search.ui.text.Match;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ArtifactTreeContentProvider implements ITreeContentProvider, IArtifactSearchContentProvider {
-
- private final Object[] EMPTY_ARR = new Object[0];
-
- private AbstractArtifactSearchResult fResult;
- private ArtifactSearchPage fPage;
- private AbstractTreeViewer fTreeViewer;
- @SuppressWarnings("unchecked")
- private Map fChildrenMap;
-
- ArtifactTreeContentProvider(ArtifactSearchPage page, AbstractTreeViewer viewer) {
- fPage = page;
- fTreeViewer = viewer;
- }
-
- public Object[] getElements(Object inputElement) {
- Object[] children = getChildren(inputElement);
- int elementLimit = getElementLimit();
- if (elementLimit != -1 && elementLimit < children.length) {
- Object[] limitedChildren = new Object[elementLimit];
- System.arraycopy(children, 0, limitedChildren, 0, elementLimit);
- return limitedChildren;
- }
- return children;
- }
-
- private int getElementLimit() {
- return fPage.getElementLimit().intValue();
- }
-
- public void dispose() {
- // nothing to do
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (newInput instanceof AbstractArtifactSearchResult) {
- initialize((AbstractArtifactSearchResult) newInput);
- }
- }
-
- @SuppressWarnings("unchecked")
- private synchronized void initialize(AbstractArtifactSearchResult result) {
- fResult = result;
- fChildrenMap = new HashMap();
- boolean showLineMatches = fResult.hasAttributeMatches();
-
- if (result != null) {
- Object[] elements = result.getElements();
- for (int i = 0; i < elements.length; i++) {
- if (showLineMatches) {
- Match[] matches = result.getMatches(elements[i]);
- for (int j = 0; j < matches.length; j++) {
- Match match = matches[j];
- if (match instanceof AttributeMatch) {
- insert(((AttributeMatch) match).getLineElement(), false);
- } else {
- insert(match.getElement(), false);
- }
- }
- } else {
- insert(elements[i], false);
- }
- }
- }
- }
-
- private void insert(Object child, boolean refreshViewer) {
- Object parent = getParent(child);
- while (parent != null) {
- if (insertChild(parent, child)) {
- if (refreshViewer) {
- fTreeViewer.add(parent, child);
- }
- } else {
- if (refreshViewer) {
- fTreeViewer.refresh(parent);
- }
- return;
- }
- child = parent;
- parent = getParent(child);
- }
- if (insertChild(fResult, child)) {
- if (refreshViewer) {
- fTreeViewer.add(fResult, child);
- }
- }
- }
-
- /**
- * returns true if the child already was a child of parent.
- *
- * @param parent
- * @param child
- * @return Returns <code>true</code> if the child was added
- */
- @SuppressWarnings("unchecked")
- private boolean insertChild(Object parent, Object child) {
- Set children = (Set) fChildrenMap.get(parent);
- if (children == null) {
- children = new HashSet();
- fChildrenMap.put(parent, children);
- }
- return children.add(child);
- }
-
- @SuppressWarnings("unchecked")
- private boolean hasChild(Object parent, Object child) {
- Set children = (Set) fChildrenMap.get(parent);
- return children != null && children.contains(child);
- }
-
- private void remove(Object element, boolean refreshViewer) {
- if (hasChildren(element)) {
- if (refreshViewer) fTreeViewer.refresh(element);
- } else {
- if (!hasMatches(element)) {
- fChildrenMap.remove(element);
- Object parent = getParent(element);
- if (parent != null) {
- removeFromSiblings(element, parent);
- remove(parent, refreshViewer);
- } else {
- removeFromSiblings(element, fResult);
- if (refreshViewer) fTreeViewer.refresh();
- }
- } else {
- if (refreshViewer) {
- fTreeViewer.refresh(element);
- }
- }
- }
- }
-
- private boolean hasMatches(Object element) {
- if (element instanceof AttributeLineElement) {
- AttributeLineElement lineElement = (AttributeLineElement) element;
- return lineElement.getNumberOfMatches(fResult) > 0;
- }
- return fResult.getMatchCount(element) > 0;
- }
-
- @SuppressWarnings("unchecked")
- private void removeFromSiblings(Object element, Object parent) {
- Set siblings = (Set) fChildrenMap.get(parent);
- if (siblings != null) {
- siblings.remove(element);
- }
- }
-
- @SuppressWarnings("unchecked")
- public Object[] getChildren(Object parentElement) {
- Set children = (Set) fChildrenMap.get(parentElement);
- if (children == null) return EMPTY_ARR;
- return children.toArray();
- }
-
- public boolean hasChildren(Object element) {
- return getChildren(element).length > 0;
- }
-
- public synchronized void elementsChanged(Object[] updatedElements) {
- for (int i = 0; i < updatedElements.length; i++) {
- if (!(updatedElements[i] instanceof AttributeLineElement)) {
- if (fResult.getMatchCount(updatedElements[i]) > 0) {
- insert(updatedElements[i], true);
- } else {
- remove(updatedElements[i], true);
- }
- } else {
- AttributeLineElement lineElement = (AttributeLineElement) updatedElements[i];
- int nMatches = lineElement.getNumberOfMatches(fResult);
- if (nMatches > 0) {
- if (hasChild(lineElement.getParent(), lineElement)) {
- fTreeViewer.update(new Object[] {lineElement, lineElement.getParent()}, null);
- } else {
- insert(lineElement, true);
- }
- } else {
- remove(lineElement, true);
- }
- }
- }
- }
-
- public void clear() {
- initialize(fResult);
- fTreeViewer.refresh();
- }
-
- public Object getParent(Object element) {
- if (element instanceof AttributeLineElement) {
- return ((AttributeLineElement) element).getParent();
- }
- if (element instanceof AttributeMatch) {
- AttributeMatch match = (AttributeMatch) element;
- return match.getArtifact();
- }
- if (element instanceof Artifact) {
- Artifact resource = (Artifact) element;
- try {
- return resource.getParent();
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- 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.framework.ui.skynet.search.page;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.jface.viewers.AbstractTreeViewer;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+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.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.search.AbstractArtifactSearchResult;
+import org.eclipse.search.ui.text.Match;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ArtifactTreeContentProvider implements ITreeContentProvider, IArtifactSearchContentProvider {
+
+ private final Object[] EMPTY_ARR = new Object[0];
+
+ private AbstractArtifactSearchResult fResult;
+ private ArtifactSearchPage fPage;
+ private AbstractTreeViewer fTreeViewer;
+ @SuppressWarnings("unchecked")
+ private Map fChildrenMap;
+
+ ArtifactTreeContentProvider(ArtifactSearchPage page, AbstractTreeViewer viewer) {
+ fPage = page;
+ fTreeViewer = viewer;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ Object[] children = getChildren(inputElement);
+ int elementLimit = getElementLimit();
+ if (elementLimit != -1 && elementLimit < children.length) {
+ Object[] limitedChildren = new Object[elementLimit];
+ System.arraycopy(children, 0, limitedChildren, 0, elementLimit);
+ return limitedChildren;
+ }
+ return children;
+ }
+
+ private int getElementLimit() {
+ return fPage.getElementLimit().intValue();
+ }
+
+ public void dispose() {
+ // nothing to do
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ if (newInput instanceof AbstractArtifactSearchResult) {
+ initialize((AbstractArtifactSearchResult) newInput);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private synchronized void initialize(AbstractArtifactSearchResult result) {
+ fResult = result;
+ fChildrenMap = new HashMap();
+ boolean showLineMatches = fResult.hasAttributeMatches();
+
+ if (result != null) {
+ Object[] elements = result.getElements();
+ for (int i = 0; i < elements.length; i++) {
+ if (showLineMatches) {
+ Match[] matches = result.getMatches(elements[i]);
+ for (int j = 0; j < matches.length; j++) {
+ Match match = matches[j];
+ if (match instanceof AttributeMatch) {
+ insert(((AttributeMatch) match).getLineElement(), false);
+ } else {
+ insert(match.getElement(), false);
+ }
+ }
+ } else {
+ insert(elements[i], false);
+ }
+ }
+ }
+ }
+
+ private void insert(Object child, boolean refreshViewer) {
+ Object parent = getParent(child);
+ while (parent != null) {
+ if (insertChild(parent, child)) {
+ if (refreshViewer) {
+ fTreeViewer.add(parent, child);
+ }
+ } else {
+ if (refreshViewer) {
+ fTreeViewer.refresh(parent);
+ }
+ return;
+ }
+ child = parent;
+ parent = getParent(child);
+ }
+ if (insertChild(fResult, child)) {
+ if (refreshViewer) {
+ fTreeViewer.add(fResult, child);
+ }
+ }
+ }
+
+ /**
+ * returns true if the child already was a child of parent.
+ *
+ * @param parent
+ * @param child
+ * @return Returns <code>true</code> if the child was added
+ */
+ @SuppressWarnings("unchecked")
+ private boolean insertChild(Object parent, Object child) {
+ Set children = (Set) fChildrenMap.get(parent);
+ if (children == null) {
+ children = new HashSet();
+ fChildrenMap.put(parent, children);
+ }
+ return children.add(child);
+ }
+
+ @SuppressWarnings("unchecked")
+ private boolean hasChild(Object parent, Object child) {
+ Set children = (Set) fChildrenMap.get(parent);
+ return children != null && children.contains(child);
+ }
+
+ private void remove(Object element, boolean refreshViewer) {
+ if (hasChildren(element)) {
+ if (refreshViewer) fTreeViewer.refresh(element);
+ } else {
+ if (!hasMatches(element)) {
+ fChildrenMap.remove(element);
+ Object parent = getParent(element);
+ if (parent != null) {
+ removeFromSiblings(element, parent);
+ remove(parent, refreshViewer);
+ } else {
+ removeFromSiblings(element, fResult);
+ if (refreshViewer) fTreeViewer.refresh();
+ }
+ } else {
+ if (refreshViewer) {
+ fTreeViewer.refresh(element);
+ }
+ }
+ }
+ }
+
+ private boolean hasMatches(Object element) {
+ if (element instanceof AttributeLineElement) {
+ AttributeLineElement lineElement = (AttributeLineElement) element;
+ return lineElement.getNumberOfMatches(fResult) > 0;
+ }
+ return fResult.getMatchCount(element) > 0;
+ }
+
+ @SuppressWarnings("unchecked")
+ private void removeFromSiblings(Object element, Object parent) {
+ Set siblings = (Set) fChildrenMap.get(parent);
+ if (siblings != null) {
+ siblings.remove(element);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object[] getChildren(Object parentElement) {
+ Set children = (Set) fChildrenMap.get(parentElement);
+ if (children == null) return EMPTY_ARR;
+ return children.toArray();
+ }
+
+ public boolean hasChildren(Object element) {
+ return getChildren(element).length > 0;
+ }
+
+ public synchronized void elementsChanged(Object[] updatedElements) {
+ for (int i = 0; i < updatedElements.length; i++) {
+ if (!(updatedElements[i] instanceof AttributeLineElement)) {
+ if (fResult.getMatchCount(updatedElements[i]) > 0) {
+ insert(updatedElements[i], true);
+ } else {
+ remove(updatedElements[i], true);
+ }
+ } else {
+ AttributeLineElement lineElement = (AttributeLineElement) updatedElements[i];
+ int nMatches = lineElement.getNumberOfMatches(fResult);
+ if (nMatches > 0) {
+ if (hasChild(lineElement.getParent(), lineElement)) {
+ fTreeViewer.update(new Object[] {lineElement, lineElement.getParent()}, null);
+ } else {
+ insert(lineElement, true);
+ }
+ } else {
+ remove(lineElement, true);
+ }
+ }
+ }
+ }
+
+ public void clear() {
+ initialize(fResult);
+ fTreeViewer.refresh();
+ }
+
+ public Object getParent(Object element) {
+ if (element instanceof AttributeLineElement) {
+ return ((AttributeLineElement) element).getParent();
+ }
+ if (element instanceof AttributeMatch) {
+ AttributeMatch match = (AttributeMatch) element;
+ return match.getArtifact();
+ }
+ if (element instanceof Artifact) {
+ Artifact resource = (Artifact) element;
+ try {
+ return resource.getParent();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ return null;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/AttributeLineElement.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/AttributeLineElement.java
index 8660e1dc6fa..51647a43c72 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/AttributeLineElement.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/AttributeLineElement.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.framework.ui.skynet.search.page;
-
-import java.util.ArrayList;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
-import org.eclipse.osee.framework.ui.skynet.search.AbstractArtifactSearchResult;
-import org.eclipse.search.ui.text.Match;
-
-/**
- * @author Roberto E. Escobar
- */
-public class AttributeLineElement implements IAdaptable {
-
- private final Attribute<?> attribute;
- private final Artifact parent;
- private final int lineNumber;
- private final int lineStartOffset;
- private final String lineContents;
-
- public AttributeLineElement(Artifact parent, Attribute<?> attribute, int lineNumber, int lineStartOffset, String contents) {
- this.parent = parent;
- this.attribute = attribute;
- this.lineContents = contents;
- this.lineNumber = lineNumber;
- this.lineStartOffset = lineStartOffset;
- }
-
- public Artifact getParent() {
- return parent;
- }
-
- public int getLine() {
- return lineNumber;
- }
-
- public String getContents() {
- return lineContents;
- }
-
- public int getOffset() {
- return lineStartOffset;
- }
-
- public boolean contains(int offset) {
- return lineStartOffset <= offset && offset < lineStartOffset + lineContents.length();
- }
-
- public int getLength() {
- return lineContents.length();
- }
-
- public AttributeMatch[] getMatches(AbstractArtifactSearchResult result) {
- ArrayList<AttributeMatch> res = new ArrayList<AttributeMatch>();
- Match[] matches = result.getMatches(parent);
- for (int i = 0; i < matches.length; i++) {
- AttributeMatch curr = (AttributeMatch) matches[i];
- if (curr.getLineElement() == this) {
- res.add(curr);
- }
- }
- return res.toArray(new AttributeMatch[res.size()]);
- }
-
- public int getNumberOfMatches(AbstractArtifactSearchResult result) {
- int count = 0;
- Match[] matches = result.getMatches(parent);
- for (int i = 0; i < matches.length; i++) {
- AttributeMatch curr = (AttributeMatch) matches[i];
- if (curr.getLineElement() == this) {
- count++;
- }
- }
- return count;
- }
-
- public Attribute<?> getAttribute() {
- return attribute;
- }
-
- @SuppressWarnings("unchecked")
- public Object getAdapter(Class adapter) {
- if (adapter == Artifact.class) {
- return getParent();
- } else if (adapter == Attribute.class) {
- return getAttribute();
- }
- 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.framework.ui.skynet.search.page;
+
+import java.util.ArrayList;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
+import org.eclipse.osee.framework.ui.skynet.search.AbstractArtifactSearchResult;
+import org.eclipse.search.ui.text.Match;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AttributeLineElement implements IAdaptable {
+
+ private final Attribute<?> attribute;
+ private final Artifact parent;
+ private final int lineNumber;
+ private final int lineStartOffset;
+ private final String lineContents;
+
+ public AttributeLineElement(Artifact parent, Attribute<?> attribute, int lineNumber, int lineStartOffset, String contents) {
+ this.parent = parent;
+ this.attribute = attribute;
+ this.lineContents = contents;
+ this.lineNumber = lineNumber;
+ this.lineStartOffset = lineStartOffset;
+ }
+
+ public Artifact getParent() {
+ return parent;
+ }
+
+ public int getLine() {
+ return lineNumber;
+ }
+
+ public String getContents() {
+ return lineContents;
+ }
+
+ public int getOffset() {
+ return lineStartOffset;
+ }
+
+ public boolean contains(int offset) {
+ return lineStartOffset <= offset && offset < lineStartOffset + lineContents.length();
+ }
+
+ public int getLength() {
+ return lineContents.length();
+ }
+
+ public AttributeMatch[] getMatches(AbstractArtifactSearchResult result) {
+ ArrayList<AttributeMatch> res = new ArrayList<AttributeMatch>();
+ Match[] matches = result.getMatches(parent);
+ for (int i = 0; i < matches.length; i++) {
+ AttributeMatch curr = (AttributeMatch) matches[i];
+ if (curr.getLineElement() == this) {
+ res.add(curr);
+ }
+ }
+ return res.toArray(new AttributeMatch[res.size()]);
+ }
+
+ public int getNumberOfMatches(AbstractArtifactSearchResult result) {
+ int count = 0;
+ Match[] matches = result.getMatches(parent);
+ for (int i = 0; i < matches.length; i++) {
+ AttributeMatch curr = (AttributeMatch) matches[i];
+ if (curr.getLineElement() == this) {
+ count++;
+ }
+ }
+ return count;
+ }
+
+ public Attribute<?> getAttribute() {
+ return attribute;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getAdapter(Class adapter) {
+ if (adapter == Artifact.class) {
+ return getParent();
+ } else if (adapter == Attribute.class) {
+ return getAttribute();
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/AttributeMatch.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/AttributeMatch.java
index c17d58af9ba..c1cc891d697 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/AttributeMatch.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/AttributeMatch.java
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.search.page;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.text.Region;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.search.ui.text.Match;
-
-/**
- * @author Roberto E. Escobar
- */
-public class AttributeMatch extends Match implements IAdaptable {
- private Region fOriginalLocation;
- private AttributeLineElement fLineElement;
-
- public AttributeMatch(Artifact element, int offset, int length, AttributeLineElement lineEntry) {
- super(element, offset, length);
- fLineElement = lineEntry;
- }
-
- public void setOffset(int offset) {
- if (fOriginalLocation == null) {
- fOriginalLocation = new Region(getOffset(), getLength());
- }
- super.setOffset(offset);
- }
-
- public void setLength(int length) {
- if (fOriginalLocation == null) {
- fOriginalLocation = new Region(getOffset(), getLength());
- }
- super.setLength(length);
- }
-
- public int getOriginalOffset() {
- if (fOriginalLocation != null) {
- return fOriginalLocation.getOffset();
- }
- return getOffset();
- }
-
- public int getOriginalLength() {
- if (fOriginalLocation != null) {
- return fOriginalLocation.getLength();
- }
- return getLength();
- }
-
- public Artifact getArtifact() {
- return (Artifact) getElement();
- }
-
- public AttributeLineElement getLineElement() {
- return fLineElement;
- }
-
- @Override
- public Object getAdapter(Class adapter) {
- if (Artifact.class.equals(adapter)) {
- return this.getArtifact();
- }
- 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.framework.ui.skynet.search.page;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.text.Region;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.search.ui.text.Match;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AttributeMatch extends Match implements IAdaptable {
+ private Region fOriginalLocation;
+ private AttributeLineElement fLineElement;
+
+ public AttributeMatch(Artifact element, int offset, int length, AttributeLineElement lineEntry) {
+ super(element, offset, length);
+ fLineElement = lineEntry;
+ }
+
+ public void setOffset(int offset) {
+ if (fOriginalLocation == null) {
+ fOriginalLocation = new Region(getOffset(), getLength());
+ }
+ super.setOffset(offset);
+ }
+
+ public void setLength(int length) {
+ if (fOriginalLocation == null) {
+ fOriginalLocation = new Region(getOffset(), getLength());
+ }
+ super.setLength(length);
+ }
+
+ public int getOriginalOffset() {
+ if (fOriginalLocation != null) {
+ return fOriginalLocation.getOffset();
+ }
+ return getOffset();
+ }
+
+ public int getOriginalLength() {
+ if (fOriginalLocation != null) {
+ return fOriginalLocation.getLength();
+ }
+ return getLength();
+ }
+
+ public Artifact getArtifact() {
+ return (Artifact) getElement();
+ }
+
+ public AttributeLineElement getLineElement() {
+ return fLineElement;
+ }
+
+ @Override
+ public Object getAdapter(Class adapter) {
+ if (Artifact.class.equals(adapter)) {
+ return this.getArtifact();
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/DecoratingArtifactSearchLabelProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/DecoratingArtifactSearchLabelProvider.java
index 248e4493ea7..f142d73a47c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/DecoratingArtifactSearchLabelProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/DecoratingArtifactSearchLabelProvider.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.framework.ui.skynet.search.page;
-
-import org.eclipse.jface.preference.JFacePreferences;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.ColumnViewer;
-import org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.StyledString;
-import org.eclipse.jface.viewers.StyledString.Styler;
-import org.eclipse.jface.viewers.ViewerColumn;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.ui.IWorkbenchPreferenceConstants;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Roberto E. Escobar
- */
-public class DecoratingArtifactSearchLabelProvider extends DecoratingStyledCellLabelProvider implements IPropertyChangeListener, ILabelProvider {
-
- private static final String HIGHLIGHT_BG_COLOR_NAME = "org.eclipse.jdt.ui.ColoredLabels.match_highlight"; //$NON-NLS-1$
-
- public static final Styler HIGHLIGHT_STYLE = StyledString.createColorRegistryStyler(null, HIGHLIGHT_BG_COLOR_NAME);
-
- public DecoratingArtifactSearchLabelProvider(ArtifactSearchLabelProvider provider) {
- super(provider, PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator(), null);
- }
-
- @Override
- public void initialize(ColumnViewer viewer, ViewerColumn column) {
- PlatformUI.getPreferenceStore().addPropertyChangeListener(this);
- JFaceResources.getColorRegistry().addListener(this);
-
- setOwnerDrawEnabled(showColoredLabels());
-
- super.initialize(viewer, column);
- }
-
- @Override
- public void dispose() {
- super.dispose();
- PlatformUI.getPreferenceStore().removePropertyChangeListener(this);
- JFaceResources.getColorRegistry().removeListener(this);
- }
-
- private void refresh() {
- ColumnViewer viewer = getViewer();
-
- if (viewer == null) {
- return;
- }
- boolean showColoredLabels = showColoredLabels();
- if (showColoredLabels != isOwnerDrawEnabled()) {
- setOwnerDrawEnabled(showColoredLabels);
- viewer.refresh();
- } else if (showColoredLabels) {
- viewer.refresh();
- }
- }
-
- @Override
- protected StyleRange prepareStyleRange(StyleRange styleRange, boolean applyColors) {
- if (!applyColors && styleRange.background != null) {
- styleRange = super.prepareStyleRange(styleRange, applyColors);
- styleRange.borderStyle = SWT.BORDER_DOT;
- return styleRange;
- }
- return super.prepareStyleRange(styleRange, applyColors);
- }
-
- public static boolean showColoredLabels() {
- return PlatformUI.getPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.USE_COLORED_LABELS);
- }
-
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- if (property.equals(JFacePreferences.QUALIFIER_COLOR) || property.equals(JFacePreferences.COUNTER_COLOR) || property.equals(JFacePreferences.DECORATIONS_COLOR) || property.equals(HIGHLIGHT_BG_COLOR_NAME) || property.equals(IWorkbenchPreferenceConstants.USE_COLORED_LABELS)) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- refresh();
- }
- });
- }
- }
-
- @Override
- public String getText(Object element) {
- return getStyledText(element).getString();
- }
-
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.search.page;
+
+import org.eclipse.jface.preference.JFacePreferences;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.ColumnViewer;
+import org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.StyledString;
+import org.eclipse.jface.viewers.StyledString.Styler;
+import org.eclipse.jface.viewers.ViewerColumn;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.ui.IWorkbenchPreferenceConstants;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DecoratingArtifactSearchLabelProvider extends DecoratingStyledCellLabelProvider implements IPropertyChangeListener, ILabelProvider {
+
+ private static final String HIGHLIGHT_BG_COLOR_NAME = "org.eclipse.jdt.ui.ColoredLabels.match_highlight"; //$NON-NLS-1$
+
+ public static final Styler HIGHLIGHT_STYLE = StyledString.createColorRegistryStyler(null, HIGHLIGHT_BG_COLOR_NAME);
+
+ public DecoratingArtifactSearchLabelProvider(ArtifactSearchLabelProvider provider) {
+ super(provider, PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator(), null);
+ }
+
+ @Override
+ public void initialize(ColumnViewer viewer, ViewerColumn column) {
+ PlatformUI.getPreferenceStore().addPropertyChangeListener(this);
+ JFaceResources.getColorRegistry().addListener(this);
+
+ setOwnerDrawEnabled(showColoredLabels());
+
+ super.initialize(viewer, column);
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ PlatformUI.getPreferenceStore().removePropertyChangeListener(this);
+ JFaceResources.getColorRegistry().removeListener(this);
+ }
+
+ private void refresh() {
+ ColumnViewer viewer = getViewer();
+
+ if (viewer == null) {
+ return;
+ }
+ boolean showColoredLabels = showColoredLabels();
+ if (showColoredLabels != isOwnerDrawEnabled()) {
+ setOwnerDrawEnabled(showColoredLabels);
+ viewer.refresh();
+ } else if (showColoredLabels) {
+ viewer.refresh();
+ }
+ }
+
+ @Override
+ protected StyleRange prepareStyleRange(StyleRange styleRange, boolean applyColors) {
+ if (!applyColors && styleRange.background != null) {
+ styleRange = super.prepareStyleRange(styleRange, applyColors);
+ styleRange.borderStyle = SWT.BORDER_DOT;
+ return styleRange;
+ }
+ return super.prepareStyleRange(styleRange, applyColors);
+ }
+
+ public static boolean showColoredLabels() {
+ return PlatformUI.getPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.USE_COLORED_LABELS);
+ }
+
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ String property = event.getProperty();
+ if (property.equals(JFacePreferences.QUALIFIER_COLOR) || property.equals(JFacePreferences.COUNTER_COLOR) || property.equals(JFacePreferences.DECORATIONS_COLOR) || property.equals(HIGHLIGHT_BG_COLOR_NAME) || property.equals(IWorkbenchPreferenceConstants.USE_COLORED_LABELS)) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ refresh();
+ }
+ });
+ }
+ }
+
+ @Override
+ public String getText(Object element) {
+ return getStyledText(element).getString();
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/IArtifactSearchContentProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/IArtifactSearchContentProvider.java
index d44376f08bd..85c7d271d04 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/IArtifactSearchContentProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/IArtifactSearchContentProvider.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.search.page;
-
-/**
- * @author Roberto E. Escobar
- */
-public interface IArtifactSearchContentProvider {
-
- public abstract void elementsChanged(Object[] updatedElements);
-
- public abstract void clear();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.search.page;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface IArtifactSearchContentProvider {
+
+ public abstract void elementsChanged(Object[] updatedElements);
+
+ public abstract void clear();
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/skywalker/SkyWalkerArtTypeTabItem.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/skywalker/SkyWalkerArtTypeTabItem.java
index 2aca6315c90..2859a7befe8 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/skywalker/SkyWalkerArtTypeTabItem.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/skywalker/SkyWalkerArtTypeTabItem.java
@@ -1,149 +1,149 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.skywalker;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.osee.framework.core.model.type.ArtifactType;
-import org.eclipse.osee.framework.ui.plugin.util.ArrayTreeContentProvider;
-import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
-import org.eclipse.osee.framework.ui.skynet.skywalker.ISkyWalkerOptionsChangeListener.ModType;
-import org.eclipse.osee.framework.ui.swt.ALayout;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.TabItem;
-
-/**
- * @author Donald G. Dunne
- */
-public class SkyWalkerArtTypeTabItem {
-
- private CheckboxTreeViewer treeViewer;
- private Button selectAll;
- private Button deSelectAll;
- private final SkyWalkerOptions options;
-
- public SkyWalkerArtTypeTabItem(org.eclipse.swt.widgets.TabFolder tabFolder, SkyWalkerOptions options) {
-
- this.options = options;
- TabItem item = new TabItem(tabFolder, SWT.NONE);
- item.setText("Artifact Type");
-
- Composite comp = new Composite(tabFolder, SWT.BORDER);
- comp.setLayout(ALayout.getZeroMarginLayout());
- comp.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
-
- treeViewer = new CheckboxTreeViewer(comp, SWT.MULTI | SWT.CHECK | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- treeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- treeViewer.setContentProvider(new ArrayTreeContentProvider());
- treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- storeSelected();
- }
- });
- treeViewer.setLabelProvider(new LabelProvider() {
-
- public Image getImage(Object obj) {
- if (obj instanceof ArtifactType) {
- return ArtifactImageManager.getImage((ArtifactType) obj);
- }
- return null;
- }
-
- public String getText(Object obj) {
- return obj.toString();
- }
- });
- treeViewer.setSorter(new ViewerSorter());
-
- Composite buttonComp = new Composite(comp, SWT.BORDER);
- buttonComp.setLayout(ALayout.getZeroMarginLayout(2, false));
- buttonComp.setLayoutData(new GridData());
-
- selectAll = new Button(buttonComp, SWT.PUSH);
- selectAll.setText("Select All");
- selectAll.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- treeViewer.setAllChecked(true);
- storeSelected();
- }
- });
-
- deSelectAll = new Button(buttonComp, SWT.PUSH);
- deSelectAll.setText("De-Select All");
- deSelectAll.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- treeViewer.setAllChecked(false);
- storeSelected();
- }
- });
- options.addSkyWalkerOptionsChangeListener(new ISkyWalkerOptionsChangeListener() {
- public void modified(ModType... modTypes) {
- handleOptionModified(modTypes);
- }
- });
-
- // Set UI to defaults
- handleOptionModified(ModType.FilterEnabled);
- handleOptionModified(ModType.ArtType);
- item.setControl(comp);
- }
-
- public void handleOptionModified(ModType... modTypes) {
- List<ModType> modList = Arrays.asList(modTypes);
- if (modList.contains(ModType.FilterEnabled)) {
- if (selectAll != null)
- selectAll.setEnabled(options.isFilterEnabled());
- if (deSelectAll != null)
- deSelectAll.setEnabled(options.isFilterEnabled());
- }
- if (modList.contains(ModType.ArtType)) {
- if (treeViewer != null) {
- treeViewer.setCheckedElements(options.getSelectedArtTypes().toArray());
- }
- }
- if (modList.contains(ModType.Artifact)) {
- if (treeViewer.getInput() == null && options.getAllArtTypes() != null && options.getAllArtTypes().size() > 0) {
- treeViewer.setInput(options.getAllArtTypes());
- treeViewer.setSubtreeChecked(treeViewer.getTree().getItems(), true);
- // treeViewer.setAllChecked(true);
- }
- }
- }
-
- public void storeSelected() {
- Set<ArtifactType> selected = new HashSet<ArtifactType>();
- for (Object obj : treeViewer.getCheckedElements()) {
- if (obj instanceof ArtifactType)
- selected.add((ArtifactType) obj);
- }
- options.setSelectedArtTypes(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.framework.ui.skynet.skywalker;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.osee.framework.core.model.type.ArtifactType;
+import org.eclipse.osee.framework.ui.plugin.util.ArrayTreeContentProvider;
+import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
+import org.eclipse.osee.framework.ui.skynet.skywalker.ISkyWalkerOptionsChangeListener.ModType;
+import org.eclipse.osee.framework.ui.swt.ALayout;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TabItem;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class SkyWalkerArtTypeTabItem {
+
+ private CheckboxTreeViewer treeViewer;
+ private Button selectAll;
+ private Button deSelectAll;
+ private final SkyWalkerOptions options;
+
+ public SkyWalkerArtTypeTabItem(org.eclipse.swt.widgets.TabFolder tabFolder, SkyWalkerOptions options) {
+
+ this.options = options;
+ TabItem item = new TabItem(tabFolder, SWT.NONE);
+ item.setText("Artifact Type");
+
+ Composite comp = new Composite(tabFolder, SWT.BORDER);
+ comp.setLayout(ALayout.getZeroMarginLayout());
+ comp.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
+
+ treeViewer = new CheckboxTreeViewer(comp, SWT.MULTI | SWT.CHECK | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ treeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ treeViewer.setContentProvider(new ArrayTreeContentProvider());
+ treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ storeSelected();
+ }
+ });
+ treeViewer.setLabelProvider(new LabelProvider() {
+
+ public Image getImage(Object obj) {
+ if (obj instanceof ArtifactType) {
+ return ArtifactImageManager.getImage((ArtifactType) obj);
+ }
+ return null;
+ }
+
+ public String getText(Object obj) {
+ return obj.toString();
+ }
+ });
+ treeViewer.setSorter(new ViewerSorter());
+
+ Composite buttonComp = new Composite(comp, SWT.BORDER);
+ buttonComp.setLayout(ALayout.getZeroMarginLayout(2, false));
+ buttonComp.setLayoutData(new GridData());
+
+ selectAll = new Button(buttonComp, SWT.PUSH);
+ selectAll.setText("Select All");
+ selectAll.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ treeViewer.setAllChecked(true);
+ storeSelected();
+ }
+ });
+
+ deSelectAll = new Button(buttonComp, SWT.PUSH);
+ deSelectAll.setText("De-Select All");
+ deSelectAll.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ treeViewer.setAllChecked(false);
+ storeSelected();
+ }
+ });
+ options.addSkyWalkerOptionsChangeListener(new ISkyWalkerOptionsChangeListener() {
+ public void modified(ModType... modTypes) {
+ handleOptionModified(modTypes);
+ }
+ });
+
+ // Set UI to defaults
+ handleOptionModified(ModType.FilterEnabled);
+ handleOptionModified(ModType.ArtType);
+ item.setControl(comp);
+ }
+
+ public void handleOptionModified(ModType... modTypes) {
+ List<ModType> modList = Arrays.asList(modTypes);
+ if (modList.contains(ModType.FilterEnabled)) {
+ if (selectAll != null)
+ selectAll.setEnabled(options.isFilterEnabled());
+ if (deSelectAll != null)
+ deSelectAll.setEnabled(options.isFilterEnabled());
+ }
+ if (modList.contains(ModType.ArtType)) {
+ if (treeViewer != null) {
+ treeViewer.setCheckedElements(options.getSelectedArtTypes().toArray());
+ }
+ }
+ if (modList.contains(ModType.Artifact)) {
+ if (treeViewer.getInput() == null && options.getAllArtTypes() != null && options.getAllArtTypes().size() > 0) {
+ treeViewer.setInput(options.getAllArtTypes());
+ treeViewer.setSubtreeChecked(treeViewer.getTree().getItems(), true);
+ // treeViewer.setAllChecked(true);
+ }
+ }
+ }
+
+ public void storeSelected() {
+ Set<ArtifactType> selected = new HashSet<ArtifactType>();
+ for (Object obj : treeViewer.getCheckedElements()) {
+ if (obj instanceof ArtifactType)
+ selected.add((ArtifactType) obj);
+ }
+ options.setSelectedArtTypes(selected);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/skywalker/SkyWalkerRelTypeTabItem.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/skywalker/SkyWalkerRelTypeTabItem.java
index 2bf4346b5d0..113787f533c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/skywalker/SkyWalkerRelTypeTabItem.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/skywalker/SkyWalkerRelTypeTabItem.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.framework.ui.skynet.skywalker;
-
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.osee.framework.ui.skynet.skywalker.ISkyWalkerOptionsChangeListener.ModType;
-import org.eclipse.osee.framework.ui.swt.ALayout;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.TabItem;
-
-/**
- * @author Donald G. Dunne
- */
-public class SkyWalkerRelTypeTabItem {
-
- private CheckboxTreeViewer treeViewer;
- private Button selectAll;
- private Button deSelectAll;
- private final SkyWalkerOptions options;
-
- public SkyWalkerRelTypeTabItem(org.eclipse.swt.widgets.TabFolder tabFolder, SkyWalkerOptions options) {
-
- this.options = options;
- TabItem item = new TabItem(tabFolder, SWT.NONE);
- item.setText("Relation Type");
-
- Composite comp = new Composite(tabFolder, SWT.BORDER);
- comp.setLayout(ALayout.getZeroMarginLayout());
- comp.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
-
- treeViewer = new CheckboxTreeViewer(comp, SWT.MULTI | SWT.CHECK | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- treeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- treeViewer.setContentProvider(new RelTypeContentProvider());
- treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- storeSelected();
- }
- });
- treeViewer.setLabelProvider(new LabelProvider() {
-
- public Image getImage(Object obj) {
- return null;
- }
-
- public String getText(Object obj) {
- return obj.toString();
- }
- });
- treeViewer.setSorter(new ViewerSorter());
-
- Composite buttonComp = new Composite(comp, SWT.BORDER);
- buttonComp.setLayout(ALayout.getZeroMarginLayout(2, false));
- buttonComp.setLayoutData(new GridData());
-
- selectAll = new Button(buttonComp, SWT.PUSH);
- selectAll.setText("Select All");
- selectAll.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- treeViewer.setAllChecked(true);
- storeSelected();
- }
- });
-
- deSelectAll = new Button(buttonComp, SWT.PUSH);
- deSelectAll.setText("De-Select All");
- deSelectAll.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- treeViewer.setAllChecked(false);
- storeSelected();
- }
- });
-
- options.addSkyWalkerOptionsChangeListener(new ISkyWalkerOptionsChangeListener() {
- public void modified(ModType... modTypes) {
- handleOptionModified(modTypes);
- }
- });
- // Set UI to defaults
- handleOptionModified(ModType.FilterEnabled);
- handleOptionModified(ModType.RelType);
- item.setControl(comp);
- }
-
- public void storeSelected() {
- options.setSelectedRelTypes(treeViewer.getCheckedElements());
- }
-
- public void handleOptionModified(ModType... modTypes) {
- List<ModType> modList = Arrays.asList(modTypes);
- if (modList.contains(ModType.FilterEnabled)) {
- if (selectAll != null)
- selectAll.setEnabled(options.isFilterEnabled());
- if (deSelectAll != null)
- deSelectAll.setEnabled(options.isFilterEnabled());
- }
- if (modList.contains(ModType.RelType)) {
- if (treeViewer != null) {
- treeViewer.setCheckedElements(options.getSelectedRelTypes().toArray());
- }
- }
- if (modList.contains(ModType.Artifact)) {
- if (treeViewer.getInput() == null && options.getAllRelTypes() != null && options.getAllRelTypes().size() > 0) {
- treeViewer.setInput(options.getAllRelationLinkDescriptorTypes());
- // treeViewer.setAllChecked(true);
- treeViewer.setSubtreeChecked(treeViewer.getTree().getItems(), 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.framework.ui.skynet.skywalker;
+
+import java.util.Arrays;
+import java.util.List;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.osee.framework.ui.skynet.skywalker.ISkyWalkerOptionsChangeListener.ModType;
+import org.eclipse.osee.framework.ui.swt.ALayout;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TabItem;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class SkyWalkerRelTypeTabItem {
+
+ private CheckboxTreeViewer treeViewer;
+ private Button selectAll;
+ private Button deSelectAll;
+ private final SkyWalkerOptions options;
+
+ public SkyWalkerRelTypeTabItem(org.eclipse.swt.widgets.TabFolder tabFolder, SkyWalkerOptions options) {
+
+ this.options = options;
+ TabItem item = new TabItem(tabFolder, SWT.NONE);
+ item.setText("Relation Type");
+
+ Composite comp = new Composite(tabFolder, SWT.BORDER);
+ comp.setLayout(ALayout.getZeroMarginLayout());
+ comp.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
+
+ treeViewer = new CheckboxTreeViewer(comp, SWT.MULTI | SWT.CHECK | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ treeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ treeViewer.setContentProvider(new RelTypeContentProvider());
+ treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ storeSelected();
+ }
+ });
+ treeViewer.setLabelProvider(new LabelProvider() {
+
+ public Image getImage(Object obj) {
+ return null;
+ }
+
+ public String getText(Object obj) {
+ return obj.toString();
+ }
+ });
+ treeViewer.setSorter(new ViewerSorter());
+
+ Composite buttonComp = new Composite(comp, SWT.BORDER);
+ buttonComp.setLayout(ALayout.getZeroMarginLayout(2, false));
+ buttonComp.setLayoutData(new GridData());
+
+ selectAll = new Button(buttonComp, SWT.PUSH);
+ selectAll.setText("Select All");
+ selectAll.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ treeViewer.setAllChecked(true);
+ storeSelected();
+ }
+ });
+
+ deSelectAll = new Button(buttonComp, SWT.PUSH);
+ deSelectAll.setText("De-Select All");
+ deSelectAll.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ treeViewer.setAllChecked(false);
+ storeSelected();
+ }
+ });
+
+ options.addSkyWalkerOptionsChangeListener(new ISkyWalkerOptionsChangeListener() {
+ public void modified(ModType... modTypes) {
+ handleOptionModified(modTypes);
+ }
+ });
+ // Set UI to defaults
+ handleOptionModified(ModType.FilterEnabled);
+ handleOptionModified(ModType.RelType);
+ item.setControl(comp);
+ }
+
+ public void storeSelected() {
+ options.setSelectedRelTypes(treeViewer.getCheckedElements());
+ }
+
+ public void handleOptionModified(ModType... modTypes) {
+ List<ModType> modList = Arrays.asList(modTypes);
+ if (modList.contains(ModType.FilterEnabled)) {
+ if (selectAll != null)
+ selectAll.setEnabled(options.isFilterEnabled());
+ if (deSelectAll != null)
+ deSelectAll.setEnabled(options.isFilterEnabled());
+ }
+ if (modList.contains(ModType.RelType)) {
+ if (treeViewer != null) {
+ treeViewer.setCheckedElements(options.getSelectedRelTypes().toArray());
+ }
+ }
+ if (modList.contains(ModType.Artifact)) {
+ if (treeViewer.getInput() == null && options.getAllRelTypes() != null && options.getAllRelTypes().size() > 0) {
+ treeViewer.setInput(options.getAllRelationLinkDescriptorTypes());
+ // treeViewer.setAllChecked(true);
+ treeViewer.setSubtreeChecked(treeViewer.getTree().getItems(), true);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/skywalker/SkyWalkerView.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/skywalker/SkyWalkerView.java
index 783e5791677..2bc2d68732a 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/skywalker/SkyWalkerView.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/skywalker/SkyWalkerView.java
@@ -1,378 +1,378 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.skywalker;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.core.data.SystemUser;
-import org.eclipse.osee.framework.jdk.core.util.AFile;
-import org.eclipse.osee.framework.jdk.core.util.GUID;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-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.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.ArtifactDoubleClick;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.util.ImageCapture;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.ViewPart;
-import org.eclipse.zest.core.viewers.GraphViewer;
-import org.eclipse.zest.core.widgets.GraphItem;
-import org.eclipse.zest.core.widgets.GraphNode;
-import org.eclipse.zest.core.widgets.ZestStyles;
-
-/**
- * @author Robert A. Fisher
- * @author Donald G. Dunne
- */
-public class SkyWalkerView extends ViewPart {
- public static final String VIEW_ID = "org.eclipse.osee.framework.ui.skynet.skywalker.SkyWalkerView";
- protected GraphViewer viewer;
- private static final String INPUT_KEY = "input";
- private static final String GUID_KEY = "guid";
- private static final String BRANCHID_KEY = "branchId";
- private String storedGuid;
- private String storedBrandId;
- private final SkyWalkerOptions options = new SkyWalkerOptions();
- private final List<Artifact> history = new LinkedList<Artifact>();
- private Action filterAction;
- private Composite viewerComp;
- protected SashForm sashForm;
-
- @Override
- public void createPartControl(Composite parent) {
-
- sashForm = new SashForm(parent, SWT.HORIZONTAL);
- sashForm.setLayout(new FillLayout());
-
- viewerComp = new Composite(sashForm, SWT.NONE);
- viewerComp.setLayout(new FillLayout());
-
- viewer = new GraphViewer(viewerComp, ZestStyles.NONE);
- viewer.setContentProvider(new ArtifactGraphContentProvider(options));
- viewer.setLabelProvider(new ArtifactGraphLabelProvider(options));
- viewer.setConnectionStyle(ZestStyles.CONNECTIONS_SOLID);
- viewer.setNodeStyle(ZestStyles.NODES_NO_LAYOUT_RESIZE);
- viewer.addDoubleClickListener(new IDoubleClickListener() {
-
- public void doubleClick(DoubleClickEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- Iterator<?> itemsIter = selection.iterator();
- while (itemsIter.hasNext()) {
- Object obj = itemsIter.next();
- if (!(obj instanceof Artifact)) {
- continue;
- }
- Artifact artifact = (Artifact) obj;
- explore(artifact);
- }
- }
-
- });
-
- Composite child1 = new Composite(sashForm, SWT.BORDER);
- child1.setLayout(new FillLayout());
- new SkyWalkerTabOptions(child1, SWT.NONE, options);
-
- options.addSkyWalkerOptionsChangeListener(new ISkyWalkerOptionsChangeListener() {
- public void modified(ModType... modTypes) {
- List<ModType> modList = Arrays.asList(modTypes);
- // Don't redraw if artifact has been changed; else get in infinite loop
- if (modList.contains(ModType.Artifact)) {
- return;
- }
- if (modList.contains(ModType.Layout)) {
- viewer.setLayoutAlgorithm(options.getLayout(), true);
- } else if (modList.contains(ModType.Show_Attribute)) {
- try {
- // exploring another artifact and then the original forces a redraw of all the
- // objects
- // which is necessary for a node size change
- Artifact art = (Artifact) viewer.getInput();
- explore(UserManager.getUser(SystemUser.UnAssigned));
- if (art != null) {
- explore(art);
- }
- } catch (Exception ex) {
- // DO Nothing
- }
- } else {
- redraw();
- }
- }
- });
-
- sashForm.setWeights(new int[] {75, 25});
-
- createActions();
- viewer.setLayoutAlgorithm(options.getLayout());
- // Restore current artifact if stored upon shutdown
- try {
- if (storedGuid != null) {
- Artifact art =
- ArtifactQuery.getArtifactFromId(storedGuid,
- BranchManager.getBranch(Integer.parseInt(storedBrandId)));
- if (art != null) {
- explore(art);
- }
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
-
- protected void createActions() {
-
- IActionBars bars = getViewSite().getActionBars();
- // IMenuManager mm = bars.getMenuManager();
- IToolBarManager tbm = bars.getToolBarManager();
-
- filterAction = new Action("Enable Filters", Action.AS_CHECK_BOX) {
- @Override
- public void run() {
- options.setFilterEnabled(filterAction.isChecked());
- redraw();
- }
- };
- filterAction.setChecked(options.isFilterEnabled());
- filterAction.setToolTipText("Enable Filters");
- filterAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.FILTERS));
- tbm.add(filterAction);
-
- Action action = new Action() {
- @Override
- public void run() {
- ArtifactDoubleClick.openArtifact(viewer.getSelection());
- }
- };
- action.setText("Open Selected");
- action.setToolTipText("Open Selected");
- action.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.EDIT2));
- tbm.add(action);
-
- action = new Action() {
- @Override
- public void run() {
- if (history.size() > 0) {
- Artifact art = history.get(history.size() - 1);
- history.remove(history.size() - 1);
- explore(art, true);
- }
- }
- };
- action.setText("Back");
- action.setToolTipText("Back");
- action.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.BACK));
- tbm.add(action);
-
- action = new Action() {
- @Override
- public void run() {
- ImageCapture imgCapture = new ImageCapture(viewerComp);
- imgCapture.popupDialog();
- }
- };
- action.setText("Print");
- action.setToolTipText("Print");
- action.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.PRINT));
- tbm.add(action);
-
- action = new Action() {
- @Override
- public void run() {
- handleSaveOptions();
- }
- };
- action.setText("Save Options");
- action.setToolTipText("Save Options");
- action.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.SAVE));
- tbm.add(action);
-
- action = new Action() {
- @Override
- public void run() {
- handleLoadOptions();
- }
- };
- action.setText("Load Options");
- action.setToolTipText("Load Options");
- action.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.LOAD));
- tbm.add(action);
-
- action = new Action() {
- @Override
- public void run() {
- redraw();
- }
- };
- action.setText("Refresh");
- action.setToolTipText("Refresh");
- action.setImageDescriptor(ImageManager.getImageDescriptor(PluginUiImage.REFRESH));
- tbm.add(action);
- }
-
- public void handleSaveOptions() {
- final FileDialog dialog = new FileDialog(Displays.getActiveShell().getShell(), SWT.SAVE);
- dialog.setFilterExtensions(new String[] {"*.sky"});
- String filename = dialog.open();
- if (filename != null) {
- try {
- Lib.writeStringToFile(options.toXml(), new File(filename));
- AWorkbench.popup("Saved", "Save Successful");
- } catch (IOException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
-
- public void handleLoadOptions() {
- final FileDialog dialog = new FileDialog(Displays.getActiveShell().getShell(), SWT.OPEN);
- dialog.setFilterExtensions(new String[] {"*.sky"});
- String filename = dialog.open();
- if (filename != null) {
- String xml = AFile.readFile(filename);
- options.fromXml(xml);
- explore(options.getArtifact());
- }
- }
-
- public void redraw() {
- if (viewer.getInput() != null) {
- explore((Artifact) viewer.getInput());
- }
- }
-
- @Override
- public void setFocus() {
- viewer.getControl().setFocus();
- }
-
- public String getActionDescription() {
- return "";
- }
-
- public void explore(Artifact artifact) {
- explore(artifact, false);
- }
-
- private boolean inExplore = false;
-
- private void explore(Artifact artifact, boolean fromHistory) {
- // If already in explore method, don't respond to events trying to redraw
- if (inExplore) {
- return;
- }
- inExplore = true;
- options.setArtifact(artifact);
-
- // Add current artifact to history only if explore wasn't caused by going back in history
- if (!fromHistory && viewer.getInput() != null) {
- Artifact currArt = (Artifact) viewer.getInput();
- if (history.isEmpty()) {
- history.add(currArt);
- } else if (history.size() > 0 && !history.get(history.size() - 1).equals(currArt)) {
- history.add(currArt);
- }
- }
- viewer.setInput(options.getArtifact());
- // Highlight center object
- GraphItem item = viewer.findGraphItem(options.getArtifact());
- if (item != null && item instanceof GraphNode) {
- GraphNode node = (GraphNode) item;
- node.setBackgroundColor(Displays.getSystemColor(SWT.COLOR_CYAN));
- viewer.update(node, null);
- }
- setPartName("Sky Walker (" + artifact.getName() + ")");
- inExplore = false;
- }
-
- public static void exploreArtifact(Artifact artifact) {
- exploreArtifact(artifact.getName(), artifact);
- }
-
- public static void exploreArtifact(String name, Artifact artifact) {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- SkyWalkerView view;
- try {
- String id = GUID.create();
- view = (SkyWalkerView) page.showView(SkyWalkerView.VIEW_ID, id, IWorkbenchPage.VIEW_ACTIVATE);
- view.explore(artifact);
- } catch (Exception ex) {
- throw new RuntimeException(ex);
- }
- }
-
- @Override
- public void saveState(IMemento memento) {
- super.saveState(memento);
-
- if (viewer.getInput() == null) {
- return;
- }
- Artifact artifact = (Artifact) viewer.getInput();
- memento = memento.createChild(INPUT_KEY);
- memento.putString(GUID_KEY, artifact.getGuid());
- memento.putString(BRANCHID_KEY, String.valueOf(artifact.getBranch().getId()));
- }
-
- @Override
- public void init(IViewSite site, IMemento memento) throws PartInitException {
- super.init(site, memento);
- try {
- if (memento != null) {
- memento = memento.getChild(INPUT_KEY);
- if (memento != null) {
- storedGuid = memento.getString(GUID_KEY);
- storedBrandId = memento.getString(BRANCHID_KEY);
- }
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.WARNING, "Sky Walker error on init: ", ex);
- }
- }
-
- /**
- * @return the options
- */
- public SkyWalkerOptions getOptions() {
- return options;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.skywalker;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.core.data.SystemUser;
+import org.eclipse.osee.framework.jdk.core.util.AFile;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+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.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.ArtifactDoubleClick;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.util.ImageCapture;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.zest.core.viewers.GraphViewer;
+import org.eclipse.zest.core.widgets.GraphItem;
+import org.eclipse.zest.core.widgets.GraphNode;
+import org.eclipse.zest.core.widgets.ZestStyles;
+
+/**
+ * @author Robert A. Fisher
+ * @author Donald G. Dunne
+ */
+public class SkyWalkerView extends ViewPart {
+ public static final String VIEW_ID = "org.eclipse.osee.framework.ui.skynet.skywalker.SkyWalkerView";
+ protected GraphViewer viewer;
+ private static final String INPUT_KEY = "input";
+ private static final String GUID_KEY = "guid";
+ private static final String BRANCHID_KEY = "branchId";
+ private String storedGuid;
+ private String storedBrandId;
+ private final SkyWalkerOptions options = new SkyWalkerOptions();
+ private final List<Artifact> history = new LinkedList<Artifact>();
+ private Action filterAction;
+ private Composite viewerComp;
+ protected SashForm sashForm;
+
+ @Override
+ public void createPartControl(Composite parent) {
+
+ sashForm = new SashForm(parent, SWT.HORIZONTAL);
+ sashForm.setLayout(new FillLayout());
+
+ viewerComp = new Composite(sashForm, SWT.NONE);
+ viewerComp.setLayout(new FillLayout());
+
+ viewer = new GraphViewer(viewerComp, ZestStyles.NONE);
+ viewer.setContentProvider(new ArtifactGraphContentProvider(options));
+ viewer.setLabelProvider(new ArtifactGraphLabelProvider(options));
+ viewer.setConnectionStyle(ZestStyles.CONNECTIONS_SOLID);
+ viewer.setNodeStyle(ZestStyles.NODES_NO_LAYOUT_RESIZE);
+ viewer.addDoubleClickListener(new IDoubleClickListener() {
+
+ public void doubleClick(DoubleClickEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ Iterator<?> itemsIter = selection.iterator();
+ while (itemsIter.hasNext()) {
+ Object obj = itemsIter.next();
+ if (!(obj instanceof Artifact)) {
+ continue;
+ }
+ Artifact artifact = (Artifact) obj;
+ explore(artifact);
+ }
+ }
+
+ });
+
+ Composite child1 = new Composite(sashForm, SWT.BORDER);
+ child1.setLayout(new FillLayout());
+ new SkyWalkerTabOptions(child1, SWT.NONE, options);
+
+ options.addSkyWalkerOptionsChangeListener(new ISkyWalkerOptionsChangeListener() {
+ public void modified(ModType... modTypes) {
+ List<ModType> modList = Arrays.asList(modTypes);
+ // Don't redraw if artifact has been changed; else get in infinite loop
+ if (modList.contains(ModType.Artifact)) {
+ return;
+ }
+ if (modList.contains(ModType.Layout)) {
+ viewer.setLayoutAlgorithm(options.getLayout(), true);
+ } else if (modList.contains(ModType.Show_Attribute)) {
+ try {
+ // exploring another artifact and then the original forces a redraw of all the
+ // objects
+ // which is necessary for a node size change
+ Artifact art = (Artifact) viewer.getInput();
+ explore(UserManager.getUser(SystemUser.UnAssigned));
+ if (art != null) {
+ explore(art);
+ }
+ } catch (Exception ex) {
+ // DO Nothing
+ }
+ } else {
+ redraw();
+ }
+ }
+ });
+
+ sashForm.setWeights(new int[] {75, 25});
+
+ createActions();
+ viewer.setLayoutAlgorithm(options.getLayout());
+ // Restore current artifact if stored upon shutdown
+ try {
+ if (storedGuid != null) {
+ Artifact art =
+ ArtifactQuery.getArtifactFromId(storedGuid,
+ BranchManager.getBranch(Integer.parseInt(storedBrandId)));
+ if (art != null) {
+ explore(art);
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ protected void createActions() {
+
+ IActionBars bars = getViewSite().getActionBars();
+ // IMenuManager mm = bars.getMenuManager();
+ IToolBarManager tbm = bars.getToolBarManager();
+
+ filterAction = new Action("Enable Filters", Action.AS_CHECK_BOX) {
+ @Override
+ public void run() {
+ options.setFilterEnabled(filterAction.isChecked());
+ redraw();
+ }
+ };
+ filterAction.setChecked(options.isFilterEnabled());
+ filterAction.setToolTipText("Enable Filters");
+ filterAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.FILTERS));
+ tbm.add(filterAction);
+
+ Action action = new Action() {
+ @Override
+ public void run() {
+ ArtifactDoubleClick.openArtifact(viewer.getSelection());
+ }
+ };
+ action.setText("Open Selected");
+ action.setToolTipText("Open Selected");
+ action.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.EDIT2));
+ tbm.add(action);
+
+ action = new Action() {
+ @Override
+ public void run() {
+ if (history.size() > 0) {
+ Artifact art = history.get(history.size() - 1);
+ history.remove(history.size() - 1);
+ explore(art, true);
+ }
+ }
+ };
+ action.setText("Back");
+ action.setToolTipText("Back");
+ action.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.BACK));
+ tbm.add(action);
+
+ action = new Action() {
+ @Override
+ public void run() {
+ ImageCapture imgCapture = new ImageCapture(viewerComp);
+ imgCapture.popupDialog();
+ }
+ };
+ action.setText("Print");
+ action.setToolTipText("Print");
+ action.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.PRINT));
+ tbm.add(action);
+
+ action = new Action() {
+ @Override
+ public void run() {
+ handleSaveOptions();
+ }
+ };
+ action.setText("Save Options");
+ action.setToolTipText("Save Options");
+ action.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.SAVE));
+ tbm.add(action);
+
+ action = new Action() {
+ @Override
+ public void run() {
+ handleLoadOptions();
+ }
+ };
+ action.setText("Load Options");
+ action.setToolTipText("Load Options");
+ action.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.LOAD));
+ tbm.add(action);
+
+ action = new Action() {
+ @Override
+ public void run() {
+ redraw();
+ }
+ };
+ action.setText("Refresh");
+ action.setToolTipText("Refresh");
+ action.setImageDescriptor(ImageManager.getImageDescriptor(PluginUiImage.REFRESH));
+ tbm.add(action);
+ }
+
+ public void handleSaveOptions() {
+ final FileDialog dialog = new FileDialog(Displays.getActiveShell().getShell(), SWT.SAVE);
+ dialog.setFilterExtensions(new String[] {"*.sky"});
+ String filename = dialog.open();
+ if (filename != null) {
+ try {
+ Lib.writeStringToFile(options.toXml(), new File(filename));
+ AWorkbench.popup("Saved", "Save Successful");
+ } catch (IOException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+
+ public void handleLoadOptions() {
+ final FileDialog dialog = new FileDialog(Displays.getActiveShell().getShell(), SWT.OPEN);
+ dialog.setFilterExtensions(new String[] {"*.sky"});
+ String filename = dialog.open();
+ if (filename != null) {
+ String xml = AFile.readFile(filename);
+ options.fromXml(xml);
+ explore(options.getArtifact());
+ }
+ }
+
+ public void redraw() {
+ if (viewer.getInput() != null) {
+ explore((Artifact) viewer.getInput());
+ }
+ }
+
+ @Override
+ public void setFocus() {
+ viewer.getControl().setFocus();
+ }
+
+ public String getActionDescription() {
+ return "";
+ }
+
+ public void explore(Artifact artifact) {
+ explore(artifact, false);
+ }
+
+ private boolean inExplore = false;
+
+ private void explore(Artifact artifact, boolean fromHistory) {
+ // If already in explore method, don't respond to events trying to redraw
+ if (inExplore) {
+ return;
+ }
+ inExplore = true;
+ options.setArtifact(artifact);
+
+ // Add current artifact to history only if explore wasn't caused by going back in history
+ if (!fromHistory && viewer.getInput() != null) {
+ Artifact currArt = (Artifact) viewer.getInput();
+ if (history.isEmpty()) {
+ history.add(currArt);
+ } else if (history.size() > 0 && !history.get(history.size() - 1).equals(currArt)) {
+ history.add(currArt);
+ }
+ }
+ viewer.setInput(options.getArtifact());
+ // Highlight center object
+ GraphItem item = viewer.findGraphItem(options.getArtifact());
+ if (item != null && item instanceof GraphNode) {
+ GraphNode node = (GraphNode) item;
+ node.setBackgroundColor(Displays.getSystemColor(SWT.COLOR_CYAN));
+ viewer.update(node, null);
+ }
+ setPartName("Sky Walker (" + artifact.getName() + ")");
+ inExplore = false;
+ }
+
+ public static void exploreArtifact(Artifact artifact) {
+ exploreArtifact(artifact.getName(), artifact);
+ }
+
+ public static void exploreArtifact(String name, Artifact artifact) {
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ SkyWalkerView view;
+ try {
+ String id = GUID.create();
+ view = (SkyWalkerView) page.showView(SkyWalkerView.VIEW_ID, id, IWorkbenchPage.VIEW_ACTIVATE);
+ view.explore(artifact);
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ @Override
+ public void saveState(IMemento memento) {
+ super.saveState(memento);
+
+ if (viewer.getInput() == null) {
+ return;
+ }
+ Artifact artifact = (Artifact) viewer.getInput();
+ memento = memento.createChild(INPUT_KEY);
+ memento.putString(GUID_KEY, artifact.getGuid());
+ memento.putString(BRANCHID_KEY, String.valueOf(artifact.getBranch().getId()));
+ }
+
+ @Override
+ public void init(IViewSite site, IMemento memento) throws PartInitException {
+ super.init(site, memento);
+ try {
+ if (memento != null) {
+ memento = memento.getChild(INPUT_KEY);
+ if (memento != null) {
+ storedGuid = memento.getString(GUID_KEY);
+ storedBrandId = memento.getString(BRANCHID_KEY);
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.WARNING, "Sky Walker error on init: ", ex);
+ }
+ }
+
+ /**
+ * @return the options
+ */
+ public SkyWalkerOptions getOptions() {
+ return options;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/skywalker/arttype/ArtifactTypeWalker.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/skywalker/arttype/ArtifactTypeWalker.java
index 178a96a3ad4..fbd22d73c28 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/skywalker/arttype/ArtifactTypeWalker.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/skywalker/arttype/ArtifactTypeWalker.java
@@ -1,127 +1,127 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.skywalker.arttype;
-
-import java.util.Iterator;
-import java.util.logging.Level;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.ArtifactType;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
-import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.util.ArtifactTypeLabelProvider;
-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.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.part.ViewPart;
-import org.eclipse.zest.core.viewers.GraphViewer;
-import org.eclipse.zest.core.widgets.GraphItem;
-import org.eclipse.zest.core.widgets.GraphNode;
-import org.eclipse.zest.core.widgets.ZestStyles;
-import org.eclipse.zest.layouts.LayoutStyles;
-import org.eclipse.zest.layouts.algorithms.RadialLayoutAlgorithm;
-
-/**
- * @author Donald G. Dunne
- */
-public class ArtifactTypeWalker extends ViewPart {
- public static final String VIEW_ID = "org.eclipse.osee.framework.ui.skynet.skywalker.ArtifactTypeWalkerView";
- protected GraphViewer viewer;
- private Composite viewerComp;
-
- @Override
- public void createPartControl(Composite parent) {
-
- viewerComp = new Composite(parent, SWT.NONE);
- viewerComp.setLayout(new FillLayout());
-
- viewer = new GraphViewer(viewerComp, ZestStyles.NONE);
- viewer.setContentProvider(new ArtifactTypeContentProvider());
- viewer.setLabelProvider(new ArtifactTypeLabelProvider());
- viewer.setConnectionStyle(ZestStyles.CONNECTIONS_SOLID);
- viewer.setNodeStyle(ZestStyles.NODES_NO_LAYOUT_RESIZE);
- viewer.setLayoutAlgorithm(new RadialLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING));
- viewer.addDoubleClickListener(new IDoubleClickListener() {
-
- public void doubleClick(DoubleClickEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- Iterator<?> itemsIter = selection.iterator();
- while (itemsIter.hasNext()) {
- Object obj = itemsIter.next();
- if (obj instanceof ArtifactType) {
- explore((ArtifactType) obj);
- }
- }
- }
-
- });
- createActions();
- refresh();
- }
-
- private void explore(ArtifactType artifactType) {
- viewer.setInput(artifactType);
- GraphItem item = viewer.findGraphItem(artifactType);
- if (item != null && item instanceof GraphNode) {
- GraphNode node = (GraphNode) item;
- node.setBackgroundColor(Displays.getSystemColor(SWT.COLOR_CYAN));
- viewer.update(node, null);
- }
- setPartName("Artifact Type Walker (" + artifactType.getName() + ")");
- }
-
- protected void createActions() {
-
- IActionBars bars = getViewSite().getActionBars();
- // IMenuManager mm = bars.getMenuManager();
- IToolBarManager tbm = bars.getToolBarManager();
-
- Action action = new Action() {
- @Override
- public void run() {
- refresh();
- }
- };
- action.setText("Refresh");
- action.setToolTipText("Refresh");
- action.setImageDescriptor(ImageManager.getImageDescriptor(PluginUiImage.REFRESH));
- tbm.add(action);
- }
-
- public void refresh() {
- try {
- explore(ArtifactTypeManager.getType(CoreArtifactTypes.Artifact));
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
-
- @Override
- public void setFocus() {
- viewer.getControl().setFocus();
- }
-
- public String getActionDescription() {
- return "";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.skywalker.arttype;
+
+import java.util.Iterator;
+import java.util.logging.Level;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.type.ArtifactType;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
+import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.util.ArtifactTypeLabelProvider;
+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.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.zest.core.viewers.GraphViewer;
+import org.eclipse.zest.core.widgets.GraphItem;
+import org.eclipse.zest.core.widgets.GraphNode;
+import org.eclipse.zest.core.widgets.ZestStyles;
+import org.eclipse.zest.layouts.LayoutStyles;
+import org.eclipse.zest.layouts.algorithms.RadialLayoutAlgorithm;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ArtifactTypeWalker extends ViewPart {
+ public static final String VIEW_ID = "org.eclipse.osee.framework.ui.skynet.skywalker.ArtifactTypeWalkerView";
+ protected GraphViewer viewer;
+ private Composite viewerComp;
+
+ @Override
+ public void createPartControl(Composite parent) {
+
+ viewerComp = new Composite(parent, SWT.NONE);
+ viewerComp.setLayout(new FillLayout());
+
+ viewer = new GraphViewer(viewerComp, ZestStyles.NONE);
+ viewer.setContentProvider(new ArtifactTypeContentProvider());
+ viewer.setLabelProvider(new ArtifactTypeLabelProvider());
+ viewer.setConnectionStyle(ZestStyles.CONNECTIONS_SOLID);
+ viewer.setNodeStyle(ZestStyles.NODES_NO_LAYOUT_RESIZE);
+ viewer.setLayoutAlgorithm(new RadialLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING));
+ viewer.addDoubleClickListener(new IDoubleClickListener() {
+
+ public void doubleClick(DoubleClickEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ Iterator<?> itemsIter = selection.iterator();
+ while (itemsIter.hasNext()) {
+ Object obj = itemsIter.next();
+ if (obj instanceof ArtifactType) {
+ explore((ArtifactType) obj);
+ }
+ }
+ }
+
+ });
+ createActions();
+ refresh();
+ }
+
+ private void explore(ArtifactType artifactType) {
+ viewer.setInput(artifactType);
+ GraphItem item = viewer.findGraphItem(artifactType);
+ if (item != null && item instanceof GraphNode) {
+ GraphNode node = (GraphNode) item;
+ node.setBackgroundColor(Displays.getSystemColor(SWT.COLOR_CYAN));
+ viewer.update(node, null);
+ }
+ setPartName("Artifact Type Walker (" + artifactType.getName() + ")");
+ }
+
+ protected void createActions() {
+
+ IActionBars bars = getViewSite().getActionBars();
+ // IMenuManager mm = bars.getMenuManager();
+ IToolBarManager tbm = bars.getToolBarManager();
+
+ Action action = new Action() {
+ @Override
+ public void run() {
+ refresh();
+ }
+ };
+ action.setText("Refresh");
+ action.setToolTipText("Refresh");
+ action.setImageDescriptor(ImageManager.getImageDescriptor(PluginUiImage.REFRESH));
+ tbm.add(action);
+ }
+
+ public void refresh() {
+ try {
+ explore(ArtifactTypeManager.getType(CoreArtifactTypes.Artifact));
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ @Override
+ public void setFocus() {
+ viewer.getControl().setFocus();
+ }
+
+ public String getActionDescription() {
+ return "";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/ArtifactTemplateProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/ArtifactTemplateProvider.java
index 88559c66add..b56fa3bd0a8 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/ArtifactTemplateProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/ArtifactTemplateProvider.java
@@ -1,145 +1,145 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.templates;
-
-import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.EXCLUDE_DELETED;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.logging.Level;
-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.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.render.IRenderer;
-
-/**
- * This provider gets all of its templates from the common branch based on a name created from concatenating the
- * getTemplate parameters together in the various possible combinations
- *
- * @author Ryan D. Brooks
- */
-public class ArtifactTemplateProvider implements ITemplateProvider {
- private HashMap<String, Artifact> templateMap;
-
- private List<Artifact> templates;
-
- public ArtifactTemplateProvider() {
-
- }
-
- private synchronized void ensureTemplateCachePopulated() throws OseeCoreException {
- if (templateMap == null) {
- templateMap = new HashMap<String, Artifact>();
- templates = ArtifactQuery.getArtifactListFromType("Renderer Template", BranchManager.getCommonBranch());
- for (Artifact art : templates) {
- Collection<Attribute<String>> attrs = art.getAttributes("Template Match Criteria");
- for (Attribute<String> attr : attrs) {
- String matchCriteria = attr.getValue();
- Artifact cachedArt = templateMap.get(matchCriteria);
- if (cachedArt == null) {
- templateMap.put(matchCriteria, art);
- } else { //use the artifact with the higher name value and warn the user that there are duplicate match criteria
- int value = cachedArt.getName().compareTo(art.getName());
- if (value < 0) {
- templateMap.put(matchCriteria, art);
- }
- OseeLog.log(
- SkynetGuiPlugin.class,
- Level.SEVERE,
- String.format(
- "ArtifactTemplateProvider has detected a conflict with 'Template Match Criteria' [%s]. Artifact [%s] will supply the template for all requests with this match criteria.",
- matchCriteria, templateMap.get(matchCriteria).getName()));
-
- }
- }
- }
- }
- }
-
- @Override
- public Artifact getTemplate(IRenderer renderer, Artifact artifact, String presentationType, String option) throws OseeCoreException {
- ensureTemplateCachePopulated();
-
- Artifact template = getArtifactFromOptionName(option);
-
- if (template == null) {
- List<String> possibleTemplateNames =
- getPossibleTemplateNamesOrderedBySpecialization(renderer, artifact, presentationType, option);
-
- for (String name : possibleTemplateNames) {
- template = templateMap.get(name);
- if (template != null) {
- return template;
- }
- }
- } else {
- return template;
- }
- throw new OseeArgumentException(String.format("Unable to find a valid template match for [%s, %s, %s, %s].",
- renderer.toString(), artifact.toString(), presentationType, option));
- }
-
- private Artifact getArtifactFromOptionName(String name) throws OseeCoreException {
- Artifact toReturn = null;
-
- if (name == null) {
- 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.framework.ui.skynet.templates;
+
+import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.EXCLUDE_DELETED;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.logging.Level;
+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.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.render.IRenderer;
+
+/**
+ * This provider gets all of its templates from the common branch based on a name created from concatenating the
+ * getTemplate parameters together in the various possible combinations
+ *
+ * @author Ryan D. Brooks
+ */
+public class ArtifactTemplateProvider implements ITemplateProvider {
+ private HashMap<String, Artifact> templateMap;
+
+ private List<Artifact> templates;
+
+ public ArtifactTemplateProvider() {
+
+ }
+
+ private synchronized void ensureTemplateCachePopulated() throws OseeCoreException {
+ if (templateMap == null) {
+ templateMap = new HashMap<String, Artifact>();
+ templates = ArtifactQuery.getArtifactListFromType("Renderer Template", BranchManager.getCommonBranch());
+ for (Artifact art : templates) {
+ Collection<Attribute<String>> attrs = art.getAttributes("Template Match Criteria");
+ for (Attribute<String> attr : attrs) {
+ String matchCriteria = attr.getValue();
+ Artifact cachedArt = templateMap.get(matchCriteria);
+ if (cachedArt == null) {
+ templateMap.put(matchCriteria, art);
+ } else { //use the artifact with the higher name value and warn the user that there are duplicate match criteria
+ int value = cachedArt.getName().compareTo(art.getName());
+ if (value < 0) {
+ templateMap.put(matchCriteria, art);
+ }
+ OseeLog.log(
+ SkynetGuiPlugin.class,
+ Level.SEVERE,
+ String.format(
+ "ArtifactTemplateProvider has detected a conflict with 'Template Match Criteria' [%s]. Artifact [%s] will supply the template for all requests with this match criteria.",
+ matchCriteria, templateMap.get(matchCriteria).getName()));
+
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public Artifact getTemplate(IRenderer renderer, Artifact artifact, String presentationType, String option) throws OseeCoreException {
+ ensureTemplateCachePopulated();
+
+ Artifact template = getArtifactFromOptionName(option);
+
+ if (template == null) {
+ List<String> possibleTemplateNames =
+ getPossibleTemplateNamesOrderedBySpecialization(renderer, artifact, presentationType, option);
+
+ for (String name : possibleTemplateNames) {
+ template = templateMap.get(name);
+ if (template != null) {
+ return template;
+ }
+ }
+ } else {
+ return template;
+ }
+ throw new OseeArgumentException(String.format("Unable to find a valid template match for [%s, %s, %s, %s].",
+ renderer.toString(), artifact.toString(), presentationType, option));
+ }
+
+ private Artifact getArtifactFromOptionName(String name) throws OseeCoreException {
+ Artifact toReturn = null;
+
+ if (name == null) {
+ return toReturn;
+ }
List<Artifact> artifacts =
ArtifactQuery.getArtifactListFromName(name, BranchManager.getCommonBranch(), EXCLUDE_DELETED);
-
- if (!artifacts.isEmpty()) {
- toReturn = artifacts.iterator().next();
- }
- return toReturn;
- }
-
- private List<String> getPossibleTemplateNamesOrderedBySpecialization(IRenderer renderer, Artifact artifact, String presentationType, String option) throws OseeArgumentException {
- if (renderer == null || presentationType == null) {
- throw new OseeArgumentException(String.format("Invalid renderer[%s] or presentationType[%s]",
- renderer.toString(), presentationType.toString()));
- }
- List<String> list = new ArrayList<String>();
-
- String rendererId = renderer.getClass().getCanonicalName();
- if (artifact != null && option != null) {
- list.add(rendererId + " " + artifact.getArtifactTypeName() + " " + presentationType + " " + option);
- }
- if (artifact != null) {
- list.add(rendererId + " " + artifact.getArtifactTypeName() + " " + presentationType);
- }
- if (option != null) {
- list.add(rendererId + " " + presentationType + " " + option);
- }
-
- list.add(rendererId + " " + presentationType);
- return list;
- }
-
- public int getApplicabilityRating(IRenderer rendererId, Artifact artifact, String presentationType, String option) {
- return ITemplateProvider.DEFAULT_MATCH;
- }
-
- public List<Artifact> getAllTemplates() throws OseeCoreException {
- if (templates == null) {
- templates = ArtifactQuery.getArtifactListFromType("Renderer Template", BranchManager.getCommonBranch());
- }
- return templates;
- }
-
-}
+
+ if (!artifacts.isEmpty()) {
+ toReturn = artifacts.iterator().next();
+ }
+ return toReturn;
+ }
+
+ private List<String> getPossibleTemplateNamesOrderedBySpecialization(IRenderer renderer, Artifact artifact, String presentationType, String option) throws OseeArgumentException {
+ if (renderer == null || presentationType == null) {
+ throw new OseeArgumentException(String.format("Invalid renderer[%s] or presentationType[%s]",
+ renderer.toString(), presentationType.toString()));
+ }
+ List<String> list = new ArrayList<String>();
+
+ String rendererId = renderer.getClass().getCanonicalName();
+ if (artifact != null && option != null) {
+ list.add(rendererId + " " + artifact.getArtifactTypeName() + " " + presentationType + " " + option);
+ }
+ if (artifact != null) {
+ list.add(rendererId + " " + artifact.getArtifactTypeName() + " " + presentationType);
+ }
+ if (option != null) {
+ list.add(rendererId + " " + presentationType + " " + option);
+ }
+
+ list.add(rendererId + " " + presentationType);
+ return list;
+ }
+
+ public int getApplicabilityRating(IRenderer rendererId, Artifact artifact, String presentationType, String option) {
+ return ITemplateProvider.DEFAULT_MATCH;
+ }
+
+ public List<Artifact> getAllTemplates() throws OseeCoreException {
+ if (templates == null) {
+ templates = ArtifactQuery.getArtifactListFromType("Renderer Template", BranchManager.getCommonBranch());
+ }
+ return templates;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/ITemplateProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/ITemplateProvider.java
index 3fa5566e6da..c7c00a84588 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/ITemplateProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/ITemplateProvider.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.framework.ui.skynet.templates;
-
-import java.util.List;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.render.IRenderer;
-
-/**
- * @author Roberto E. Escobar
- */
-public interface ITemplateProvider {
-
- public static final int SUBTYPE_TYPE_MATCH = 30;
- public static final int ARTIFACT_TYPE_MATCH = 20;
- public static final int DEFAULT_MATCH = 10;
- public static final int NO_MATCH = -1;
-
- public Artifact getTemplate(IRenderer renderer, Artifact artifact, String presentationType, String option) throws OseeCoreException;
-
- public abstract int getApplicabilityRating(IRenderer renderer, Artifact artifact, String presentationType, String option);
-
- public List<Artifact> getAllTemplates() 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.framework.ui.skynet.templates;
+
+import java.util.List;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.render.IRenderer;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface ITemplateProvider {
+
+ public static final int SUBTYPE_TYPE_MATCH = 30;
+ public static final int ARTIFACT_TYPE_MATCH = 20;
+ public static final int DEFAULT_MATCH = 10;
+ public static final int NO_MATCH = -1;
+
+ public Artifact getTemplate(IRenderer renderer, Artifact artifact, String presentationType, String option) throws OseeCoreException;
+
+ public abstract int getApplicabilityRating(IRenderer renderer, Artifact artifact, String presentationType, String option);
+
+ public List<Artifact> getAllTemplates() throws OseeCoreException;
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/TemplateManager.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/TemplateManager.java
index 1937b11c83a..d3dc0c95386 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/TemplateManager.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/TemplateManager.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.framework.ui.skynet.templates;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.plugin.core.util.ExtensionDefinedObjects;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.render.IRenderer;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class TemplateManager {
- private static final String EXTENSION_ID = "org.eclipse.osee.framework.ui.skynet.TemplateProvider";
- private static final String EXTENSION_ELEMENT = "TemplateProvider";
- private static final String EXTENSION_CLASSNAME = "classname";
- private final List<ITemplateProvider> templateProviders;
- private static final TemplateManager instance = new TemplateManager();
-
- private TemplateManager() {
- ExtensionDefinedObjects<ITemplateProvider> extensionDefinedObjects =
- new ExtensionDefinedObjects<ITemplateProvider>(EXTENSION_ID, EXTENSION_ELEMENT, EXTENSION_CLASSNAME);
- templateProviders = extensionDefinedObjects.getObjects();
- }
-
- public static Artifact getTemplate(IRenderer renderer, Artifact artifact, String presentationType, String option) throws OseeCoreException {
- ITemplateProvider bestTemplateProvider = null;
- int highestRating = 0;
- for (ITemplateProvider templateProvider : instance.templateProviders) {
- int rating = templateProvider.getApplicabilityRating(renderer, artifact, presentationType, option);
- if (rating > highestRating) {
- bestTemplateProvider = templateProvider;
- highestRating = rating;
- }
- }
- return bestTemplateProvider.getTemplate(renderer, artifact, presentationType, option);
- }
-
- public static List<Artifact> getAllTemplates() {
- List<Artifact> templates = new ArrayList<Artifact>();
- try {
- for (ITemplateProvider provider : instance.templateProviders) {
- templates.addAll(provider.getAllTemplates());
- }
- Collections.sort(templates);
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- return templates;
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.templates;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.plugin.core.util.ExtensionDefinedObjects;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.render.IRenderer;
+
+/**
+ * @author Andrew M. Finkbeiner
+ */
+public class TemplateManager {
+ private static final String EXTENSION_ID = "org.eclipse.osee.framework.ui.skynet.TemplateProvider";
+ private static final String EXTENSION_ELEMENT = "TemplateProvider";
+ private static final String EXTENSION_CLASSNAME = "classname";
+ private final List<ITemplateProvider> templateProviders;
+ private static final TemplateManager instance = new TemplateManager();
+
+ private TemplateManager() {
+ ExtensionDefinedObjects<ITemplateProvider> extensionDefinedObjects =
+ new ExtensionDefinedObjects<ITemplateProvider>(EXTENSION_ID, EXTENSION_ELEMENT, EXTENSION_CLASSNAME);
+ templateProviders = extensionDefinedObjects.getObjects();
+ }
+
+ public static Artifact getTemplate(IRenderer renderer, Artifact artifact, String presentationType, String option) throws OseeCoreException {
+ ITemplateProvider bestTemplateProvider = null;
+ int highestRating = 0;
+ for (ITemplateProvider templateProvider : instance.templateProviders) {
+ int rating = templateProvider.getApplicabilityRating(renderer, artifact, presentationType, option);
+ if (rating > highestRating) {
+ bestTemplateProvider = templateProvider;
+ highestRating = rating;
+ }
+ }
+ return bestTemplateProvider.getTemplate(renderer, artifact, presentationType, option);
+ }
+
+ public static List<Artifact> getAllTemplates() {
+ List<Artifact> templates = new ArrayList<Artifact>();
+ try {
+ for (ITemplateProvider provider : instance.templateProviders) {
+ templates.addAll(provider.getAllTemplates());
+ }
+ Collections.sort(templates);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ return templates;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/InterArtifactExplorerDropHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/InterArtifactExplorerDropHandler.java
index 05f594abb7e..18287fcba75 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/InterArtifactExplorerDropHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/InterArtifactExplorerDropHandler.java
@@ -1,176 +1,176 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.update;
-
-import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.INCLUDE_DELETED;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osee.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.client.ClientSessionManager;
-import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-import org.eclipse.osee.framework.core.enums.RelationOrderBaseTypes;
-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.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.OseeSql;
-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.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.ui.swt.Displays;
-
-/**
- * @author Jeff C. Phillips
- */
-public class InterArtifactExplorerDropHandler {
-
- private static final String ACCESS_ERROR_MSG_TITLE = "Drag and Drop Error";
- private static final String UPDATE_FROM_PARENT_ERROR_MSG =
- "Attempting to update child branch from parent branch. Use 'Update Branch' instead.";
- private static final String ACCESS_ERROR_MSG =
- "Access control has restricted this action. The current user does not have sufficient permission to drag and drop artifacts on this branch from the selected source branch.";
-
- public void dropArtifactIntoDifferentBranch(Artifact destinationParentArtifact, Artifact[] sourceArtifacts, boolean prompt) throws OseeCoreException {
- if (destinationParentArtifact == null || sourceArtifacts == null || sourceArtifacts.length < 1) {
- throw new OseeArgumentException("Invalid arguments");
- }
- Branch sourceBranch = sourceArtifacts[0].getBranch();
- Branch destinationBranch = destinationParentArtifact.getBranch();
-
- if (isUpdateFromParent(sourceBranch, destinationBranch)) {
- MessageDialog.openError(Displays.getActiveShell(), ACCESS_ERROR_MSG_TITLE,
- UPDATE_FROM_PARENT_ERROR_MSG);
- } else if (isAccessAllowed(sourceBranch, destinationBranch)) {
- List<TransferObject> transferObjects = createTransferObjects(destinationParentArtifact, sourceArtifacts);
- if (prompt) {
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.update;
+
+import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.INCLUDE_DELETED;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.osee.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.core.client.ClientSessionManager;
+import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
+import org.eclipse.osee.framework.core.enums.RelationOrderBaseTypes;
+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.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.OseeSql;
+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.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.ui.swt.Displays;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class InterArtifactExplorerDropHandler {
+
+ private static final String ACCESS_ERROR_MSG_TITLE = "Drag and Drop Error";
+ private static final String UPDATE_FROM_PARENT_ERROR_MSG =
+ "Attempting to update child branch from parent branch. Use 'Update Branch' instead.";
+ private static final String ACCESS_ERROR_MSG =
+ "Access control has restricted this action. The current user does not have sufficient permission to drag and drop artifacts on this branch from the selected source branch.";
+
+ public void dropArtifactIntoDifferentBranch(Artifact destinationParentArtifact, Artifact[] sourceArtifacts, boolean prompt) throws OseeCoreException {
+ if (destinationParentArtifact == null || sourceArtifacts == null || sourceArtifacts.length < 1) {
+ throw new OseeArgumentException("Invalid arguments");
+ }
+ Branch sourceBranch = sourceArtifacts[0].getBranch();
+ Branch destinationBranch = destinationParentArtifact.getBranch();
+
+ if (isUpdateFromParent(sourceBranch, destinationBranch)) {
+ MessageDialog.openError(Displays.getActiveShell(), ACCESS_ERROR_MSG_TITLE,
+ UPDATE_FROM_PARENT_ERROR_MSG);
+ } else if (isAccessAllowed(sourceBranch, destinationBranch)) {
+ List<TransferObject> transferObjects = createTransferObjects(destinationParentArtifact, sourceArtifacts);
+ if (prompt) {
boolean userConfirmed = confirmUsersRequestAndProcess(transferObjects);
- if (!userConfirmed) {
- return;
- }
- }
- addArtifactsToNewTransaction(destinationParentArtifact, transferObjects, sourceBranch);
- } else {
- MessageDialog.openError(Displays.getActiveShell(), ACCESS_ERROR_MSG_TITLE, ACCESS_ERROR_MSG);
- }
- }
+ if (!userConfirmed) {
+ return;
+ }
+ }
+ addArtifactsToNewTransaction(destinationParentArtifact, transferObjects, sourceBranch);
+ } else {
+ MessageDialog.openError(Displays.getActiveShell(), ACCESS_ERROR_MSG_TITLE, ACCESS_ERROR_MSG);
+ }
+ }
private List<TransferObject> createTransferObjects(Artifact destinationParentArtifact, Artifact[] sourceArtifacts) throws OseeCoreException {
- List<TransferObject> transferObjects = new LinkedList<TransferObject>();
-
- for (Artifact sourceArtifact : sourceArtifacts) {
- TransferStatus transferStatus = null;
- if (artifactOnBranch(destinationParentArtifact.getBranch(), sourceArtifact)) {
- transferStatus = TransferStatus.UPDATE;
- } else {
- transferStatus = TransferStatus.INTRODUCE;
- }
- transferObjects.add(new TransferObject(sourceArtifact, transferStatus));
- }
- return transferObjects;
- }
-
- private boolean isUpdateFromParent(Branch sourceBranch, Branch destinationBranch) throws OseeCoreException {
- boolean result = false;
- if (destinationBranch.hasParentBranch()) {
- result = destinationBranch.getParentBranch().equals(sourceBranch);
- }
- return result;
- }
-
- private boolean isAccessAllowed(Branch sourceBranch, Branch destinationBranch) throws OseeCoreException {
- return AccessControlManager.hasPermission(destinationBranch, PermissionEnum.WRITE) && AccessControlManager.hasPermission(
- sourceBranch, PermissionEnum.READ);
- }
-
+ List<TransferObject> transferObjects = new LinkedList<TransferObject>();
+
+ for (Artifact sourceArtifact : sourceArtifacts) {
+ TransferStatus transferStatus = null;
+ if (artifactOnBranch(destinationParentArtifact.getBranch(), sourceArtifact)) {
+ transferStatus = TransferStatus.UPDATE;
+ } else {
+ transferStatus = TransferStatus.INTRODUCE;
+ }
+ transferObjects.add(new TransferObject(sourceArtifact, transferStatus));
+ }
+ return transferObjects;
+ }
+
+ private boolean isUpdateFromParent(Branch sourceBranch, Branch destinationBranch) throws OseeCoreException {
+ boolean result = false;
+ if (destinationBranch.hasParentBranch()) {
+ result = destinationBranch.getParentBranch().equals(sourceBranch);
+ }
+ return result;
+ }
+
+ private boolean isAccessAllowed(Branch sourceBranch, Branch destinationBranch) throws OseeCoreException {
+ return AccessControlManager.hasPermission(destinationBranch, PermissionEnum.WRITE) && AccessControlManager.hasPermission(
+ sourceBranch, PermissionEnum.READ);
+ }
+
private boolean confirmUsersRequestAndProcess(List<TransferObject> transferObjects) {
- ReflectArtifactStatusDialog updateArtifactStatusDialog = new ReflectArtifactStatusDialog(transferObjects);
- return updateArtifactStatusDialog.open() == Window.OK;
- }
-
- private void addArtifactsToNewTransaction(Artifact destinationArtifact, List<TransferObject> transferObjects, Branch sourceBranch) throws OseeCoreException {
- loadArtifactsIntoCache(transferObjects, sourceBranch);
- handleTransfers(transferObjects, destinationArtifact);
- }
+ ReflectArtifactStatusDialog updateArtifactStatusDialog = new ReflectArtifactStatusDialog(transferObjects);
+ return updateArtifactStatusDialog.open() == Window.OK;
+ }
+
+ private void addArtifactsToNewTransaction(Artifact destinationArtifact, List<TransferObject> transferObjects, Branch sourceBranch) throws OseeCoreException {
+ loadArtifactsIntoCache(transferObjects, sourceBranch);
+ handleTransfers(transferObjects, destinationArtifact);
+ }
private void reloadCachedArtifacts(ArrayList<Artifact> reloadArtifacts) throws OseeCoreException {
- for (Artifact reloadArtifact : reloadArtifacts) {
- reloadArtifact.reloadAttributesAndRelations();
- }
- }
+ for (Artifact reloadArtifact : reloadArtifacts) {
+ reloadArtifact.reloadAttributesAndRelations();
+ }
+ }
private void handleTransfers(List<TransferObject> transferObjects, Artifact destinationArtifact) throws OseeCoreException {
SkynetTransaction transaction =
new SkynetTransaction(destinationArtifact.getBranch(),
"Introduced " + transferObjects.size() + " artifact(s)");
- ArrayList<Artifact> reloadArtifacts = new ArrayList<Artifact>();
+ ArrayList<Artifact> reloadArtifacts = new ArrayList<Artifact>();
- for (TransferObject transferObject : transferObjects) {
- TransferStatus status = transferObject.getStatus();
- Artifact updatedArtifact = null;
- if (status == TransferStatus.INTRODUCE) {
- updatedArtifact = handleIntroduceCase(transferObject, destinationArtifact);
+ for (TransferObject transferObject : transferObjects) {
+ TransferStatus status = transferObject.getStatus();
+ Artifact updatedArtifact = null;
+ if (status == TransferStatus.INTRODUCE) {
+ updatedArtifact = handleIntroduceCase(transferObject, destinationArtifact);
} else if (status == TransferStatus.UPDATE) {
- updatedArtifact = handleUpdateCase(transferObject, destinationArtifact, reloadArtifacts);
- }
- updatedArtifact.persist(transaction);
- }
- transaction.execute();
- reloadCachedArtifacts(reloadArtifacts);
- }
+ updatedArtifact = handleUpdateCase(transferObject, destinationArtifact, reloadArtifacts);
+ }
+ updatedArtifact.persist(transaction);
+ }
+ transaction.execute();
+ reloadCachedArtifacts(reloadArtifacts);
+ }
private void loadArtifactsIntoCache(List<TransferObject> transferObjects, Branch sourceBranch) throws OseeCoreException {
- ArrayList<Integer> sourceArtIds = new ArrayList<Integer>(transferObjects.size());
+ ArrayList<Integer> sourceArtIds = new ArrayList<Integer>(transferObjects.size());
- for (TransferObject transferObject : transferObjects) {
- sourceArtIds.add(transferObject.getArtifact().getArtId());
- }
+ for (TransferObject transferObject : transferObjects) {
+ sourceArtIds.add(transferObject.getArtifact().getArtId());
+ }
ArtifactQuery.getArtifactListFromIds(sourceArtIds, sourceBranch);
- }
+ }
private Artifact handleIntroduceCase(TransferObject transferObject, Artifact destinationArtifact) throws OseeCoreException {
- Artifact updatedArtifact = null;
- Artifact sourceArtifact = transferObject.getArtifact();
- Artifact parentArtifact = getParent(sourceArtifact, destinationArtifact);
- updatedArtifact = sourceArtifact.reflect(destinationArtifact.getBranch());
+ Artifact updatedArtifact = null;
+ Artifact sourceArtifact = transferObject.getArtifact();
+ Artifact parentArtifact = getParent(sourceArtifact, destinationArtifact);
+ updatedArtifact = sourceArtifact.reflect(destinationArtifact.getBranch());
updatedArtifact.setRelations(RelationOrderBaseTypes.USER_DEFINED, CoreRelationTypes.Default_Hierarchical__Parent,
Collections.singleton(parentArtifact));
- return updatedArtifact;
- }
+ return updatedArtifact;
+ }
private Artifact handleUpdateCase(TransferObject transferObject, Artifact destinationArtifact, ArrayList<Artifact> reloadArtifacts) throws OseeCoreException {
- Artifact sourceArtifact = transferObject.getArtifact();
- destinationArtifact.updateArtifactFromBranch(sourceArtifact.getBranch());
- reloadArtifacts.add(destinationArtifact);
- return destinationArtifact;
- }
-
- private Artifact getParent(Artifact sourceArtifact, Artifact destinationArtifact) throws OseeCoreException {
- Artifact reflectedArtifact =
+ Artifact sourceArtifact = transferObject.getArtifact();
+ destinationArtifact.updateArtifactFromBranch(sourceArtifact.getBranch());
+ reloadArtifacts.add(destinationArtifact);
+ return destinationArtifact;
+ }
+
+ private Artifact getParent(Artifact sourceArtifact, Artifact destinationArtifact) throws OseeCoreException {
+ Artifact reflectedArtifact =
ArtifactQuery.checkArtifactFromId(sourceArtifact.getArtId(), destinationArtifact.getBranch(),
INCLUDE_DELETED);
- Artifact newDestinationArtifact = destinationArtifact;
-
- if (reflectedArtifact != null) {
- newDestinationArtifact = reflectedArtifact.getParent();
- }
- return newDestinationArtifact;
- }
-
- private boolean artifactOnBranch(Branch sourceBranch, Artifact sourceArtifact) throws OseeCoreException {
+ Artifact newDestinationArtifact = destinationArtifact;
+
+ if (reflectedArtifact != null) {
+ newDestinationArtifact = reflectedArtifact.getParent();
+ }
+ return newDestinationArtifact;
+ }
+
+ private boolean artifactOnBranch(Branch sourceBranch, Artifact sourceArtifact) throws OseeCoreException {
return ConnectionHandler.runPreparedQueryFetchInt(0, ClientSessionManager.getSql(OseeSql.IS_ARTIFACT_ON_BRANCH),
sourceArtifact.getArtId(), sourceBranch.getId()) > 0;
- }
-}
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/ReflectArtifactStatusDialog.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/ReflectArtifactStatusDialog.java
index 8551da80d32..d81c6d83611 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/ReflectArtifactStatusDialog.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/ReflectArtifactStatusDialog.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.update;
-
+package org.eclipse.osee.framework.ui.skynet.update;
+
import java.util.List;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.TreeViewer;
@@ -17,34 +17,34 @@ import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-
-/**
- * @author Jeff C. Phillips
- *
- */
-public class ReflectArtifactStatusDialog extends MessageDialog{
- private static final String TITLE = "Confirm Inter Artifact Explorer Drop";
- private static final String OK = "Ok";
- private static final String CANCEL = "Cancel";
- private List<TransferObject> transferObjects;
-
- public ReflectArtifactStatusDialog(List<TransferObject> transferObjects) {
- super(Displays.getActiveShell(), TITLE, null, null, MessageDialog.NONE,
- new String[] {OK, CANCEL}, 0);
- this.transferObjects = transferObjects;
- }
-
- @Override
- protected Control createDialogArea(Composite container) {
- TreeViewer listViewer = new TreeViewer(container);
- GridData gridData = new GridData(GridData.FILL_BOTH);
- gridData.heightHint = 270;
- gridData.widthHint = 500;
- listViewer.getControl().setLayoutData(gridData);
- listViewer.setContentProvider(new ReflectContentProvider());
- listViewer.setLabelProvider(new ReflectDecoratingLabelProvider(new RevertLabelProvider()));
- listViewer.setInput(transferObjects);
-
- return listViewer.getControl();
- }
-}
+
+/**
+ * @author Jeff C. Phillips
+ *
+ */
+public class ReflectArtifactStatusDialog extends MessageDialog{
+ private static final String TITLE = "Confirm Inter Artifact Explorer Drop";
+ private static final String OK = "Ok";
+ private static final String CANCEL = "Cancel";
+ private List<TransferObject> transferObjects;
+
+ public ReflectArtifactStatusDialog(List<TransferObject> transferObjects) {
+ super(Displays.getActiveShell(), TITLE, null, null, MessageDialog.NONE,
+ new String[] {OK, CANCEL}, 0);
+ this.transferObjects = transferObjects;
+ }
+
+ @Override
+ protected Control createDialogArea(Composite container) {
+ TreeViewer listViewer = new TreeViewer(container);
+ GridData gridData = new GridData(GridData.FILL_BOTH);
+ gridData.heightHint = 270;
+ gridData.widthHint = 500;
+ listViewer.getControl().setLayoutData(gridData);
+ listViewer.setContentProvider(new ReflectContentProvider());
+ listViewer.setLabelProvider(new ReflectDecoratingLabelProvider(new RevertLabelProvider()));
+ listViewer.setInput(transferObjects);
+
+ return listViewer.getControl();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/ReflectContentProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/ReflectContentProvider.java
index 4c211a3ccbe..5d9134b0787 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/ReflectContentProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/ReflectContentProvider.java
@@ -8,50 +8,50 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.update;
-
+package org.eclipse.osee.framework.ui.skynet.update;
+
import java.util.Collection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
-
-/**
- * @author Jeff C. Phillips
- *
- */
-public class ReflectContentProvider implements ITreeContentProvider{
-
- @Override
- public Object[] getChildren(Object parentElement) {
- return null;
- }
-
- @Override
- public Object getParent(Object element) {
- return null;
- }
-
- @Override
- public boolean hasChildren(Object element) {
- return false;
- }
-
- @Override
- public Object[] getElements(Object inputElement) {
- if (inputElement instanceof Object[]) {
- return (Object[]) inputElement;
- }
- if (inputElement instanceof Collection) {
- return ((Collection<?>) inputElement).toArray();
- }
- return new Object[0];
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
-}
+
+/**
+ * @author Jeff C. Phillips
+ *
+ */
+public class ReflectContentProvider implements ITreeContentProvider{
+
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ return null;
+ }
+
+ @Override
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ @Override
+ public boolean hasChildren(Object element) {
+ return false;
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ if (inputElement instanceof Object[]) {
+ return (Object[]) inputElement;
+ }
+ if (inputElement instanceof Collection) {
+ return ((Collection<?>) inputElement).toArray();
+ }
+ return new Object[0];
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/ReflectDecoratingLabelProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/ReflectDecoratingLabelProvider.java
index afb7f1bcaa3..f58c97e7c7d 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/ReflectDecoratingLabelProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/ReflectDecoratingLabelProvider.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.framework.ui.skynet.update;
-
-import org.eclipse.jface.viewers.ColumnViewer;
-import org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ViewerColumn;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Jeff C. Phillips
- */
-public class ReflectDecoratingLabelProvider extends DecoratingStyledCellLabelProvider implements ILabelProvider {
-
- public ReflectDecoratingLabelProvider(RevertLabelProvider labelProvider) {
- super(labelProvider, PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator(), null);
- }
-
- public void initialize(ColumnViewer viewer, ViewerColumn column) {
- setOwnerDrawEnabled(true);
-
- super.initialize(viewer, column);
- }
-
- protected StyleRange prepareStyleRange(StyleRange styleRange, boolean applyColors) {
- if (!applyColors && styleRange.background != null) {
- styleRange = super.prepareStyleRange(styleRange, applyColors);
- styleRange.borderStyle = SWT.BORDER_DASH;
- return styleRange;
- }
- return super.prepareStyleRange(styleRange, applyColors);
- }
-
- public String getText(Object element) {
- return getStyledText(element).getString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.update;
+
+import org.eclipse.jface.viewers.ColumnViewer;
+import org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ViewerColumn;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class ReflectDecoratingLabelProvider extends DecoratingStyledCellLabelProvider implements ILabelProvider {
+
+ public ReflectDecoratingLabelProvider(RevertLabelProvider labelProvider) {
+ super(labelProvider, PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator(), null);
+ }
+
+ public void initialize(ColumnViewer viewer, ViewerColumn column) {
+ setOwnerDrawEnabled(true);
+
+ super.initialize(viewer, column);
+ }
+
+ protected StyleRange prepareStyleRange(StyleRange styleRange, boolean applyColors) {
+ if (!applyColors && styleRange.background != null) {
+ styleRange = super.prepareStyleRange(styleRange, applyColors);
+ styleRange.borderStyle = SWT.BORDER_DASH;
+ return styleRange;
+ }
+ return super.prepareStyleRange(styleRange, applyColors);
+ }
+
+ public String getText(Object element) {
+ return getStyledText(element).getString();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/TransferObject.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/TransferObject.java
index 4667f1671db..7e2163da121 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/TransferObject.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/TransferObject.java
@@ -8,34 +8,34 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.update;
-
+package org.eclipse.osee.framework.ui.skynet.update;
+
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-
-/**
- * @author Jeff C. Phillips
- */
-public class TransferObject {
- private TransferStatus status;
- private Artifact artifact;
-
- public TransferObject(Artifact artifact, TransferStatus status) {
- super();
- this.status = status;
- this.artifact = artifact;
- }
-
- /**
- * @return the status
- */
- public TransferStatus getStatus() {
- return status;
- }
-
- /**
- * @return the artifact
- */
- public Artifact getArtifact() {
- return artifact;
- }
-}
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class TransferObject {
+ private TransferStatus status;
+ private Artifact artifact;
+
+ public TransferObject(Artifact artifact, TransferStatus status) {
+ super();
+ this.status = status;
+ this.artifact = artifact;
+ }
+
+ /**
+ * @return the status
+ */
+ public TransferStatus getStatus() {
+ return status;
+ }
+
+ /**
+ * @return the artifact
+ */
+ public Artifact getArtifact() {
+ return artifact;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/TransferStatus.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/TransferStatus.java
index 377a8322f43..128036c1d1e 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/TransferStatus.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/update/TransferStatus.java
@@ -8,28 +8,28 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.update;
-
-/**
- * @author Jeff C. Phillips
- */
-public enum TransferStatus {
-
- REBASELINE("Replace artifact in baseline with new version"),
- REBASELINE_SOMEWHERE_ON_BRANCH("Artifact exist on branch - Revert artifact and update"),
- ADD_TO_BASELINE("Add artifact to baseline transaction"),
- INTRODUCE("Introduce this artifact to this branch in a new transaction"),
- UPDATE("Update this artifact in a new transaction"),
- ERROR("This artifact will not be updated");
-
- private String message;
-
- private TransferStatus(String message) {
- this.message = message;
- }
-
- public String getMessage() {
- return message;
- }
-
-}
+package org.eclipse.osee.framework.ui.skynet.update;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public enum TransferStatus {
+
+ REBASELINE("Replace artifact in baseline with new version"),
+ REBASELINE_SOMEWHERE_ON_BRANCH("Artifact exist on branch - Revert artifact and update"),
+ ADD_TO_BASELINE("Add artifact to baseline transaction"),
+ INTRODUCE("Introduce this artifact to this branch in a new transaction"),
+ UPDATE("Update this artifact in a new transaction"),
+ ERROR("This artifact will not be updated");
+
+ private String message;
+
+ private TransferStatus(String message) {
+ this.message = message;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/ArtifactDragAndDrop.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/ArtifactDragAndDrop.java
index 09c9435f9fb..38524ee1413 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/ArtifactDragAndDrop.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/ArtifactDragAndDrop.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.util;
-
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.swt.dnd.DragSourceEvent;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * @author Donald G. Dunne
- */
-public class ArtifactDragAndDrop extends SkynetDragAndDrop {
-
- private final Artifact artifact;
-
- public ArtifactDragAndDrop(Control control, Artifact artifact, String viewId) {
- super(control, viewId);
- this.artifact = artifact;
- }
-
- @Override
- public Artifact[] getArtifacts() {
- return new Artifact[] {artifact};
- }
-
- @Override
- public void artifactTransferDragSetData(DragSourceEvent event) {
- super.artifactTransferDragSetData(event);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.util;
+
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.swt.dnd.DragSourceEvent;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ArtifactDragAndDrop extends SkynetDragAndDrop {
+
+ private final Artifact artifact;
+
+ public ArtifactDragAndDrop(Control control, Artifact artifact, String viewId) {
+ super(control, viewId);
+ this.artifact = artifact;
+ }
+
+ @Override
+ public Artifact[] getArtifacts() {
+ return new Artifact[] {artifact};
+ }
+
+ @Override
+ public void artifactTransferDragSetData(DragSourceEvent event) {
+ super.artifactTransferDragSetData(event);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/ArtifactPasteConfiguration.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/ArtifactPasteConfiguration.java
index 9e2ec07a1ca..cc690494ea7 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/ArtifactPasteConfiguration.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/ArtifactPasteConfiguration.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.framework.ui.skynet.util;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ArtifactPasteConfiguration {
-
- private boolean includeChildrenOfCopiedElements;
- private boolean isOrderDuplicationAllowed;
-
- public ArtifactPasteConfiguration() {
- includeChildrenOfCopiedElements = false;
- isOrderDuplicationAllowed = true;
- }
-
- public void setIncludeChildrenOfCopiedElements(boolean includeChildrenOfCopiedElements) {
- this.includeChildrenOfCopiedElements = includeChildrenOfCopiedElements;
- }
-
- public boolean isIncludeChildrenOfCopiedElements() {
- return includeChildrenOfCopiedElements;
- }
-
- public boolean isKeepRelationOrderSettings() {
- return isOrderDuplicationAllowed;
- }
-
- public void setKeepRelationOrderSettings(boolean isOrderDuplicationAllowed) {
- this.isOrderDuplicationAllowed = isOrderDuplicationAllowed;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.util;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ArtifactPasteConfiguration {
+
+ private boolean includeChildrenOfCopiedElements;
+ private boolean isOrderDuplicationAllowed;
+
+ public ArtifactPasteConfiguration() {
+ includeChildrenOfCopiedElements = false;
+ isOrderDuplicationAllowed = true;
+ }
+
+ public void setIncludeChildrenOfCopiedElements(boolean includeChildrenOfCopiedElements) {
+ this.includeChildrenOfCopiedElements = includeChildrenOfCopiedElements;
+ }
+
+ public boolean isIncludeChildrenOfCopiedElements() {
+ return includeChildrenOfCopiedElements;
+ }
+
+ public boolean isKeepRelationOrderSettings() {
+ return isOrderDuplicationAllowed;
+ }
+
+ public void setKeepRelationOrderSettings(boolean isOrderDuplicationAllowed) {
+ this.isOrderDuplicationAllowed = isOrderDuplicationAllowed;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/DbConnectionExceptionComposite.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/DbConnectionExceptionComposite.java
index b2e89193c58..2e4de6cc1b4 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/DbConnectionExceptionComposite.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/DbConnectionExceptionComposite.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.util;
-
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.swt.ExceptionComposite;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @author Donald G. Dunne
- */
-public class DbConnectionExceptionComposite extends ExceptionComposite {
-
- /**
- * @param parent
- * @param style
- */
- public DbConnectionExceptionComposite(Composite parent, Exception ex) {
- super(parent, ex);
- }
-
- /**
- * Tests the DB Connection and returns true if ok. If exceptions and parent != null, the
- * DbConnectionExceptionComposite will be displayed in parent giving exception information.
- *
- * @param parent
- */
- public static boolean dbConnectionIsOk(Composite parent) {
- // try {
- // ConnectionHandler.getConnection();
- // } catch (Exception ex) {
- // if (parent != null) new DbConnectionExceptionComposite(parent, ex);
- // }
- Result result = SkynetGuiPlugin.areOSEEServicesAvailable();
- if (result.isFalse()) {
- new DbConnectionExceptionComposite(parent, new IllegalStateException(
- "OSEE Service(s) Unavailable:\n\t" + result.getText().replaceAll("\n", "\n\t")));
- }
- return result.isTrue();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.util;
+
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.swt.ExceptionComposite;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class DbConnectionExceptionComposite extends ExceptionComposite {
+
+ /**
+ * @param parent
+ * @param style
+ */
+ public DbConnectionExceptionComposite(Composite parent, Exception ex) {
+ super(parent, ex);
+ }
+
+ /**
+ * Tests the DB Connection and returns true if ok. If exceptions and parent != null, the
+ * DbConnectionExceptionComposite will be displayed in parent giving exception information.
+ *
+ * @param parent
+ */
+ public static boolean dbConnectionIsOk(Composite parent) {
+ // try {
+ // ConnectionHandler.getConnection();
+ // } catch (Exception ex) {
+ // if (parent != null) new DbConnectionExceptionComposite(parent, ex);
+ // }
+ Result result = SkynetGuiPlugin.areOSEEServicesAvailable();
+ if (result.isFalse()) {
+ new DbConnectionExceptionComposite(parent, new IllegalStateException(
+ "OSEE Service(s) Unavailable:\n\t" + result.getText().replaceAll("\n", "\n\t")));
+ }
+ return result.isTrue();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/ElapsedTime.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/ElapsedTime.java
index f1110df321c..f12a7ca81a8 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/ElapsedTime.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/ElapsedTime.java
@@ -8,36 +8,36 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.util;
-
+package org.eclipse.osee.framework.ui.skynet.util;
+
import java.util.Date;
import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
-
-/**
- * @author Donald G. Dunne
- */
-public class ElapsedTime {
-
- Date startDate;
- Date endDate;
- private String name;
-
- public ElapsedTime(String name) {
- start(name);
- }
-
- public void start(String name) {
- this.name = name;
- startDate = new Date();
- System.out.println("\n" + name + " - start " + XDate.getTimeStamp());
- }
-
- public void end() {
- endDate = new Date();
- long diff = endDate.getTime() - startDate.getTime();
- String str =
- String.format("%s - elapsed %d sec - start %s - end %s", name, (diff / 1000), XDate.getDateStr(startDate,
- XDate.HHMMSSSS), XDate.getDateStr(endDate, XDate.HHMMSSSS));
- System.out.println(str);
- }
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ElapsedTime {
+
+ Date startDate;
+ Date endDate;
+ private String name;
+
+ public ElapsedTime(String name) {
+ start(name);
+ }
+
+ public void start(String name) {
+ this.name = name;
+ startDate = new Date();
+ System.out.println("\n" + name + " - start " + XDate.getTimeStamp());
+ }
+
+ public void end() {
+ endDate = new Date();
+ long diff = endDate.getTime() - startDate.getTime();
+ String str =
+ String.format("%s - elapsed %d sec - start %s - end %s", name, (diff / 1000), XDate.getDateStr(startDate,
+ XDate.HHMMSSSS), XDate.getDateStr(endDate, XDate.HHMMSSSS));
+ System.out.println(str);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/FileUiUtil.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/FileUiUtil.java
index f638442866b..1ece72fffff 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/FileUiUtil.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/FileUiUtil.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.framework.ui.skynet.util;
-
-import java.util.logging.Level;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-
-/**
- * @author Megumi Telles
- */
-public class FileUiUtil {
- public static String FILENAME_WARNING_MESSAGE =
- "\n\nis approaching a large size which may cause the opening application to error. " + "\nSuggest moving your workspace to avoid potential errors. ";
- public final static int FILENAME_LIMIT = 215;
- public static boolean showAgain = true;
-
- public static boolean ensureFilenameLimit(IFile file) {
- boolean withinLimit = true;
- String absPath = file.getLocation().toFile().getAbsolutePath();
- if (absPath.length() > FILENAME_LIMIT) {
- String warningMessage = "Your filename: \n\n" + absPath + FILENAME_WARNING_MESSAGE;
- // need to warn user that their filename size is large and may cause the program (Word, Excel, PPT) to error
- if (showAgain) {
- //display warning once per session
- WordUiUtil.displayWarningMessageDialog("Filename Size Warning", warningMessage);
- showAgain = false;
- }
- //log the warning every time
- OseeLog.log(SkynetGuiPlugin.class, Level.WARNING, warningMessage);
- withinLimit = false;
- }
- return withinLimit;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.util;
+
+import java.util.logging.Level;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+
+/**
+ * @author Megumi Telles
+ */
+public class FileUiUtil {
+ public static String FILENAME_WARNING_MESSAGE =
+ "\n\nis approaching a large size which may cause the opening application to error. " + "\nSuggest moving your workspace to avoid potential errors. ";
+ public final static int FILENAME_LIMIT = 215;
+ public static boolean showAgain = true;
+
+ public static boolean ensureFilenameLimit(IFile file) {
+ boolean withinLimit = true;
+ String absPath = file.getLocation().toFile().getAbsolutePath();
+ if (absPath.length() > FILENAME_LIMIT) {
+ String warningMessage = "Your filename: \n\n" + absPath + FILENAME_WARNING_MESSAGE;
+ // need to warn user that their filename size is large and may cause the program (Word, Excel, PPT) to error
+ if (showAgain) {
+ //display warning once per session
+ WordUiUtil.displayWarningMessageDialog("Filename Size Warning", warningMessage);
+ showAgain = false;
+ }
+ //log the warning every time
+ OseeLog.log(SkynetGuiPlugin.class, Level.WARNING, warningMessage);
+ withinLimit = false;
+ }
+ return withinLimit;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/FormsUtil.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/FormsUtil.java
index 36c3462a740..4a191d4db77 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/FormsUtil.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/FormsUtil.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.framework.ui.skynet.util;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.ui.skynet.XFormToolkit;
-import org.eclipse.osee.framework.ui.skynet.widgets.dialog.HtmlDialog;
-import org.eclipse.osee.framework.ui.swt.ALayout;
-import org.eclipse.osee.framework.ui.swt.FontManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-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.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.FormColors;
-import org.eclipse.ui.forms.IFormColors;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Hyperlink;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-
-/**
- * @author Donald G. Dunne
- */
-public class FormsUtil {
-
- public static void createLabelText(XFormToolkit toolkit, Composite comp, String labelStr, String valueStr) throws OseeCoreException {
- createLabelText(toolkit, comp, labelStr, valueStr, null);
- }
-
- public static void createLabelOrHyperlink(Composite comp, XFormToolkit toolkit, final int horizontalSpan, final String str) {
- if (str.length() > 150) {
- Hyperlink label = toolkit.createHyperlink(comp, Strings.truncate(str, 150) + "...", SWT.NONE);
- label.setToolTipText("click to view all");
- label.addListener(SWT.MouseUp, new Listener() {
- public void handleEvent(Event event) {
- new HtmlDialog("Note", null, str).open();
- }
- });
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = horizontalSpan;
- label.setLayoutData(gd);
- } else {
- Label label = toolkit.createLabel(comp, str);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = horizontalSpan;
- label.setLayoutData(gd);
- }
- }
-
- public static Text createLabelText(XFormToolkit toolkit, Composite comp, String labelStr, String valueStr, String tooltip) throws OseeCoreException {
- Composite topLineComp = new Composite(comp, SWT.NONE);
- topLineComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- topLineComp.setLayout(ALayout.getZeroMarginLayout(2, false));
- toolkit.adapt(topLineComp);
-
- Label label = toolkit.createLabel(topLineComp, labelStr);
- if (tooltip != null && !tooltip.equals("")) {
- label.setToolTipText(tooltip);
- }
- setLabelFonts(label, FontManager.getDefaultLabelFont());
- Text text = new Text(topLineComp, SWT.NO_TRIM);
- text.setLayoutData(new GridData());
- toolkit.adapt(text, true, true);
- text.setText(valueStr);
- if (tooltip != null && !tooltip.equals("")) {
- text.setToolTipText(tooltip);
- }
- return text;
- }
-
- public static void createLabelValue(XFormToolkit toolkit, Composite comp, String labelStr, String valueStr) throws OseeCoreException {
- createLabelValue(toolkit, comp, labelStr, valueStr, null);
- }
-
- public static Label createLabelValue(XFormToolkit toolkit, Composite comp, String labelStr, String valueStr, String tooltip) throws OseeCoreException {
- Composite topLineComp = new Composite(comp, SWT.NONE);
- topLineComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- topLineComp.setLayout(ALayout.getZeroMarginLayout(2, false));
- toolkit.adapt(topLineComp);
- Label label = toolkit.createLabel(topLineComp, labelStr, SWT.NONE);
- label.setLayoutData(new GridData());
- if (Strings.isValid(tooltip)) {
- label.setToolTipText(tooltip);
- }
- setLabelFonts(label, FontManager.getDefaultLabelFont());
- Label valueLabel = toolkit.createLabel(topLineComp, valueStr, SWT.NONE);
- if (Strings.isValid(tooltip)) {
- valueLabel.setToolTipText(tooltip);
- }
- valueLabel.setLayoutData(new GridData());
- return valueLabel;
- }
-
- public static void setLabelFonts(Control parent, Font font) {
- if (parent instanceof Label) {
- Label label = (Label) parent;
- label.setFont(font);
- }
- if (parent instanceof Composite) {
- Composite container = (Composite) parent;
- for (Control child : container.getChildren()) {
- setLabelFonts(child, font);
- }
- container.layout();
- }
- }
-
- public static void addHeadingGradient(FormToolkit toolkit, ScrolledForm form, boolean add) {
- FormColors colors = toolkit.getColors();
- Color top = colors.getColor(IFormColors.H_GRADIENT_END);
- Color bot = colors.getColor(IFormColors.H_GRADIENT_START);
- if (add) {
- form.getForm().setTextBackground(new Color[] {top, bot}, new int[] {100}, true);
- } else {
- form.getForm().setTextBackground(null, null, false);
- form.getForm().setBackground(colors.getBackground());
- }
- form.getForm().setHeadColor(IFormColors.H_BOTTOM_KEYLINE1,
- add ? colors.getColor(IFormColors.H_BOTTOM_KEYLINE1) : null);
- form.getForm().setHeadColor(IFormColors.H_BOTTOM_KEYLINE2,
- add ? colors.getColor(IFormColors.H_BOTTOM_KEYLINE2) : null);
- form.getForm().setHeadColor(IFormColors.H_HOVER_LIGHT, add ? colors.getColor(IFormColors.H_HOVER_LIGHT) : null);
- form.getForm().setHeadColor(IFormColors.H_HOVER_FULL, add ? colors.getColor(IFormColors.H_HOVER_FULL) : null);
- form.getForm().setHeadColor(IFormColors.TB_TOGGLE, add ? colors.getColor(IFormColors.TB_TOGGLE) : null);
- form.getForm().setHeadColor(IFormColors.TB_TOGGLE_HOVER,
- add ? colors.getColor(IFormColors.TB_TOGGLE_HOVER) : null);
- form.getForm().setSeparatorVisible(add);
- form.reflow(true);
- form.redraw();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.util;
+
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.ui.skynet.XFormToolkit;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.HtmlDialog;
+import org.eclipse.osee.framework.ui.swt.ALayout;
+import org.eclipse.osee.framework.ui.swt.FontManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+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.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.FormColors;
+import org.eclipse.ui.forms.IFormColors;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class FormsUtil {
+
+ public static void createLabelText(XFormToolkit toolkit, Composite comp, String labelStr, String valueStr) throws OseeCoreException {
+ createLabelText(toolkit, comp, labelStr, valueStr, null);
+ }
+
+ public static void createLabelOrHyperlink(Composite comp, XFormToolkit toolkit, final int horizontalSpan, final String str) {
+ if (str.length() > 150) {
+ Hyperlink label = toolkit.createHyperlink(comp, Strings.truncate(str, 150) + "...", SWT.NONE);
+ label.setToolTipText("click to view all");
+ label.addListener(SWT.MouseUp, new Listener() {
+ public void handleEvent(Event event) {
+ new HtmlDialog("Note", null, str).open();
+ }
+ });
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = horizontalSpan;
+ label.setLayoutData(gd);
+ } else {
+ Label label = toolkit.createLabel(comp, str);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = horizontalSpan;
+ label.setLayoutData(gd);
+ }
+ }
+
+ public static Text createLabelText(XFormToolkit toolkit, Composite comp, String labelStr, String valueStr, String tooltip) throws OseeCoreException {
+ Composite topLineComp = new Composite(comp, SWT.NONE);
+ topLineComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ topLineComp.setLayout(ALayout.getZeroMarginLayout(2, false));
+ toolkit.adapt(topLineComp);
+
+ Label label = toolkit.createLabel(topLineComp, labelStr);
+ if (tooltip != null && !tooltip.equals("")) {
+ label.setToolTipText(tooltip);
+ }
+ setLabelFonts(label, FontManager.getDefaultLabelFont());
+ Text text = new Text(topLineComp, SWT.NO_TRIM);
+ text.setLayoutData(new GridData());
+ toolkit.adapt(text, true, true);
+ text.setText(valueStr);
+ if (tooltip != null && !tooltip.equals("")) {
+ text.setToolTipText(tooltip);
+ }
+ return text;
+ }
+
+ public static void createLabelValue(XFormToolkit toolkit, Composite comp, String labelStr, String valueStr) throws OseeCoreException {
+ createLabelValue(toolkit, comp, labelStr, valueStr, null);
+ }
+
+ public static Label createLabelValue(XFormToolkit toolkit, Composite comp, String labelStr, String valueStr, String tooltip) throws OseeCoreException {
+ Composite topLineComp = new Composite(comp, SWT.NONE);
+ topLineComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ topLineComp.setLayout(ALayout.getZeroMarginLayout(2, false));
+ toolkit.adapt(topLineComp);
+ Label label = toolkit.createLabel(topLineComp, labelStr, SWT.NONE);
+ label.setLayoutData(new GridData());
+ if (Strings.isValid(tooltip)) {
+ label.setToolTipText(tooltip);
+ }
+ setLabelFonts(label, FontManager.getDefaultLabelFont());
+ Label valueLabel = toolkit.createLabel(topLineComp, valueStr, SWT.NONE);
+ if (Strings.isValid(tooltip)) {
+ valueLabel.setToolTipText(tooltip);
+ }
+ valueLabel.setLayoutData(new GridData());
+ return valueLabel;
+ }
+
+ public static void setLabelFonts(Control parent, Font font) {
+ if (parent instanceof Label) {
+ Label label = (Label) parent;
+ label.setFont(font);
+ }
+ if (parent instanceof Composite) {
+ Composite container = (Composite) parent;
+ for (Control child : container.getChildren()) {
+ setLabelFonts(child, font);
+ }
+ container.layout();
+ }
+ }
+
+ public static void addHeadingGradient(FormToolkit toolkit, ScrolledForm form, boolean add) {
+ FormColors colors = toolkit.getColors();
+ Color top = colors.getColor(IFormColors.H_GRADIENT_END);
+ Color bot = colors.getColor(IFormColors.H_GRADIENT_START);
+ if (add) {
+ form.getForm().setTextBackground(new Color[] {top, bot}, new int[] {100}, true);
+ } else {
+ form.getForm().setTextBackground(null, null, false);
+ form.getForm().setBackground(colors.getBackground());
+ }
+ form.getForm().setHeadColor(IFormColors.H_BOTTOM_KEYLINE1,
+ add ? colors.getColor(IFormColors.H_BOTTOM_KEYLINE1) : null);
+ form.getForm().setHeadColor(IFormColors.H_BOTTOM_KEYLINE2,
+ add ? colors.getColor(IFormColors.H_BOTTOM_KEYLINE2) : null);
+ form.getForm().setHeadColor(IFormColors.H_HOVER_LIGHT, add ? colors.getColor(IFormColors.H_HOVER_LIGHT) : null);
+ form.getForm().setHeadColor(IFormColors.H_HOVER_FULL, add ? colors.getColor(IFormColors.H_HOVER_FULL) : null);
+ form.getForm().setHeadColor(IFormColors.TB_TOGGLE, add ? colors.getColor(IFormColors.TB_TOGGLE) : null);
+ form.getForm().setHeadColor(IFormColors.TB_TOGGLE_HOVER,
+ add ? colors.getColor(IFormColors.TB_TOGGLE_HOVER) : null);
+ form.getForm().setSeparatorVisible(add);
+ form.reflow(true);
+ form.redraw();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/KeyEventExample.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/KeyEventExample.java
index 4f56cfb3db9..d12075415d0 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/KeyEventExample.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/KeyEventExample.java
@@ -1,241 +1,241 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.util;
-
-/**
- * @author Donald G. Dunne
- *
- */
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-/*
- * Control example snippet: print key state, code and character
- *
- * For a list of all SWT example snippets see
- * http://www.eclipse.org/swt/snippets/
- *
- * @since 3.0
- */
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-
-public class KeyEventExample {
-
- static String stateMask(int stateMask) {
- String string = "";
- if ((stateMask & SWT.CTRL) != 0) string += " CTRL";
- if ((stateMask & SWT.ALT) != 0) string += " ALT";
- if ((stateMask & SWT.SHIFT) != 0) string += " SHIFT";
- if ((stateMask & SWT.COMMAND) != 0) string += " COMMAND";
- return string;
- }
-
- static String character(char character) {
- switch (character) {
- case 0:
- return "'\\0'";
- case SWT.BS:
- return "'\\b'";
- case SWT.CR:
- return "'\\r'";
- case SWT.DEL:
- return "DEL";
- case SWT.ESC:
- return "ESC";
- case SWT.LF:
- return "'\\n'";
- case SWT.TAB:
- return "'\\t'";
- }
- return "'" + character + "'";
- }
-
- static String keyCode(int keyCode) {
- switch (keyCode) {
-
- /* Keyboard and Mouse Masks */
- case SWT.ALT:
- return "ALT";
- case SWT.SHIFT:
- return "SHIFT";
- case SWT.CONTROL:
- return "CONTROL";
- case SWT.COMMAND:
- return "COMMAND";
-
- /* Non-Numeric Keypad Keys */
- case SWT.ARROW_UP:
- return "ARROW_UP";
- case SWT.ARROW_DOWN:
- return "ARROW_DOWN";
- case SWT.ARROW_LEFT:
- return "ARROW_LEFT";
- case SWT.ARROW_RIGHT:
- return "ARROW_RIGHT";
- case SWT.PAGE_UP:
- return "PAGE_UP";
- case SWT.PAGE_DOWN:
- return "PAGE_DOWN";
- case SWT.HOME:
- return "HOME";
- case SWT.END:
- return "END";
- case SWT.INSERT:
- return "INSERT";
-
- /* Virtual and Ascii Keys */
- case SWT.BS:
- return "BS";
- case SWT.CR:
- return "CR";
- case SWT.DEL:
- return "DEL";
- case SWT.ESC:
- return "ESC";
- case SWT.LF:
- return "LF";
- case SWT.TAB:
- return "TAB";
-
- /* Functions Keys */
- case SWT.F1:
- return "F1";
- case SWT.F2:
- return "F2";
- case SWT.F3:
- return "F3";
- case SWT.F4:
- return "F4";
- case SWT.F5:
- return "F5";
- case SWT.F6:
- return "F6";
- case SWT.F7:
- return "F7";
- case SWT.F8:
- return "F8";
- case SWT.F9:
- return "F9";
- case SWT.F10:
- return "F10";
- case SWT.F11:
- return "F11";
- case SWT.F12:
- return "F12";
- case SWT.F13:
- return "F13";
- case SWT.F14:
- return "F14";
- case SWT.F15:
- return "F15";
-
- /* Numeric Keypad Keys */
- case SWT.KEYPAD_ADD:
- return "KEYPAD_ADD";
- case SWT.KEYPAD_SUBTRACT:
- return "KEYPAD_SUBTRACT";
- case SWT.KEYPAD_MULTIPLY:
- return "KEYPAD_MULTIPLY";
- case SWT.KEYPAD_DIVIDE:
- return "KEYPAD_DIVIDE";
- case SWT.KEYPAD_DECIMAL:
- return "KEYPAD_DECIMAL";
- case SWT.KEYPAD_CR:
- return "KEYPAD_CR";
- case SWT.KEYPAD_0:
- return "KEYPAD_0";
- case SWT.KEYPAD_1:
- return "KEYPAD_1";
- case SWT.KEYPAD_2:
- return "KEYPAD_2";
- case SWT.KEYPAD_3:
- return "KEYPAD_3";
- case SWT.KEYPAD_4:
- return "KEYPAD_4";
- case SWT.KEYPAD_5:
- return "KEYPAD_5";
- case SWT.KEYPAD_6:
- return "KEYPAD_6";
- case SWT.KEYPAD_7:
- return "KEYPAD_7";
- case SWT.KEYPAD_8:
- return "KEYPAD_8";
- case SWT.KEYPAD_9:
- return "KEYPAD_9";
- case SWT.KEYPAD_EQUAL:
- return "KEYPAD_EQUAL";
-
- /* Other keys */
- case SWT.CAPS_LOCK:
- return "CAPS_LOCK";
- case SWT.NUM_LOCK:
- return "NUM_LOCK";
- case SWT.SCROLL_LOCK:
- return "SCROLL_LOCK";
- case SWT.PAUSE:
- return "PAUSE";
- case SWT.BREAK:
- return "BREAK";
- case SWT.PRINT_SCREEN:
- return "PRINT_SCREEN";
- case SWT.HELP:
- return "HELP";
- }
- return character((char) keyCode);
- }
-
- public static void printEvent(Event e) {
- String string = e.type == SWT.KeyDown ? "DOWN:" : "UP :";
- string += " stateMask=0x" + Integer.toHexString(e.stateMask) + stateMask(e.stateMask) + ",";
- string += " keyCode=0x" + Integer.toHexString(e.keyCode) + " " + keyCode(e.keyCode) + ",";
- string += " character=0x" + Integer.toHexString(e.character) + " " + character(e.character);
- System.out.println(string);
- }
-
- public static void printEvent(String prefix, KeyEvent e) {
- String string = prefix;
- string += " stateMask=0x" + Integer.toHexString(e.stateMask) + stateMask(e.stateMask) + ",";
- string += " keyCode=0x" + Integer.toHexString(e.keyCode) + " " + keyCode(e.keyCode) + ",";
- string += " character=0x" + Integer.toHexString(e.character) + " " + character(e.character);
- System.out.println(string);
- }
-
- public static void main(String[] args) {
- Display display = new Display();
- Shell shell = new Shell(display);
- Listener listener = new Listener() {
- public void handleEvent(Event e) {
- printEvent(e);
- }
- };
- shell.addListener(SWT.KeyDown, listener);
- shell.addListener(SWT.KeyUp, listener);
- shell.setSize(200, 200);
- shell.open();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch()) display.sleep();
- }
- display.dispose();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.util;
+
+/**
+ * @author Donald G. Dunne
+ *
+ */
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/*
+ * Control example snippet: print key state, code and character
+ *
+ * For a list of all SWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ *
+ * @since 3.0
+ */
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+
+public class KeyEventExample {
+
+ static String stateMask(int stateMask) {
+ String string = "";
+ if ((stateMask & SWT.CTRL) != 0) string += " CTRL";
+ if ((stateMask & SWT.ALT) != 0) string += " ALT";
+ if ((stateMask & SWT.SHIFT) != 0) string += " SHIFT";
+ if ((stateMask & SWT.COMMAND) != 0) string += " COMMAND";
+ return string;
+ }
+
+ static String character(char character) {
+ switch (character) {
+ case 0:
+ return "'\\0'";
+ case SWT.BS:
+ return "'\\b'";
+ case SWT.CR:
+ return "'\\r'";
+ case SWT.DEL:
+ return "DEL";
+ case SWT.ESC:
+ return "ESC";
+ case SWT.LF:
+ return "'\\n'";
+ case SWT.TAB:
+ return "'\\t'";
+ }
+ return "'" + character + "'";
+ }
+
+ static String keyCode(int keyCode) {
+ switch (keyCode) {
+
+ /* Keyboard and Mouse Masks */
+ case SWT.ALT:
+ return "ALT";
+ case SWT.SHIFT:
+ return "SHIFT";
+ case SWT.CONTROL:
+ return "CONTROL";
+ case SWT.COMMAND:
+ return "COMMAND";
+
+ /* Non-Numeric Keypad Keys */
+ case SWT.ARROW_UP:
+ return "ARROW_UP";
+ case SWT.ARROW_DOWN:
+ return "ARROW_DOWN";
+ case SWT.ARROW_LEFT:
+ return "ARROW_LEFT";
+ case SWT.ARROW_RIGHT:
+ return "ARROW_RIGHT";
+ case SWT.PAGE_UP:
+ return "PAGE_UP";
+ case SWT.PAGE_DOWN:
+ return "PAGE_DOWN";
+ case SWT.HOME:
+ return "HOME";
+ case SWT.END:
+ return "END";
+ case SWT.INSERT:
+ return "INSERT";
+
+ /* Virtual and Ascii Keys */
+ case SWT.BS:
+ return "BS";
+ case SWT.CR:
+ return "CR";
+ case SWT.DEL:
+ return "DEL";
+ case SWT.ESC:
+ return "ESC";
+ case SWT.LF:
+ return "LF";
+ case SWT.TAB:
+ return "TAB";
+
+ /* Functions Keys */
+ case SWT.F1:
+ return "F1";
+ case SWT.F2:
+ return "F2";
+ case SWT.F3:
+ return "F3";
+ case SWT.F4:
+ return "F4";
+ case SWT.F5:
+ return "F5";
+ case SWT.F6:
+ return "F6";
+ case SWT.F7:
+ return "F7";
+ case SWT.F8:
+ return "F8";
+ case SWT.F9:
+ return "F9";
+ case SWT.F10:
+ return "F10";
+ case SWT.F11:
+ return "F11";
+ case SWT.F12:
+ return "F12";
+ case SWT.F13:
+ return "F13";
+ case SWT.F14:
+ return "F14";
+ case SWT.F15:
+ return "F15";
+
+ /* Numeric Keypad Keys */
+ case SWT.KEYPAD_ADD:
+ return "KEYPAD_ADD";
+ case SWT.KEYPAD_SUBTRACT:
+ return "KEYPAD_SUBTRACT";
+ case SWT.KEYPAD_MULTIPLY:
+ return "KEYPAD_MULTIPLY";
+ case SWT.KEYPAD_DIVIDE:
+ return "KEYPAD_DIVIDE";
+ case SWT.KEYPAD_DECIMAL:
+ return "KEYPAD_DECIMAL";
+ case SWT.KEYPAD_CR:
+ return "KEYPAD_CR";
+ case SWT.KEYPAD_0:
+ return "KEYPAD_0";
+ case SWT.KEYPAD_1:
+ return "KEYPAD_1";
+ case SWT.KEYPAD_2:
+ return "KEYPAD_2";
+ case SWT.KEYPAD_3:
+ return "KEYPAD_3";
+ case SWT.KEYPAD_4:
+ return "KEYPAD_4";
+ case SWT.KEYPAD_5:
+ return "KEYPAD_5";
+ case SWT.KEYPAD_6:
+ return "KEYPAD_6";
+ case SWT.KEYPAD_7:
+ return "KEYPAD_7";
+ case SWT.KEYPAD_8:
+ return "KEYPAD_8";
+ case SWT.KEYPAD_9:
+ return "KEYPAD_9";
+ case SWT.KEYPAD_EQUAL:
+ return "KEYPAD_EQUAL";
+
+ /* Other keys */
+ case SWT.CAPS_LOCK:
+ return "CAPS_LOCK";
+ case SWT.NUM_LOCK:
+ return "NUM_LOCK";
+ case SWT.SCROLL_LOCK:
+ return "SCROLL_LOCK";
+ case SWT.PAUSE:
+ return "PAUSE";
+ case SWT.BREAK:
+ return "BREAK";
+ case SWT.PRINT_SCREEN:
+ return "PRINT_SCREEN";
+ case SWT.HELP:
+ return "HELP";
+ }
+ return character((char) keyCode);
+ }
+
+ public static void printEvent(Event e) {
+ String string = e.type == SWT.KeyDown ? "DOWN:" : "UP :";
+ string += " stateMask=0x" + Integer.toHexString(e.stateMask) + stateMask(e.stateMask) + ",";
+ string += " keyCode=0x" + Integer.toHexString(e.keyCode) + " " + keyCode(e.keyCode) + ",";
+ string += " character=0x" + Integer.toHexString(e.character) + " " + character(e.character);
+ System.out.println(string);
+ }
+
+ public static void printEvent(String prefix, KeyEvent e) {
+ String string = prefix;
+ string += " stateMask=0x" + Integer.toHexString(e.stateMask) + stateMask(e.stateMask) + ",";
+ string += " keyCode=0x" + Integer.toHexString(e.keyCode) + " " + keyCode(e.keyCode) + ",";
+ string += " character=0x" + Integer.toHexString(e.character) + " " + character(e.character);
+ System.out.println(string);
+ }
+
+ public static void main(String[] args) {
+ Display display = new Display();
+ Shell shell = new Shell(display);
+ Listener listener = new Listener() {
+ public void handleEvent(Event e) {
+ printEvent(e);
+ }
+ };
+ shell.addListener(SWT.KeyDown, listener);
+ shell.addListener(SWT.KeyUp, listener);
+ shell.setSize(200, 200);
+ shell.open();
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) display.sleep();
+ }
+ display.dispose();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/LoadingComposite.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/LoadingComposite.java
index 8eddabfebcc..739c9158a5f 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/LoadingComposite.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/LoadingComposite.java
@@ -1,27 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.util;
-
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.osee.framework.ui.swt.LabelComposite;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @author Donald G. Dunne
- */
-public class LoadingComposite extends LabelComposite {
-
- public LoadingComposite(Composite parent) {
- super(parent, ImageManager.getImage(FrameworkImage.CLOCK), "Loading...");
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.util;
+
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.osee.framework.ui.swt.LabelComposite;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class LoadingComposite extends LabelComposite {
+
+ public LoadingComposite(Composite parent) {
+ super(parent, ImageManager.getImage(FrameworkImage.CLOCK), "Loading...");
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/OseeDictionary.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/OseeDictionary.java
index b6b510603e8..8bedc269cf3 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/OseeDictionary.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/OseeDictionary.java
@@ -1,153 +1,153 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.util;
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
-import org.eclipse.osee.framework.core.operation.Operations;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.swt.styledText.IDictionary;
-import org.osgi.framework.Bundle;
-
-/**
- * Dictionary provided by OSEE that includes all dictionarys through the OseeDictionary extension point.
- *
- * @author Donald G. Dunne
- */
-public class OseeDictionary extends AbstractOperation implements IDictionary {
-
- private static Set<IOseeDictionary> dictionaries = new HashSet<IOseeDictionary>();
- private static OseeDictionary instance = new OseeDictionary();
- private static boolean isLoadingDictionary = false;
- private static boolean loaded = false;
-
- public static OseeDictionary getInstance() {
- return instance;
- }
-
- public static void load() {
- if (loaded || isLoadingDictionary) return;
- Operations.executeAsJob(new OseeDictionary(), false);
- }
-
- public OseeDictionary() {
- super("Loading Osee Dictionary", SkynetGuiPlugin.PLUGIN_ID);
- }
-
- public boolean isWord(String word) {
- // Just return true till dictionary loaded
- if (!loaded && isLoadingDictionary) return true;
- // If not loaded, kickoff operation to load and return true
- if (!loaded) {
- Operations.executeAsJob(new OseeDictionary(), false);
- return true;
- }
- // System.out.println("Lookup => \""+word+"\"");
- String cleanWord = getCleanWord(word);
- if (cleanWord.equals("") || cleanWord.length() == 1) return true;
- for (IOseeDictionary dict : dictionaries) {
- if (dict.isWord(cleanWord)) return true;
- }
- return false;
- }
- // Remove any junky characters and check for acronyms and other known
- // non-word type stuff. Return valid word to check in dictionary OR
- // "" if there is no word in this string
- // eg now) = now
- // a..b = ""
- // SQA = ""
- // NEon = ""
- private static Pattern pattern = Pattern.compile("^[a-zA-Z]{1}[a-z]+$");
-
- public String getCleanWord(String w) {
- // Single character is a valid word
- if (w.length() == 1) return w;
-
- // First, remove any non-word characters before and after string
- // eg. end. (now) it!
- w = w.replaceAll("^\\W+", "");
- w = w.replaceAll("\\W+$", "");
- w = w.replaceAll("'s$", ""); // Get rid of 's at end of word
-
- // If any non-alphabetic characters still in string, not a word
- // If string not either all lowercase or first letter capitalized, not a
- // word
- Matcher m = pattern.matcher(w);
- if (!m.find()) return "";
- return w.toLowerCase();
- }
-
- private synchronized void ensureLoaded() {
- if (!loaded && !isLoadingDictionary) {
- getIDictionaries();
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.INFO, "Loading Osee Dictionary");
- }
- }
-
- private static void getIDictionaries() {
- if (loaded) return;
- isLoadingDictionary = true;
- if (!Platform.isRunning()) return;
- IExtensionPoint point = null;
- try {
- point =
- Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.osee.framework.ui.skynet.OseeDictionary");
- } catch (NullPointerException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, "Can't access OseeDictionary extension point", ex);
- return;
- }
- if (point == null) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, "Can't access OseeDictionary 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("OseeDictionary")) {
- 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();
- dictionaries.add((IOseeDictionary) obj);
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP,
- "Error loading OseeDictionary extension", ex);
- }
- }
-
- }
- }
- }
- loaded = true;
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- ensureLoaded();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.util;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.osee.framework.core.operation.AbstractOperation;
+import org.eclipse.osee.framework.core.operation.Operations;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.swt.styledText.IDictionary;
+import org.osgi.framework.Bundle;
+
+/**
+ * Dictionary provided by OSEE that includes all dictionarys through the OseeDictionary extension point.
+ *
+ * @author Donald G. Dunne
+ */
+public class OseeDictionary extends AbstractOperation implements IDictionary {
+
+ private static Set<IOseeDictionary> dictionaries = new HashSet<IOseeDictionary>();
+ private static OseeDictionary instance = new OseeDictionary();
+ private static boolean isLoadingDictionary = false;
+ private static boolean loaded = false;
+
+ public static OseeDictionary getInstance() {
+ return instance;
+ }
+
+ public static void load() {
+ if (loaded || isLoadingDictionary) return;
+ Operations.executeAsJob(new OseeDictionary(), false);
+ }
+
+ public OseeDictionary() {
+ super("Loading Osee Dictionary", SkynetGuiPlugin.PLUGIN_ID);
+ }
+
+ public boolean isWord(String word) {
+ // Just return true till dictionary loaded
+ if (!loaded && isLoadingDictionary) return true;
+ // If not loaded, kickoff operation to load and return true
+ if (!loaded) {
+ Operations.executeAsJob(new OseeDictionary(), false);
+ return true;
+ }
+ // System.out.println("Lookup => \""+word+"\"");
+ String cleanWord = getCleanWord(word);
+ if (cleanWord.equals("") || cleanWord.length() == 1) return true;
+ for (IOseeDictionary dict : dictionaries) {
+ if (dict.isWord(cleanWord)) return true;
+ }
+ return false;
+ }
+ // Remove any junky characters and check for acronyms and other known
+ // non-word type stuff. Return valid word to check in dictionary OR
+ // "" if there is no word in this string
+ // eg now) = now
+ // a..b = ""
+ // SQA = ""
+ // NEon = ""
+ private static Pattern pattern = Pattern.compile("^[a-zA-Z]{1}[a-z]+$");
+
+ public String getCleanWord(String w) {
+ // Single character is a valid word
+ if (w.length() == 1) return w;
+
+ // First, remove any non-word characters before and after string
+ // eg. end. (now) it!
+ w = w.replaceAll("^\\W+", "");
+ w = w.replaceAll("\\W+$", "");
+ w = w.replaceAll("'s$", ""); // Get rid of 's at end of word
+
+ // If any non-alphabetic characters still in string, not a word
+ // If string not either all lowercase or first letter capitalized, not a
+ // word
+ Matcher m = pattern.matcher(w);
+ if (!m.find()) return "";
+ return w.toLowerCase();
+ }
+
+ private synchronized void ensureLoaded() {
+ if (!loaded && !isLoadingDictionary) {
+ getIDictionaries();
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.INFO, "Loading Osee Dictionary");
+ }
+ }
+
+ private static void getIDictionaries() {
+ if (loaded) return;
+ isLoadingDictionary = true;
+ if (!Platform.isRunning()) return;
+ IExtensionPoint point = null;
+ try {
+ point =
+ Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.osee.framework.ui.skynet.OseeDictionary");
+ } catch (NullPointerException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, "Can't access OseeDictionary extension point", ex);
+ return;
+ }
+ if (point == null) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, "Can't access OseeDictionary 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("OseeDictionary")) {
+ 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();
+ dictionaries.add((IOseeDictionary) obj);
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP,
+ "Error loading OseeDictionary extension", ex);
+ }
+ }
+
+ }
+ }
+ }
+ loaded = true;
+ }
+
+ @Override
+ protected void doWork(IProgressMonitor monitor) throws Exception {
+ ensureLoaded();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/PromptChangeUtil.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/PromptChangeUtil.java
index bfce3286e9a..96f7eee9ae0 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/PromptChangeUtil.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/PromptChangeUtil.java
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.util;
-
-import java.util.Collection;
-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.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.ui.skynet.widgets.dialog.ChangeBranchArchivedStateDialog;
-import org.eclipse.osee.framework.ui.skynet.widgets.dialog.ChangeBranchStateDialog;
-import org.eclipse.osee.framework.ui.skynet.widgets.dialog.ChangeBranchTypeDialog;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.widgets.TreeItem;
-
-/**
- * @author Megumi Telles
- */
-public class PromptChangeUtil {
-
- public static boolean promptChangeBranchType(final Collection<TreeItem> branches) throws OseeCoreException {
- ChangeBranchTypeDialog ld = new ChangeBranchTypeDialog(Displays.getActiveShell());
- int result = ld.open();
- if (result == 0) {
- BranchType type = ld.getSelection();
- for (TreeItem item : branches) {
- Branch branch = (Branch) item.getData();
- BranchManager.updateBranchType(null, branch.getId(), branch.getGuid(), type);
- }
- return true;
- }
- return false;
- }
-
- public static boolean promptChangeBranchState(final Collection<TreeItem> branches) throws OseeCoreException {
- ChangeBranchStateDialog ld = new ChangeBranchStateDialog(Displays.getActiveShell());
- int result = ld.open();
- if (result == 0) {
- BranchState state = ld.getSelection();
- for (TreeItem item : branches) {
- Branch branch = (Branch) item.getData();
- BranchManager.updateBranchState(null, branch.getId(), branch.getGuid(), state);
- }
- return true;
- }
- return false;
- }
-
- public static boolean promptChangeBranchArchivedState(final Collection<TreeItem> branches) throws OseeCoreException {
- ChangeBranchArchivedStateDialog ld = new ChangeBranchArchivedStateDialog(Displays.getActiveShell());
- int result = ld.open();
- if (result == 0) {
- BranchArchivedState state = ld.getSelection();
- for (TreeItem item : branches) {
- Branch branch = (Branch) item.getData();
- BranchManager.updateBranchArchivedState(null, branch.getId(), branch.getGuid(), state);
- }
- return true;
- }
- 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.framework.ui.skynet.util;
+
+import java.util.Collection;
+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.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.ChangeBranchArchivedStateDialog;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.ChangeBranchStateDialog;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.ChangeBranchTypeDialog;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * @author Megumi Telles
+ */
+public class PromptChangeUtil {
+
+ public static boolean promptChangeBranchType(final Collection<TreeItem> branches) throws OseeCoreException {
+ ChangeBranchTypeDialog ld = new ChangeBranchTypeDialog(Displays.getActiveShell());
+ int result = ld.open();
+ if (result == 0) {
+ BranchType type = ld.getSelection();
+ for (TreeItem item : branches) {
+ Branch branch = (Branch) item.getData();
+ BranchManager.updateBranchType(null, branch.getId(), branch.getGuid(), type);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean promptChangeBranchState(final Collection<TreeItem> branches) throws OseeCoreException {
+ ChangeBranchStateDialog ld = new ChangeBranchStateDialog(Displays.getActiveShell());
+ int result = ld.open();
+ if (result == 0) {
+ BranchState state = ld.getSelection();
+ for (TreeItem item : branches) {
+ Branch branch = (Branch) item.getData();
+ BranchManager.updateBranchState(null, branch.getId(), branch.getGuid(), state);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean promptChangeBranchArchivedState(final Collection<TreeItem> branches) throws OseeCoreException {
+ ChangeBranchArchivedStateDialog ld = new ChangeBranchArchivedStateDialog(Displays.getActiveShell());
+ int result = ld.open();
+ if (result == 0) {
+ BranchArchivedState state = ld.getSelection();
+ for (TreeItem item : branches) {
+ Branch branch = (Branch) item.getData();
+ BranchManager.updateBranchArchivedState(null, branch.getId(), branch.getGuid(), state);
+ }
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/SkynetViews.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/SkynetViews.java
index b5b6739aba7..a4ba112e976 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/SkynetViews.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/SkynetViews.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.framework.ui.skynet.util;
-
-import java.util.logging.Level;
-import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.framework.database.core.OseeInfo;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Jeff C. Phillips
- */
-public class SkynetViews {
-
- private static final String MEMENTO_SOURCE_GUID = "sourceDbGuid";
-
- public static boolean isSourceValid(IMemento memento) {
- boolean result = false;
- if (memento != null) {
- String dbId = memento.getString(MEMENTO_SOURCE_GUID);
- if (Strings.isValid(dbId)) {
- String currentDbId = null;
- try {
- currentDbId = OseeInfo.getDatabaseGuid();
- } catch (OseeDataStoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.WARNING, "Unable to set memento source db guid");
- }
- if (dbId.equals(currentDbId)) {
- result = true;
- }
- }
- }
- return result;
- }
-
- public static void addDatabaseSourceId(IMemento memento) {
- if (memento != null) {
- try {
- memento.putString(MEMENTO_SOURCE_GUID, OseeInfo.getDatabaseGuid());
- } catch (OseeDataStoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.WARNING, "Unable to set memento source db guid");
- }
- }
- }
-
- public static void closeView(final String viewId, final String secondaryId) {
- if (Strings.isValid(viewId)) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- IWorkbench workbench = PlatformUI.getWorkbench();
- if (workbench != null) {
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- if (workbenchWindow != null) {
- IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
- if (workbenchPage != null) {
- workbenchPage.hideView(workbenchPage.findViewReference(viewId, secondaryId));
- }
- }
- }
- }
- });
- }
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.util;
+
+import java.util.logging.Level;
+import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
+import org.eclipse.osee.framework.database.core.OseeInfo;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class SkynetViews {
+
+ private static final String MEMENTO_SOURCE_GUID = "sourceDbGuid";
+
+ public static boolean isSourceValid(IMemento memento) {
+ boolean result = false;
+ if (memento != null) {
+ String dbId = memento.getString(MEMENTO_SOURCE_GUID);
+ if (Strings.isValid(dbId)) {
+ String currentDbId = null;
+ try {
+ currentDbId = OseeInfo.getDatabaseGuid();
+ } catch (OseeDataStoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.WARNING, "Unable to set memento source db guid");
+ }
+ if (dbId.equals(currentDbId)) {
+ result = true;
+ }
+ }
+ }
+ return result;
+ }
+
+ public static void addDatabaseSourceId(IMemento memento) {
+ if (memento != null) {
+ try {
+ memento.putString(MEMENTO_SOURCE_GUID, OseeInfo.getDatabaseGuid());
+ } catch (OseeDataStoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.WARNING, "Unable to set memento source db guid");
+ }
+ }
+ }
+
+ public static void closeView(final String viewId, final String secondaryId) {
+ if (Strings.isValid(viewId)) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ if (workbench != null) {
+ IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+ if (workbenchWindow != null) {
+ IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
+ if (workbenchPage != null) {
+ workbenchPage.hideView(workbenchPage.findViewReference(viewId, secondaryId));
+ }
+ }
+ }
+ }
+ });
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/TransactionIdLabelProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/TransactionIdLabelProvider.java
index d9666db12f3..e3e2f3d2964 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/TransactionIdLabelProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/TransactionIdLabelProvider.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.util;
-
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-
-/**
- * @author Donald G. Dunne
- */
-public class TransactionIdLabelProvider extends LabelProvider {
-
- public TransactionIdLabelProvider() {
- }
-
- @Override
- public String getText(Object element) {
- return ((TransactionRecord) element).toString() + " - " + ((TransactionRecord) element).getComment();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.util;
+
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class TransactionIdLabelProvider extends LabelProvider {
+
+ public TransactionIdLabelProvider() {
+ }
+
+ @Override
+ public String getText(Object element) {
+ return ((TransactionRecord) element).toString() + " - " + ((TransactionRecord) element).getComment();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/WordUiUtil.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/WordUiUtil.java
index dccf3eff675..a9a371dd4f4 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/WordUiUtil.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/WordUiUtil.java
@@ -1,98 +1,98 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.util;
-
-import java.util.Collection;
-import org.eclipse.jface.dialogs.MessageDialog;
-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.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.framework.ui.swt.Displays;
-
-/**
- * @author Megumi Telles
- */
-public final class WordUiUtil {
-
- private WordUiUtil() {
- }
-
- public static void displayErrorMessageDialog(final String title, final String message) {
- Displays.pendInDisplayThread(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openError(Displays.getActiveShell(), title, message);
- }
- });
- }
-
- public static void displayWarningMessageDialog(final String title, final String message) {
- Displays.pendInDisplayThread(new Runnable() {
- @Override
- public void run() {
- MessageDialog.openWarning(Displays.getActiveShell(), title, message);
- }
- });
- }
-
- public static void displayTrackedChangesOnArtifacts(final Collection<Artifact> artifacts) {
- if (!artifacts.isEmpty()) {
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- XResultData rd = new XResultData();
- rd.logWarning("\nYou chose to diff changes and the following Artifacts were detected to have tracked changes on.");
- rd.log("Please make sure to accept/reject all tracked changes and comment references.\n");
- rd.addRaw(AHTML.beginMultiColumnTable(60, 1));
- rd.addRaw(AHTML.addHeaderRowMultiColumnTable(new String[] {"Artifact Name", "HRID"}));
- for (Artifact artifact : artifacts) {
- rd.addRaw(AHTML.addRowMultiColumnTable(new String[] {artifact.toString(),
- XResultData.getHyperlink(artifact)}));
- }
- rd.addRaw(AHTML.endMultiColumnTable());
- try {
- rd.report("Artifacts With Tracked Changes");
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- });
- }
- }
-
- public static void displayUnhandledArtifacts(final Collection<Artifact> artifacts, final String warningString) {
- if (!artifacts.isEmpty()) {
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- XResultData rd = new XResultData();
- rd.logWarning("\nYou chose to preview/edit artifacts that could not be handled: ");
- rd.log(warningString + "\n");
- rd.addRaw(AHTML.beginMultiColumnTable(60, 1));
- rd.addRaw(AHTML.addHeaderRowMultiColumnTable(new String[] {"Artifact Name", "HRID"}));
- for (Artifact artifact : artifacts) {
- rd.addRaw(AHTML.addRowMultiColumnTable(new String[] {artifact.toString(),
- XResultData.getHyperlink(artifact)}));
- }
- rd.addRaw(AHTML.endMultiColumnTable());
- try {
- rd.report("Unhandled Artifacts");
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.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.framework.ui.skynet.util;
+
+import java.util.Collection;
+import org.eclipse.jface.dialogs.MessageDialog;
+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.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.framework.ui.swt.Displays;
+
+/**
+ * @author Megumi Telles
+ */
+public final class WordUiUtil {
+
+ private WordUiUtil() {
+ }
+
+ public static void displayErrorMessageDialog(final String title, final String message) {
+ Displays.pendInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ MessageDialog.openError(Displays.getActiveShell(), title, message);
+ }
+ });
+ }
+
+ public static void displayWarningMessageDialog(final String title, final String message) {
+ Displays.pendInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ MessageDialog.openWarning(Displays.getActiveShell(), title, message);
+ }
+ });
+ }
+
+ public static void displayTrackedChangesOnArtifacts(final Collection<Artifact> artifacts) {
+ if (!artifacts.isEmpty()) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ XResultData rd = new XResultData();
+ rd.logWarning("\nYou chose to diff changes and the following Artifacts were detected to have tracked changes on.");
+ rd.log("Please make sure to accept/reject all tracked changes and comment references.\n");
+ rd.addRaw(AHTML.beginMultiColumnTable(60, 1));
+ rd.addRaw(AHTML.addHeaderRowMultiColumnTable(new String[] {"Artifact Name", "HRID"}));
+ for (Artifact artifact : artifacts) {
+ rd.addRaw(AHTML.addRowMultiColumnTable(new String[] {artifact.toString(),
+ XResultData.getHyperlink(artifact)}));
+ }
+ rd.addRaw(AHTML.endMultiColumnTable());
+ try {
+ rd.report("Artifacts With Tracked Changes");
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ });
+ }
+ }
+
+ public static void displayUnhandledArtifacts(final Collection<Artifact> artifacts, final String warningString) {
+ if (!artifacts.isEmpty()) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ XResultData rd = new XResultData();
+ rd.logWarning("\nYou chose to preview/edit artifacts that could not be handled: ");
+ rd.log(warningString + "\n");
+ rd.addRaw(AHTML.beginMultiColumnTable(60, 1));
+ rd.addRaw(AHTML.addHeaderRowMultiColumnTable(new String[] {"Artifact Name", "HRID"}));
+ for (Artifact artifact : artifacts) {
+ rd.addRaw(AHTML.addRowMultiColumnTable(new String[] {artifact.toString(),
+ XResultData.getHyperlink(artifact)}));
+ }
+ rd.addRaw(AHTML.endMultiColumnTable());
+ try {
+ rd.report("Unhandled Artifacts");
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ });
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/email/EmailUserGroups.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/email/EmailUserGroups.java
index 8fcba80b0c9..59569beb55f 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/email/EmailUserGroups.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/email/EmailUserGroups.java
@@ -1,112 +1,112 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.util.email;
-
-import java.util.HashSet;
-import java.util.Set;
-import org.eclipse.osee.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-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.UserManager;
-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.search.ArtifactQuery;
-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.plugin.xnavigate.XNavigateItem;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItemAction;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.results.ResultsEditor;
-import org.eclipse.osee.framework.ui.skynet.widgets.dialog.UserGroupsCheckTreeDialog;
-import org.eclipse.swt.program.Program;
-
-/**
- * @author Donald G. Dunne
- */
-public class EmailUserGroups extends XNavigateItemAction {
-
- /**
- * @param teamDefHoldingVersions Team Definition Artifact that is related to versions or null for popup selection
- */
- public EmailUserGroups(XNavigateItem parent) {
- super(parent, "Email User Groups", FrameworkImage.EMAIL);
- }
-
- public static Set<Artifact> getEmailGroupsAndUserGroups(User user) throws OseeCoreException {
- Set<Artifact> artifacts = new HashSet<Artifact>();
- for (Artifact art : ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.UserGroup,
- BranchManager.getCommonBranch())) {
- // Only add group if have read permissions
- if (!art.getName().equals("Root Artifact") && AccessControlManager.hasPermission(art, PermissionEnum.READ)) {
- artifacts.add(art);
- }
- }
- return artifacts;
- }
-
- @Override
- public void run(TableLoadOption... tableLoadOptions) {
- try {
- Set<Artifact> groupOptions = getEmailGroupsAndUserGroups(UserManager.getUser());
- UserGroupsCheckTreeDialog dialog = new UserGroupsCheckTreeDialog(groupOptions);
- dialog.setTitle("Select Groups to Email");
- if (dialog.open() == 0) {
-
- Set<String> emails = new HashSet<String>();
- for (Artifact artifact : dialog.getSelection()) {
- if (artifact.isOfType(CoreArtifactTypes.UniversalGroup)) {
- for (Artifact userArt : artifact.getRelatedArtifacts(CoreRelationTypes.Universal_Grouping__Members)) {
- if (userArt instanceof User) {
- if (!EmailUtil.isEmailValid((User) userArt)) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE, String.format(
- "Invalid email [%s] for user [%s]; skipping", ((User) userArt).getEmail(), userArt));
- } else {
- emails.add(((User) userArt).getEmail());
- }
- }
- }
- } else if (artifact.isOfType(CoreArtifactTypes.UserGroup)) {
- for (User user : artifact.getRelatedArtifacts(CoreRelationTypes.Users_User, User.class)) {
- if (!EmailUtil.isEmailValid(user)) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE, String.format(
- "Invalid email [%s] for user [%s]; skipping", user.getEmail(), user));
- } else {
- emails.add(user.getEmail());
- }
- }
- }
- }
- if (emails.isEmpty()) {
- AWorkbench.popup("Error", "No emails configured.");
- return;
- }
- String emailStr = org.eclipse.osee.framework.jdk.core.util.Collections.toString(";", emails);
- if (emailStr.length() > 2048) {
- AWorkbench.popup("Email list too big for auto-open. Emails opened in editor for copy/paste.");
- ResultsEditor.open("Email Addresses", "Email Addresses", emailStr);
- } else {
- Program.launch("mailto:" + emailStr);
- }
- AWorkbench.popup("Complete", "Configured emails openened in local email client.");
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.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.framework.ui.skynet.util.email;
+
+import java.util.HashSet;
+import java.util.Set;
+import org.eclipse.osee.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
+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.UserManager;
+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.search.ArtifactQuery;
+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.plugin.xnavigate.XNavigateItem;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItemAction;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.results.ResultsEditor;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.UserGroupsCheckTreeDialog;
+import org.eclipse.swt.program.Program;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class EmailUserGroups extends XNavigateItemAction {
+
+ /**
+ * @param teamDefHoldingVersions Team Definition Artifact that is related to versions or null for popup selection
+ */
+ public EmailUserGroups(XNavigateItem parent) {
+ super(parent, "Email User Groups", FrameworkImage.EMAIL);
+ }
+
+ public static Set<Artifact> getEmailGroupsAndUserGroups(User user) throws OseeCoreException {
+ Set<Artifact> artifacts = new HashSet<Artifact>();
+ for (Artifact art : ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.UserGroup,
+ BranchManager.getCommonBranch())) {
+ // Only add group if have read permissions
+ if (!art.getName().equals("Root Artifact") && AccessControlManager.hasPermission(art, PermissionEnum.READ)) {
+ artifacts.add(art);
+ }
+ }
+ return artifacts;
+ }
+
+ @Override
+ public void run(TableLoadOption... tableLoadOptions) {
+ try {
+ Set<Artifact> groupOptions = getEmailGroupsAndUserGroups(UserManager.getUser());
+ UserGroupsCheckTreeDialog dialog = new UserGroupsCheckTreeDialog(groupOptions);
+ dialog.setTitle("Select Groups to Email");
+ if (dialog.open() == 0) {
+
+ Set<String> emails = new HashSet<String>();
+ for (Artifact artifact : dialog.getSelection()) {
+ if (artifact.isOfType(CoreArtifactTypes.UniversalGroup)) {
+ for (Artifact userArt : artifact.getRelatedArtifacts(CoreRelationTypes.Universal_Grouping__Members)) {
+ if (userArt instanceof User) {
+ if (!EmailUtil.isEmailValid((User) userArt)) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE, String.format(
+ "Invalid email [%s] for user [%s]; skipping", ((User) userArt).getEmail(), userArt));
+ } else {
+ emails.add(((User) userArt).getEmail());
+ }
+ }
+ }
+ } else if (artifact.isOfType(CoreArtifactTypes.UserGroup)) {
+ for (User user : artifact.getRelatedArtifacts(CoreRelationTypes.Users_User, User.class)) {
+ if (!EmailUtil.isEmailValid(user)) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE, String.format(
+ "Invalid email [%s] for user [%s]; skipping", user.getEmail(), user));
+ } else {
+ emails.add(user.getEmail());
+ }
+ }
+ }
+ }
+ if (emails.isEmpty()) {
+ AWorkbench.popup("Error", "No emails configured.");
+ return;
+ }
+ String emailStr = org.eclipse.osee.framework.jdk.core.util.Collections.toString(";", emails);
+ if (emailStr.length() > 2048) {
+ AWorkbench.popup("Email list too big for auto-open. Emails opened in editor for copy/paste.");
+ ResultsEditor.open("Email Addresses", "Email Addresses", emailStr);
+ } else {
+ Program.launch("mailto:" + emailStr);
+ }
+ AWorkbench.popup("Complete", "Configured emails openened in local email client.");
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/email/EmailUtil.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/email/EmailUtil.java
index a113e18eddb..b437f0bb196 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/email/EmailUtil.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/email/EmailUtil.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.framework.ui.skynet.util.email;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.regex.Pattern;
-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.UserManager;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.util.OseeEmail;
-import org.eclipse.osee.framework.ui.skynet.util.OseeEmail.BodyType;
-
-/**
- * @author Donald G. Dunne
- */
-public class EmailUtil {
-
- private static Pattern addressPattern = Pattern.compile(".+?@.+?\\.[a-z]+");
-
- public static boolean isEmailValid(String email) {
- return addressPattern.matcher(email).matches();
- }
-
- public static boolean isEmailValid(User user) throws OseeCoreException {
- return isEmailValid(user.getEmail());
- }
-
- public static Collection<User> getValidEmailUsers(Collection<User> users) throws OseeCoreException {
- Set<User> validUsers = new HashSet<User>();
- for (User user : users) {
- try {
- if (isEmailValid(user)) {
- validUsers.add(user);
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE, ex);
- }
- }
- return validUsers;
- }
-
- public static void emailHtml(Collection<String> emails, String subject, String htmlBody) throws OseeCoreException {
- OseeEmail emailMessage =
- new OseeEmail(emails, UserManager.getUser().getEmail(), UserManager.getUser().getEmail(), subject,
- htmlBody, BodyType.Html);
- emailMessage.send();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.util.email;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.regex.Pattern;
+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.UserManager;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.util.OseeEmail;
+import org.eclipse.osee.framework.ui.skynet.util.OseeEmail.BodyType;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class EmailUtil {
+
+ private static Pattern addressPattern = Pattern.compile(".+?@.+?\\.[a-z]+");
+
+ public static boolean isEmailValid(String email) {
+ return addressPattern.matcher(email).matches();
+ }
+
+ public static boolean isEmailValid(User user) throws OseeCoreException {
+ return isEmailValid(user.getEmail());
+ }
+
+ public static Collection<User> getValidEmailUsers(Collection<User> users) throws OseeCoreException {
+ Set<User> validUsers = new HashSet<User>();
+ for (User user : users) {
+ try {
+ if (isEmailValid(user)) {
+ validUsers.add(user);
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE, ex);
+ }
+ }
+ return validUsers;
+ }
+
+ public static void emailHtml(Collection<String> emails, String subject, String htmlBody) throws OseeCoreException {
+ OseeEmail emailMessage =
+ new OseeEmail(emails, UserManager.getUser().getEmail(), UserManager.getUser().getEmail(), subject,
+ htmlBody, BodyType.Html);
+ emailMessage.send();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/filteredTree/MinMaxOSEECheckedFilteredTreeDialog.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/filteredTree/MinMaxOSEECheckedFilteredTreeDialog.java
index 014b4f2c312..9eb2a880761 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/filteredTree/MinMaxOSEECheckedFilteredTreeDialog.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/filteredTree/MinMaxOSEECheckedFilteredTreeDialog.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.framework.ui.skynet.util.filteredTree;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.osee.framework.jdk.core.util.Collections;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.dialogs.PatternFilter;
-
-/**
- * @author Donald G. Dunne
- */
-public class MinMaxOSEECheckedFilteredTreeDialog extends OSEECheckedFilteredTreeDialog {
-
- private final int maxSelectionRequired;
- private final int minSelectionRequired;
-
- public MinMaxOSEECheckedFilteredTreeDialog(String dialogTitle, String dialogMessage, PatternFilter patternFilter, IContentProvider contentProvider, IBaseLabelProvider labelProvider, ViewerSorter viewerSorter, int minSelectionRequired, int maxSelectionRequired) {
- super(dialogTitle, dialogMessage, patternFilter, contentProvider, labelProvider, viewerSorter);
- this.minSelectionRequired = minSelectionRequired;
- this.maxSelectionRequired = maxSelectionRequired;
- }
-
- @Override
- protected Control createButtonBar(Composite parent) {
- Control c = super.createButtonBar(parent);
- if (this.minSelectionRequired == 0) {
- okButton.setEnabled(true);
- }
- return c;
- }
-
- @Override
- protected Result isComplete() {
- int numberSelected = getResult().length;
- if (minSelectionRequired <= numberSelected && maxSelectionRequired >= numberSelected) {
- return Result.TrueResult;
- } else {
- List<String> message = new ArrayList<String>();
- if (numberSelected < minSelectionRequired) {
- message.add(String.format("Must select at least [%s]", minSelectionRequired));
- }
- if (numberSelected > maxSelectionRequired) {
- message.add(String.format("Can't select more than [%s]", maxSelectionRequired));
- }
- return new Result(Collections.toString(" &&", message));
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.util.filteredTree;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.jface.viewers.IBaseLabelProvider;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.dialogs.PatternFilter;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class MinMaxOSEECheckedFilteredTreeDialog extends OSEECheckedFilteredTreeDialog {
+
+ private final int maxSelectionRequired;
+ private final int minSelectionRequired;
+
+ public MinMaxOSEECheckedFilteredTreeDialog(String dialogTitle, String dialogMessage, PatternFilter patternFilter, IContentProvider contentProvider, IBaseLabelProvider labelProvider, ViewerSorter viewerSorter, int minSelectionRequired, int maxSelectionRequired) {
+ super(dialogTitle, dialogMessage, patternFilter, contentProvider, labelProvider, viewerSorter);
+ this.minSelectionRequired = minSelectionRequired;
+ this.maxSelectionRequired = maxSelectionRequired;
+ }
+
+ @Override
+ protected Control createButtonBar(Composite parent) {
+ Control c = super.createButtonBar(parent);
+ if (this.minSelectionRequired == 0) {
+ okButton.setEnabled(true);
+ }
+ return c;
+ }
+
+ @Override
+ protected Result isComplete() {
+ int numberSelected = getResult().length;
+ if (minSelectionRequired <= numberSelected && maxSelectionRequired >= numberSelected) {
+ return Result.TrueResult;
+ } else {
+ List<String> message = new ArrayList<String>();
+ if (numberSelected < minSelectionRequired) {
+ message.add(String.format("Must select at least [%s]", minSelectionRequired));
+ }
+ if (numberSelected > maxSelectionRequired) {
+ message.add(String.format("Can't select more than [%s]", maxSelectionRequired));
+ }
+ return new Result(Collections.toString(" &&", message));
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/DefaultBranchContentProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/DefaultBranchContentProvider.java
index a9f68a9b85f..86641f48e8e 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/DefaultBranchContentProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/DefaultBranchContentProvider.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.framework.ui.skynet.widgets;
-
-import java.util.List;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.osee.framework.core.model.Branch;
-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.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;
-
-/**
- * @author Robert A. Fisher
- */
-public class DefaultBranchContentProvider implements ITreeContentProvider, IBranchEventListener {
- private final ITreeContentProvider provider;
- private final Branch branch;
-
- /**
- * @param provider
- */
- public DefaultBranchContentProvider(final ITreeContentProvider provider, Branch branch) {
- if (provider == null) throw new IllegalArgumentException("provider can not be null");
-
- this.branch = branch;
- this.provider = provider;
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public void dispose() {
- OseeEventManager.removeListener(this);
- }
-
- public Object[] getChildren(Object parentElement) {
- return provider.getChildren(parentElement);
- }
-
- public Object getParent(Object element) {
- return provider.getParent(element);
- }
-
- public boolean hasChildren(Object element) {
- return provider.hasChildren(element);
- }
-
- public Object[] getElements(Object inputElement) {
- return provider.getElements(branch);
- }
-
- @Override
- public void handleBranchEventREM1(Sender sender, BranchEventType branchModType, final int branchId) {
- }
-
- @Override
- public void handleBranchEvent(Sender sender, BranchEvent branchEvent) {
- }
-
- @Override
- public void handleLocalBranchToArtifactCacheUpdateEvent(Sender sender) {
- }
-
- @Override
- public List<? extends IEventFilter> getEventFilters() {
- if (branch != null) {
- return OseeEventManager.getEventFiltersForBranch(branch);
- }
- 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.framework.ui.skynet.widgets;
+
+import java.util.List;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.osee.framework.core.model.Branch;
+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.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;
+
+/**
+ * @author Robert A. Fisher
+ */
+public class DefaultBranchContentProvider implements ITreeContentProvider, IBranchEventListener {
+ private final ITreeContentProvider provider;
+ private final Branch branch;
+
+ /**
+ * @param provider
+ */
+ public DefaultBranchContentProvider(final ITreeContentProvider provider, Branch branch) {
+ if (provider == null) throw new IllegalArgumentException("provider can not be null");
+
+ this.branch = branch;
+ this.provider = provider;
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ public void dispose() {
+ OseeEventManager.removeListener(this);
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ return provider.getChildren(parentElement);
+ }
+
+ public Object getParent(Object element) {
+ return provider.getParent(element);
+ }
+
+ public boolean hasChildren(Object element) {
+ return provider.hasChildren(element);
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return provider.getElements(branch);
+ }
+
+ @Override
+ public void handleBranchEventREM1(Sender sender, BranchEventType branchModType, final int branchId) {
+ }
+
+ @Override
+ public void handleBranchEvent(Sender sender, BranchEvent branchEvent) {
+ }
+
+ @Override
+ public void handleLocalBranchToArtifactCacheUpdateEvent(Sender sender) {
+ }
+
+ @Override
+ public List<? extends IEventFilter> getEventFilters() {
+ if (branch != null) {
+ return OseeEventManager.getEventFiltersForBranch(branch);
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IArtifactStoredWidget.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IArtifactStoredWidget.java
index bc61ee0cfcc..0b415621115 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IArtifactStoredWidget.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IArtifactStoredWidget.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.framework.ui.skynet.widgets;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-
-/**
- * Used by XWidgets that perform external data storage
- *
- * @author Roberto E. Escobar
- */
-public interface IArtifactStoredWidget {
-
- /**
- * Save data changes to artifact
- *
- * @throws Exception
- */
- public void saveToArtifact() throws OseeCoreException;
-
- /**
- * Revert changes to widget data back to what was in artifact
- *
- * @throws Exception
- */
- public void revert() throws OseeCoreException;
-
- /**
- * Return true if storage data different than widget data
- *
- * @throws Exception
- */
- public Result isDirty() 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.framework.ui.skynet.widgets;
+
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+
+/**
+ * Used by XWidgets that perform external data storage
+ *
+ * @author Roberto E. Escobar
+ */
+public interface IArtifactStoredWidget {
+
+ /**
+ * Save data changes to artifact
+ *
+ * @throws Exception
+ */
+ public void saveToArtifact() throws OseeCoreException;
+
+ /**
+ * Revert changes to widget data back to what was in artifact
+ *
+ * @throws Exception
+ */
+ public void revert() throws OseeCoreException;
+
+ /**
+ * Return true if storage data different than widget data
+ *
+ * @throws Exception
+ */
+ public Result isDirty() throws OseeCoreException;
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IArtifactWidget.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IArtifactWidget.java
index 50a203cf891..9b6a14a7c58 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IArtifactWidget.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IArtifactWidget.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.framework.ui.skynet.widgets;
-
-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;
-
-/**
- * Used by XWidgets that perform external data storage
- *
- * @author Donald G. Dunne
- */
-public interface IArtifactWidget extends IArtifactStoredWidget {
-
- /**
- * Set artifact used as storage for this widget
- *
- * @throws Exception
- */
- public void setArtifact(Artifact artifact) 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.framework.ui.skynet.widgets;
+
+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;
+
+/**
+ * Used by XWidgets that perform external data storage
+ *
+ * @author Donald G. Dunne
+ */
+public interface IArtifactWidget extends IArtifactStoredWidget {
+
+ /**
+ * Set artifact used as storage for this widget
+ *
+ * @throws Exception
+ */
+ public void setArtifact(Artifact artifact) throws OseeCoreException;
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IAttributeWidget.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IAttributeWidget.java
index 2c303d2fdaf..33ed8a61544 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IAttributeWidget.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/IAttributeWidget.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.framework.ui.skynet.widgets;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-
-/**
- * Used by XWidgets that perform external data storage
- *
- * @author Roberto E. Escobar
- */
-public interface IAttributeWidget extends IArtifactStoredWidget {
-
- /**
- * Set attributeType used as storage for this widget
- *
- * @throws OseeCoreException
- */
- public void setAttributeType(Artifact artifact, String attributeTypeName) throws OseeCoreException;
-
- /**
- * Get attributeType used as storage for this widget
- */
- public String getAttributeType();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+
+/**
+ * Used by XWidgets that perform external data storage
+ *
+ * @author Roberto E. Escobar
+ */
+public interface IAttributeWidget extends IArtifactStoredWidget {
+
+ /**
+ * Set attributeType used as storage for this widget
+ *
+ * @throws OseeCoreException
+ */
+ public void setAttributeType(Artifact artifact, String attributeTypeName) throws OseeCoreException;
+
+ /**
+ * Get attributeType used as storage for this widget
+ */
+ public String getAttributeType();
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XArtifactTypeListViewer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XArtifactTypeListViewer.java
index 426005ffbb7..185dca5c0db 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XArtifactTypeListViewer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XArtifactTypeListViewer.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.framework.ui.skynet.widgets;
-
-import java.util.ArrayList;
-import org.eclipse.osee.framework.core.model.type.ArtifactType;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-
-/**
- * @author Jeff C. Phillips
- */
-public class XArtifactTypeListViewer extends XTypeListViewer {
- private static final String NAME = "XArtifactTypeListViewer";
-
- public XArtifactTypeListViewer(String keyedBranchName, String defaultValue) {
- super(NAME);
-
- setContentProvider(new DefaultBranchContentProvider(new ArtifactTypeContentProvider(), resolveBranch(keyedBranchName)));
- ArrayList<Object> input = new ArrayList<Object>(1);
- input.add(resolveBranch(keyedBranchName));
-
- setInput(input);
-
- if (defaultValue != null) {
- try {
- ArtifactType artifactType = ArtifactTypeManager.getType(defaultValue);
- setDefaultSelected(artifactType);
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.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.framework.ui.skynet.widgets;
+
+import java.util.ArrayList;
+import org.eclipse.osee.framework.core.model.type.ArtifactType;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class XArtifactTypeListViewer extends XTypeListViewer {
+ private static final String NAME = "XArtifactTypeListViewer";
+
+ public XArtifactTypeListViewer(String keyedBranchName, String defaultValue) {
+ super(NAME);
+
+ setContentProvider(new DefaultBranchContentProvider(new ArtifactTypeContentProvider(), resolveBranch(keyedBranchName)));
+ ArrayList<Object> input = new ArrayList<Object>(1);
+ input.add(resolveBranch(keyedBranchName));
+
+ setInput(input);
+
+ if (defaultValue != null) {
+ try {
+ ArtifactType artifactType = ArtifactTypeManager.getType(defaultValue);
+ setDefaultSelected(artifactType);
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XAttributeTypeListViewer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XAttributeTypeListViewer.java
index db9b5e9a0f4..a50755ebed0 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XAttributeTypeListViewer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XAttributeTypeListViewer.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets;
-
-import java.util.ArrayList;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-
-/**
- * @author Jeff C. Phillips
- */
-public class XAttributeTypeListViewer extends XTypeListViewer {
- private static final String NAME = "XAttributeTypeListViewer";
-
- public XAttributeTypeListViewer(String keyedBranchName, String defaultValue) {
- super(NAME);
-
- try {
- setContentProvider(new DefaultBranchContentProvider(new AttributeContentProvider(),
- BranchManager.getSystemRootBranch()));
- ArrayList<Object> input = new ArrayList<Object>(1);
- input.add(resolveBranch(keyedBranchName));
-
- setInput(input);
-
- try {
- if (defaultValue != null) {
- AttributeType attributeType = AttributeTypeManager.getType(defaultValue);
- setDefaultSelected(attributeType);
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.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.framework.ui.skynet.widgets;
+
+import java.util.ArrayList;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class XAttributeTypeListViewer extends XTypeListViewer {
+ private static final String NAME = "XAttributeTypeListViewer";
+
+ public XAttributeTypeListViewer(String keyedBranchName, String defaultValue) {
+ super(NAME);
+
+ try {
+ setContentProvider(new DefaultBranchContentProvider(new AttributeContentProvider(),
+ BranchManager.getSystemRootBranch()));
+ ArrayList<Object> input = new ArrayList<Object>(1);
+ input.add(resolveBranch(keyedBranchName));
+
+ setInput(input);
+
+ try {
+ if (defaultValue != null) {
+ AttributeType attributeType = AttributeTypeManager.getType(defaultValue);
+ setDefaultSelected(attributeType);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XBranchSelectComboWidget.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XBranchSelectComboWidget.java
index 2797d8417d0..04d69ff1082 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XBranchSelectComboWidget.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XBranchSelectComboWidget.java
@@ -1,189 +1,189 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.widgets;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.panels.BranchSelectSimpleComposite;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-
-/**
- * @author Roberto E. Escobar
- */
-public class XBranchSelectComboWidget extends XWidget implements Listener {
- public static final String WIDGET_ID = XBranchSelectWidget.class.getSimpleName();
-
- private BranchSelectSimpleComposite selectComposite;
- private Composite composite;
- private final int defaultBranch;
-
- private final List<Listener> listeners = new ArrayList<Listener>();
-
- public XBranchSelectComboWidget(String label) {
- super(label);
- this.defaultBranch = -1;
- }
-
- @Override
- protected void createControls(Composite parent, int horizontalSpan) {
- composite = null;
-
- if (!verticalLabel && (horizontalSpan < 2)) {
- horizontalSpan = 2;
- } else if (verticalLabel) {
- horizontalSpan = 1;
- }
-
- if (isDisplayLabel() && verticalLabel) {
- composite = new Composite(parent, SWT.NONE);
- GridLayout gL = new GridLayout();
- gL.marginWidth = 0;
- gL.marginHeight = 0;
- composite.setLayout(gL);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- } else {
- composite = parent;
- }
-
- // Create List Widgets
- if (isDisplayLabel()) {
- labelWidget = new Label(composite, SWT.NONE);
- labelWidget.setText(getLabel() + ":");
- }
- selectComposite = BranchSelectSimpleComposite.createBranchSelectComposite(composite, SWT.NONE);
- if (defaultBranch != -1) {
- selectComposite.restoreWidgetValues(null, Integer.toString(defaultBranch));
- }
- selectComposite.addListener(this);
- }
-
- @Override
- public void dispose() {
- if (selectComposite != null) {
- selectComposite.removeListener(this);
- selectComposite.dispose();
- }
- }
-
- @Override
- public Control getControl() {
- return composite;
- }
-
- @Override
- public Branch getData() {
- return selectComposite.getSelectedBranch();
- }
-
- @Override
- public String getReportData() {
- Branch branch = selectComposite.getSelectedBranch();
- return branch != null ? branch.getName() : "";
- }
-
- @Override
- public String getXmlData() {
- System.out.println("Get XML Data Called: ");
- return "";
- }
-
- @Override
- public IStatus isValid() {
- if (selectComposite.getSelectedBranch() == null) {
- return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, "Must select a Branch");
- }
- return Status.OK_STATUS;
- }
-
- @Override
- public void refresh() {
- }
-
- @Override
- public void setFocus() {
- selectComposite.setFocus();
- }
-
- @Override
- public void setXmlData(String str) {
- System.out.println("Set XML Data Called: " + str);
- }
-
- @Override
- public String toHTML(String labelFont) {
- System.out.println("Set to Html Called: " + labelFont);
- return "";
- }
-
- @Override
- public void setDisplayLabel(final String displayLabel) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- XBranchSelectComboWidget.super.setDisplayLabel(displayLabel);
- getLabelWidget().setText(displayLabel);
- }
- });
- }
-
- @Override
- public void setToolTip(final String toolTip) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (Strings.isValid(toolTip) != false) {
- XBranchSelectComboWidget.super.setToolTip(toolTip);
- if (selectComposite != null && selectComposite.isDisposed() != true) {
- selectComposite.setToolTipText(toolTip);
- for (Control control : selectComposite.getChildren()) {
- control.setToolTipText(toolTip);
- }
- }
- }
- }
- });
- }
-
- @Override
- public void handleEvent(Event event) {
- super.validate();
- notifyListeners(event);
- }
-
- public void addListener(Listener listener) {
- listeners.add(listener);
- }
-
- public void removeListener(Listener listener) {
- listeners.remove(listener);
- }
-
- private void notifyListeners(Event event) {
- for (Listener listener : listeners) {
- listener.handleEvent(event);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.panels.BranchSelectSimpleComposite;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class XBranchSelectComboWidget extends XWidget implements Listener {
+ public static final String WIDGET_ID = XBranchSelectWidget.class.getSimpleName();
+
+ private BranchSelectSimpleComposite selectComposite;
+ private Composite composite;
+ private final int defaultBranch;
+
+ private final List<Listener> listeners = new ArrayList<Listener>();
+
+ public XBranchSelectComboWidget(String label) {
+ super(label);
+ this.defaultBranch = -1;
+ }
+
+ @Override
+ protected void createControls(Composite parent, int horizontalSpan) {
+ composite = null;
+
+ if (!verticalLabel && (horizontalSpan < 2)) {
+ horizontalSpan = 2;
+ } else if (verticalLabel) {
+ horizontalSpan = 1;
+ }
+
+ if (isDisplayLabel() && verticalLabel) {
+ composite = new Composite(parent, SWT.NONE);
+ GridLayout gL = new GridLayout();
+ gL.marginWidth = 0;
+ gL.marginHeight = 0;
+ composite.setLayout(gL);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ } else {
+ composite = parent;
+ }
+
+ // Create List Widgets
+ if (isDisplayLabel()) {
+ labelWidget = new Label(composite, SWT.NONE);
+ labelWidget.setText(getLabel() + ":");
+ }
+ selectComposite = BranchSelectSimpleComposite.createBranchSelectComposite(composite, SWT.NONE);
+ if (defaultBranch != -1) {
+ selectComposite.restoreWidgetValues(null, Integer.toString(defaultBranch));
+ }
+ selectComposite.addListener(this);
+ }
+
+ @Override
+ public void dispose() {
+ if (selectComposite != null) {
+ selectComposite.removeListener(this);
+ selectComposite.dispose();
+ }
+ }
+
+ @Override
+ public Control getControl() {
+ return composite;
+ }
+
+ @Override
+ public Branch getData() {
+ return selectComposite.getSelectedBranch();
+ }
+
+ @Override
+ public String getReportData() {
+ Branch branch = selectComposite.getSelectedBranch();
+ return branch != null ? branch.getName() : "";
+ }
+
+ @Override
+ public String getXmlData() {
+ System.out.println("Get XML Data Called: ");
+ return "";
+ }
+
+ @Override
+ public IStatus isValid() {
+ if (selectComposite.getSelectedBranch() == null) {
+ return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, "Must select a Branch");
+ }
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public void refresh() {
+ }
+
+ @Override
+ public void setFocus() {
+ selectComposite.setFocus();
+ }
+
+ @Override
+ public void setXmlData(String str) {
+ System.out.println("Set XML Data Called: " + str);
+ }
+
+ @Override
+ public String toHTML(String labelFont) {
+ System.out.println("Set to Html Called: " + labelFont);
+ return "";
+ }
+
+ @Override
+ public void setDisplayLabel(final String displayLabel) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ XBranchSelectComboWidget.super.setDisplayLabel(displayLabel);
+ getLabelWidget().setText(displayLabel);
+ }
+ });
+ }
+
+ @Override
+ public void setToolTip(final String toolTip) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (Strings.isValid(toolTip) != false) {
+ XBranchSelectComboWidget.super.setToolTip(toolTip);
+ if (selectComposite != null && selectComposite.isDisposed() != true) {
+ selectComposite.setToolTipText(toolTip);
+ for (Control control : selectComposite.getChildren()) {
+ control.setToolTipText(toolTip);
+ }
+ }
+ }
+ }
+ });
+ }
+
+ @Override
+ public void handleEvent(Event event) {
+ super.validate();
+ notifyListeners(event);
+ }
+
+ public void addListener(Listener listener) {
+ listeners.add(listener);
+ }
+
+ public void removeListener(Listener listener) {
+ listeners.remove(listener);
+ }
+
+ private void notifyListeners(Event event) {
+ for (Listener listener : listeners) {
+ listener.handleEvent(event);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XBranchSelectWidget.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XBranchSelectWidget.java
index 82b38f0f86f..bbb1cd76bf1 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XBranchSelectWidget.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XBranchSelectWidget.java
@@ -1,204 +1,204 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.widgets;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.branch.BranchSelectComposite;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-
-/**
- * @author Roberto E. Escobar
- * @author Donald G. Dunne
- */
-public class XBranchSelectWidget extends XWidget implements Listener {
- public static final String WIDGET_ID = XBranchSelectWidget.class.getSimpleName();
-
- private BranchSelectComposite selectComposite;
- private Composite composite;
- private Branch defaultBranch;
-
- private final List<Listener> listeners = new ArrayList<Listener>();
-
- public XBranchSelectWidget(String label) {
- super(label);
- }
-
- @Override
- protected void createControls(Composite parent, int horizontalSpan) {
- composite = null;
-
- if (!verticalLabel && (horizontalSpan < 2)) {
- horizontalSpan = 2;
- } else if (verticalLabel) {
- horizontalSpan = 1;
- }
-
- if (isDisplayLabel() && verticalLabel) {
- composite = new Composite(parent, SWT.NONE);
- GridLayout gL = new GridLayout();
- gL.marginWidth = 0;
- gL.marginHeight = 0;
- composite.setLayout(gL);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- } else {
- composite = parent;
- }
-
- // Create List Widgets
- if (isDisplayLabel()) {
- labelWidget = new Label(composite, SWT.NONE);
- labelWidget.setText(getLabel() + ":");
- }
- selectComposite = BranchSelectComposite.createBranchSelectComposite(composite, SWT.NONE);
- if (defaultBranch != null) {
- selectComposite.setDefaultSelectedBranch(defaultBranch);
- }
- selectComposite.addListener(this);
- }
-
- @Override
- public void dispose() {
- if (selectComposite != null) {
- selectComposite.removeListener(this);
- selectComposite.dispose();
- }
- }
-
- @Override
- public Control getControl() {
- return selectComposite.getBranchSelectText();
- }
-
- @Override
- public Branch getData() {
- return getSelection();
- }
-
- public Branch getSelection() {
- return selectComposite.getSelectedBranch();
- }
-
- @Override
- public String getReportData() {
- Branch branch = selectComposite.getSelectedBranch();
- return branch != null ? branch.getName() : "";
- }
-
- @Override
- public String getXmlData() {
- System.out.println("Get XML Data Called: ");
- return "";
- }
-
- @Override
- public IStatus isValid() {
- if (selectComposite.getSelectedBranch() == null) {
- return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, "Must select a Branch");
- }
- return Status.OK_STATUS;
- }
-
- @Override
- public void refresh() {
- }
-
- @Override
- public void setFocus() {
- selectComposite.setFocus();
- }
-
- @Override
- public void setXmlData(String str) {
- System.out.println("Set XML Data Called: " + str);
- }
-
- @Override
- public String toHTML(String labelFont) {
- System.out.println("Set to Html Called: " + labelFont);
- return "";
- }
-
- @Override
- public void setDisplayLabel(final String displayLabel) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- XBranchSelectWidget.super.setDisplayLabel(displayLabel);
- getLabelWidget().setText(displayLabel);
- }
- });
- }
-
- @Override
- public void setToolTip(final String toolTip) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (Strings.isValid(toolTip) != false) {
- XBranchSelectWidget.super.setToolTip(toolTip);
- if (selectComposite != null && selectComposite.isDisposed() != true) {
- selectComposite.setToolTipText(toolTip);
- for (Control control : selectComposite.getChildren()) {
- control.setToolTipText(toolTip);
- }
- }
- }
- }
- });
- }
-
- @Override
- public void handleEvent(Event event) {
- super.validate();
- notifyListeners(event);
- }
-
- public void addListener(Listener listener) {
- listeners.add(listener);
- }
-
- public void removeListener(Listener listener) {
- listeners.remove(listener);
- }
-
- private void notifyListeners(Event event) {
- for (Listener listener : listeners) {
- listener.handleEvent(event);
- }
- }
-
- public void setSelection(Branch branch) {
- defaultBranch = branch;
- if (selectComposite != null) {
- selectComposite.setSelected(branch);
- }
- }
-
- public BranchSelectComposite getSelectComposite() {
- return selectComposite;
- }
-
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.branch.BranchSelectComposite;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+
+/**
+ * @author Roberto E. Escobar
+ * @author Donald G. Dunne
+ */
+public class XBranchSelectWidget extends XWidget implements Listener {
+ public static final String WIDGET_ID = XBranchSelectWidget.class.getSimpleName();
+
+ private BranchSelectComposite selectComposite;
+ private Composite composite;
+ private Branch defaultBranch;
+
+ private final List<Listener> listeners = new ArrayList<Listener>();
+
+ public XBranchSelectWidget(String label) {
+ super(label);
+ }
+
+ @Override
+ protected void createControls(Composite parent, int horizontalSpan) {
+ composite = null;
+
+ if (!verticalLabel && (horizontalSpan < 2)) {
+ horizontalSpan = 2;
+ } else if (verticalLabel) {
+ horizontalSpan = 1;
+ }
+
+ if (isDisplayLabel() && verticalLabel) {
+ composite = new Composite(parent, SWT.NONE);
+ GridLayout gL = new GridLayout();
+ gL.marginWidth = 0;
+ gL.marginHeight = 0;
+ composite.setLayout(gL);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ } else {
+ composite = parent;
+ }
+
+ // Create List Widgets
+ if (isDisplayLabel()) {
+ labelWidget = new Label(composite, SWT.NONE);
+ labelWidget.setText(getLabel() + ":");
+ }
+ selectComposite = BranchSelectComposite.createBranchSelectComposite(composite, SWT.NONE);
+ if (defaultBranch != null) {
+ selectComposite.setDefaultSelectedBranch(defaultBranch);
+ }
+ selectComposite.addListener(this);
+ }
+
+ @Override
+ public void dispose() {
+ if (selectComposite != null) {
+ selectComposite.removeListener(this);
+ selectComposite.dispose();
+ }
+ }
+
+ @Override
+ public Control getControl() {
+ return selectComposite.getBranchSelectText();
+ }
+
+ @Override
+ public Branch getData() {
+ return getSelection();
+ }
+
+ public Branch getSelection() {
+ return selectComposite.getSelectedBranch();
+ }
+
+ @Override
+ public String getReportData() {
+ Branch branch = selectComposite.getSelectedBranch();
+ return branch != null ? branch.getName() : "";
+ }
+
+ @Override
+ public String getXmlData() {
+ System.out.println("Get XML Data Called: ");
+ return "";
+ }
+
+ @Override
+ public IStatus isValid() {
+ if (selectComposite.getSelectedBranch() == null) {
+ return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, "Must select a Branch");
+ }
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public void refresh() {
+ }
+
+ @Override
+ public void setFocus() {
+ selectComposite.setFocus();
+ }
+
+ @Override
+ public void setXmlData(String str) {
+ System.out.println("Set XML Data Called: " + str);
+ }
+
+ @Override
+ public String toHTML(String labelFont) {
+ System.out.println("Set to Html Called: " + labelFont);
+ return "";
+ }
+
+ @Override
+ public void setDisplayLabel(final String displayLabel) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ XBranchSelectWidget.super.setDisplayLabel(displayLabel);
+ getLabelWidget().setText(displayLabel);
+ }
+ });
+ }
+
+ @Override
+ public void setToolTip(final String toolTip) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (Strings.isValid(toolTip) != false) {
+ XBranchSelectWidget.super.setToolTip(toolTip);
+ if (selectComposite != null && selectComposite.isDisposed() != true) {
+ selectComposite.setToolTipText(toolTip);
+ for (Control control : selectComposite.getChildren()) {
+ control.setToolTipText(toolTip);
+ }
+ }
+ }
+ }
+ });
+ }
+
+ @Override
+ public void handleEvent(Event event) {
+ super.validate();
+ notifyListeners(event);
+ }
+
+ public void addListener(Listener listener) {
+ listeners.add(listener);
+ }
+
+ public void removeListener(Listener listener) {
+ listeners.remove(listener);
+ }
+
+ private void notifyListeners(Event event) {
+ for (Listener listener : listeners) {
+ listener.handleEvent(event);
+ }
+ }
+
+ public void setSelection(Branch branch) {
+ defaultBranch = branch;
+ if (selectComposite != null) {
+ selectComposite.setSelected(branch);
+ }
+ }
+
+ public BranchSelectComposite getSelectComposite() {
+ return selectComposite;
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XBranchSelectWidgetProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XBranchSelectWidgetProvider.java
index 9f9786a0020..dc035b6ca05 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XBranchSelectWidgetProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XBranchSelectWidgetProvider.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.framework.ui.skynet.widgets;
-
-import java.util.logging.Level;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IXWidgetProvider;
-
-/**
- * @author Roberto E. Escobar
- */
-public class XBranchSelectWidgetProvider implements IXWidgetProvider {
-
- @Override
- public XWidget createXWidget(String widgetName, String name, DynamicXWidgetLayoutData widgetLayoutData) {
- XWidget toReturn = null;
- if (widgetName.equals(XBranchSelectWidget.WIDGET_ID)) {
- XBranchSelectWidget widget = new XBranchSelectWidget(name);
- widget.setToolTip(widgetLayoutData.getToolTip());
- try {
- String branchGuid = widgetLayoutData.getDefaultValue();
- if (branchGuid != null) {
- widget.setSelection(BranchManager.getBranchByGuid(branchGuid));
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- toReturn = widget;
- }
- 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.framework.ui.skynet.widgets;
+
+import java.util.logging.Level;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IXWidgetProvider;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class XBranchSelectWidgetProvider implements IXWidgetProvider {
+
+ @Override
+ public XWidget createXWidget(String widgetName, String name, DynamicXWidgetLayoutData widgetLayoutData) {
+ XWidget toReturn = null;
+ if (widgetName.equals(XBranchSelectWidget.WIDGET_ID)) {
+ XBranchSelectWidget widget = new XBranchSelectWidget(name);
+ widget.setToolTip(widgetLayoutData.getToolTip());
+ try {
+ String branchGuid = widgetLayoutData.getDefaultValue();
+ if (branchGuid != null) {
+ widget.setSelection(BranchManager.getBranchByGuid(branchGuid));
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ toReturn = widget;
+ }
+ return toReturn;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XButtonViaAction.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XButtonViaAction.java
index f94c84c13cf..80d0f2c5879 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XButtonViaAction.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XButtonViaAction.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.framework.ui.skynet.widgets;
-
-import org.eclipse.jface.action.Action;
-
-/**
- * @author Donald G. Dunne
- */
-public class XButtonViaAction extends XButton {
-
- public XButtonViaAction(final Action action) {
- super(action.getText(), action.getImageDescriptor().createImage());
- if (action.getToolTipText() != null && !action.getToolTipText().equals("")) {
- setToolTip(action.getToolTipText());
- }
- addXModifiedListener(new XModifiedListener() {
-
- @Override
- public void widgetModified(XWidget widget) {
- action.run();
- }
- });
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+import org.eclipse.jface.action.Action;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XButtonViaAction extends XButton {
+
+ public XButtonViaAction(final Action action) {
+ super(action.getText(), action.getImageDescriptor().createImage());
+ if (action.getToolTipText() != null && !action.getToolTipText().equals("")) {
+ setToolTip(action.getToolTipText());
+ }
+ addXModifiedListener(new XModifiedListener() {
+
+ @Override
+ public void widgetModified(XWidget widget) {
+ action.run();
+ }
+ });
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XCombo.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XCombo.java
index afb0e97c212..f18c5a42ac6 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XCombo.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XCombo.java
@@ -1,74 +1,74 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-
-/**
- * @author Donald G. Dunne
- */
-public class XCombo extends XWidget {
-
- private Combo dataCombo;
- private Composite parent;
- protected String data = "";
- protected String[] inDataStrings; // Strings sent in for display
- //
- private final Map<String, Integer> displayDataStrings = new HashMap<String, Integer>();
- protected Map<String, String> dataStringToXmlString;
- private String displayArray[];
- private boolean isDefaultSelectionAllowed;
-
- public XCombo(String displayLabel, String xmlRoot, String xmlSubRoot) {
- super(displayLabel, xmlRoot, xmlSubRoot);
- isDefaultSelectionAllowed = true;
- }
-
- public XCombo(String displayLabel, String xmlRoot) {
- this(displayLabel, xmlRoot, "");
- }
-
- public XCombo(String displayLabel) {
- this(displayLabel, "", "");
- }
-
- public void setDefaultSelectionAllowed(boolean isAllowed) {
- this.isDefaultSelectionAllowed = isAllowed;
- }
-
- public boolean isDefaultSelectionAllowed() {
- return isDefaultSelectionAllowed;
- }
-
- @Override
- public Control getControl() {
- return dataCombo;
- }
-
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XCombo extends XWidget {
+
+ private Combo dataCombo;
+ private Composite parent;
+ protected String data = "";
+ protected String[] inDataStrings; // Strings sent in for display
+ //
+ private final Map<String, Integer> displayDataStrings = new HashMap<String, Integer>();
+ protected Map<String, String> dataStringToXmlString;
+ private String displayArray[];
+ private boolean isDefaultSelectionAllowed;
+
+ public XCombo(String displayLabel, String xmlRoot, String xmlSubRoot) {
+ super(displayLabel, xmlRoot, xmlSubRoot);
+ isDefaultSelectionAllowed = true;
+ }
+
+ public XCombo(String displayLabel, String xmlRoot) {
+ this(displayLabel, xmlRoot, "");
+ }
+
+ public XCombo(String displayLabel) {
+ this(displayLabel, "", "");
+ }
+
+ public void setDefaultSelectionAllowed(boolean isAllowed) {
+ this.isDefaultSelectionAllowed = isAllowed;
+ }
+
+ public boolean isDefaultSelectionAllowed() {
+ return isDefaultSelectionAllowed;
+ }
+
+ @Override
+ public Control getControl() {
+ return dataCombo;
+ }
+
@Override
public void setEditable(boolean editable) {
super.setEditable(editable);
@@ -77,311 +77,311 @@ public class XCombo extends XWidget {
}
}
- public void setEnabled(boolean enabled) {
- dataCombo.setEnabled(enabled);
- }
-
- public void createWidgets(Composite composite, int horizontalSpan, String inDataStrings[]) {
- this.inDataStrings = inDataStrings;
- createWidgets(composite, horizontalSpan);
- }
-
- /**
- * Create Data Widgets. Widgets Created: Data: "--select--" horizonatalSpan takes up 2 columns; horizontalSpan must
- * be >=2 the string "--select--" will be added to the sent in dataStrings array
- */
- @Override
- protected void createControls(Composite parent, int horizontalSpan) {
-
- GridData gd;
- this.parent = parent;
-
- if (inDataStrings == null) {
- inDataStrings = new String[] {"DATA NOT FOUND"};
- }
- setDisplayDataStrings();
-
- if (horizontalSpan < 2) {
- horizontalSpan = 2;
- }
-
- // Create Data Widgets
- if (isDisplayLabel() && !getLabel().equals("")) {
- labelWidget = new Label(parent, SWT.NONE);
- labelWidget.setText(getLabel() + ":");
- if (getToolTip() != null) {
- labelWidget.setToolTipText(getToolTip());
- }
- }
-
- dataCombo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.V_SCROLL);
- dataCombo.setItems(displayArray);
- dataCombo.setVisibleItemCount(Math.min(displayArray.length, 45));
-
- gd = new GridData();
+ public void setEnabled(boolean enabled) {
+ dataCombo.setEnabled(enabled);
+ }
+
+ public void createWidgets(Composite composite, int horizontalSpan, String inDataStrings[]) {
+ this.inDataStrings = inDataStrings;
+ createWidgets(composite, horizontalSpan);
+ }
+
+ /**
+ * Create Data Widgets. Widgets Created: Data: "--select--" horizonatalSpan takes up 2 columns; horizontalSpan must
+ * be >=2 the string "--select--" will be added to the sent in dataStrings array
+ */
+ @Override
+ protected void createControls(Composite parent, int horizontalSpan) {
+
+ GridData gd;
+ this.parent = parent;
+
+ if (inDataStrings == null) {
+ inDataStrings = new String[] {"DATA NOT FOUND"};
+ }
+ setDisplayDataStrings();
+
+ if (horizontalSpan < 2) {
+ horizontalSpan = 2;
+ }
+
+ // Create Data Widgets
+ if (isDisplayLabel() && !getLabel().equals("")) {
+ labelWidget = new Label(parent, SWT.NONE);
+ labelWidget.setText(getLabel() + ":");
+ if (getToolTip() != null) {
+ labelWidget.setToolTipText(getToolTip());
+ }
+ }
+
+ dataCombo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.V_SCROLL);
+ dataCombo.setItems(displayArray);
+ dataCombo.setVisibleItemCount(Math.min(displayArray.length, 45));
+
+ gd = new GridData();
if (fillHorizontally) {
gd.grabExcessHorizontalSpace = true;
}
if (fillVertically) {
gd.grabExcessVerticalSpace = true;
}
- gd.horizontalSpan = horizontalSpan - 1;
- dataCombo.setLayoutData(gd);
- ModifyListener dataComboListener = new ModifyListener() {
-
- public void modifyText(ModifyEvent e) {
- data = dataCombo.getText();
- if (data.compareTo("--select--") == 0) {
- data = "";
- }
- validate();
- notifyXModifiedListeners();
- }
- };
- dataCombo.addModifyListener(dataComboListener);
-
- refresh();
- dataCombo.setEnabled(isEditable());
- }
-
- public int getDisplayPosition(String str) {
- for (int i = 0; i < displayArray.length; i++) {
+ gd.horizontalSpan = horizontalSpan - 1;
+ dataCombo.setLayoutData(gd);
+ ModifyListener dataComboListener = new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ data = dataCombo.getText();
+ if (data.compareTo("--select--") == 0) {
+ data = "";
+ }
+ validate();
+ notifyXModifiedListeners();
+ }
+ };
+ dataCombo.addModifyListener(dataComboListener);
+
+ refresh();
+ dataCombo.setEnabled(isEditable());
+ }
+
+ public int getDisplayPosition(String str) {
+ for (int i = 0; i < displayArray.length; i++) {
if (str.equals(displayArray[i])) {
return i;
}
- }
- return 0;
- }
-
- public int getDisplayPosition() {
- for (int i = 0; i < displayArray.length; i++) {
+ }
+ return 0;
+ }
+
+ public int getDisplayPosition() {
+ for (int i = 0; i < displayArray.length; i++) {
if (data.equals(displayArray[i])) {
return i;
}
- }
- return 0;
- }
-
- public void setDataStrings(String[] inDataStrings) {
- this.inDataStrings = inDataStrings;
- setDisplayDataStrings();
- if (dataCombo != null && !dataCombo.isDisposed()) {
- dataCombo.setItems(displayArray);
+ }
+ return 0;
+ }
+
+ public void setDataStrings(String[] inDataStrings) {
+ this.inDataStrings = inDataStrings;
+ setDisplayDataStrings();
+ if (dataCombo != null && !dataCombo.isDisposed()) {
+ dataCombo.setItems(displayArray);
if (displayArray.length < 15) {
dataCombo.setVisibleItemCount(displayArray.length);
}
- }
- updateComboWidget();
- }
-
- /**
- * Given the inDataStrings, create the mapping of all data strings including "--select--" and map them to their index
- * in the combo list.
- */
- private void setDisplayDataStrings() {
- displayDataStrings.clear();
-
- if (isDefaultSelectionAllowed()) {
- displayDataStrings.put("--select--", 0);
- displayArray = new String[inDataStrings.length + 1];
- displayArray[0] = "--select--";
- for (int i = 0; i < inDataStrings.length; i++) {
- displayDataStrings.put(inDataStrings[i], (i + 1));
- displayArray[i + 1] = inDataStrings[i];
- }
- } else {
- displayArray = new String[inDataStrings.length];
- for (int i = 0; i < inDataStrings.length; i++) {
- displayDataStrings.put(inDataStrings[i], i);
- displayArray[i] = inDataStrings[i];
- }
- }
- }
-
- @Override
- public void setFocus() {
+ }
+ updateComboWidget();
+ }
+
+ /**
+ * Given the inDataStrings, create the mapping of all data strings including "--select--" and map them to their index
+ * in the combo list.
+ */
+ private void setDisplayDataStrings() {
+ displayDataStrings.clear();
+
+ if (isDefaultSelectionAllowed()) {
+ displayDataStrings.put("--select--", 0);
+ displayArray = new String[inDataStrings.length + 1];
+ displayArray[0] = "--select--";
+ for (int i = 0; i < inDataStrings.length; i++) {
+ displayDataStrings.put(inDataStrings[i], (i + 1));
+ displayArray[i + 1] = inDataStrings[i];
+ }
+ } else {
+ displayArray = new String[inDataStrings.length];
+ for (int i = 0; i < inDataStrings.length; i++) {
+ displayDataStrings.put(inDataStrings[i], i);
+ displayArray[i] = inDataStrings[i];
+ }
+ }
+ }
+
+ @Override
+ public void setFocus() {
if (dataCombo != null) {
dataCombo.setFocus();
}
- }
-
- public void setDataStringToXmlTranslations(Map<String, String> dataStringToXmlString) {
- this.dataStringToXmlString = dataStringToXmlString;
- }
-
- @Override
- public void setFromXml(String xml) throws IllegalStateException {
- Matcher m;
- if (getXmlSubRoot().equals("")) {
- m =
+ }
+
+ public void setDataStringToXmlTranslations(Map<String, String> dataStringToXmlString) {
+ this.dataStringToXmlString = dataStringToXmlString;
+ }
+
+ @Override
+ public void setFromXml(String xml) throws IllegalStateException {
+ Matcher m;
+ if (getXmlSubRoot().equals("")) {
+ m =
Pattern.compile("<" + getXmlRoot() + ">(.*?)</" + getXmlRoot() + ">", Pattern.MULTILINE | Pattern.DOTALL).matcher(
xml);
- } else {
- m =
+ } else {
+ m =
Pattern.compile(
"<" + getXmlRoot() + "><" + getXmlSubRoot() + ">(.*?)</" + getXmlSubRoot() + "></" + getXmlRoot() + ">",
Pattern.MULTILINE | Pattern.DOTALL).matcher(xml);
- }
- while (m.find()) {
- String str = m.group(1);
- String transStr = null;
- // If translation given, translate back to display string
- // ie. bems number => full name
- if (dataStringToXmlString != null) {
- if (dataStringToXmlString.containsValue(str)) {
- for (Iterator iter = dataStringToXmlString.entrySet().iterator(); iter.hasNext();) {
- Map.Entry<String, String> entry = (Map.Entry<String, String>) iter.next();
- if (str.equals(entry.getValue())) {
- transStr = entry.getKey();
- break;
- }
- }
- }
- }
- if (transStr != null) {
- set(transStr);
- } else {
- set(str);
- }
- break;
- }
- refresh();
- }
-
- @Override
- public void refresh() {
- updateComboWidget();
- }
-
- public void addModifyListener(ModifyListener modifyListener) {
+ }
+ while (m.find()) {
+ String str = m.group(1);
+ String transStr = null;
+ // If translation given, translate back to display string
+ // ie. bems number => full name
+ if (dataStringToXmlString != null) {
+ if (dataStringToXmlString.containsValue(str)) {
+ for (Iterator iter = dataStringToXmlString.entrySet().iterator(); iter.hasNext();) {
+ Map.Entry<String, String> entry = (Map.Entry<String, String>) iter.next();
+ if (str.equals(entry.getValue())) {
+ transStr = entry.getKey();
+ break;
+ }
+ }
+ }
+ }
+ if (transStr != null) {
+ set(transStr);
+ } else {
+ set(str);
+ }
+ break;
+ }
+ refresh();
+ }
+
+ @Override
+ public void refresh() {
+ updateComboWidget();
+ }
+
+ public void addModifyListener(ModifyListener modifyListener) {
if (dataCombo != null) {
dataCombo.addModifyListener(modifyListener);
}
- }
-
- public Combo getComboBox() {
- return dataCombo;
- }
-
- /**
- * @return selected display value (eg. Donald Dunne)
- */
- public String get() {
- return data;
- }
-
- /**
- * @return returns translated xml value (eg. 727536)
- */
- public String getXml() {
- String s = "";
- if (dataStringToXmlString == null) {
- s = data;
- } else {
- s = dataStringToXmlString.get(data);
- if (s == null) {
- s = data;
- }
- }
- return s;
- }
-
- @Override
- public String getReportData() {
- return data;
- }
-
- @Override
- public String getXmlData() {
- return getReportData();
- }
-
- @Override
- public void setXmlData(String str) {
- }
-
- private void updateComboWidget() {
- if (dataCombo != null && !dataCombo.isDisposed()) {
- if (displayDataStrings.containsKey(data)) {
- if (data.compareTo("") == 0) {
- dataCombo.select(0);
- } else {
- Integer pos = displayDataStrings.get(data);
- dataCombo.select(pos.intValue());
- }
- } else if (data.compareTo("") != 0) {
- // if not found, add it and select it
- displayDataStrings.put(data, displayDataStrings.size());
- dataCombo.add(data);
- dataCombo.select(displayDataStrings.size() - 1);
- } else {
- dataCombo.select(0);
- }
+ }
+
+ public Combo getComboBox() {
+ return dataCombo;
+ }
+
+ /**
+ * @return selected display value (eg. Donald Dunne)
+ */
+ public String get() {
+ return data;
+ }
+
+ /**
+ * @return returns translated xml value (eg. 727536)
+ */
+ public String getXml() {
+ String s = "";
+ if (dataStringToXmlString == null) {
+ s = data;
+ } else {
+ s = dataStringToXmlString.get(data);
+ if (s == null) {
+ s = data;
+ }
+ }
+ return s;
+ }
+
+ @Override
+ public String getReportData() {
+ return data;
+ }
+
+ @Override
+ public String getXmlData() {
+ return getReportData();
+ }
+
+ @Override
+ public void setXmlData(String str) {
+ }
+
+ private void updateComboWidget() {
+ if (dataCombo != null && !dataCombo.isDisposed()) {
+ if (displayDataStrings.containsKey(data)) {
+ if (data.compareTo("") == 0) {
+ dataCombo.select(0);
+ } else {
+ Integer pos = displayDataStrings.get(data);
+ dataCombo.select(pos.intValue());
+ }
+ } else if (data.compareTo("") != 0) {
+ // if not found, add it and select it
+ displayDataStrings.put(data, displayDataStrings.size());
+ dataCombo.add(data);
+ dataCombo.select(displayDataStrings.size() - 1);
+ } else {
+ dataCombo.select(0);
+ }
if (displayDataStrings.size() < 15) {
- dataCombo.setVisibleItemCount(displayDataStrings.size());
+ dataCombo.setVisibleItemCount(displayDataStrings.size());
} else {
- dataCombo.setVisibleItemCount(15);
+ dataCombo.setVisibleItemCount(15);
}
- dataCombo.getParent().layout(true);
- }
- validate();
- }
-
- public void set(String data) {
- this.data = data;
- updateComboWidget();
- }
-
- public void set(int pos) {
- if (displayArray.length > pos) {
- this.data = displayArray[pos];
- updateComboWidget();
- }
- }
-
- public void remove(String data) {
- displayDataStrings.remove(data);
+ dataCombo.getParent().layout(true);
+ }
+ validate();
+ }
+
+ public void set(String data) {
+ this.data = data;
+ updateComboWidget();
+ }
+
+ public void set(int pos) {
+ if (displayArray.length > pos) {
+ this.data = displayArray[pos];
+ updateComboWidget();
+ }
+ }
+
+ public void remove(String data) {
+ displayDataStrings.remove(data);
if (dataCombo.indexOf(data) >= 0) {
dataCombo.remove(data);
}
- }
-
- @Override
- public IStatus isValid() {
- if (isRequiredEntry() && data.equals("")) {
- return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, getLabel() + " must be selected.");
- }
- return Status.OK_STATUS;
- }
-
- @Override
- protected String toXml() {
- return toXml(getXmlRoot());
- }
-
- @Override
- protected String toXml(String xmlRoot) {
- String s;
- String dataStr = getXml();
- if (getXmlSubRoot() == null || getXmlSubRoot().equals("")) {
- s = "<" + xmlRoot + ">" + dataStr + "</" + xmlRoot + ">\n";
- } else {
- s = "<" + xmlRoot + "><" + getXmlSubRoot() + ">" + dataStr + "</" + getXmlSubRoot() + "></" + xmlRoot + ">\n";
- }
- return s;
- }
-
- @Override
- public String toHTML(String labelFont) {
- return AHTML.getLabelStr(labelFont, getLabel() + ": ") + data;
- }
-
- public static void copy(XCombo from, XCombo to) throws IllegalStateException {
- to.set(from.get());
- }
-
- @Override
- public void dispose() {
+ }
+
+ @Override
+ public IStatus isValid() {
+ if (isRequiredEntry() && data.equals("")) {
+ return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, getLabel() + " must be selected.");
+ }
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ protected String toXml() {
+ return toXml(getXmlRoot());
+ }
+
+ @Override
+ protected String toXml(String xmlRoot) {
+ String s;
+ String dataStr = getXml();
+ if (getXmlSubRoot() == null || getXmlSubRoot().equals("")) {
+ s = "<" + xmlRoot + ">" + dataStr + "</" + xmlRoot + ">\n";
+ } else {
+ s = "<" + xmlRoot + "><" + getXmlSubRoot() + ">" + dataStr + "</" + getXmlSubRoot() + "></" + xmlRoot + ">\n";
+ }
+ return s;
+ }
+
+ @Override
+ public String toHTML(String labelFont) {
+ return AHTML.getLabelStr(labelFont, getLabel() + ": ") + data;
+ }
+
+ public static void copy(XCombo from, XCombo to) throws IllegalStateException {
+ to.set(from.get());
+ }
+
+ @Override
+ public void dispose() {
if (labelWidget != null) {
labelWidget.dispose();
}
@@ -394,19 +394,19 @@ public class XCombo extends XWidget {
if (parent != null && !parent.isDisposed()) {
parent.layout();
}
- super.dispose();
- }
-
- public String[] getDisplayArray() {
- return displayArray;
- }
-
- public String[] getInDataStrings() {
- return inDataStrings;
- }
-
- @Override
- public Object getData() {
- return dataCombo.getText();
- }
+ super.dispose();
+ }
+
+ public String[] getDisplayArray() {
+ return displayArray;
+ }
+
+ public String[] getInDataStrings() {
+ return inDataStrings;
+ }
+
+ @Override
+ public Object getData() {
+ return dataCombo.getText();
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XDate.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XDate.java
index 1410ac3ff3c..37355d9c6e4 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XDate.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XDate.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.framework.ui.skynet.widgets;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.nebula.widgets.calendarcombo.CalendarCombo;
-import org.eclipse.nebula.widgets.calendarcombo.CalendarListenerAdapter;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.swt.Widgets;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-
-/**
- * @author Donald G. Dunne
- */
-public class XDate extends XWidget {
-
- private CalendarCombo dateCombo;
- private Composite parent;
- protected Date date;
- public static String MMDDYY = "MM/dd/yyyy";
- public static String YYYYMMDD = "yyyy/MM/dd";
- public static String YYYY_MM_DD = "yyyy_MM_dd";
- public static String MMDDYYHHMM = "MM/dd/yyyy hh:mm a";
- public static String HHMMSS = "hh:mm:ss";
- public static String HHMMSSSS = "hh:mm:ss:SS";
- public static String HHMM = "hh:mm";
- public static final HashMap<String, DateFormat> dateFormats = new HashMap<String, DateFormat>();
- private String defaultFormat = MMDDYYHHMM;
- private final ArrayList<ModifyListener> listeners = new ArrayList<ModifyListener>();
- private boolean requireFutureDate = false;
-
- public static final long MILLISECONDS_IN_A_WEEK = 604800000;
- public static final long MILLISECONDS_IN_A_DAY = 86400000;
-
- public XDate() {
- this("", "");
- }
-
- public XDate(Date date) {
- this("", "");
- this.date = date;
- }
-
- public XDate(String displayLabel) {
- this(displayLabel, "");
- }
-
- public XDate(String displayLabel, String xmlRoot) {
- super(displayLabel, xmlRoot);
- date = null;
- }
-
- public String getHHMM() {
- return get(HHMM);
- }
-
- public String getHHMMSS() {
- return get(HHMMSS);
- }
-
- public String getMMDDYY() {
- return get(MMDDYY);
- }
-
- public String getMMDDYYHHMM() {
- return get(MMDDYYHHMM);
- }
-
- @Override
- public Control getControl() {
- return dateCombo;
- }
-
- /**
- * Set the default format for the date ADate.MMMDDDYY or ADate MMMDDDYYYHHHMM or use java.util.date format string
- *
- * @param format
- */
- public void setFormat(String format) {
- defaultFormat = format;
- }
-
- public void clearData() {
- date = null;
- }
-
- public static String getDateStr(Date date, String format) {
- if (date == null) {
- return "";
- }
- DateFormat dateFormat = dateFormats.get(format);
- if (dateFormat == null) {
- dateFormat = new SimpleDateFormat(format);
- dateFormats.put(format, dateFormat);
- }
- return dateFormat.format(date);
- }
-
- public static String getDateNow() {
- return getDateNow(MMDDYY);
- }
-
- public static String getTimeStamp() {
- return getDateNow(HHMMSSSS);
- }
-
- public static String getDateNow(String format) {
- XDate d = new XDate();
- d.setDateToNow();
- return d.get(format);
- }
-
- /**
- * Create Date Widgets Label/DatePickerCombo
- *
- * @param parent
- * @param horizontalSpan - horizontalSpan takes up 4 columns, therefore horizontalSpan must be >=4
- */
- @Override
- protected void createControls(Composite parent, int horizontalSpan) {
-
- // composite = new Composite(parent, parent.getStyle());
- this.parent = parent;
-
- if (horizontalSpan < 2) {
- horizontalSpan = 2;
- }
-
- labelWidget = new Label(parent, SWT.NONE);
- labelWidget.setText(getLabel() + ": ");
- dateCombo = new CalendarCombo(parent, SWT.BORDER);
- dateCombo.setEnabled(isEditable());
- GridData gd = new GridData();
- gd.widthHint = 100;
- if (date != null) {
- dateCombo.setDate(date);
- }
- dateCombo.addCalendarListener(new CalendarListenerAdapter() {
- @Override
- public void dateChanged(Calendar newDate) {
- super.dateChanged(newDate);
- if (newDate == null) {
- date = null;
- } else {
- date = newDate.getTime();
- }
- validate();
- notifyXModifiedListeners();
- dateCombo.getParent().layout();
- }
- });
-
- }
-
- @Override
- public void dispose() {
- labelWidget.dispose();
- if (Widgets.isAccessible(parent)) {
- parent.layout();
- }
- }
-
- @Override
- public void setFromXml(String xml) {
- Matcher m =
- Pattern.compile("<" + getXmlRoot() + ">(\\d+)</" + getXmlRoot() + ">", Pattern.MULTILINE | Pattern.DOTALL).matcher(
- xml);
- if (m.find()) {
- try {
- Long l = new Long(m.group(1));
- date = new Date(l.longValue());
- } catch (NumberFormatException e) {
- e.printStackTrace();
- }
- }
- refresh();
- }
-
- public void addModifyListener(ModifyListener listener) {
- listeners.add(listener);
- updateListeners();
- }
-
- public void updateListeners() {
- for (ModifyListener listener : listeners) {
- if (dateCombo != null) {
- dateCombo.removeModifyListener(listener);
- dateCombo.addModifyListener(listener);
- }
- }
- }
-
- public void clear() {
- date = new Date();
- refresh();
- }
-
- public Date getDate() {
- return date;
- }
-
- public void setDateToNow() {
- setDate(new java.util.Date());
- }
-
- public void setDate(Date date) {
- this.date = date;
- if (dateCombo != null && !dateCombo.isDisposed()) {
- dateCombo.setDate(date);
- }
- }
-
- @Override
- public void refresh() {
- validate();
- }
-
- @Override
- public IStatus isValid() {
- if (isRequireFutureDate()) {
- if (getDate().before(new Date())) {
- return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, getLabel() + " must be in future.");
- }
- }
- if (isRequiredEntry()) {
- if (get().equals("")) {
- return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, getLabel() + " must be selected.");
- }
- }
- return Status.OK_STATUS;
- }
-
- @Override
- public String getReportData() {
- return get();
- }
-
- public String get() {
- if (date == null) {
- return "";
- }
- return DateFormat.getDateInstance().format(date);
- }
-
- public String get(String pattern) {
- return get(new SimpleDateFormat(pattern));
- }
-
- public String get(DateFormat dateFormat) {
- if (date == null) {
- return "";
- }
- String result = dateFormat.format(date);
- return result;
- }
-
- @Override
- public void setFocus() {
- if (dateCombo != null) {
- dateCombo.setFocus();
- }
- }
-
- /**
- * Don't need this since overriding toReport and toXml
- */
- @Override
- public String getXmlData() {
- String dateStr = "";
- if (date != null) {
- dateStr = date.getTime() + "";
- }
- return dateStr;
- }
-
- /**
- * Don't need this since overriding setFromXml
- */
- @Override
- public void setXmlData(String str) {
- if (str.equals("")) {
- date = null;
- } else {
- try {
- Long l = new Long(str);
- date = new Date(l.longValue());
- } catch (NumberFormatException e) {
- e.printStackTrace();
- date = null;
- }
- }
- }
-
- @Override
- public String toHTML(String labelFont) {
- return AHTML.getLabelStr(labelFont, getLabel() + ": ") + get(defaultFormat);
- }
-
- public String toHTML(String labelFont, String pattern) {
- return AHTML.getLabelStr(labelFont, getLabel() + ": ") + get(pattern);
- }
-
- public boolean isRequireFutureDate() {
- return requireFutureDate;
- }
-
- public void setRequireFutureDate(boolean requireFutureDate) {
- this.requireFutureDate = requireFutureDate;
- }
-
- @Override
- public Object getData() {
- return getDate();
- }
-
- public int getDifference(Date date) {
- return calculateDifference(getDate(), date);
- }
-
- public static int calculateDifference(Date a, Date b) {
- int tempDifference = 0;
- int difference = 0;
- Calendar earlier = Calendar.getInstance();
- Calendar later = Calendar.getInstance();
-
- if (a.compareTo(b) < 0) {
- earlier.setTime(a);
- later.setTime(b);
- } else {
- earlier.setTime(b);
- later.setTime(a);
- }
-
- while (earlier.get(Calendar.YEAR) != later.get(Calendar.YEAR)) {
- tempDifference = 365 * (later.get(Calendar.YEAR) - earlier.get(Calendar.YEAR));
- difference += tempDifference;
-
- earlier.add(Calendar.DAY_OF_YEAR, tempDifference);
- }
-
- if (earlier.get(Calendar.DAY_OF_YEAR) != later.get(Calendar.DAY_OF_YEAR)) {
- tempDifference = later.get(Calendar.DAY_OF_YEAR) - earlier.get(Calendar.DAY_OF_YEAR);
- difference += tempDifference;
-
- earlier.add(Calendar.DAY_OF_YEAR, tempDifference);
- }
-
- return difference;
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.nebula.widgets.calendarcombo.CalendarCombo;
+import org.eclipse.nebula.widgets.calendarcombo.CalendarListenerAdapter;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.swt.Widgets;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XDate extends XWidget {
+
+ private CalendarCombo dateCombo;
+ private Composite parent;
+ protected Date date;
+ public static String MMDDYY = "MM/dd/yyyy";
+ public static String YYYYMMDD = "yyyy/MM/dd";
+ public static String YYYY_MM_DD = "yyyy_MM_dd";
+ public static String MMDDYYHHMM = "MM/dd/yyyy hh:mm a";
+ public static String HHMMSS = "hh:mm:ss";
+ public static String HHMMSSSS = "hh:mm:ss:SS";
+ public static String HHMM = "hh:mm";
+ public static final HashMap<String, DateFormat> dateFormats = new HashMap<String, DateFormat>();
+ private String defaultFormat = MMDDYYHHMM;
+ private final ArrayList<ModifyListener> listeners = new ArrayList<ModifyListener>();
+ private boolean requireFutureDate = false;
+
+ public static final long MILLISECONDS_IN_A_WEEK = 604800000;
+ public static final long MILLISECONDS_IN_A_DAY = 86400000;
+
+ public XDate() {
+ this("", "");
+ }
+
+ public XDate(Date date) {
+ this("", "");
+ this.date = date;
+ }
+
+ public XDate(String displayLabel) {
+ this(displayLabel, "");
+ }
+
+ public XDate(String displayLabel, String xmlRoot) {
+ super(displayLabel, xmlRoot);
+ date = null;
+ }
+
+ public String getHHMM() {
+ return get(HHMM);
+ }
+
+ public String getHHMMSS() {
+ return get(HHMMSS);
+ }
+
+ public String getMMDDYY() {
+ return get(MMDDYY);
+ }
+
+ public String getMMDDYYHHMM() {
+ return get(MMDDYYHHMM);
+ }
+
+ @Override
+ public Control getControl() {
+ return dateCombo;
+ }
+
+ /**
+ * Set the default format for the date ADate.MMMDDDYY or ADate MMMDDDYYYHHHMM or use java.util.date format string
+ *
+ * @param format
+ */
+ public void setFormat(String format) {
+ defaultFormat = format;
+ }
+
+ public void clearData() {
+ date = null;
+ }
+
+ public static String getDateStr(Date date, String format) {
+ if (date == null) {
+ return "";
+ }
+ DateFormat dateFormat = dateFormats.get(format);
+ if (dateFormat == null) {
+ dateFormat = new SimpleDateFormat(format);
+ dateFormats.put(format, dateFormat);
+ }
+ return dateFormat.format(date);
+ }
+
+ public static String getDateNow() {
+ return getDateNow(MMDDYY);
+ }
+
+ public static String getTimeStamp() {
+ return getDateNow(HHMMSSSS);
+ }
+
+ public static String getDateNow(String format) {
+ XDate d = new XDate();
+ d.setDateToNow();
+ return d.get(format);
+ }
+
+ /**
+ * Create Date Widgets Label/DatePickerCombo
+ *
+ * @param parent
+ * @param horizontalSpan - horizontalSpan takes up 4 columns, therefore horizontalSpan must be >=4
+ */
+ @Override
+ protected void createControls(Composite parent, int horizontalSpan) {
+
+ // composite = new Composite(parent, parent.getStyle());
+ this.parent = parent;
+
+ if (horizontalSpan < 2) {
+ horizontalSpan = 2;
+ }
+
+ labelWidget = new Label(parent, SWT.NONE);
+ labelWidget.setText(getLabel() + ": ");
+ dateCombo = new CalendarCombo(parent, SWT.BORDER);
+ dateCombo.setEnabled(isEditable());
+ GridData gd = new GridData();
+ gd.widthHint = 100;
+ if (date != null) {
+ dateCombo.setDate(date);
+ }
+ dateCombo.addCalendarListener(new CalendarListenerAdapter() {
+ @Override
+ public void dateChanged(Calendar newDate) {
+ super.dateChanged(newDate);
+ if (newDate == null) {
+ date = null;
+ } else {
+ date = newDate.getTime();
+ }
+ validate();
+ notifyXModifiedListeners();
+ dateCombo.getParent().layout();
+ }
+ });
+
+ }
+
+ @Override
+ public void dispose() {
+ labelWidget.dispose();
+ if (Widgets.isAccessible(parent)) {
+ parent.layout();
+ }
+ }
+
+ @Override
+ public void setFromXml(String xml) {
+ Matcher m =
+ Pattern.compile("<" + getXmlRoot() + ">(\\d+)</" + getXmlRoot() + ">", Pattern.MULTILINE | Pattern.DOTALL).matcher(
+ xml);
+ if (m.find()) {
+ try {
+ Long l = new Long(m.group(1));
+ date = new Date(l.longValue());
+ } catch (NumberFormatException e) {
+ e.printStackTrace();
+ }
+ }
+ refresh();
+ }
+
+ public void addModifyListener(ModifyListener listener) {
+ listeners.add(listener);
+ updateListeners();
+ }
+
+ public void updateListeners() {
+ for (ModifyListener listener : listeners) {
+ if (dateCombo != null) {
+ dateCombo.removeModifyListener(listener);
+ dateCombo.addModifyListener(listener);
+ }
+ }
+ }
+
+ public void clear() {
+ date = new Date();
+ refresh();
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDateToNow() {
+ setDate(new java.util.Date());
+ }
+
+ public void setDate(Date date) {
+ this.date = date;
+ if (dateCombo != null && !dateCombo.isDisposed()) {
+ dateCombo.setDate(date);
+ }
+ }
+
+ @Override
+ public void refresh() {
+ validate();
+ }
+
+ @Override
+ public IStatus isValid() {
+ if (isRequireFutureDate()) {
+ if (getDate().before(new Date())) {
+ return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, getLabel() + " must be in future.");
+ }
+ }
+ if (isRequiredEntry()) {
+ if (get().equals("")) {
+ return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, getLabel() + " must be selected.");
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public String getReportData() {
+ return get();
+ }
+
+ public String get() {
+ if (date == null) {
+ return "";
+ }
+ return DateFormat.getDateInstance().format(date);
+ }
+
+ public String get(String pattern) {
+ return get(new SimpleDateFormat(pattern));
+ }
+
+ public String get(DateFormat dateFormat) {
+ if (date == null) {
+ return "";
+ }
+ String result = dateFormat.format(date);
+ return result;
+ }
+
+ @Override
+ public void setFocus() {
+ if (dateCombo != null) {
+ dateCombo.setFocus();
+ }
+ }
+
+ /**
+ * Don't need this since overriding toReport and toXml
+ */
+ @Override
+ public String getXmlData() {
+ String dateStr = "";
+ if (date != null) {
+ dateStr = date.getTime() + "";
+ }
+ return dateStr;
+ }
+
+ /**
+ * Don't need this since overriding setFromXml
+ */
+ @Override
+ public void setXmlData(String str) {
+ if (str.equals("")) {
+ date = null;
+ } else {
+ try {
+ Long l = new Long(str);
+ date = new Date(l.longValue());
+ } catch (NumberFormatException e) {
+ e.printStackTrace();
+ date = null;
+ }
+ }
+ }
+
+ @Override
+ public String toHTML(String labelFont) {
+ return AHTML.getLabelStr(labelFont, getLabel() + ": ") + get(defaultFormat);
+ }
+
+ public String toHTML(String labelFont, String pattern) {
+ return AHTML.getLabelStr(labelFont, getLabel() + ": ") + get(pattern);
+ }
+
+ public boolean isRequireFutureDate() {
+ return requireFutureDate;
+ }
+
+ public void setRequireFutureDate(boolean requireFutureDate) {
+ this.requireFutureDate = requireFutureDate;
+ }
+
+ @Override
+ public Object getData() {
+ return getDate();
+ }
+
+ public int getDifference(Date date) {
+ return calculateDifference(getDate(), date);
+ }
+
+ public static int calculateDifference(Date a, Date b) {
+ int tempDifference = 0;
+ int difference = 0;
+ Calendar earlier = Calendar.getInstance();
+ Calendar later = Calendar.getInstance();
+
+ if (a.compareTo(b) < 0) {
+ earlier.setTime(a);
+ later.setTime(b);
+ } else {
+ earlier.setTime(b);
+ later.setTime(a);
+ }
+
+ while (earlier.get(Calendar.YEAR) != later.get(Calendar.YEAR)) {
+ tempDifference = 365 * (later.get(Calendar.YEAR) - earlier.get(Calendar.YEAR));
+ difference += tempDifference;
+
+ earlier.add(Calendar.DAY_OF_YEAR, tempDifference);
+ }
+
+ if (earlier.get(Calendar.DAY_OF_YEAR) != later.get(Calendar.DAY_OF_YEAR)) {
+ tempDifference = later.get(Calendar.DAY_OF_YEAR) - earlier.get(Calendar.DAY_OF_YEAR);
+ difference += tempDifference;
+
+ earlier.add(Calendar.DAY_OF_YEAR, tempDifference);
+ }
+
+ return difference;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XDateDam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XDateDam.java
index 250219db231..35520846ba0 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XDateDam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XDateDam.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.framework.ui.skynet.widgets;
-
-import java.util.Date;
-import org.eclipse.core.runtime.IStatus;
-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.validation.IOseeValidator;
-import org.eclipse.osee.framework.skynet.core.validation.OseeValidator;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-
-public class XDateDam extends XDate implements IAttributeWidget {
-
- private Artifact artifact;
- private String attributeTypeName;
-
- public XDateDam(String displayLabel) {
- super(displayLabel);
- }
-
- @Override
- public String getAttributeType() {
- return attributeTypeName;
- }
-
- @Override
- public void setAttributeType(Artifact artifact, String attrName) throws OseeCoreException {
- this.artifact = artifact;
- this.attributeTypeName = attrName;
- Date value = artifact.getSoleAttributeValue(attributeTypeName, null);
- if (value != null) {
- super.setDate(value);
- }
- }
-
- @Override
- public void saveToArtifact() {
- try {
- if (date == null) {
- artifact.deleteSoleAttribute(attributeTypeName);
- } else {
- Date enteredValue = getDate();
- artifact.setSoleAttributeValue(attributeTypeName, enteredValue);
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @Override
- public Result isDirty() throws OseeCoreException {
- Date enteredValue = getDate();
- Date storedValue = artifact.getSoleAttributeValue(attributeTypeName, null);
- if (enteredValue == null && storedValue == null) {
- return Result.FalseResult;
- }
- if (enteredValue == null && storedValue != null) {
- return new Result(true, attributeTypeName + " is dirty");
- }
- if (enteredValue != null && storedValue == null) {
- return new Result(true, attributeTypeName + " is dirty");
- }
- if (enteredValue.getTime() != storedValue.getTime()) {
- return new Result(true, attributeTypeName + " is dirty");
- }
- return Result.FalseResult;
- }
-
- @Override
- public void revert() throws OseeCoreException {
- setAttributeType(artifact, attributeTypeName);
- }
-
- @Override
- public IStatus isValid() {
- IStatus status = super.isValid();
- if (status.isOK()) {
- status = OseeValidator.getInstance().validate(IOseeValidator.SHORT, artifact, attributeTypeName, get());
- }
- return status;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+import java.util.Date;
+import org.eclipse.core.runtime.IStatus;
+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.validation.IOseeValidator;
+import org.eclipse.osee.framework.skynet.core.validation.OseeValidator;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+
+public class XDateDam extends XDate implements IAttributeWidget {
+
+ private Artifact artifact;
+ private String attributeTypeName;
+
+ public XDateDam(String displayLabel) {
+ super(displayLabel);
+ }
+
+ @Override
+ public String getAttributeType() {
+ return attributeTypeName;
+ }
+
+ @Override
+ public void setAttributeType(Artifact artifact, String attrName) throws OseeCoreException {
+ this.artifact = artifact;
+ this.attributeTypeName = attrName;
+ Date value = artifact.getSoleAttributeValue(attributeTypeName, null);
+ if (value != null) {
+ super.setDate(value);
+ }
+ }
+
+ @Override
+ public void saveToArtifact() {
+ try {
+ if (date == null) {
+ artifact.deleteSoleAttribute(attributeTypeName);
+ } else {
+ Date enteredValue = getDate();
+ artifact.setSoleAttributeValue(attributeTypeName, enteredValue);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @Override
+ public Result isDirty() throws OseeCoreException {
+ Date enteredValue = getDate();
+ Date storedValue = artifact.getSoleAttributeValue(attributeTypeName, null);
+ if (enteredValue == null && storedValue == null) {
+ return Result.FalseResult;
+ }
+ if (enteredValue == null && storedValue != null) {
+ return new Result(true, attributeTypeName + " is dirty");
+ }
+ if (enteredValue != null && storedValue == null) {
+ return new Result(true, attributeTypeName + " is dirty");
+ }
+ if (enteredValue.getTime() != storedValue.getTime()) {
+ return new Result(true, attributeTypeName + " is dirty");
+ }
+ return Result.FalseResult;
+ }
+
+ @Override
+ public void revert() throws OseeCoreException {
+ setAttributeType(artifact, attributeTypeName);
+ }
+
+ @Override
+ public IStatus isValid() {
+ IStatus status = super.isValid();
+ if (status.isOK()) {
+ status = OseeValidator.getInstance().validate(IOseeValidator.SHORT, artifact, attributeTypeName, get());
+ }
+ return status;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFileTextWithSelectionDialog.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFileTextWithSelectionDialog.java
index 182d5d50bcf..01e81bf0da8 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFileTextWithSelectionDialog.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFileTextWithSelectionDialog.java
@@ -1,117 +1,117 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.widgets;
-
-import java.io.File;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.FileDialog;
-
-/**
- * @author Donald G. Dunne
- */
-public class XFileTextWithSelectionDialog extends XText {
-
- private String defaultFileSelection;
- private final Type type;
- public static enum Type {
- File, Directory
- };
-
- public XFileTextWithSelectionDialog(String displayLabel, Type type, String defaultFileSelection) {
- this(displayLabel, type);
- this.defaultFileSelection = defaultFileSelection;
- }
-
- public XFileTextWithSelectionDialog(String displayLabel, Type type) {
- super(displayLabel);
- this.type = type;
- }
-
- public XFileTextWithSelectionDialog() {
- this("", Type.File);
- }
-
- /**
- * @param displayLabel
- */
- public XFileTextWithSelectionDialog(String displayLabel) {
- this(displayLabel, Type.File);
- }
-
- @Override
- public void createControls(final Composite parent, int horizontalSpan, boolean fillText) {
- super.createControls(parent, horizontalSpan, fillText);
-
- Button fileDialog = new Button(getStyledText().getParent(), SWT.NONE);
- fileDialog.setText("Select " + type.name());
- if (Strings.isValid(defaultFileSelection)) {
- set(defaultFileSelection);
- }
- fileDialog.addSelectionListener(new SelectionListener() {
-
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e) {
- if (type == Type.File) {
- FileDialog dialog = new FileDialog(Displays.getActiveShell(), SWT.OPEN);
- dialog.setFilterExtensions(new String[] {"*.*"});
- File dir = new File(defaultFileSelection != null ? defaultFileSelection : "");
- if (dir.isFile() || dir.isDirectory())
- dialog.setFilterPath(defaultFileSelection);
- else
- dialog.setFilterPath("c:\\");
-
- String result = dialog.open();
- if (result != null && !result.equals("")) {
- setText(dialog.getFilterPath() + File.separatorChar + dialog.getFileName());
- }
- } else if (type == Type.Directory) {
- DirectoryDialog dialog = new DirectoryDialog(Displays.getActiveShell(), SWT.OPEN);
- File dir = new File(defaultFileSelection != null ? defaultFileSelection : "");
- if (dir.isFile() || dir.isDirectory())
- dialog.setFilterPath(defaultFileSelection);
- else
- dialog.setFilterPath("c:\\");
-
- String result = dialog.open();
- if (result != null && !result.equals("")) {
- setText(result);
- }
- }
- }
- });
- }
-
- /**
- * @return the defaultFileSelection
- */
- public String getDefaultFileSelection() {
- return defaultFileSelection;
- }
-
- /**
- * @param defaultFileSelection the defaultFileSelection to set
- */
- public void setDefaultFileSelection(String defaultFileSelection) {
- this.defaultFileSelection = defaultFileSelection;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+import java.io.File;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.FileDialog;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XFileTextWithSelectionDialog extends XText {
+
+ private String defaultFileSelection;
+ private final Type type;
+ public static enum Type {
+ File, Directory
+ };
+
+ public XFileTextWithSelectionDialog(String displayLabel, Type type, String defaultFileSelection) {
+ this(displayLabel, type);
+ this.defaultFileSelection = defaultFileSelection;
+ }
+
+ public XFileTextWithSelectionDialog(String displayLabel, Type type) {
+ super(displayLabel);
+ this.type = type;
+ }
+
+ public XFileTextWithSelectionDialog() {
+ this("", Type.File);
+ }
+
+ /**
+ * @param displayLabel
+ */
+ public XFileTextWithSelectionDialog(String displayLabel) {
+ this(displayLabel, Type.File);
+ }
+
+ @Override
+ public void createControls(final Composite parent, int horizontalSpan, boolean fillText) {
+ super.createControls(parent, horizontalSpan, fillText);
+
+ Button fileDialog = new Button(getStyledText().getParent(), SWT.NONE);
+ fileDialog.setText("Select " + type.name());
+ if (Strings.isValid(defaultFileSelection)) {
+ set(defaultFileSelection);
+ }
+ fileDialog.addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ if (type == Type.File) {
+ FileDialog dialog = new FileDialog(Displays.getActiveShell(), SWT.OPEN);
+ dialog.setFilterExtensions(new String[] {"*.*"});
+ File dir = new File(defaultFileSelection != null ? defaultFileSelection : "");
+ if (dir.isFile() || dir.isDirectory())
+ dialog.setFilterPath(defaultFileSelection);
+ else
+ dialog.setFilterPath("c:\\");
+
+ String result = dialog.open();
+ if (result != null && !result.equals("")) {
+ setText(dialog.getFilterPath() + File.separatorChar + dialog.getFileName());
+ }
+ } else if (type == Type.Directory) {
+ DirectoryDialog dialog = new DirectoryDialog(Displays.getActiveShell(), SWT.OPEN);
+ File dir = new File(defaultFileSelection != null ? defaultFileSelection : "");
+ if (dir.isFile() || dir.isDirectory())
+ dialog.setFilterPath(defaultFileSelection);
+ else
+ dialog.setFilterPath("c:\\");
+
+ String result = dialog.open();
+ if (result != null && !result.equals("")) {
+ setText(result);
+ }
+ }
+ }
+ });
+ }
+
+ /**
+ * @return the defaultFileSelection
+ */
+ public String getDefaultFileSelection() {
+ return defaultFileSelection;
+ }
+
+ /**
+ * @param defaultFileSelection the defaultFileSelection to set
+ */
+ public void setDefaultFileSelection(String defaultFileSelection) {
+ this.defaultFileSelection = defaultFileSelection;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFlatDam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFlatDam.java
index 94be314424d..659b0f94902 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFlatDam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFlatDam.java
@@ -1,291 +1,291 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-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.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-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.plugin.core.util.Jobs;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
-import org.eclipse.osee.framework.skynet.core.attribute.BinaryBackedAttribute;
-import org.eclipse.osee.framework.skynet.core.attribute.DateAttribute;
-import org.eclipse.osee.framework.skynet.core.attribute.FloatingPointAttribute;
-import org.eclipse.osee.framework.skynet.core.attribute.IntegerAttribute;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.progress.UIJob;
-
-public class XFlatDam extends XFlatWidget<String> implements IAttributeWidget {
- private Artifact artifact;
- private String attributeTypeName;
- private final Map<String, XWidget> xWidgets;
- private final XModifiedListener xModifiedListener;
-
- public XFlatDam(String displayLabel) {
- super(displayLabel);
- this.xWidgets = new LinkedHashMap<String, XWidget>();
- this.artifact = null;
- this.xModifiedListener = new XModifiedListener() {
- @Override
- public void widgetModified(XWidget widget) {
- notifyXModifiedListeners();
- };
- };
- }
-
- @Override
- public String getAttributeType() {
- return attributeTypeName;
- }
-
- @Override
- public void setAttributeType(Artifact artifact, String attributeTypeName) throws OseeCoreException {
- this.artifact = artifact;
- this.attributeTypeName = attributeTypeName;
- AttributeType attributeType = AttributeTypeManager.getType(attributeTypeName);
-
- int minOccurrence = attributeType.getMinOccurrences();
- int maxOccurrence = attributeType.getMaxOccurrences();
-
- if (minOccurrence == 0) {
- minOccurrence = 1;
- }
- setPageRange(minOccurrence, maxOccurrence);
- }
-
- @Override
- protected void createControls(Composite parent, int horizontalSpan) {
- super.createControls(parent, horizontalSpan);
- final Collection<String> values = new ArrayList<String>();
- try {
- values.addAll(getStored());
- for (int index = 0; index < values.size(); index++) {
- addPage("");
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- Job job = new UIJob("Update Flat XText") {
-
- @Override
- public IStatus runInUIThread(IProgressMonitor monitor) {
- setNotificationsAllowed(false);
- Iterator<String> dataIterator = values.iterator();
- Iterator<XWidget> widgetIterator = xWidgets.values().iterator();
- while (dataIterator.hasNext() && widgetIterator.hasNext()) {
- XWidget widget = widgetIterator.next();
- if (widget instanceof XText) {
- ((XText) widget).set(dataIterator.next());
- } else if (widget instanceof XDate) {
- ((XDate) widget).setDate(toDate(dataIterator.next()));
- }
- }
- values.clear();
- setNotificationsAllowed(true);
- return Status.OK_STATUS;
- }
- };
- Jobs.startJob(job);
- }
-
- public List<String> getInput() {
- List<String> data = new ArrayList<String>();
- for (XWidget widget : xWidgets.values()) {
- if (widget instanceof XText) {
- data.add(((XText) widget).get());
- } else if (widget instanceof XDate) {
- Date date = ((XDate) widget).getDate();
- if (date != null) {
- data.add(String.valueOf(date.getTime()));
- }
- }
- }
- return data;
- }
-
- public Collection<String> getStored() throws OseeCoreException {
- return artifact.getAttributesToStringList(attributeTypeName);
- }
-
- @Override
- public Result isDirty() throws OseeCoreException {
- try {
- Collection<String> enteredValues = new ArrayList<String>();//getSelected();
- Collection<String> storedValues = getStored();
- if (!Collections.isEqual(enteredValues, storedValues)) {
- return new Result(true, attributeTypeName + " is dirty");
- }
- } catch (NumberFormatException ex) {
- // do nothing
- }
- return Result.FalseResult;
- }
-
- @Override
- public void revert() throws OseeCoreException {
- setAttributeType(artifact, attributeTypeName);
- }
-
- @Override
- public void saveToArtifact() throws OseeCoreException {
- artifact.setAttributeValues(attributeTypeName, getInput());
- }
-
- @Override
- protected void createPage(final String id, Composite parent, String initialInput) {
- if (!xWidgets.containsKey(id)) {
- try {
- XWidget xWidget = getWidget(attributeTypeName, parent, initialInput);
- xWidget.setEditable(isEditable());
- xWidgets.put(id, xWidget);
-
- xWidget.addXModifiedListener(xModifiedListener);
- parent.layout();
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
-
- @Override
- protected void onRemovePage(String id) {
- xWidgets.remove(id);
- }
-
- @Override
- public IStatus isValid() {
- for (XWidget widget : xWidgets.values()) {
- IStatus status = widget.isValid();
- if (!status.isOK()) {
- return status;
- }
- }
- return Status.OK_STATUS;
- }
-
- @Override
- public void validate() {
- for (String id : getPageIds()) {
- if (Strings.isValid(id)) {
- XWidget widget = xWidgets.get(id);
- widget.validate();
- }
- }
- }
-
- private Date toDate(String value) {
- try {
- return new Date(Long.parseLong(value));
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return new Date();
- }
-
- private XWidget getWidget(String attributeType, Composite parent, String initialInput) throws OseeCoreException {
- XWidget xWidget = null;
-
- if (AttributeTypeManager.isBaseTypeCompatible(IntegerAttribute.class, attributeType)) {
- XInteger xInteger = new XInteger("");
- xInteger.setFillHorizontally(true);
- xInteger.createWidgets(getManagedForm(), parent, 2);
- if (Strings.isValid(initialInput)) {
- xInteger.setText(initialInput);
- }
- xWidget = xInteger;
- } else if (AttributeTypeManager.isBaseTypeCompatible(DateAttribute.class, attributeType)) {
- XDate xDate = new XDate("");
- xDate.setFillHorizontally(true);
- xDate.createWidgets(getManagedForm(), parent, 2);
- if (Strings.isValid(initialInput)) {
- xDate.setDate(toDate(initialInput));
- }
- xWidget = xDate;
- } else if (AttributeTypeManager.isBaseTypeCompatible(FloatingPointAttribute.class, attributeType)) {
- XFloat xFloat = new XFloat("");
- xFloat.setFillHorizontally(true);
- xFloat.createWidgets(getManagedForm(), parent, 2);
- if (Strings.isValid(initialInput)) {
- xFloat.setText(initialInput);
- }
- xWidget = xFloat;
- } else if (AttributeTypeManager.isBaseTypeCompatible(BinaryBackedAttribute.class, attributeType)) {
- XLabel xLabel = new XLabel("");
- xLabel.setFillHorizontally(true);
- xLabel.createWidgets(getManagedForm(), parent, 2);
- if (Strings.isValid(initialInput)) {
- xLabel.setLabel(initialInput);
- }
- xWidget = xLabel;
- }
-
- if (xWidget == null) {
- XText xTextWidget = new XTextInternalWidget("");
- if (Strings.isValid(initialInput)) {
- xTextWidget.setText(initialInput);
- }
- xTextWidget.addXTextSpellModifyDictionary(new SkynetSpellModifyDictionary());
- xTextWidget.setFillHorizontally(false);
- xTextWidget.setFillVertically(false);
- xTextWidget.createWidgets(getManagedForm(), parent, 2);
- xWidget = xTextWidget;
- }
- return xWidget;
- }
-
- private final class XTextInternalWidget extends XText {
-
- public XTextInternalWidget(String label) {
- super(label);
- }
-
- @Override
- protected int getTextStyle() {
- int styleBase = SWT.NONE;
- if (isEditable()) {
- styleBase |= SWT.READ_ONLY;
- }
- return styleBase | (fillVertically ? SWT.WRAP | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL : SWT.SINGLE);
- }
-
- @Override
- public void createControls(Composite parent, int horizontalSpan, boolean fillText) {
- super.createControls(parent, horizontalSpan, fillText);
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
- gd.widthHint = 200;
- sText.setLayoutData(gd);
- sText.setWordWrap(true);
- sText.setEditable(isEditable());
- if (!isEditable()) {
- sText.setBackground(Displays.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+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.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+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.plugin.core.util.Jobs;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
+import org.eclipse.osee.framework.skynet.core.attribute.BinaryBackedAttribute;
+import org.eclipse.osee.framework.skynet.core.attribute.DateAttribute;
+import org.eclipse.osee.framework.skynet.core.attribute.FloatingPointAttribute;
+import org.eclipse.osee.framework.skynet.core.attribute.IntegerAttribute;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.progress.UIJob;
+
+public class XFlatDam extends XFlatWidget<String> implements IAttributeWidget {
+ private Artifact artifact;
+ private String attributeTypeName;
+ private final Map<String, XWidget> xWidgets;
+ private final XModifiedListener xModifiedListener;
+
+ public XFlatDam(String displayLabel) {
+ super(displayLabel);
+ this.xWidgets = new LinkedHashMap<String, XWidget>();
+ this.artifact = null;
+ this.xModifiedListener = new XModifiedListener() {
+ @Override
+ public void widgetModified(XWidget widget) {
+ notifyXModifiedListeners();
+ };
+ };
+ }
+
+ @Override
+ public String getAttributeType() {
+ return attributeTypeName;
+ }
+
+ @Override
+ public void setAttributeType(Artifact artifact, String attributeTypeName) throws OseeCoreException {
+ this.artifact = artifact;
+ this.attributeTypeName = attributeTypeName;
+ AttributeType attributeType = AttributeTypeManager.getType(attributeTypeName);
+
+ int minOccurrence = attributeType.getMinOccurrences();
+ int maxOccurrence = attributeType.getMaxOccurrences();
+
+ if (minOccurrence == 0) {
+ minOccurrence = 1;
+ }
+ setPageRange(minOccurrence, maxOccurrence);
+ }
+
+ @Override
+ protected void createControls(Composite parent, int horizontalSpan) {
+ super.createControls(parent, horizontalSpan);
+ final Collection<String> values = new ArrayList<String>();
+ try {
+ values.addAll(getStored());
+ for (int index = 0; index < values.size(); index++) {
+ addPage("");
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ Job job = new UIJob("Update Flat XText") {
+
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ setNotificationsAllowed(false);
+ Iterator<String> dataIterator = values.iterator();
+ Iterator<XWidget> widgetIterator = xWidgets.values().iterator();
+ while (dataIterator.hasNext() && widgetIterator.hasNext()) {
+ XWidget widget = widgetIterator.next();
+ if (widget instanceof XText) {
+ ((XText) widget).set(dataIterator.next());
+ } else if (widget instanceof XDate) {
+ ((XDate) widget).setDate(toDate(dataIterator.next()));
+ }
+ }
+ values.clear();
+ setNotificationsAllowed(true);
+ return Status.OK_STATUS;
+ }
+ };
+ Jobs.startJob(job);
+ }
+
+ public List<String> getInput() {
+ List<String> data = new ArrayList<String>();
+ for (XWidget widget : xWidgets.values()) {
+ if (widget instanceof XText) {
+ data.add(((XText) widget).get());
+ } else if (widget instanceof XDate) {
+ Date date = ((XDate) widget).getDate();
+ if (date != null) {
+ data.add(String.valueOf(date.getTime()));
+ }
+ }
+ }
+ return data;
+ }
+
+ public Collection<String> getStored() throws OseeCoreException {
+ return artifact.getAttributesToStringList(attributeTypeName);
+ }
+
+ @Override
+ public Result isDirty() throws OseeCoreException {
+ try {
+ Collection<String> enteredValues = new ArrayList<String>();//getSelected();
+ Collection<String> storedValues = getStored();
+ if (!Collections.isEqual(enteredValues, storedValues)) {
+ return new Result(true, attributeTypeName + " is dirty");
+ }
+ } catch (NumberFormatException ex) {
+ // do nothing
+ }
+ return Result.FalseResult;
+ }
+
+ @Override
+ public void revert() throws OseeCoreException {
+ setAttributeType(artifact, attributeTypeName);
+ }
+
+ @Override
+ public void saveToArtifact() throws OseeCoreException {
+ artifact.setAttributeValues(attributeTypeName, getInput());
+ }
+
+ @Override
+ protected void createPage(final String id, Composite parent, String initialInput) {
+ if (!xWidgets.containsKey(id)) {
+ try {
+ XWidget xWidget = getWidget(attributeTypeName, parent, initialInput);
+ xWidget.setEditable(isEditable());
+ xWidgets.put(id, xWidget);
+
+ xWidget.addXModifiedListener(xModifiedListener);
+ parent.layout();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+
+ @Override
+ protected void onRemovePage(String id) {
+ xWidgets.remove(id);
+ }
+
+ @Override
+ public IStatus isValid() {
+ for (XWidget widget : xWidgets.values()) {
+ IStatus status = widget.isValid();
+ if (!status.isOK()) {
+ return status;
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public void validate() {
+ for (String id : getPageIds()) {
+ if (Strings.isValid(id)) {
+ XWidget widget = xWidgets.get(id);
+ widget.validate();
+ }
+ }
+ }
+
+ private Date toDate(String value) {
+ try {
+ return new Date(Long.parseLong(value));
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return new Date();
+ }
+
+ private XWidget getWidget(String attributeType, Composite parent, String initialInput) throws OseeCoreException {
+ XWidget xWidget = null;
+
+ if (AttributeTypeManager.isBaseTypeCompatible(IntegerAttribute.class, attributeType)) {
+ XInteger xInteger = new XInteger("");
+ xInteger.setFillHorizontally(true);
+ xInteger.createWidgets(getManagedForm(), parent, 2);
+ if (Strings.isValid(initialInput)) {
+ xInteger.setText(initialInput);
+ }
+ xWidget = xInteger;
+ } else if (AttributeTypeManager.isBaseTypeCompatible(DateAttribute.class, attributeType)) {
+ XDate xDate = new XDate("");
+ xDate.setFillHorizontally(true);
+ xDate.createWidgets(getManagedForm(), parent, 2);
+ if (Strings.isValid(initialInput)) {
+ xDate.setDate(toDate(initialInput));
+ }
+ xWidget = xDate;
+ } else if (AttributeTypeManager.isBaseTypeCompatible(FloatingPointAttribute.class, attributeType)) {
+ XFloat xFloat = new XFloat("");
+ xFloat.setFillHorizontally(true);
+ xFloat.createWidgets(getManagedForm(), parent, 2);
+ if (Strings.isValid(initialInput)) {
+ xFloat.setText(initialInput);
+ }
+ xWidget = xFloat;
+ } else if (AttributeTypeManager.isBaseTypeCompatible(BinaryBackedAttribute.class, attributeType)) {
+ XLabel xLabel = new XLabel("");
+ xLabel.setFillHorizontally(true);
+ xLabel.createWidgets(getManagedForm(), parent, 2);
+ if (Strings.isValid(initialInput)) {
+ xLabel.setLabel(initialInput);
+ }
+ xWidget = xLabel;
+ }
+
+ if (xWidget == null) {
+ XText xTextWidget = new XTextInternalWidget("");
+ if (Strings.isValid(initialInput)) {
+ xTextWidget.setText(initialInput);
+ }
+ xTextWidget.addXTextSpellModifyDictionary(new SkynetSpellModifyDictionary());
+ xTextWidget.setFillHorizontally(false);
+ xTextWidget.setFillVertically(false);
+ xTextWidget.createWidgets(getManagedForm(), parent, 2);
+ xWidget = xTextWidget;
+ }
+ return xWidget;
+ }
+
+ private final class XTextInternalWidget extends XText {
+
+ public XTextInternalWidget(String label) {
+ super(label);
+ }
+
+ @Override
+ protected int getTextStyle() {
+ int styleBase = SWT.NONE;
+ if (isEditable()) {
+ styleBase |= SWT.READ_ONLY;
+ }
+ return styleBase | (fillVertically ? SWT.WRAP | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL : SWT.SINGLE);
+ }
+
+ @Override
+ public void createControls(Composite parent, int horizontalSpan, boolean fillText) {
+ super.createControls(parent, horizontalSpan, fillText);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gd.widthHint = 200;
+ sText.setLayoutData(gd);
+ sText.setWordWrap(true);
+ sText.setEditable(isEditable());
+ if (!isEditable()) {
+ sText.setBackground(Displays.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFlatWidget.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFlatWidget.java
index 6cd410d1046..4909ea0e6c3 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFlatWidget.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFlatWidget.java
@@ -1,403 +1,403 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets;
-
-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.action.Action;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.jdk.core.util.Collections;
-import org.eclipse.osee.framework.jdk.core.util.GUID;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-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.Widgets;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-
-public abstract class XFlatWidget<T> extends XLabel {
-
- private FlatControl flatControl;
- private StyledText currentPageLabel;
- private Composite container;
- private Label messageLabel;
- private Label messageIcon;
- private int minPage;
- private int maxPage;
-
- public XFlatWidget(String displayLabel, String xmlRoot) {
- super(displayLabel, xmlRoot);
- setToolTip("Navigate pages by clicking forward and backward buttons.");
- minPage = 0;
- maxPage = 0;
- }
-
- @Override
- public void dispose() {
- flatControl.dispose();
- super.dispose();
- }
-
- public Collection<String> getPageIds() {
- return flatControl.pageIds;
- }
-
- public XFlatWidget(String displayLabel) {
- this(displayLabel, "");
- }
-
- protected void setPageRange(int minPage, int maxPage) throws OseeArgumentException {
- if (minPage < 0) {
- throw new OseeArgumentException("Min Number of Pages must be greater than 0");
- }
- if (maxPage < 1) {
- throw new OseeArgumentException("Max Number of Pages must be at least 1");
- }
-
- if (maxPage < minPage) {
- throw new OseeArgumentException(
- String.format("Invalid required number of pages [%s] < [%s]", maxPage, minPage));
- }
- this.minPage = minPage;
- this.maxPage = maxPage;
- }
-
- @Override
- public Control getControl() {
- return flatControl.flatComposite;
- }
-
- @Override
- public void setToolTip(String toolTip) {
- if (Strings.isValid(toolTip)) {
- super.setToolTip(toolTip);
- }
- }
-
- @Override
- public void refresh() {
- updateCurrentPageLabel();
- flatControl.refresh();
- }
-
- @Override
- protected void createControls(final Composite parent, int horizontalSpan) {
- container = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(isDisplayLabel() ? 2 : 1, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.marginRight = 0;
- container.setLayout(layout);
- container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- if (isDisplayLabel() && Strings.isValid(getLabel())) {
- labelWidget = new Label(container, SWT.NONE);
- labelWidget.setText(String.format("%s:", getLabel()));
- labelWidget.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
- if (getToolTip() != null) {
- labelWidget.setToolTipText(getToolTip());
- }
- }
-
- Composite composite = new Composite(container, SWT.NONE);
- GridLayout layout1 = new GridLayout(1, false);
- layout1.marginHeight = 0;
- layout1.marginWidth = 0;
- layout1.verticalSpacing = 0;
- layout1.horizontalSpacing = 0;
- composite.setLayout(layout1);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- createToolBar(composite);
- flatControl = new FlatControl();
- flatControl.createControl(composite);
- createMessageArea(composite);
-
- addToolTip(container, getToolTip());
- refresh();
- }
-
- private void createMessageArea(Composite parent) {
- Composite messageArea = new Composite(parent, SWT.BORDER);
- GridLayout layout = new GridLayout(2, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.marginLeft = 5;
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
- layout.marginBottom = 5;
-
- messageArea.setLayout(layout);
- messageArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- messageArea.setBackground(Displays.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
-
- messageIcon = new Label(messageArea, SWT.NONE);
- messageIcon.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
-
- messageLabel = new Label(messageArea, SWT.NONE);
- messageLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));
- }
-
- private void createToolBar(Composite parent) {
- Composite composite = new Composite(parent, SWT.BORDER);
- GridLayout layout = new GridLayout(3, false);
- layout.marginHeight = 0;
- layout.marginLeft = 5;
- layout.marginWidth = 2;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- currentPageLabel = new StyledText(composite, SWT.READ_ONLY | SWT.SINGLE | SWT.WRAP);
- currentPageLabel.setAlignment(SWT.RIGHT);
- currentPageLabel.setFont(JFaceResources.getBannerFont());
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
- gd.minimumWidth = 10;
- currentPageLabel.setLayoutData(gd);
- currentPageLabel.setText("0 Items");
-
- Composite filler = new Composite(composite, SWT.NONE);
- GridLayout layout1 = new GridLayout(1, false);
- filler.setLayout(layout1);
- filler.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
- ToolBar toolbar = new ToolBar(composite, SWT.FLAT | SWT.HORIZONTAL);
- toolbar.setLayoutData(new GridData(SWT.NONE, SWT.NONE, false, false));
- ToolBarManager manager = new ToolBarManager(toolbar);
- manager.add(new Separator());
- manager.add(new AddPage());
- manager.update(true);
- }
-
- private void addToolTip(Control control, String toolTipText) {
- if (Strings.isValid(toolTipText)) {
- control.setToolTipText(toolTipText);
- if (control instanceof Composite) {
- for (Control child : ((Composite) control).getChildren()) {
- child.setToolTipText(toolTipText);
- }
- }
- }
- }
-
- private void updateCurrentPageLabel() {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (Widgets.isAccessible(currentPageLabel)) {
- int totalPages = flatControl.getTotalPages();
- currentPageLabel.setText(String.format("%s Items", totalPages));
- }
- }
- });
- }
-
- public void addPage(T value) {
- flatControl.addPage(value);
- }
-
- private void setMessage(final int severity, final String message) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (Widgets.isAccessible(messageLabel)) {
- Composite parent = messageLabel.getParent();
-
- String text = message;
- boolean isVisible = Strings.isValid(text);
-
- String imageName = null;
- switch (severity) {
- case IStatus.INFO:
- imageName = ISharedImages.IMG_OBJS_INFO_TSK;
- break;
- case IStatus.ERROR:
- imageName = ISharedImages.IMG_OBJS_ERROR_TSK;
- break;
- case IStatus.WARNING:
- imageName = ISharedImages.IMG_OBJS_WARN_TSK;
- break;
- default:
- imageName = null;
- break;
- }
- Image image =
- Strings.isValid(imageName) ? PlatformUI.getWorkbench().getSharedImages().getImage(imageName) : null;
- messageIcon.setImage(image);
- messageLabel.setText(isVisible ? " " + text : text);
-
- messageIcon.setVisible(isVisible);
- messageLabel.setVisible(isVisible);
- parent.setVisible(isVisible);
- parent.layout();
- }
- }
- });
- }
-
- protected abstract void createPage(String id, Composite parent, T value);
-
- protected abstract void onRemovePage(String id);
-
- private final class AddPage extends Action {
- public AddPage() {
- super();
- setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.ADD_GREEN));
- setToolTipText("Adds a page");
- }
-
- @Override
- public void run() {
- flatControl.addPage((T) null);
- }
- }
-
- private final class RemovePage extends Action {
- public RemovePage() {
- super();
- setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.REMOVE));
- setToolTipText("Removes a page");
- }
-
- @Override
- public void run() {
- AWorkbench.popup("Not implemented yet");
- flatControl.removePage("here");
- }
- }
-
- private final class FlatControl {
- private final List<String> pageIds;
- private Composite flatComposite;
- private final Map<String, Composite> pages = new HashMap<String, Composite>();
-
- public FlatControl() {
- this.pageIds = new ArrayList<String>();
- }
-
- private void createControl(Composite parent) {
- pageIds.clear();
- flatComposite = new Composite(parent, SWT.BORDER);
- flatComposite.setLayout(ALayout.getZeroMarginLayout());
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
- gd.minimumWidth = 60;
- flatComposite.setLayoutData(gd);
- flatComposite.layout();
- }
-
- public void dispose() {
- pageIds.clear();
- Widgets.disposeWidget(flatComposite);
- }
-
- public void refresh() {
- flatComposite.layout();
- flatComposite.getParent().layout();
- }
-
- private int getTotalPages() {
- return Widgets.isAccessible(flatComposite) ? pages.size() : 0;
- }
-
- private void addPage(T value) {
- int numberOfPages = getTotalPages();
- IStatus status = validate(numberOfPages + 1);
- if (status.isOK()) {
- setMessage(IStatus.OK, "");
- final String pageId = GUID.create();
- if (pageIds.add(pageId)) {
- Composite composite = new Composite(flatComposite, SWT.WRAP | SWT.BORDER);
- composite.setLayout(new GridLayout(3, false));
- composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
-
- createPage(pageId, composite, value);
-
- Button button = new Button(composite, SWT.FLAT);
- button.setImage(ImageManager.getImage(FrameworkImage.DELETE));
- button.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- removePage(pageId);
- }
- });
-
- pages.put(pageId, composite);
- notifyXModifiedListeners();
- } else {
- setMessage(IStatus.WARNING, "Add page error");
- }
- } else {
- setMessage(IStatus.ERROR, status.getMessage());
- }
- }
-
- private void removePage(String pageId) {
- int numberOfPages = getTotalPages();
- IStatus status = validate(numberOfPages - 1);
- if (status.isOK()) {
- setMessage(IStatus.OK, "");
-
- pageIds.remove(pageId);
- if (pageId != null) {
- onRemovePage(pageId);
- Control control = pages.remove(pageId);
- Widgets.disposeWidget(control);
- notifyXModifiedListeners();
- } else {
- setMessage(IStatus.WARNING, "Remove page error");
- }
- } else {
- setMessage(IStatus.ERROR, status.getMessage());
- }
- }
-
- private IStatus validate(int numberOfPages) {
- IStatus status = null;
- if (minPage <= numberOfPages && maxPage >= numberOfPages) {
- status = Status.OK_STATUS;
- } else {
- List<String> message = new ArrayList<String>();
- if (numberOfPages < minPage) {
- message.add(String.format("Must have at least [%s] page%s", minPage, minPage == 1 ? "" : "s"));
- }
- if (numberOfPages > maxPage) {
- message.add(String.format("Can't add more than [%s] page%s", maxPage, maxPage == 1 ? "" : "s"));
- }
- status = new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, Collections.toString(" &", message));
- }
- return status;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+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.action.Action;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+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.Widgets;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+public abstract class XFlatWidget<T> extends XLabel {
+
+ private FlatControl flatControl;
+ private StyledText currentPageLabel;
+ private Composite container;
+ private Label messageLabel;
+ private Label messageIcon;
+ private int minPage;
+ private int maxPage;
+
+ public XFlatWidget(String displayLabel, String xmlRoot) {
+ super(displayLabel, xmlRoot);
+ setToolTip("Navigate pages by clicking forward and backward buttons.");
+ minPage = 0;
+ maxPage = 0;
+ }
+
+ @Override
+ public void dispose() {
+ flatControl.dispose();
+ super.dispose();
+ }
+
+ public Collection<String> getPageIds() {
+ return flatControl.pageIds;
+ }
+
+ public XFlatWidget(String displayLabel) {
+ this(displayLabel, "");
+ }
+
+ protected void setPageRange(int minPage, int maxPage) throws OseeArgumentException {
+ if (minPage < 0) {
+ throw new OseeArgumentException("Min Number of Pages must be greater than 0");
+ }
+ if (maxPage < 1) {
+ throw new OseeArgumentException("Max Number of Pages must be at least 1");
+ }
+
+ if (maxPage < minPage) {
+ throw new OseeArgumentException(
+ String.format("Invalid required number of pages [%s] < [%s]", maxPage, minPage));
+ }
+ this.minPage = minPage;
+ this.maxPage = maxPage;
+ }
+
+ @Override
+ public Control getControl() {
+ return flatControl.flatComposite;
+ }
+
+ @Override
+ public void setToolTip(String toolTip) {
+ if (Strings.isValid(toolTip)) {
+ super.setToolTip(toolTip);
+ }
+ }
+
+ @Override
+ public void refresh() {
+ updateCurrentPageLabel();
+ flatControl.refresh();
+ }
+
+ @Override
+ protected void createControls(final Composite parent, int horizontalSpan) {
+ container = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(isDisplayLabel() ? 2 : 1, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.marginRight = 0;
+ container.setLayout(layout);
+ container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ if (isDisplayLabel() && Strings.isValid(getLabel())) {
+ labelWidget = new Label(container, SWT.NONE);
+ labelWidget.setText(String.format("%s:", getLabel()));
+ labelWidget.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
+ if (getToolTip() != null) {
+ labelWidget.setToolTipText(getToolTip());
+ }
+ }
+
+ Composite composite = new Composite(container, SWT.NONE);
+ GridLayout layout1 = new GridLayout(1, false);
+ layout1.marginHeight = 0;
+ layout1.marginWidth = 0;
+ layout1.verticalSpacing = 0;
+ layout1.horizontalSpacing = 0;
+ composite.setLayout(layout1);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ createToolBar(composite);
+ flatControl = new FlatControl();
+ flatControl.createControl(composite);
+ createMessageArea(composite);
+
+ addToolTip(container, getToolTip());
+ refresh();
+ }
+
+ private void createMessageArea(Composite parent) {
+ Composite messageArea = new Composite(parent, SWT.BORDER);
+ GridLayout layout = new GridLayout(2, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.marginLeft = 5;
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+ layout.marginBottom = 5;
+
+ messageArea.setLayout(layout);
+ messageArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ messageArea.setBackground(Displays.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+
+ messageIcon = new Label(messageArea, SWT.NONE);
+ messageIcon.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+
+ messageLabel = new Label(messageArea, SWT.NONE);
+ messageLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));
+ }
+
+ private void createToolBar(Composite parent) {
+ Composite composite = new Composite(parent, SWT.BORDER);
+ GridLayout layout = new GridLayout(3, false);
+ layout.marginHeight = 0;
+ layout.marginLeft = 5;
+ layout.marginWidth = 2;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ currentPageLabel = new StyledText(composite, SWT.READ_ONLY | SWT.SINGLE | SWT.WRAP);
+ currentPageLabel.setAlignment(SWT.RIGHT);
+ currentPageLabel.setFont(JFaceResources.getBannerFont());
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ gd.minimumWidth = 10;
+ currentPageLabel.setLayoutData(gd);
+ currentPageLabel.setText("0 Items");
+
+ Composite filler = new Composite(composite, SWT.NONE);
+ GridLayout layout1 = new GridLayout(1, false);
+ filler.setLayout(layout1);
+ filler.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ ToolBar toolbar = new ToolBar(composite, SWT.FLAT | SWT.HORIZONTAL);
+ toolbar.setLayoutData(new GridData(SWT.NONE, SWT.NONE, false, false));
+ ToolBarManager manager = new ToolBarManager(toolbar);
+ manager.add(new Separator());
+ manager.add(new AddPage());
+ manager.update(true);
+ }
+
+ private void addToolTip(Control control, String toolTipText) {
+ if (Strings.isValid(toolTipText)) {
+ control.setToolTipText(toolTipText);
+ if (control instanceof Composite) {
+ for (Control child : ((Composite) control).getChildren()) {
+ child.setToolTipText(toolTipText);
+ }
+ }
+ }
+ }
+
+ private void updateCurrentPageLabel() {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (Widgets.isAccessible(currentPageLabel)) {
+ int totalPages = flatControl.getTotalPages();
+ currentPageLabel.setText(String.format("%s Items", totalPages));
+ }
+ }
+ });
+ }
+
+ public void addPage(T value) {
+ flatControl.addPage(value);
+ }
+
+ private void setMessage(final int severity, final String message) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (Widgets.isAccessible(messageLabel)) {
+ Composite parent = messageLabel.getParent();
+
+ String text = message;
+ boolean isVisible = Strings.isValid(text);
+
+ String imageName = null;
+ switch (severity) {
+ case IStatus.INFO:
+ imageName = ISharedImages.IMG_OBJS_INFO_TSK;
+ break;
+ case IStatus.ERROR:
+ imageName = ISharedImages.IMG_OBJS_ERROR_TSK;
+ break;
+ case IStatus.WARNING:
+ imageName = ISharedImages.IMG_OBJS_WARN_TSK;
+ break;
+ default:
+ imageName = null;
+ break;
+ }
+ Image image =
+ Strings.isValid(imageName) ? PlatformUI.getWorkbench().getSharedImages().getImage(imageName) : null;
+ messageIcon.setImage(image);
+ messageLabel.setText(isVisible ? " " + text : text);
+
+ messageIcon.setVisible(isVisible);
+ messageLabel.setVisible(isVisible);
+ parent.setVisible(isVisible);
+ parent.layout();
+ }
+ }
+ });
+ }
+
+ protected abstract void createPage(String id, Composite parent, T value);
+
+ protected abstract void onRemovePage(String id);
+
+ private final class AddPage extends Action {
+ public AddPage() {
+ super();
+ setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.ADD_GREEN));
+ setToolTipText("Adds a page");
+ }
+
+ @Override
+ public void run() {
+ flatControl.addPage((T) null);
+ }
+ }
+
+ private final class RemovePage extends Action {
+ public RemovePage() {
+ super();
+ setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.REMOVE));
+ setToolTipText("Removes a page");
+ }
+
+ @Override
+ public void run() {
+ AWorkbench.popup("Not implemented yet");
+ flatControl.removePage("here");
+ }
+ }
+
+ private final class FlatControl {
+ private final List<String> pageIds;
+ private Composite flatComposite;
+ private final Map<String, Composite> pages = new HashMap<String, Composite>();
+
+ public FlatControl() {
+ this.pageIds = new ArrayList<String>();
+ }
+
+ private void createControl(Composite parent) {
+ pageIds.clear();
+ flatComposite = new Composite(parent, SWT.BORDER);
+ flatComposite.setLayout(ALayout.getZeroMarginLayout());
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ gd.minimumWidth = 60;
+ flatComposite.setLayoutData(gd);
+ flatComposite.layout();
+ }
+
+ public void dispose() {
+ pageIds.clear();
+ Widgets.disposeWidget(flatComposite);
+ }
+
+ public void refresh() {
+ flatComposite.layout();
+ flatComposite.getParent().layout();
+ }
+
+ private int getTotalPages() {
+ return Widgets.isAccessible(flatComposite) ? pages.size() : 0;
+ }
+
+ private void addPage(T value) {
+ int numberOfPages = getTotalPages();
+ IStatus status = validate(numberOfPages + 1);
+ if (status.isOK()) {
+ setMessage(IStatus.OK, "");
+ final String pageId = GUID.create();
+ if (pageIds.add(pageId)) {
+ Composite composite = new Composite(flatComposite, SWT.WRAP | SWT.BORDER);
+ composite.setLayout(new GridLayout(3, false));
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+
+ createPage(pageId, composite, value);
+
+ Button button = new Button(composite, SWT.FLAT);
+ button.setImage(ImageManager.getImage(FrameworkImage.DELETE));
+ button.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ removePage(pageId);
+ }
+ });
+
+ pages.put(pageId, composite);
+ notifyXModifiedListeners();
+ } else {
+ setMessage(IStatus.WARNING, "Add page error");
+ }
+ } else {
+ setMessage(IStatus.ERROR, status.getMessage());
+ }
+ }
+
+ private void removePage(String pageId) {
+ int numberOfPages = getTotalPages();
+ IStatus status = validate(numberOfPages - 1);
+ if (status.isOK()) {
+ setMessage(IStatus.OK, "");
+
+ pageIds.remove(pageId);
+ if (pageId != null) {
+ onRemovePage(pageId);
+ Control control = pages.remove(pageId);
+ Widgets.disposeWidget(control);
+ notifyXModifiedListeners();
+ } else {
+ setMessage(IStatus.WARNING, "Remove page error");
+ }
+ } else {
+ setMessage(IStatus.ERROR, status.getMessage());
+ }
+ }
+
+ private IStatus validate(int numberOfPages) {
+ IStatus status = null;
+ if (minPage <= numberOfPages && maxPage >= numberOfPages) {
+ status = Status.OK_STATUS;
+ } else {
+ List<String> message = new ArrayList<String>();
+ if (numberOfPages < minPage) {
+ message.add(String.format("Must have at least [%s] page%s", minPage, minPage == 1 ? "" : "s"));
+ }
+ if (numberOfPages > maxPage) {
+ message.add(String.format("Can't add more than [%s] page%s", maxPage, maxPage == 1 ? "" : "s"));
+ }
+ status = new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, Collections.toString(" &", message));
+ }
+ return status;
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFloat.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFloat.java
index 4c7c6cc4b6a..69db7c36d0c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFloat.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFloat.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.framework.ui.skynet.widgets;
-
-import java.text.NumberFormat;
-import java.text.ParseException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-
-/**
- * @author Donald G. Dunne
- */
-public class XFloat extends XText {
- private double minValue = 0;
- private boolean minValueSet = false;
- private double maxValue = 0;
- private boolean maxValueSet = false;
-
- public XFloat(String displayLabel) {
- super(displayLabel, "float");
- }
-
- public XFloat(String displayLabel, String xmlRoot) {
- super(displayLabel, xmlRoot);
- }
-
- public void setMinValue(double minValue) {
- minValueSet = true;
- this.minValue = minValue;
- }
-
- public void setMaxValue(double maxValue) {
- maxValueSet = false;
- this.maxValue = maxValue;
- }
-
- @Override
- public double getFloat() {
- if (get().equals("")) {
- return 0.0;
- }
- try {
- return NumberFormat.getInstance().parse(get()).doubleValue();
- } catch (ParseException e) {
- return 0.0;
- }
- }
-
- @Override
- public IStatus isValid() {
- if (isRequiredEntry() || Strings.isValid(get())) {
- String name = getLabel();
- if (name.equals("")) {
- name = "Value";
- }
- IStatus result = super.isValid();
- if (!result.isOK()) {
- return result;
- } else if (!this.isFloat()) {
- return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, name + " must be a Float");
- } else if (minValueSet && this.getFloat() < minValue) {
- return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, name + " must be >= " + minValue);
- } else if (maxValueSet && this.getFloat() > maxValue) {
- return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, name + " must be <= " + maxValue);
- }
- }
- return Status.OK_STATUS;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+import java.text.NumberFormat;
+import java.text.ParseException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XFloat extends XText {
+ private double minValue = 0;
+ private boolean minValueSet = false;
+ private double maxValue = 0;
+ private boolean maxValueSet = false;
+
+ public XFloat(String displayLabel) {
+ super(displayLabel, "float");
+ }
+
+ public XFloat(String displayLabel, String xmlRoot) {
+ super(displayLabel, xmlRoot);
+ }
+
+ public void setMinValue(double minValue) {
+ minValueSet = true;
+ this.minValue = minValue;
+ }
+
+ public void setMaxValue(double maxValue) {
+ maxValueSet = false;
+ this.maxValue = maxValue;
+ }
+
+ @Override
+ public double getFloat() {
+ if (get().equals("")) {
+ return 0.0;
+ }
+ try {
+ return NumberFormat.getInstance().parse(get()).doubleValue();
+ } catch (ParseException e) {
+ return 0.0;
+ }
+ }
+
+ @Override
+ public IStatus isValid() {
+ if (isRequiredEntry() || Strings.isValid(get())) {
+ String name = getLabel();
+ if (name.equals("")) {
+ name = "Value";
+ }
+ IStatus result = super.isValid();
+ if (!result.isOK()) {
+ return result;
+ } else if (!this.isFloat()) {
+ return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, name + " must be a Float");
+ } else if (minValueSet && this.getFloat() < minValue) {
+ return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, name + " must be >= " + minValue);
+ } else if (maxValueSet && this.getFloat() > maxValue) {
+ return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, name + " must be <= " + maxValue);
+ }
+ }
+ return Status.OK_STATUS;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFloatDam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFloatDam.java
index 01d3a55b707..590583e5fca 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFloatDam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XFloatDam.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.framework.ui.skynet.widgets;
-
-import java.text.NumberFormat;
-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.Result;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-
-/**
- * @author Donald G. Dunne
- */
-public class XFloatDam extends XFloat implements IAttributeWidget {
-
- private Artifact artifact;
- private String attributeTypeName;
-
- public XFloatDam(String displayLabel) {
- super(displayLabel);
- }
-
- public XFloatDam(String displayLabel, String xmlRoot) {
- super(displayLabel, xmlRoot);
- }
-
- @Override
- public String getAttributeType() {
- return attributeTypeName;
- }
-
- @Override
- public void setAttributeType(Artifact artifact, String attrName) throws OseeCoreException {
- this.artifact = artifact;
- this.attributeTypeName = attrName;
- Double value = artifact.getSoleAttributeValue(attributeTypeName, null);
- super.set(value == null ? "" : NumberFormat.getInstance().format(value));
- }
-
- @Override
- public void saveToArtifact() {
- try {
- if (text == null || text.equals("")) {
- artifact.deleteSoleAttribute(attributeTypeName);
- } else {
- Double enteredValue = getFloat();
- artifact.setSoleAttributeValue(attributeTypeName, enteredValue);
- }
- } catch (NumberFormatException ex) {
- // do nothing
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @Override
- public Result isDirty() throws OseeCoreException {
- Double enteredValue = getFloat();
- Double storedValue = artifact.getSoleAttributeValue(attributeTypeName, 0.0);
- if (enteredValue.doubleValue() != storedValue.doubleValue()) {
- return new Result(true, attributeTypeName + " is dirty");
- }
- return Result.FalseResult;
- }
-
- @Override
- public void revert() throws OseeCoreException {
- setAttributeType(artifact, 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.framework.ui.skynet.widgets;
+
+import java.text.NumberFormat;
+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.Result;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XFloatDam extends XFloat implements IAttributeWidget {
+
+ private Artifact artifact;
+ private String attributeTypeName;
+
+ public XFloatDam(String displayLabel) {
+ super(displayLabel);
+ }
+
+ public XFloatDam(String displayLabel, String xmlRoot) {
+ super(displayLabel, xmlRoot);
+ }
+
+ @Override
+ public String getAttributeType() {
+ return attributeTypeName;
+ }
+
+ @Override
+ public void setAttributeType(Artifact artifact, String attrName) throws OseeCoreException {
+ this.artifact = artifact;
+ this.attributeTypeName = attrName;
+ Double value = artifact.getSoleAttributeValue(attributeTypeName, null);
+ super.set(value == null ? "" : NumberFormat.getInstance().format(value));
+ }
+
+ @Override
+ public void saveToArtifact() {
+ try {
+ if (text == null || text.equals("")) {
+ artifact.deleteSoleAttribute(attributeTypeName);
+ } else {
+ Double enteredValue = getFloat();
+ artifact.setSoleAttributeValue(attributeTypeName, enteredValue);
+ }
+ } catch (NumberFormatException ex) {
+ // do nothing
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @Override
+ public Result isDirty() throws OseeCoreException {
+ Double enteredValue = getFloat();
+ Double storedValue = artifact.getSoleAttributeValue(attributeTypeName, 0.0);
+ if (enteredValue.doubleValue() != storedValue.doubleValue()) {
+ return new Result(true, attributeTypeName + " is dirty");
+ }
+ return Result.FalseResult;
+ }
+
+ @Override
+ public void revert() throws OseeCoreException {
+ setAttributeType(artifact, attributeTypeName);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XLabelValue.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XLabelValue.java
index 948f0b763c7..047551befec 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XLabelValue.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XLabelValue.java
@@ -8,16 +8,16 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets;
-
-/**
- * @author Donald G. Dunne
- */
-public class XLabelValue extends XLabelValueBase {
-
- public XLabelValue(String label, String value) {
- super(label);
- setValueText(value);
- }
-
-}
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XLabelValue extends XLabelValueBase {
+
+ public XLabelValue(String label, String value) {
+ super(label);
+ setValueText(value);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XListDropViewer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XListDropViewer.java
index 9f3c1e479df..a97a9b89145 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XListDropViewer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XListDropViewer.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.framework.ui.skynet.widgets;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.ArtifactLabelProvider;
-import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactTransfer;
-import org.eclipse.osee.framework.ui.skynet.util.SkynetDragAndDrop;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-
-/**
- * @author Ryan D. Brooks
- */
-public class XListDropViewer extends XListViewer {
- private MenuItem removeFromMenuItem;
- private TableViewer myTableViewer;
- private ArrayContentProvider myArrayContentProvider = null;
- private ArtifactLabelProvider myArtifactLabelProvider = null;
-
- /**
- * @param displayLabel
- */
- public XListDropViewer(String displayLabel) {
- super(displayLabel);
- this.myArrayContentProvider = new ArrayContentProvider();
- setContentProvider(this.myArrayContentProvider);
- this.myArtifactLabelProvider = new ArtifactLabelProvider();
- setLabelProvider(this.myArtifactLabelProvider);
- }
-
- @Override
- protected void createControls(Composite parent, int horizontalSpan) {
- Menu popupMenu = new Menu(parent);
- setMultiSelect(true);
- super.setListMenu(popupMenu);
- super.createControls(parent, horizontalSpan);
- new XDragAndDrop();
- this.myTableViewer = super.getTableViewer();
- // popupMenu.addMenuListener(new MenuEnablingListener());
- createRemoveFromMenuItem(popupMenu);
- myTableViewer.getTable().setMenu(popupMenu);
- }
-
- private void createRemoveFromMenuItem(Menu popupMenu) {
- removeFromMenuItem = new MenuItem(popupMenu, SWT.PUSH);
- removeFromMenuItem.setText("Remove From This Blam's Parameters ");
- removeFromMenuItem.addSelectionListener(new SelectionListener() {
-
- public void widgetSelected(SelectionEvent event) {
- IStructuredSelection structuredSelection = (IStructuredSelection) myTableViewer.getSelection();
- Iterator<?> iterator = structuredSelection.iterator();
-
- Object orginalInput = getInput();
- Collection<Object> modList = getCollectionInput();
-
- while (iterator.hasNext()) {
- modList.remove(iterator.next());
- }
-
- myArrayContentProvider.inputChanged(myTableViewer, orginalInput, modList);
- refresh();
- }
-
- public void widgetDefaultSelected(SelectionEvent ev) {
- }
- });
- }
-
- /**
- * Adds artifacts to the viewer's input.
- *
- * @param artifacts
- */
- public void addToInput(Artifact... artifacts) {
- ArrayList<Object> objects = new ArrayList<Object>();
-
- for (Artifact artifact : artifacts) {
- objects.add((Object) artifact);
- }
-
- if (getInput() == null) {
- setInput(objects);
- } else {
- add(objects);
- updateListWidget();
- }
- notifyXModifiedListeners();
- }
-
- @Override
- public Object getData() {
- return getInput();
- }
-
- private class XDragAndDrop extends SkynetDragAndDrop {
- public XDragAndDrop() {
- super(null, getControl(), "viewId");
- }
-
- @Override
- public void performDragOver(DropTargetEvent event) {
- if (ArtifactTransfer.getInstance().isSupportedType(event.currentDataType)) {
- event.detail = DND.DROP_COPY;
- }
- }
-
- @Override
- public Artifact[] getArtifacts() {
- return null;
- }
-
- @Override
- public void performArtifactDrop(Artifact[] dropArtifacts) {
- addToInput(dropArtifacts);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.ArtifactLabelProvider;
+import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactTransfer;
+import org.eclipse.osee.framework.ui.skynet.util.SkynetDragAndDrop;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public class XListDropViewer extends XListViewer {
+ private MenuItem removeFromMenuItem;
+ private TableViewer myTableViewer;
+ private ArrayContentProvider myArrayContentProvider = null;
+ private ArtifactLabelProvider myArtifactLabelProvider = null;
+
+ /**
+ * @param displayLabel
+ */
+ public XListDropViewer(String displayLabel) {
+ super(displayLabel);
+ this.myArrayContentProvider = new ArrayContentProvider();
+ setContentProvider(this.myArrayContentProvider);
+ this.myArtifactLabelProvider = new ArtifactLabelProvider();
+ setLabelProvider(this.myArtifactLabelProvider);
+ }
+
+ @Override
+ protected void createControls(Composite parent, int horizontalSpan) {
+ Menu popupMenu = new Menu(parent);
+ setMultiSelect(true);
+ super.setListMenu(popupMenu);
+ super.createControls(parent, horizontalSpan);
+ new XDragAndDrop();
+ this.myTableViewer = super.getTableViewer();
+ // popupMenu.addMenuListener(new MenuEnablingListener());
+ createRemoveFromMenuItem(popupMenu);
+ myTableViewer.getTable().setMenu(popupMenu);
+ }
+
+ private void createRemoveFromMenuItem(Menu popupMenu) {
+ removeFromMenuItem = new MenuItem(popupMenu, SWT.PUSH);
+ removeFromMenuItem.setText("Remove From This Blam's Parameters ");
+ removeFromMenuItem.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent event) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) myTableViewer.getSelection();
+ Iterator<?> iterator = structuredSelection.iterator();
+
+ Object orginalInput = getInput();
+ Collection<Object> modList = getCollectionInput();
+
+ while (iterator.hasNext()) {
+ modList.remove(iterator.next());
+ }
+
+ myArrayContentProvider.inputChanged(myTableViewer, orginalInput, modList);
+ refresh();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent ev) {
+ }
+ });
+ }
+
+ /**
+ * Adds artifacts to the viewer's input.
+ *
+ * @param artifacts
+ */
+ public void addToInput(Artifact... artifacts) {
+ ArrayList<Object> objects = new ArrayList<Object>();
+
+ for (Artifact artifact : artifacts) {
+ objects.add((Object) artifact);
+ }
+
+ if (getInput() == null) {
+ setInput(objects);
+ } else {
+ add(objects);
+ updateListWidget();
+ }
+ notifyXModifiedListeners();
+ }
+
+ @Override
+ public Object getData() {
+ return getInput();
+ }
+
+ private class XDragAndDrop extends SkynetDragAndDrop {
+ public XDragAndDrop() {
+ super(null, getControl(), "viewId");
+ }
+
+ @Override
+ public void performDragOver(DropTargetEvent event) {
+ if (ArtifactTransfer.getInstance().isSupportedType(event.currentDataType)) {
+ event.detail = DND.DROP_COPY;
+ }
+ }
+
+ @Override
+ public Artifact[] getArtifacts() {
+ return null;
+ }
+
+ @Override
+ public void performArtifactDrop(Artifact[] dropArtifacts) {
+ addToInput(dropArtifacts);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XListViewer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XListViewer.java
index 87731ea6982..d69aa229490 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XListViewer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XListViewer.java
@@ -1,435 +1,435 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Table;
-
-/**
- * @author Donald G. Dunne
- */
-public class XListViewer extends XWidget {
-
- // XListViewer uses a table so images can be used. SWT doesn't support images in ListViewer
- private TableViewer listViewer;
- private Menu listMenu;
- private Composite parent;
- private Composite composite;
- private int requiredMinSelected = 0;
- private int requiredMaxSelected = 0;
- private boolean grabHorizontal = false;
- private boolean multiSelect = false;
- private Object defaultSelectedObject;
-
- protected SelectionListener listListener = new SelectionListener() {
-
- public void widgetSelected(SelectionEvent e) {
- handleSelection();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- };
- private Collection<Object> input;
- private IContentProvider contentProvider;
- private ILabelProvider labelProvider;
- private ViewerSorter sorter;
- private int widthHint;
- private int heightHint;
-
- public XListViewer(String displayLabel) {
- this(displayLabel, "list", "");
- }
-
- public XListViewer() {
- this("List", "list", "");
- }
-
- public XListViewer(String displayLabel, String xmlRoot, String xmlSubRoot) {
- super(displayLabel, xmlRoot, xmlSubRoot);
- listMenu = null;
- }
-
- @Override
- public Control getControl() {
- return listViewer.getControl();
- }
-
- /**
- * @param listMenu The listMenu to set.
- */
- public void setListMenu(Menu listMenu) {
- this.listMenu = listMenu;
- }
-
- public void setContentProvider(IContentProvider contentProvider) {
- this.contentProvider = contentProvider;
- }
-
- public void setLabelProvider(ILabelProvider labelProvider) {
- this.labelProvider = labelProvider;
- if (listViewer != null) {
- listViewer.setLabelProvider(labelProvider);
- }
- }
-
- public void setSorter(ViewerSorter sorter) {
- this.sorter = sorter;
- }
-
- public void setInput(Collection<Object> input) {
- this.input = input;
- if (listViewer != null) {
- listViewer.setInput(input);
- }
- }
-
- /**
- * @param input
- */
- public void setInput(Object input) {
- if (listViewer != null) {
- listViewer.setInput(input);
- }
- }
-
- public Object getInput() {
- return listViewer.getInput();
- }
-
- public Collection<Object> getCollectionInput() {
- return input;
- }
-
- public void setInputArtifacts(Collection<? extends Artifact> arts) {
- ArrayList<Object> objs = new ArrayList<Object>();
- objs.addAll(arts);
- setInput(objs);
- }
-
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- listViewer.addSelectionChangedListener(listener);
- }
-
- public void setHints(int widthHint, int heightHint) {
- this.widthHint = widthHint;
- this.heightHint = heightHint;
- }
-
- /**
- * Create List Widgets. Widgets Created: List: horizonatalSpan takes up 2 columns; horizontalSpan must be >=2
- */
- @Override
- protected void createControls(Composite parent, int horizontalSpan) {
-
- this.parent = parent;
- composite = null;
-
- if (!verticalLabel && (horizontalSpan < 2)) {
- horizontalSpan = 2;
- } else if (verticalLabel) {
- horizontalSpan = 1;
- }
-
- if (isDisplayLabel() && verticalLabel) {
- composite = new Composite(parent, SWT.NONE);
- // composite.setBackground(Displays.getSystemColor(SWT.COLOR_CYAN));
- composite.setLayout(new GridLayout(1, false));
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.horizontalSpan = 2;
- gd.grabExcessHorizontalSpace = true;
- gd.grabExcessVerticalSpace = true;
- composite.setLayoutData(gd);
- } else {
- composite = parent;
- }
-
- // Create List Widgets
- if (isDisplayLabel()) {
- labelWidget = new Label(composite, SWT.NONE);
- labelWidget.setText(getLabel() + ":");
- if (getToolTip() != null) {
- labelWidget.setToolTipText(getToolTip());
- }
- }
-
- listViewer =
- new TableViewer(composite,
- (multiSelect ? SWT.MULTI : SWT.SINGLE) | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- listViewer.setContentProvider(contentProvider);
- listViewer.setLabelProvider(labelProvider);
- if (sorter != null) {
- listViewer.setSorter(sorter);
- }
- listViewer.setInput(input);
- listViewer.getTable().setMenu(listMenu);
- listViewer.getTable().addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- handleSelection();
- }
- });
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.verticalSpan = 10;
- if (grabHorizontal) {
- gd.grabExcessHorizontalSpace = true;
- }
- if (widthHint > 0) {
- gd.widthHint = widthHint;
- }
- if (heightHint > 0) {
- gd.heightHint = heightHint;
- }
- gd.grabExcessVerticalSpace = true;
- listViewer.getTable().setLayoutData(gd);
- listViewer.getTable().addSelectionListener(listListener);
-
- if (defaultSelectedObject != null) {
- setSelected(defaultSelectedObject);
- }
- updateListWidget();
- }
-
- @Override
- public void dispose() {
- labelWidget.dispose();
- listViewer.getTable().dispose();
- if (composite != null && !composite.isDisposed()) {
- composite.dispose();
- }
- if (parent != null && !parent.isDisposed()) {
- parent.layout();
- }
- }
-
- @Override
- public void setFocus() {
- }
-
- /**
- * Don't need this since overriding toReport and toXml
- */
- @Override
- public String getXmlData() {
- return "";
- }
-
- /**
- * Don't need this since overriding setFromXml
- */
- @Override
- public void setXmlData(String str) {
- return;
- }
-
- private void handleSelection() {
- validate();
- notifyXModifiedListeners();
- }
-
- @Override
- public void refresh() {
- updateListWidget();
- }
-
- public void addSelectionListener(SelectionListener selectionListener) {
- listViewer.getTable().addSelectionListener(selectionListener);
- }
-
- @SuppressWarnings("unchecked")
- public ArrayList<Object> getSelected() {
- ArrayList<Object> selected = new ArrayList<Object>();
- IStructuredSelection selection = (IStructuredSelection) listViewer.getSelection();
- Iterator i = selection.iterator();
- while (i.hasNext()) {
- selected.add(i.next());
- }
- return selected;
- }
-
- @Override
- public void setFromXml(String xml) {
- }
-
- public Table getTable() {
- return listViewer.getTable();
- }
-
- public TableViewer getTableViewer() {
- return listViewer;
- }
-
- protected void updateListWidget() {
- listViewer.refresh();
- validate();
- }
-
- public void add(Object object) {
- if (!input.contains(object)) {
- input.add(object);
- }
- }
-
- public void add(Object[] objects) {
- for (Object object : objects) {
- add(object);
- }
- }
-
- public void add(Collection<Object> objects) {
- // to ensure no duplicates
- input.removeAll(objects);
-
- if (!input.containsAll(objects)) {
- input.addAll(objects);
- }
- }
-
- public void setSelected(ArrayList<Object> selected) {
- setSelected(new StructuredSelection(selected.toArray(new Object[selected.size()])));
- }
-
- public void setSelected(Object selected) {
- setSelected(new StructuredSelection(selected));
- }
-
- private void setSelected(StructuredSelection selection) {
- listViewer.setSelection(selection);
- updateListWidget();
- }
-
- @Override
- public IStatus isValid() {
- if (!isRequiredEntry()) {
- return Status.OK_STATUS;
- }
- int size = getSelected().size();
- if (requiredMaxSelected != 0) {
- if ((size >= requiredMinSelected) && (size <= requiredMaxSelected)) {
- return Status.OK_STATUS;
- } else if (size < requiredMinSelected) {
- return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID,
- getLabel() + " must have at least " + requiredMinSelected + " selected.");
- } else if (size < requiredMaxSelected) {
- return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID,
- getLabel() + " should only have " + requiredMaxSelected + " selected.");
- } else {
- return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, getLabel());
- }
- }
- if (size == 0) {
- return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, getLabel() + " must be selected.");
- }
- return Status.OK_STATUS;
-
- }
-
- /**
- * Minimum number of selected items that makes this widget valid
- *
- * @param minSelected -
- * @param maxSelected =
- */
- public void setRequiredSelected(int minSelected, int maxSelected) {
- this.requiredMinSelected = minSelected;
- this.requiredMaxSelected = maxSelected;
- setRequiredEntry(true);
- }
-
- @Override
- public void setRequiredEntry(boolean requiredEntry) {
- super.setRequiredEntry(requiredEntry);
- if (!requiredEntry) {
- this.requiredMinSelected = 1;
- this.requiredMaxSelected = 1;
- }
- }
-
- @Override
- public String getReportData() {
- String s = "\n";
- for (Object obj : getSelected()) {
- s = s + " - " + obj + "\n";
- }
- s = s.replaceAll("\n+$", "");
- return s;
- }
-
- @Override
- public String toXml() {
- return toXml(getXmlRoot(), getXmlSubRoot());
- }
-
- @Override
- public String toXml(String xmlRoot, String xmlSubRoot) {
- return "";
- }
-
- @Override
- public String toHTML(String labelFont) {
- String s = "<dl><dt>" + AHTML.getLabelStr(labelFont, getLabel() + ": ") + "<dt><ul type=\"disc\">";
- for (Object xItem : getSelected()) {
- s += "<li>" + xItem;
- }
-
- return s + "</ul></dl>";
- }
-
- /**
- * @param grabHorizontal The grabHorizontal to set.
- */
- public void setGrabHorizontal(boolean grabHorizontal) {
- this.grabHorizontal = grabHorizontal;
- }
-
- public boolean isMultiSelect() {
- return multiSelect;
- }
-
- public void setMultiSelect(boolean multiSelect) {
- this.multiSelect = multiSelect;
- }
-
- @Override
- public Object getData() {
- return getSelected();
- }
-
- public void setDefaultSelected(Object defaultSelectedObject) {
- this.defaultSelectedObject = defaultSelectedObject;
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Table;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XListViewer extends XWidget {
+
+ // XListViewer uses a table so images can be used. SWT doesn't support images in ListViewer
+ private TableViewer listViewer;
+ private Menu listMenu;
+ private Composite parent;
+ private Composite composite;
+ private int requiredMinSelected = 0;
+ private int requiredMaxSelected = 0;
+ private boolean grabHorizontal = false;
+ private boolean multiSelect = false;
+ private Object defaultSelectedObject;
+
+ protected SelectionListener listListener = new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ handleSelection();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ };
+ private Collection<Object> input;
+ private IContentProvider contentProvider;
+ private ILabelProvider labelProvider;
+ private ViewerSorter sorter;
+ private int widthHint;
+ private int heightHint;
+
+ public XListViewer(String displayLabel) {
+ this(displayLabel, "list", "");
+ }
+
+ public XListViewer() {
+ this("List", "list", "");
+ }
+
+ public XListViewer(String displayLabel, String xmlRoot, String xmlSubRoot) {
+ super(displayLabel, xmlRoot, xmlSubRoot);
+ listMenu = null;
+ }
+
+ @Override
+ public Control getControl() {
+ return listViewer.getControl();
+ }
+
+ /**
+ * @param listMenu The listMenu to set.
+ */
+ public void setListMenu(Menu listMenu) {
+ this.listMenu = listMenu;
+ }
+
+ public void setContentProvider(IContentProvider contentProvider) {
+ this.contentProvider = contentProvider;
+ }
+
+ public void setLabelProvider(ILabelProvider labelProvider) {
+ this.labelProvider = labelProvider;
+ if (listViewer != null) {
+ listViewer.setLabelProvider(labelProvider);
+ }
+ }
+
+ public void setSorter(ViewerSorter sorter) {
+ this.sorter = sorter;
+ }
+
+ public void setInput(Collection<Object> input) {
+ this.input = input;
+ if (listViewer != null) {
+ listViewer.setInput(input);
+ }
+ }
+
+ /**
+ * @param input
+ */
+ public void setInput(Object input) {
+ if (listViewer != null) {
+ listViewer.setInput(input);
+ }
+ }
+
+ public Object getInput() {
+ return listViewer.getInput();
+ }
+
+ public Collection<Object> getCollectionInput() {
+ return input;
+ }
+
+ public void setInputArtifacts(Collection<? extends Artifact> arts) {
+ ArrayList<Object> objs = new ArrayList<Object>();
+ objs.addAll(arts);
+ setInput(objs);
+ }
+
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ listViewer.addSelectionChangedListener(listener);
+ }
+
+ public void setHints(int widthHint, int heightHint) {
+ this.widthHint = widthHint;
+ this.heightHint = heightHint;
+ }
+
+ /**
+ * Create List Widgets. Widgets Created: List: horizonatalSpan takes up 2 columns; horizontalSpan must be >=2
+ */
+ @Override
+ protected void createControls(Composite parent, int horizontalSpan) {
+
+ this.parent = parent;
+ composite = null;
+
+ if (!verticalLabel && (horizontalSpan < 2)) {
+ horizontalSpan = 2;
+ } else if (verticalLabel) {
+ horizontalSpan = 1;
+ }
+
+ if (isDisplayLabel() && verticalLabel) {
+ composite = new Composite(parent, SWT.NONE);
+ // composite.setBackground(Displays.getSystemColor(SWT.COLOR_CYAN));
+ composite.setLayout(new GridLayout(1, false));
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.horizontalSpan = 2;
+ gd.grabExcessHorizontalSpace = true;
+ gd.grabExcessVerticalSpace = true;
+ composite.setLayoutData(gd);
+ } else {
+ composite = parent;
+ }
+
+ // Create List Widgets
+ if (isDisplayLabel()) {
+ labelWidget = new Label(composite, SWT.NONE);
+ labelWidget.setText(getLabel() + ":");
+ if (getToolTip() != null) {
+ labelWidget.setToolTipText(getToolTip());
+ }
+ }
+
+ listViewer =
+ new TableViewer(composite,
+ (multiSelect ? SWT.MULTI : SWT.SINGLE) | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
+ listViewer.setContentProvider(contentProvider);
+ listViewer.setLabelProvider(labelProvider);
+ if (sorter != null) {
+ listViewer.setSorter(sorter);
+ }
+ listViewer.setInput(input);
+ listViewer.getTable().setMenu(listMenu);
+ listViewer.getTable().addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ handleSelection();
+ }
+ });
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.verticalSpan = 10;
+ if (grabHorizontal) {
+ gd.grabExcessHorizontalSpace = true;
+ }
+ if (widthHint > 0) {
+ gd.widthHint = widthHint;
+ }
+ if (heightHint > 0) {
+ gd.heightHint = heightHint;
+ }
+ gd.grabExcessVerticalSpace = true;
+ listViewer.getTable().setLayoutData(gd);
+ listViewer.getTable().addSelectionListener(listListener);
+
+ if (defaultSelectedObject != null) {
+ setSelected(defaultSelectedObject);
+ }
+ updateListWidget();
+ }
+
+ @Override
+ public void dispose() {
+ labelWidget.dispose();
+ listViewer.getTable().dispose();
+ if (composite != null && !composite.isDisposed()) {
+ composite.dispose();
+ }
+ if (parent != null && !parent.isDisposed()) {
+ parent.layout();
+ }
+ }
+
+ @Override
+ public void setFocus() {
+ }
+
+ /**
+ * Don't need this since overriding toReport and toXml
+ */
+ @Override
+ public String getXmlData() {
+ return "";
+ }
+
+ /**
+ * Don't need this since overriding setFromXml
+ */
+ @Override
+ public void setXmlData(String str) {
+ return;
+ }
+
+ private void handleSelection() {
+ validate();
+ notifyXModifiedListeners();
+ }
+
+ @Override
+ public void refresh() {
+ updateListWidget();
+ }
+
+ public void addSelectionListener(SelectionListener selectionListener) {
+ listViewer.getTable().addSelectionListener(selectionListener);
+ }
+
+ @SuppressWarnings("unchecked")
+ public ArrayList<Object> getSelected() {
+ ArrayList<Object> selected = new ArrayList<Object>();
+ IStructuredSelection selection = (IStructuredSelection) listViewer.getSelection();
+ Iterator i = selection.iterator();
+ while (i.hasNext()) {
+ selected.add(i.next());
+ }
+ return selected;
+ }
+
+ @Override
+ public void setFromXml(String xml) {
+ }
+
+ public Table getTable() {
+ return listViewer.getTable();
+ }
+
+ public TableViewer getTableViewer() {
+ return listViewer;
+ }
+
+ protected void updateListWidget() {
+ listViewer.refresh();
+ validate();
+ }
+
+ public void add(Object object) {
+ if (!input.contains(object)) {
+ input.add(object);
+ }
+ }
+
+ public void add(Object[] objects) {
+ for (Object object : objects) {
+ add(object);
+ }
+ }
+
+ public void add(Collection<Object> objects) {
+ // to ensure no duplicates
+ input.removeAll(objects);
+
+ if (!input.containsAll(objects)) {
+ input.addAll(objects);
+ }
+ }
+
+ public void setSelected(ArrayList<Object> selected) {
+ setSelected(new StructuredSelection(selected.toArray(new Object[selected.size()])));
+ }
+
+ public void setSelected(Object selected) {
+ setSelected(new StructuredSelection(selected));
+ }
+
+ private void setSelected(StructuredSelection selection) {
+ listViewer.setSelection(selection);
+ updateListWidget();
+ }
+
+ @Override
+ public IStatus isValid() {
+ if (!isRequiredEntry()) {
+ return Status.OK_STATUS;
+ }
+ int size = getSelected().size();
+ if (requiredMaxSelected != 0) {
+ if ((size >= requiredMinSelected) && (size <= requiredMaxSelected)) {
+ return Status.OK_STATUS;
+ } else if (size < requiredMinSelected) {
+ return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID,
+ getLabel() + " must have at least " + requiredMinSelected + " selected.");
+ } else if (size < requiredMaxSelected) {
+ return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID,
+ getLabel() + " should only have " + requiredMaxSelected + " selected.");
+ } else {
+ return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, getLabel());
+ }
+ }
+ if (size == 0) {
+ return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, getLabel() + " must be selected.");
+ }
+ return Status.OK_STATUS;
+
+ }
+
+ /**
+ * Minimum number of selected items that makes this widget valid
+ *
+ * @param minSelected -
+ * @param maxSelected =
+ */
+ public void setRequiredSelected(int minSelected, int maxSelected) {
+ this.requiredMinSelected = minSelected;
+ this.requiredMaxSelected = maxSelected;
+ setRequiredEntry(true);
+ }
+
+ @Override
+ public void setRequiredEntry(boolean requiredEntry) {
+ super.setRequiredEntry(requiredEntry);
+ if (!requiredEntry) {
+ this.requiredMinSelected = 1;
+ this.requiredMaxSelected = 1;
+ }
+ }
+
+ @Override
+ public String getReportData() {
+ String s = "\n";
+ for (Object obj : getSelected()) {
+ s = s + " - " + obj + "\n";
+ }
+ s = s.replaceAll("\n+$", "");
+ return s;
+ }
+
+ @Override
+ public String toXml() {
+ return toXml(getXmlRoot(), getXmlSubRoot());
+ }
+
+ @Override
+ public String toXml(String xmlRoot, String xmlSubRoot) {
+ return "";
+ }
+
+ @Override
+ public String toHTML(String labelFont) {
+ String s = "<dl><dt>" + AHTML.getLabelStr(labelFont, getLabel() + ": ") + "<dt><ul type=\"disc\">";
+ for (Object xItem : getSelected()) {
+ s += "<li>" + xItem;
+ }
+
+ return s + "</ul></dl>";
+ }
+
+ /**
+ * @param grabHorizontal The grabHorizontal to set.
+ */
+ public void setGrabHorizontal(boolean grabHorizontal) {
+ this.grabHorizontal = grabHorizontal;
+ }
+
+ public boolean isMultiSelect() {
+ return multiSelect;
+ }
+
+ public void setMultiSelect(boolean multiSelect) {
+ this.multiSelect = multiSelect;
+ }
+
+ @Override
+ public Object getData() {
+ return getSelected();
+ }
+
+ public void setDefaultSelected(Object defaultSelectedObject) {
+ this.defaultSelectedObject = defaultSelectedObject;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XOption.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XOption.java
index 37863091f88..3bf6eb8b3c1 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XOption.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XOption.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets;
-
-/**
- * @author Donald G. Dunne
- */
-public enum XOption {
- NONE,
-
- REQUIRED,
- NOT_REQUIRED,
- ENABLED,
- NOT_ENABLED,
- EDITABLE,
- NOT_EDITABLE,
- MULTI_SELECT,
- HORIZONTAL_LABEL,
- VERTICAL_LABEL,
- LABEL_AFTER,
- LABEL_BEFORE,
- NO_LABEL,
- SORTED,
- ADD_DEFAULT_VALUE,
- NO_DEFAULT_VALUE,
- BEGIN_COMPOSITE_4,
- BEGIN_COMPOSITE_6,
- BEGIN_COMPOSITE_8,
- BEGIN_COMPOSITE_10,
- BEGIN_GROUP_COMPOSITE_4,
- BEGIN_GROUP_COMPOSITE_6,
- BEGIN_GROUP_COMPOSITE_8,
- BEGIN_GROUP_COMPOSITE_10,
- END_COMPOSITE,
-
- // Fill Options
- FILL_NONE,
- FILL_HORIZONTALLY,
- FILL_VERTICALLY,
-
- // Align Options
- ALIGN_LEFT,
- ALIGN_RIGHT,
- ALIGN_CENTER;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+/**
+ * @author Donald G. Dunne
+ */
+public enum XOption {
+ NONE,
+
+ REQUIRED,
+ NOT_REQUIRED,
+ ENABLED,
+ NOT_ENABLED,
+ EDITABLE,
+ NOT_EDITABLE,
+ MULTI_SELECT,
+ HORIZONTAL_LABEL,
+ VERTICAL_LABEL,
+ LABEL_AFTER,
+ LABEL_BEFORE,
+ NO_LABEL,
+ SORTED,
+ ADD_DEFAULT_VALUE,
+ NO_DEFAULT_VALUE,
+ BEGIN_COMPOSITE_4,
+ BEGIN_COMPOSITE_6,
+ BEGIN_COMPOSITE_8,
+ BEGIN_COMPOSITE_10,
+ BEGIN_GROUP_COMPOSITE_4,
+ BEGIN_GROUP_COMPOSITE_6,
+ BEGIN_GROUP_COMPOSITE_8,
+ BEGIN_GROUP_COMPOSITE_10,
+ END_COMPOSITE,
+
+ // Fill Options
+ FILL_NONE,
+ FILL_HORIZONTALLY,
+ FILL_VERTICALLY,
+
+ // Align Options
+ ALIGN_LEFT,
+ ALIGN_RIGHT,
+ ALIGN_CENTER;
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XOptionHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XOptionHandler.java
index 5a84b110012..4b7e54e17f1 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XOptionHandler.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XOptionHandler.java
@@ -1,109 +1,109 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * @author Donald G. Dunne
- */
-public class XOptionHandler {
-
- private Set<XOption> xOptions = new HashSet<XOption>();
-
- public XOptionHandler(XOption... xOption) {
- set(xOption);
- }
-
- public static Collection<XOption> getCollection(XOption... ats) {
- Set<XOption> items = new HashSet<XOption>();
- for (XOption item : ats) {
- items.add(item);
- }
- return items;
- }
-
- public void add(XOption xOption) {
- if (xOption.name().startsWith("ALIGN_")) {
- xOptions.remove(XOption.ALIGN_CENTER);
- xOptions.remove(XOption.ALIGN_LEFT);
- xOptions.remove(XOption.ALIGN_RIGHT);
- } else if (xOption == XOption.HORIZONTAL_LABEL) {
- xOptions.remove(XOption.VERTICAL_LABEL);
- } else if (xOption == XOption.EDITABLE) {
- xOptions.remove(XOption.NOT_EDITABLE);
- } else if (xOption == XOption.NOT_EDITABLE) {
- xOptions.remove(XOption.EDITABLE);
- } else if (xOption == XOption.NOT_REQUIRED) {
- xOptions.remove(XOption.REQUIRED);
- } else if (xOption == XOption.REQUIRED) {
- xOptions.remove(XOption.NOT_REQUIRED);
- } else if (xOption == XOption.NOT_ENABLED) {
- xOptions.remove(XOption.ENABLED);
- } else if (xOption == XOption.ENABLED) {
- xOptions.remove(XOption.NOT_ENABLED);
- } else if (xOption == XOption.FILL_NONE) {
- xOptions.remove(XOption.FILL_HORIZONTALLY);
- xOptions.remove(XOption.FILL_VERTICALLY);
- } else if (xOption == XOption.VERTICAL_LABEL) {
- xOptions.remove(XOption.HORIZONTAL_LABEL);
- }
- xOptions.add(xOption);
- }
-
- public void add(XOption... xOption) {
- for (XOption xOpt : xOption) {
- add(xOpt);
- }
- }
-
- public void add(Collection<XOption> xOption) {
- for (XOption xOpt : xOption) {
- add(xOpt);
- }
- }
-
- public boolean contains(XOption xOption) {
- return xOptions.contains(xOption);
- }
-
- /**
- * @return the xOptions
- */
- public Set<XOption> getXOptions() {
- return xOptions;
- }
-
- /**
- * @param options the xOptions to set
- */
- public void set(Set<XOption> options) {
- this.xOptions.clear();
- // Must go through the add method to ensure values set properly
- for (XOption xOption : options) {
- add(xOption);
- }
- }
-
- /**
- * @param options the xOptions to set
- */
- public void set(XOption options[]) {
- this.xOptions.clear();
- // Must go through the add method to ensure values set properly
- for (XOption xOption : options) {
- add(xOption);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XOptionHandler {
+
+ private Set<XOption> xOptions = new HashSet<XOption>();
+
+ public XOptionHandler(XOption... xOption) {
+ set(xOption);
+ }
+
+ public static Collection<XOption> getCollection(XOption... ats) {
+ Set<XOption> items = new HashSet<XOption>();
+ for (XOption item : ats) {
+ items.add(item);
+ }
+ return items;
+ }
+
+ public void add(XOption xOption) {
+ if (xOption.name().startsWith("ALIGN_")) {
+ xOptions.remove(XOption.ALIGN_CENTER);
+ xOptions.remove(XOption.ALIGN_LEFT);
+ xOptions.remove(XOption.ALIGN_RIGHT);
+ } else if (xOption == XOption.HORIZONTAL_LABEL) {
+ xOptions.remove(XOption.VERTICAL_LABEL);
+ } else if (xOption == XOption.EDITABLE) {
+ xOptions.remove(XOption.NOT_EDITABLE);
+ } else if (xOption == XOption.NOT_EDITABLE) {
+ xOptions.remove(XOption.EDITABLE);
+ } else if (xOption == XOption.NOT_REQUIRED) {
+ xOptions.remove(XOption.REQUIRED);
+ } else if (xOption == XOption.REQUIRED) {
+ xOptions.remove(XOption.NOT_REQUIRED);
+ } else if (xOption == XOption.NOT_ENABLED) {
+ xOptions.remove(XOption.ENABLED);
+ } else if (xOption == XOption.ENABLED) {
+ xOptions.remove(XOption.NOT_ENABLED);
+ } else if (xOption == XOption.FILL_NONE) {
+ xOptions.remove(XOption.FILL_HORIZONTALLY);
+ xOptions.remove(XOption.FILL_VERTICALLY);
+ } else if (xOption == XOption.VERTICAL_LABEL) {
+ xOptions.remove(XOption.HORIZONTAL_LABEL);
+ }
+ xOptions.add(xOption);
+ }
+
+ public void add(XOption... xOption) {
+ for (XOption xOpt : xOption) {
+ add(xOpt);
+ }
+ }
+
+ public void add(Collection<XOption> xOption) {
+ for (XOption xOpt : xOption) {
+ add(xOpt);
+ }
+ }
+
+ public boolean contains(XOption xOption) {
+ return xOptions.contains(xOption);
+ }
+
+ /**
+ * @return the xOptions
+ */
+ public Set<XOption> getXOptions() {
+ return xOptions;
+ }
+
+ /**
+ * @param options the xOptions to set
+ */
+ public void set(Set<XOption> options) {
+ this.xOptions.clear();
+ // Must go through the add method to ensure values set properly
+ for (XOption xOption : options) {
+ add(xOption);
+ }
+ }
+
+ /**
+ * @param options the xOptions to set
+ */
+ public void set(XOption options[]) {
+ this.xOptions.clear();
+ // Must go through the add method to ensure values set properly
+ for (XOption xOption : options) {
+ add(xOption);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XSelectFromDialog.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XSelectFromDialog.java
index 5d52ee69181..7e1b526464f 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XSelectFromDialog.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XSelectFromDialog.java
@@ -1,214 +1,214 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-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.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.util.filteredTree.MinMaxOSEECheckedFilteredTreeDialog;
-import org.eclipse.osee.framework.ui.swt.ALayout;
-import org.eclipse.osee.framework.ui.swt.Displays;
-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.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-
-/**
- * @author Roberto E. Escobar
- */
-public abstract class XSelectFromDialog<T> extends XText {
-
- private final List<T> selected;
- private final List<T> input;
- private int minSelectionRequired, maxSelectionRequired = 1;
- private Button selectionButton;
-
- public XSelectFromDialog(String displayLabel, String xmlRoot) {
- super(displayLabel, xmlRoot);
- this.selected = new ArrayList<T>();
- this.input = new ArrayList<T>();
- setToolTip("Click the button on the left to change the current selection.");
- }
-
- public XSelectFromDialog(String displayLabel) {
- this(displayLabel, "");
- }
-
- public void setRequiredSelection(int minSelectionRequired, int maxSelectionRequired) throws OseeArgumentException {
- if (minSelectionRequired < 0) {
- throw new OseeArgumentException("Min Number of Selection must be greater than or equal to 0");
- }
- if (maxSelectionRequired < 1) {
- throw new OseeArgumentException("Max Number of Selection must be at least 1");
- }
-
- if (maxSelectionRequired < minSelectionRequired) {
- throw new OseeArgumentException(String.format("Invalid required number of selections [%s] < [%s]",
- maxSelectionRequired, minSelectionRequired));
- }
- this.minSelectionRequired = minSelectionRequired;
- this.maxSelectionRequired = maxSelectionRequired;
- }
-
- @Override
- protected int getTextStyle() {
- return SWT.READ_ONLY | SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL;
- }
-
- @Override
- public void setToolTip(String toolTip) {
- if (Strings.isValid(toolTip)) {
- super.setToolTip(toolTip);
- }
- }
-
- @Override
- public Object getData() {
- return getSelected();
- }
-
- @Override
- public void setEditable(boolean editable) {
- super.setEditable(editable);
- if (Widgets.isAccessible(selectionButton)) {
- selectionButton.setEnabled(editable);
- }
- }
-
- @Override
- public void createControls(final Composite parent, int horizontalSpan, boolean fillText) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(ALayout.getZeroMarginLayout(3, false));
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
-
- Label label = getLabelWidget();
- if (label != null) {
- label.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
- }
- setVerticalLabel(true);
- super.createControls(composite, horizontalSpan, fillText);
-
- getStyledText().setEditable(false);
- getStyledText().setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
-
- selectionButton = new Button(composite, SWT.PUSH);
- selectionButton.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
- selectionButton.setText("Set...");
- selectionButton.setEnabled(isEditable());
- selectionButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (openSelectionDialog()) {
- notifyXModifiedListeners();
- }
- }
- });
- addToolTip(composite, getToolTip());
- getStyledText().setBackground(Displays.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
- refresh();
- }
-
- private void addToolTip(Control control, String toolTipText) {
- if (Strings.isValid(toolTipText)) {
- control.setToolTipText(toolTipText);
- if (control instanceof Composite) {
- for (Control child : ((Composite) control).getChildren()) {
- child.setToolTipText(toolTipText);
- }
- }
- }
- }
-
- public void setSelectableItems(Collection<T> input) {
- this.input.clear();
- this.input.addAll(input);
- }
-
- public List<T> getSelectableItems() {
- return new ArrayList<T>(input);
- }
-
- public void setSelected(Collection<T> input) {
- this.selected.clear();
- this.selected.addAll(input);
- setText(Collections.toString("\n", selected));
- }
-
- public List<T> getSelected() {
- return new ArrayList<T>(selected);
- }
-
- public abstract MinMaxOSEECheckedFilteredTreeDialog createDialog();
-
- @SuppressWarnings("unchecked")
- protected boolean openSelectionDialog() {
- boolean selectedChanged = false;
- if (getSelectableItems().isEmpty()) {
- MessageDialog.openInformation(Displays.getActiveShell(), getLabel(),
- "Could not find items available to select from.");
- } else {
- try {
- MinMaxOSEECheckedFilteredTreeDialog dialog = createDialog();
- Set<T> choices = new HashSet<T>(selected);
- choices.addAll(input);
- dialog.setInput(choices);
- dialog.setInitialSelections(getSelected());
-
- int result = dialog.open();
- if (result == 0) {
- List<T> dialogSelections = new ArrayList<T>();
- for (Object obj : dialog.getResult()) {
- dialogSelections.add((T) obj);
- }
-
- // boolean wasDifference = !Collections.setComplement(selected, dialogSelections).isEmpty();
- // wasDifference &= !Collections.setComplement(dialogSelections, selected).isEmpty();
- // if (wasDifference) {
- setSelected(dialogSelections);
- selectedChanged = true;
- // }
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- return selectedChanged;
- }
-
- /**
- * @return the minSelectionRequired
- */
- public int getMinSelectionRequired() {
- return minSelectionRequired;
- }
-
- /**
- * @return the maxSelectionRequired
- */
- public int getMaxSelectionRequired() {
- return maxSelectionRequired;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+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.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.util.filteredTree.MinMaxOSEECheckedFilteredTreeDialog;
+import org.eclipse.osee.framework.ui.swt.ALayout;
+import org.eclipse.osee.framework.ui.swt.Displays;
+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.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public abstract class XSelectFromDialog<T> extends XText {
+
+ private final List<T> selected;
+ private final List<T> input;
+ private int minSelectionRequired, maxSelectionRequired = 1;
+ private Button selectionButton;
+
+ public XSelectFromDialog(String displayLabel, String xmlRoot) {
+ super(displayLabel, xmlRoot);
+ this.selected = new ArrayList<T>();
+ this.input = new ArrayList<T>();
+ setToolTip("Click the button on the left to change the current selection.");
+ }
+
+ public XSelectFromDialog(String displayLabel) {
+ this(displayLabel, "");
+ }
+
+ public void setRequiredSelection(int minSelectionRequired, int maxSelectionRequired) throws OseeArgumentException {
+ if (minSelectionRequired < 0) {
+ throw new OseeArgumentException("Min Number of Selection must be greater than or equal to 0");
+ }
+ if (maxSelectionRequired < 1) {
+ throw new OseeArgumentException("Max Number of Selection must be at least 1");
+ }
+
+ if (maxSelectionRequired < minSelectionRequired) {
+ throw new OseeArgumentException(String.format("Invalid required number of selections [%s] < [%s]",
+ maxSelectionRequired, minSelectionRequired));
+ }
+ this.minSelectionRequired = minSelectionRequired;
+ this.maxSelectionRequired = maxSelectionRequired;
+ }
+
+ @Override
+ protected int getTextStyle() {
+ return SWT.READ_ONLY | SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL;
+ }
+
+ @Override
+ public void setToolTip(String toolTip) {
+ if (Strings.isValid(toolTip)) {
+ super.setToolTip(toolTip);
+ }
+ }
+
+ @Override
+ public Object getData() {
+ return getSelected();
+ }
+
+ @Override
+ public void setEditable(boolean editable) {
+ super.setEditable(editable);
+ if (Widgets.isAccessible(selectionButton)) {
+ selectionButton.setEnabled(editable);
+ }
+ }
+
+ @Override
+ public void createControls(final Composite parent, int horizontalSpan, boolean fillText) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(ALayout.getZeroMarginLayout(3, false));
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
+
+ Label label = getLabelWidget();
+ if (label != null) {
+ label.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
+ }
+ setVerticalLabel(true);
+ super.createControls(composite, horizontalSpan, fillText);
+
+ getStyledText().setEditable(false);
+ getStyledText().setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
+
+ selectionButton = new Button(composite, SWT.PUSH);
+ selectionButton.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
+ selectionButton.setText("Set...");
+ selectionButton.setEnabled(isEditable());
+ selectionButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (openSelectionDialog()) {
+ notifyXModifiedListeners();
+ }
+ }
+ });
+ addToolTip(composite, getToolTip());
+ getStyledText().setBackground(Displays.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
+ refresh();
+ }
+
+ private void addToolTip(Control control, String toolTipText) {
+ if (Strings.isValid(toolTipText)) {
+ control.setToolTipText(toolTipText);
+ if (control instanceof Composite) {
+ for (Control child : ((Composite) control).getChildren()) {
+ child.setToolTipText(toolTipText);
+ }
+ }
+ }
+ }
+
+ public void setSelectableItems(Collection<T> input) {
+ this.input.clear();
+ this.input.addAll(input);
+ }
+
+ public List<T> getSelectableItems() {
+ return new ArrayList<T>(input);
+ }
+
+ public void setSelected(Collection<T> input) {
+ this.selected.clear();
+ this.selected.addAll(input);
+ setText(Collections.toString("\n", selected));
+ }
+
+ public List<T> getSelected() {
+ return new ArrayList<T>(selected);
+ }
+
+ public abstract MinMaxOSEECheckedFilteredTreeDialog createDialog();
+
+ @SuppressWarnings("unchecked")
+ protected boolean openSelectionDialog() {
+ boolean selectedChanged = false;
+ if (getSelectableItems().isEmpty()) {
+ MessageDialog.openInformation(Displays.getActiveShell(), getLabel(),
+ "Could not find items available to select from.");
+ } else {
+ try {
+ MinMaxOSEECheckedFilteredTreeDialog dialog = createDialog();
+ Set<T> choices = new HashSet<T>(selected);
+ choices.addAll(input);
+ dialog.setInput(choices);
+ dialog.setInitialSelections(getSelected());
+
+ int result = dialog.open();
+ if (result == 0) {
+ List<T> dialogSelections = new ArrayList<T>();
+ for (Object obj : dialog.getResult()) {
+ dialogSelections.add((T) obj);
+ }
+
+ // boolean wasDifference = !Collections.setComplement(selected, dialogSelections).isEmpty();
+ // wasDifference &= !Collections.setComplement(dialogSelections, selected).isEmpty();
+ // if (wasDifference) {
+ setSelected(dialogSelections);
+ selectedChanged = true;
+ // }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ return selectedChanged;
+ }
+
+ /**
+ * @return the minSelectionRequired
+ */
+ public int getMinSelectionRequired() {
+ return minSelectionRequired;
+ }
+
+ /**
+ * @return the maxSelectionRequired
+ */
+ public int getMaxSelectionRequired() {
+ return maxSelectionRequired;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XSelectFromMultiChoiceBranch.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XSelectFromMultiChoiceBranch.java
index 1ef023079ae..322467ecde1 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XSelectFromMultiChoiceBranch.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XSelectFromMultiChoiceBranch.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.framework.ui.skynet.widgets;
-
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.ui.skynet.branch.BranchCheckTreeDialog;
-import org.eclipse.osee.framework.ui.skynet.util.filteredTree.MinMaxOSEECheckedFilteredTreeDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @author Roberto E. Escobar
- */
-public class XSelectFromMultiChoiceBranch extends XSelectFromDialog<Branch> {
-
- public XSelectFromMultiChoiceBranch(String displayLabel) {
- super(displayLabel);
- }
-
- @Override
- public void createControls(Composite parent, int horizontalSpan, boolean fillText) {
- super.createControls(parent, horizontalSpan, fillText);
- getStyledText().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- }
-
- @Override
- public MinMaxOSEECheckedFilteredTreeDialog createDialog() {
- return new BranchCheckTreeDialog(getLabel(), "Select from the items below", 1, Integer.MAX_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.framework.ui.skynet.widgets;
+
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.ui.skynet.branch.BranchCheckTreeDialog;
+import org.eclipse.osee.framework.ui.skynet.util.filteredTree.MinMaxOSEECheckedFilteredTreeDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class XSelectFromMultiChoiceBranch extends XSelectFromDialog<Branch> {
+
+ public XSelectFromMultiChoiceBranch(String displayLabel) {
+ super(displayLabel);
+ }
+
+ @Override
+ public void createControls(Composite parent, int horizontalSpan, boolean fillText) {
+ super.createControls(parent, horizontalSpan, fillText);
+ getStyledText().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ }
+
+ @Override
+ public MinMaxOSEECheckedFilteredTreeDialog createDialog() {
+ return new BranchCheckTreeDialog(getLabel(), "Select from the items below", 1, Integer.MAX_VALUE);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XSelectFromMultiChoiceDam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XSelectFromMultiChoiceDam.java
index 352d7aa9491..dc837e982b9 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XSelectFromMultiChoiceDam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XSelectFromMultiChoiceDam.java
@@ -1,112 +1,112 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets;
-
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-import org.eclipse.osee.framework.jdk.core.util.Collections;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
-import org.eclipse.osee.framework.skynet.core.validation.IOseeValidator;
-import org.eclipse.osee.framework.skynet.core.validation.OseeValidator;
-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.util.ArtifactNameSorter;
-import org.eclipse.osee.framework.ui.skynet.util.filteredTree.MinMaxOSEECheckedFilteredTreeDialog;
-import org.eclipse.osee.framework.ui.skynet.util.filteredTree.SimpleCheckFilteredTreeDialog;
-
-/**
- * @author Roberto E. Escobar
- */
-public class XSelectFromMultiChoiceDam extends XSelectFromDialog<String> implements IAttributeWidget {
-
- private Artifact artifact;
- private String attributeTypeName;
-
- public XSelectFromMultiChoiceDam(String displayLabel) {
- super(displayLabel);
- this.artifact = null;
- }
-
- @Override
- public String getAttributeType() {
- return attributeTypeName;
- }
-
- @Override
- public void setAttributeType(Artifact artifact, String attributeTypeName) throws OseeCoreException {
- this.artifact = artifact;
- this.attributeTypeName = attributeTypeName;
- AttributeType attributeType = AttributeTypeManager.getType(attributeTypeName);
- int minOccurrence = attributeType.getMinOccurrences();
- int maxOccurrence = attributeType.getMaxOccurrences();
-
- setRequiredSelection(minOccurrence, maxOccurrence);
- setSelected(getStored());
- setRequiredEntry(true);
- }
-
- @Override
- public MinMaxOSEECheckedFilteredTreeDialog createDialog() {
- SimpleCheckFilteredTreeDialog dialog =
- new SimpleCheckFilteredTreeDialog(getLabel(), "Select from the items below",
- new ArrayTreeContentProvider(), new LabelProvider(), new ArtifactNameSorter(),
- getMinSelectionRequired(), getMaxSelectionRequired());
- return dialog;
- }
-
- public Collection<String> getStored() throws OseeCoreException {
- return artifact.getAttributesToStringList(attributeTypeName);
- }
-
- @Override
- public Result isDirty() throws OseeCoreException {
- try {
- Collection<String> enteredValues = getSelected();
- Collection<String> storedValues = getStored();
- if (!Collections.isEqual(enteredValues, storedValues)) {
- return new Result(true, attributeTypeName + " is dirty");
- }
- } catch (NumberFormatException ex) {
- // do nothing
- }
- return Result.FalseResult;
- }
-
- @Override
- public void revert() throws OseeCoreException {
- setAttributeType(artifact, attributeTypeName);
- }
-
- @Override
- public void saveToArtifact() throws OseeCoreException {
- artifact.setAttributeValues(attributeTypeName, getSelected());
- }
-
- @Override
- public IStatus isValid() {
- IStatus status = super.isValid();
- if (status.isOK()) {
- List<String> items = getSelected();
- for (String item : items) {
- status = OseeValidator.getInstance().validate(IOseeValidator.SHORT, artifact, attributeTypeName, item);
- if (!status.isOK()) {
- break;
- }
- }
- }
- return status;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
+import org.eclipse.osee.framework.skynet.core.validation.IOseeValidator;
+import org.eclipse.osee.framework.skynet.core.validation.OseeValidator;
+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.util.ArtifactNameSorter;
+import org.eclipse.osee.framework.ui.skynet.util.filteredTree.MinMaxOSEECheckedFilteredTreeDialog;
+import org.eclipse.osee.framework.ui.skynet.util.filteredTree.SimpleCheckFilteredTreeDialog;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class XSelectFromMultiChoiceDam extends XSelectFromDialog<String> implements IAttributeWidget {
+
+ private Artifact artifact;
+ private String attributeTypeName;
+
+ public XSelectFromMultiChoiceDam(String displayLabel) {
+ super(displayLabel);
+ this.artifact = null;
+ }
+
+ @Override
+ public String getAttributeType() {
+ return attributeTypeName;
+ }
+
+ @Override
+ public void setAttributeType(Artifact artifact, String attributeTypeName) throws OseeCoreException {
+ this.artifact = artifact;
+ this.attributeTypeName = attributeTypeName;
+ AttributeType attributeType = AttributeTypeManager.getType(attributeTypeName);
+ int minOccurrence = attributeType.getMinOccurrences();
+ int maxOccurrence = attributeType.getMaxOccurrences();
+
+ setRequiredSelection(minOccurrence, maxOccurrence);
+ setSelected(getStored());
+ setRequiredEntry(true);
+ }
+
+ @Override
+ public MinMaxOSEECheckedFilteredTreeDialog createDialog() {
+ SimpleCheckFilteredTreeDialog dialog =
+ new SimpleCheckFilteredTreeDialog(getLabel(), "Select from the items below",
+ new ArrayTreeContentProvider(), new LabelProvider(), new ArtifactNameSorter(),
+ getMinSelectionRequired(), getMaxSelectionRequired());
+ return dialog;
+ }
+
+ public Collection<String> getStored() throws OseeCoreException {
+ return artifact.getAttributesToStringList(attributeTypeName);
+ }
+
+ @Override
+ public Result isDirty() throws OseeCoreException {
+ try {
+ Collection<String> enteredValues = getSelected();
+ Collection<String> storedValues = getStored();
+ if (!Collections.isEqual(enteredValues, storedValues)) {
+ return new Result(true, attributeTypeName + " is dirty");
+ }
+ } catch (NumberFormatException ex) {
+ // do nothing
+ }
+ return Result.FalseResult;
+ }
+
+ @Override
+ public void revert() throws OseeCoreException {
+ setAttributeType(artifact, attributeTypeName);
+ }
+
+ @Override
+ public void saveToArtifact() throws OseeCoreException {
+ artifact.setAttributeValues(attributeTypeName, getSelected());
+ }
+
+ @Override
+ public IStatus isValid() {
+ IStatus status = super.isValid();
+ if (status.isOK()) {
+ List<String> items = getSelected();
+ for (String item : items) {
+ status = OseeValidator.getInstance().validate(IOseeValidator.SHORT, artifact, attributeTypeName, item);
+ if (!status.isOK()) {
+ break;
+ }
+ }
+ }
+ return status;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XStackedDam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XStackedDam.java
index 9dceb47aae7..492f70bc37e 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XStackedDam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XStackedDam.java
@@ -1,289 +1,289 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-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.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-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.plugin.core.util.Jobs;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
-import org.eclipse.osee.framework.skynet.core.attribute.BinaryBackedAttribute;
-import org.eclipse.osee.framework.skynet.core.attribute.DateAttribute;
-import org.eclipse.osee.framework.skynet.core.attribute.FloatingPointAttribute;
-import org.eclipse.osee.framework.skynet.core.attribute.IntegerAttribute;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.progress.UIJob;
-
-public class XStackedDam extends XStackedWidget<String> implements IAttributeWidget {
- private Artifact artifact;
- private String attributeTypeName;
- private final Map<String, XWidget> xWidgets;
- private final XModifiedListener xModifiedListener;
-
- public XStackedDam(String displayLabel) {
- super(displayLabel);
- this.xWidgets = new LinkedHashMap<String, XWidget>();
- this.artifact = null;
- this.xModifiedListener = new XModifiedListener() {
- @Override
- public void widgetModified(XWidget widget) {
- notifyXModifiedListeners();
- };
- };
- }
-
- @Override
- public String getAttributeType() {
- return attributeTypeName;
- }
-
- @Override
- public void setAttributeType(Artifact artifact, String attributeTypeName) throws OseeCoreException {
- this.artifact = artifact;
- this.attributeTypeName = attributeTypeName;
- AttributeType attributeType = AttributeTypeManager.getType(attributeTypeName);
-
- int minOccurrence = attributeType.getMinOccurrences();
- int maxOccurrence = attributeType.getMaxOccurrences();
-
- if (minOccurrence == 0) {
- minOccurrence = 1;
- }
- setPageRange(minOccurrence, maxOccurrence);
- }
-
- @Override
- protected void createControls(Composite parent, int horizontalSpan) {
- super.createControls(parent, horizontalSpan);
- final Collection<String> values = new ArrayList<String>();
- try {
- values.addAll(getStored());
- for (int index = 0; index < values.size(); index++) {
- addPage("");
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- Job job = new UIJob("Update Stacked XText") {
-
- @Override
- public IStatus runInUIThread(IProgressMonitor monitor) {
- setNotificationsAllowed(false);
- Iterator<String> dataIterator = values.iterator();
- Iterator<XWidget> widgetIterator = xWidgets.values().iterator();
- while (dataIterator.hasNext() && widgetIterator.hasNext()) {
- XWidget widget = widgetIterator.next();
- if (widget instanceof XText) {
- ((XText) widget).set(dataIterator.next());
- } else if (widget instanceof XDate) {
- ((XDate) widget).setDate(toDate(dataIterator.next()));
- }
- }
- values.clear();
- setNotificationsAllowed(true);
- return Status.OK_STATUS;
- }
- };
- Jobs.startJob(job);
- }
-
- public List<String> getInput() {
- List<String> data = new ArrayList<String>();
- for (XWidget widget : xWidgets.values()) {
- if (widget instanceof XText) {
- data.add(((XText) widget).get());
- } else if (widget instanceof XDate) {
- Date date = ((XDate) widget).getDate();
- if (date != null) {
- data.add(String.valueOf(date.getTime()));
- }
- }
- }
- return data;
- }
-
- public Collection<String> getStored() throws OseeCoreException {
- return artifact.getAttributesToStringList(attributeTypeName);
- }
-
- @Override
- public Result isDirty() throws OseeCoreException {
- try {
- Collection<String> enteredValues = new ArrayList<String>();//getSelected();
- Collection<String> storedValues = getStored();
- if (!Collections.isEqual(enteredValues, storedValues)) {
- return new Result(true, attributeTypeName + " is dirty");
- }
- } catch (NumberFormatException ex) {
- // do nothing
- }
- return Result.FalseResult;
- }
-
- @Override
- public void revert() throws OseeCoreException {
- setAttributeType(artifact, attributeTypeName);
- }
-
- @Override
- public void saveToArtifact() throws OseeCoreException {
- artifact.setAttributeValues(attributeTypeName, getInput());
- }
-
- @Override
- protected void createPage(String id, Composite parent, String initialInput) {
- if (!xWidgets.containsKey(id)) {
- try {
- XWidget xWidget = getWidget(attributeTypeName, parent, initialInput);
- xWidget.setEditable(isEditable());
- xWidgets.put(id, xWidget);
-
- xWidget.addXModifiedListener(xModifiedListener);
- parent.layout();
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
-
- @Override
- protected void onRemovePage(String id) {
- xWidgets.remove(id);
- }
-
- @Override
- public IStatus isValid() {
- for (XWidget widget : xWidgets.values()) {
- IStatus status = widget.isValid();
- if (!status.isOK()) {
- return status;
- }
- }
- return Status.OK_STATUS;
- }
-
- @Override
- public void validate() {
- String id = getCurrentPageId();
- if (Strings.isValid(id)) {
- XWidget widget = xWidgets.get(id);
- widget.validate();
- }
- }
-
- private Date toDate(String value) {
- try {
- return new Date(Long.parseLong(value));
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return new Date();
- }
-
- private XWidget getWidget(String attributeType, Composite parent, String initialInput) throws OseeCoreException {
- XWidget xWidget = null;
- if (AttributeTypeManager.isBaseTypeCompatible(IntegerAttribute.class, attributeType)) {
- XInteger xInteger = new XInteger("");
- xInteger.setFillHorizontally(true);
- xInteger.createWidgets(getManagedForm(), parent, 2);
- if (Strings.isValid(initialInput)) {
- xInteger.setText(initialInput);
- }
- xWidget = xInteger;
- } else if (AttributeTypeManager.isBaseTypeCompatible(DateAttribute.class, attributeType)) {
- XDate xDate = new XDate("");
- xDate.setFillHorizontally(true);
- xDate.createWidgets(getManagedForm(), parent, 2);
- if (Strings.isValid(initialInput)) {
- xDate.setDate(toDate(initialInput));
- }
- xWidget = xDate;
- } else if (AttributeTypeManager.isBaseTypeCompatible(FloatingPointAttribute.class, attributeType)) {
- XFloat xFloat = new XFloat("");
- xFloat.setFillHorizontally(true);
- xFloat.createWidgets(getManagedForm(), parent, 2);
- if (Strings.isValid(initialInput)) {
- xFloat.setText(initialInput);
- }
- xWidget = xFloat;
- } else if (AttributeTypeManager.isBaseTypeCompatible(BinaryBackedAttribute.class, attributeType)) {
- XLabel xLabel = new XLabel("");
- xLabel.setFillHorizontally(true);
- xLabel.createWidgets(getManagedForm(), parent, 2);
- if (Strings.isValid(initialInput)) {
- xLabel.setLabel(initialInput);
- }
- xWidget = xLabel;
- }
-
- if (xWidget == null) {
- XText xTextWidget = new XTextInternalWidget("");
- if (Strings.isValid(initialInput)) {
- xTextWidget.setText(initialInput);
- }
- xTextWidget.addXTextSpellModifyDictionary(new SkynetSpellModifyDictionary());
- xTextWidget.setFillHorizontally(false);
- xTextWidget.setFillVertically(true);
- xTextWidget.createWidgets(getManagedForm(), parent, 2);
- xWidget = xTextWidget;
- }
- return xWidget;
- }
- private final class XTextInternalWidget extends XText {
-
- public XTextInternalWidget(String label) {
- super(label);
- }
-
- @Override
- protected int getTextStyle() {
- int styleBase = SWT.NONE;
- if (isEditable()) {
- styleBase |= SWT.READ_ONLY;
- }
- return styleBase | (fillVertically ? SWT.WRAP | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL : SWT.SINGLE);
- }
-
- @Override
- public void createControls(Composite parent, int horizontalSpan, boolean fillText) {
- super.createControls(parent, horizontalSpan, fillText);
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
- gd.widthHint = 200;
- gd.heightHint = 200;
- sText.setLayoutData(gd);
- sText.setWordWrap(true);
- sText.setEditable(isEditable());
- if (!isEditable()) {
- sText.setBackground(Displays.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+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.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+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.plugin.core.util.Jobs;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
+import org.eclipse.osee.framework.skynet.core.attribute.BinaryBackedAttribute;
+import org.eclipse.osee.framework.skynet.core.attribute.DateAttribute;
+import org.eclipse.osee.framework.skynet.core.attribute.FloatingPointAttribute;
+import org.eclipse.osee.framework.skynet.core.attribute.IntegerAttribute;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.progress.UIJob;
+
+public class XStackedDam extends XStackedWidget<String> implements IAttributeWidget {
+ private Artifact artifact;
+ private String attributeTypeName;
+ private final Map<String, XWidget> xWidgets;
+ private final XModifiedListener xModifiedListener;
+
+ public XStackedDam(String displayLabel) {
+ super(displayLabel);
+ this.xWidgets = new LinkedHashMap<String, XWidget>();
+ this.artifact = null;
+ this.xModifiedListener = new XModifiedListener() {
+ @Override
+ public void widgetModified(XWidget widget) {
+ notifyXModifiedListeners();
+ };
+ };
+ }
+
+ @Override
+ public String getAttributeType() {
+ return attributeTypeName;
+ }
+
+ @Override
+ public void setAttributeType(Artifact artifact, String attributeTypeName) throws OseeCoreException {
+ this.artifact = artifact;
+ this.attributeTypeName = attributeTypeName;
+ AttributeType attributeType = AttributeTypeManager.getType(attributeTypeName);
+
+ int minOccurrence = attributeType.getMinOccurrences();
+ int maxOccurrence = attributeType.getMaxOccurrences();
+
+ if (minOccurrence == 0) {
+ minOccurrence = 1;
+ }
+ setPageRange(minOccurrence, maxOccurrence);
+ }
+
+ @Override
+ protected void createControls(Composite parent, int horizontalSpan) {
+ super.createControls(parent, horizontalSpan);
+ final Collection<String> values = new ArrayList<String>();
+ try {
+ values.addAll(getStored());
+ for (int index = 0; index < values.size(); index++) {
+ addPage("");
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ Job job = new UIJob("Update Stacked XText") {
+
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ setNotificationsAllowed(false);
+ Iterator<String> dataIterator = values.iterator();
+ Iterator<XWidget> widgetIterator = xWidgets.values().iterator();
+ while (dataIterator.hasNext() && widgetIterator.hasNext()) {
+ XWidget widget = widgetIterator.next();
+ if (widget instanceof XText) {
+ ((XText) widget).set(dataIterator.next());
+ } else if (widget instanceof XDate) {
+ ((XDate) widget).setDate(toDate(dataIterator.next()));
+ }
+ }
+ values.clear();
+ setNotificationsAllowed(true);
+ return Status.OK_STATUS;
+ }
+ };
+ Jobs.startJob(job);
+ }
+
+ public List<String> getInput() {
+ List<String> data = new ArrayList<String>();
+ for (XWidget widget : xWidgets.values()) {
+ if (widget instanceof XText) {
+ data.add(((XText) widget).get());
+ } else if (widget instanceof XDate) {
+ Date date = ((XDate) widget).getDate();
+ if (date != null) {
+ data.add(String.valueOf(date.getTime()));
+ }
+ }
+ }
+ return data;
+ }
+
+ public Collection<String> getStored() throws OseeCoreException {
+ return artifact.getAttributesToStringList(attributeTypeName);
+ }
+
+ @Override
+ public Result isDirty() throws OseeCoreException {
+ try {
+ Collection<String> enteredValues = new ArrayList<String>();//getSelected();
+ Collection<String> storedValues = getStored();
+ if (!Collections.isEqual(enteredValues, storedValues)) {
+ return new Result(true, attributeTypeName + " is dirty");
+ }
+ } catch (NumberFormatException ex) {
+ // do nothing
+ }
+ return Result.FalseResult;
+ }
+
+ @Override
+ public void revert() throws OseeCoreException {
+ setAttributeType(artifact, attributeTypeName);
+ }
+
+ @Override
+ public void saveToArtifact() throws OseeCoreException {
+ artifact.setAttributeValues(attributeTypeName, getInput());
+ }
+
+ @Override
+ protected void createPage(String id, Composite parent, String initialInput) {
+ if (!xWidgets.containsKey(id)) {
+ try {
+ XWidget xWidget = getWidget(attributeTypeName, parent, initialInput);
+ xWidget.setEditable(isEditable());
+ xWidgets.put(id, xWidget);
+
+ xWidget.addXModifiedListener(xModifiedListener);
+ parent.layout();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+
+ @Override
+ protected void onRemovePage(String id) {
+ xWidgets.remove(id);
+ }
+
+ @Override
+ public IStatus isValid() {
+ for (XWidget widget : xWidgets.values()) {
+ IStatus status = widget.isValid();
+ if (!status.isOK()) {
+ return status;
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public void validate() {
+ String id = getCurrentPageId();
+ if (Strings.isValid(id)) {
+ XWidget widget = xWidgets.get(id);
+ widget.validate();
+ }
+ }
+
+ private Date toDate(String value) {
+ try {
+ return new Date(Long.parseLong(value));
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return new Date();
+ }
+
+ private XWidget getWidget(String attributeType, Composite parent, String initialInput) throws OseeCoreException {
+ XWidget xWidget = null;
+ if (AttributeTypeManager.isBaseTypeCompatible(IntegerAttribute.class, attributeType)) {
+ XInteger xInteger = new XInteger("");
+ xInteger.setFillHorizontally(true);
+ xInteger.createWidgets(getManagedForm(), parent, 2);
+ if (Strings.isValid(initialInput)) {
+ xInteger.setText(initialInput);
+ }
+ xWidget = xInteger;
+ } else if (AttributeTypeManager.isBaseTypeCompatible(DateAttribute.class, attributeType)) {
+ XDate xDate = new XDate("");
+ xDate.setFillHorizontally(true);
+ xDate.createWidgets(getManagedForm(), parent, 2);
+ if (Strings.isValid(initialInput)) {
+ xDate.setDate(toDate(initialInput));
+ }
+ xWidget = xDate;
+ } else if (AttributeTypeManager.isBaseTypeCompatible(FloatingPointAttribute.class, attributeType)) {
+ XFloat xFloat = new XFloat("");
+ xFloat.setFillHorizontally(true);
+ xFloat.createWidgets(getManagedForm(), parent, 2);
+ if (Strings.isValid(initialInput)) {
+ xFloat.setText(initialInput);
+ }
+ xWidget = xFloat;
+ } else if (AttributeTypeManager.isBaseTypeCompatible(BinaryBackedAttribute.class, attributeType)) {
+ XLabel xLabel = new XLabel("");
+ xLabel.setFillHorizontally(true);
+ xLabel.createWidgets(getManagedForm(), parent, 2);
+ if (Strings.isValid(initialInput)) {
+ xLabel.setLabel(initialInput);
+ }
+ xWidget = xLabel;
+ }
+
+ if (xWidget == null) {
+ XText xTextWidget = new XTextInternalWidget("");
+ if (Strings.isValid(initialInput)) {
+ xTextWidget.setText(initialInput);
+ }
+ xTextWidget.addXTextSpellModifyDictionary(new SkynetSpellModifyDictionary());
+ xTextWidget.setFillHorizontally(false);
+ xTextWidget.setFillVertically(true);
+ xTextWidget.createWidgets(getManagedForm(), parent, 2);
+ xWidget = xTextWidget;
+ }
+ return xWidget;
+ }
+ private final class XTextInternalWidget extends XText {
+
+ public XTextInternalWidget(String label) {
+ super(label);
+ }
+
+ @Override
+ protected int getTextStyle() {
+ int styleBase = SWT.NONE;
+ if (isEditable()) {
+ styleBase |= SWT.READ_ONLY;
+ }
+ return styleBase | (fillVertically ? SWT.WRAP | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL : SWT.SINGLE);
+ }
+
+ @Override
+ public void createControls(Composite parent, int horizontalSpan, boolean fillText) {
+ super.createControls(parent, horizontalSpan, fillText);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gd.widthHint = 200;
+ gd.heightHint = 200;
+ sText.setLayoutData(gd);
+ sText.setWordWrap(true);
+ sText.setEditable(isEditable());
+ if (!isEditable()) {
+ sText.setBackground(Displays.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XStackedWidget.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XStackedWidget.java
index 54ac2ea9c38..1bfe4ce34af 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XStackedWidget.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XStackedWidget.java
@@ -1,488 +1,488 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.jdk.core.util.Collections;
-import org.eclipse.osee.framework.jdk.core.util.GUID;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-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.StackedViewer;
-import org.eclipse.osee.framework.ui.swt.Widgets;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-
-public abstract class XStackedWidget<T> extends XLabel {
-
- private StackedControl stackedControl;
- private StyledText currentPageLabel;
- private Composite container;
- private Label messageLabel;
- private Label messageIcon;
- private int minPage;
- private int maxPage;
-
- public XStackedWidget(String displayLabel, String xmlRoot) {
- super(displayLabel, xmlRoot);
- setToolTip("Navigate pages by clicking forward and backward buttons.");
- minPage = 0;
- maxPage = 0;
- }
-
- @Override
- public void dispose() {
- stackedControl.dispose();
- super.dispose();
- }
-
- public XStackedWidget(String displayLabel) {
- this(displayLabel, "");
- }
-
- protected void setPageRange(int minPage, int maxPage) throws OseeArgumentException {
- if (minPage < 0) {
- throw new OseeArgumentException("Min Number of Pages must be greater than 0");
- }
- if (maxPage < 1) {
- throw new OseeArgumentException("Max Number of Pages must be at least 1");
- }
-
- if (maxPage < minPage) {
- throw new OseeArgumentException(
- String.format("Invalid required number of pages [%s] < [%s]", maxPage, minPage));
- }
- this.minPage = minPage;
- this.maxPage = maxPage;
- }
-
- @Override
- public Control getControl() {
- if (stackedControl == null) {
- return null;
- }
- return stackedControl.stackedViewer;
- }
-
- @Override
- public void setToolTip(String toolTip) {
- if (Strings.isValid(toolTip)) {
- super.setToolTip(toolTip);
- }
- }
-
- @Override
- public void refresh() {
- updateCurrentPageLabel();
- stackedControl.refresh();
- }
-
- @Override
- protected void createControls(final Composite parent, int horizontalSpan) {
- container = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(isDisplayLabel() ? 2 : 1, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.marginRight = 0;
- container.setLayout(layout);
- container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- if (isDisplayLabel() && Strings.isValid(getLabel())) {
- labelWidget = new Label(container, SWT.NONE);
- labelWidget.setText(String.format("%s:", getLabel()));
- labelWidget.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
- if (getToolTip() != null) {
- labelWidget.setToolTipText(getToolTip());
- }
- }
-
- Composite composite = new Composite(container, SWT.NONE);
- GridLayout layout1 = new GridLayout(1, false);
- layout1.marginHeight = 0;
- layout1.marginWidth = 0;
- layout1.verticalSpacing = 0;
- layout1.horizontalSpacing = 0;
- composite.setLayout(layout1);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- createToolBar(composite);
- stackedControl = new StackedControl();
- stackedControl.createControl(composite);
- createMessageArea(composite);
-
- addToolTip(container, getToolTip());
- stackedControl.next();
- refresh();
- }
-
- private void createMessageArea(Composite parent) {
- Composite messageArea = new Composite(parent, SWT.BORDER);
- GridLayout layout = new GridLayout(2, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.marginLeft = 5;
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
- layout.marginBottom = 5;
-
- messageArea.setLayout(layout);
- messageArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- messageArea.setBackground(Displays.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
-
- messageIcon = new Label(messageArea, SWT.NONE);
- messageIcon.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
-
- messageLabel = new Label(messageArea, SWT.NONE);
- messageLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));
- }
-
- private void createToolBar(Composite parent) {
- Composite composite = new Composite(parent, SWT.BORDER);
- GridLayout layout = new GridLayout(3, false);
- layout.marginHeight = 0;
- layout.marginLeft = 5;
- layout.marginWidth = 2;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- composite.setBackground(Displays.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
-
- currentPageLabel = new StyledText(composite, SWT.READ_ONLY | SWT.SINGLE | SWT.WRAP);
- currentPageLabel.setAlignment(SWT.RIGHT);
- currentPageLabel.setFont(JFaceResources.getBannerFont());
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
- gd.minimumWidth = 10;
- currentPageLabel.setLayoutData(gd);
- currentPageLabel.setText("0 of 0");
-
- Composite filler = new Composite(composite, SWT.NONE);
- GridLayout layout1 = new GridLayout(1, false);
- filler.setLayout(layout1);
- filler.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
- ToolBar toolbar = new ToolBar(composite, SWT.FLAT | SWT.HORIZONTAL);
- toolbar.setLayoutData(new GridData(SWT.NONE, SWT.NONE, false, false));
- ToolBarManager manager = new ToolBarManager(toolbar);
- manager.add(new Separator());
- manager.add(new Back());
- manager.add(new Forward());
- manager.add(new Separator());
- manager.add(new AddPage());
- manager.add(new RemovePage());
- manager.update(true);
- }
-
- private void addToolTip(Control control, String toolTipText) {
- if (Strings.isValid(toolTipText)) {
- control.setToolTipText(toolTipText);
- if (control instanceof Composite) {
- for (Control child : ((Composite) control).getChildren()) {
- child.setToolTipText(toolTipText);
- }
- }
- }
- }
-
- private void updateCurrentPageLabel() {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (Widgets.isAccessible(currentPageLabel)) {
- int totalPages = stackedControl.getTotalPages();
- int currentPage = stackedControl.getCurrentPageIndex() + 1;
- if (currentPage > totalPages) {
- currentPage = totalPages;
- }
- currentPageLabel.setText(String.format("Page %s of %s - Page Id (%s)", currentPage, totalPages,
- stackedControl.getCurrentPageId()));
- }
- }
- });
- }
-
- public void addPage(T value) {
- stackedControl.addPage(value);
- }
-
- protected String getCurrentPageId() {
- return stackedControl.getCurrentPageId();
- }
-
- private void setMessage(final int severity, final String message) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (Widgets.isAccessible(messageLabel)) {
- Composite parent = messageLabel.getParent();
-
- String text = message;
- boolean isVisible = Strings.isValid(text);
-
- String imageName = null;
- switch (severity) {
- case IStatus.INFO:
- imageName = ISharedImages.IMG_OBJS_INFO_TSK;
- break;
- case IStatus.ERROR:
- imageName = ISharedImages.IMG_OBJS_ERROR_TSK;
- break;
- case IStatus.WARNING:
- imageName = ISharedImages.IMG_OBJS_WARN_TSK;
- break;
- default:
- break;
- }
- Image image =
- Strings.isValid(imageName) ? PlatformUI.getWorkbench().getSharedImages().getImage(imageName) : null;
- messageIcon.setImage(image);
- messageLabel.setText(isVisible ? " " + text : text);
-
- messageIcon.setVisible(isVisible);
- messageLabel.setVisible(isVisible);
- parent.setVisible(isVisible);
- parent.layout();
- }
- }
- });
- }
-
- protected abstract void createPage(String id, Composite parent, T value);
-
- protected abstract void onRemovePage(String id);
-
- private final class Back extends Action {
- public Back() {
- super();
- setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.NAV_BACKWARD));
- setToolTipText("Back to previous page");
- }
-
- @Override
- public void run() {
- stackedControl.previous();
- }
- }
-
- private final class Forward extends Action {
- public Forward() {
- super();
- setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.NAV_FORWARD));
- setToolTipText("Forward to next page");
- }
-
- @Override
- public void run() {
- stackedControl.next();
- }
- }
-
- private final class AddPage extends Action {
- public AddPage() {
- super();
- setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.ADD_GREEN));
- setToolTipText("Adds a page");
- }
-
- @Override
- public void run() {
- stackedControl.addPage((T) null);
- }
- }
-
- private final class RemovePage extends Action {
- public RemovePage() {
- super();
- setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.X_RED));
- setToolTipText("Removes a page");
- }
-
- @Override
- public void run() {
- stackedControl.removePage();
- }
- }
-
- private final class StackedControl {
- private StackedViewer stackedViewer;
- private int currentPage;
- private final List<String> pageIds;
-
- public StackedControl() {
- this.stackedViewer = null;
- this.currentPage = -1;
- this.pageIds = new ArrayList<String>();
- }
-
- private void createControl(Composite parent) {
- pageIds.clear();
- stackedViewer = new StackedViewer(parent, SWT.BORDER);
- stackedViewer.setLayout(ALayout.getZeroMarginLayout());
- GridData gd = new GridData(SWT.FILL, SWT.FILL, false, false);
- gd.minimumHeight = 60;
- gd.minimumWidth = 60;
- stackedViewer.setLayoutData(gd);
- stackedViewer.setCurrentControl(StackedViewer.DEFAULT_CONTROL);
- stackedViewer.layout();
- }
-
- public void dispose() {
- pageIds.clear();
- Widgets.disposeWidget(stackedViewer);
- }
-
- public void refresh() {
- stackedViewer.getStackComposite().layout();
- stackedViewer.getStackComposite().getParent().layout();
- }
-
- private int getTotalPages() {
- return Widgets.isAccessible(stackedViewer) ? stackedViewer.getControlCount() : 0;
- }
-
- private int getCurrentPageIndex() {
- return currentPage;
- }
-
- private String getCurrentPageId() {
- String toReturn = null;
- int index = getCurrentPageIndex();
- if (index >= 0 && index < pageIds.size()) {
- toReturn = pageIds.get(index);
- }
- return toReturn;
- }
-
- private void next() {
- int next = getCurrentPageIndex();
- if (next + 1 < getTotalPages()) {
- next++;
- } else {
- next = 0;
- }
- setCurrentPage(next);
- }
-
- private void previous() {
- int previous = getCurrentPageIndex();
- if (previous - 1 >= 0) {
- previous--;
- } else {
- previous = getTotalPages() - 1;
- }
- setCurrentPage(previous);
- }
-
- public void setCurrentPage(int index) {
- String pageId = null;
- setMessage(IStatus.OK, "");
- if (index >= 0 && index < pageIds.size()) {
- pageId = pageIds.get(index);
- if (pageId == null) {
- setMessage(IStatus.ERROR, String.format("Page [%s] not found.", index));
- }
- } else {
- setMessage(IStatus.ERROR, String.format("Page [%s] out of bounds.", index));
- }
-
- if (pageId == null) {
- index = 0;
- pageId = StackedViewer.DEFAULT_CONTROL;
- }
- this.currentPage = index;
- stackedViewer.setCurrentControl(pageId);
- updateCurrentPageLabel();
- }
-
- private void addPage(T value) {
- int numberOfPages = getTotalPages();
- IStatus status = validate(numberOfPages + 1);
- if (status.isOK()) {
- setMessage(IStatus.OK, "");
- String id = GUID.create();
- if (pageIds.add(id)) {
- Composite composite = new Composite(stackedViewer.getStackComposite(), SWT.WRAP);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
-
- createPage(id, composite, value);
- stackedViewer.addControl(id, composite);
- setCurrentPage(numberOfPages);
- notifyXModifiedListeners();
- } else {
- setMessage(IStatus.WARNING,
- String.format("Add page error - page at index [%s] already exists", getCurrentPageIndex()));
- }
- } else {
- setMessage(IStatus.ERROR, status.getMessage());
- }
- }
-
- private void removePage() {
- int numberOfPages = getTotalPages();
- IStatus status = validate(numberOfPages - 1);
- if (status.isOK()) {
- setMessage(IStatus.OK, "");
- System.out.println("Delete Page");
-
- String pageId = pageIds.remove(getCurrentPageIndex());
- if (pageId != null) {
- onRemovePage(pageId);
- Control control = stackedViewer.removeControl(pageId);
- Widgets.disposeWidget(control);
- previous();
- notifyXModifiedListeners();
- } else {
- setMessage(IStatus.WARNING,
- String.format("Remove page error - page at index [%s] does not exist", getCurrentPageIndex()));
- }
- } else {
- setMessage(IStatus.ERROR, status.getMessage());
- }
- }
-
- private IStatus validate(int numberOfPages) {
- IStatus status = null;
- if (minPage <= numberOfPages && maxPage >= numberOfPages) {
- status = Status.OK_STATUS;
- } else {
- List<String> message = new ArrayList<String>();
- if (numberOfPages < minPage) {
- message.add(String.format("Must have at least [%s] page%s", minPage, minPage == 1 ? "" : "s"));
- }
- if (numberOfPages > maxPage) {
- message.add(String.format("Can't add more than [%s] page%s", maxPage, maxPage == 1 ? "" : "s"));
- }
- status = new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, Collections.toString(" &", message));
- }
- return status;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+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.StackedViewer;
+import org.eclipse.osee.framework.ui.swt.Widgets;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+public abstract class XStackedWidget<T> extends XLabel {
+
+ private StackedControl stackedControl;
+ private StyledText currentPageLabel;
+ private Composite container;
+ private Label messageLabel;
+ private Label messageIcon;
+ private int minPage;
+ private int maxPage;
+
+ public XStackedWidget(String displayLabel, String xmlRoot) {
+ super(displayLabel, xmlRoot);
+ setToolTip("Navigate pages by clicking forward and backward buttons.");
+ minPage = 0;
+ maxPage = 0;
+ }
+
+ @Override
+ public void dispose() {
+ stackedControl.dispose();
+ super.dispose();
+ }
+
+ public XStackedWidget(String displayLabel) {
+ this(displayLabel, "");
+ }
+
+ protected void setPageRange(int minPage, int maxPage) throws OseeArgumentException {
+ if (minPage < 0) {
+ throw new OseeArgumentException("Min Number of Pages must be greater than 0");
+ }
+ if (maxPage < 1) {
+ throw new OseeArgumentException("Max Number of Pages must be at least 1");
+ }
+
+ if (maxPage < minPage) {
+ throw new OseeArgumentException(
+ String.format("Invalid required number of pages [%s] < [%s]", maxPage, minPage));
+ }
+ this.minPage = minPage;
+ this.maxPage = maxPage;
+ }
+
+ @Override
+ public Control getControl() {
+ if (stackedControl == null) {
+ return null;
+ }
+ return stackedControl.stackedViewer;
+ }
+
+ @Override
+ public void setToolTip(String toolTip) {
+ if (Strings.isValid(toolTip)) {
+ super.setToolTip(toolTip);
+ }
+ }
+
+ @Override
+ public void refresh() {
+ updateCurrentPageLabel();
+ stackedControl.refresh();
+ }
+
+ @Override
+ protected void createControls(final Composite parent, int horizontalSpan) {
+ container = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(isDisplayLabel() ? 2 : 1, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.marginRight = 0;
+ container.setLayout(layout);
+ container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ if (isDisplayLabel() && Strings.isValid(getLabel())) {
+ labelWidget = new Label(container, SWT.NONE);
+ labelWidget.setText(String.format("%s:", getLabel()));
+ labelWidget.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
+ if (getToolTip() != null) {
+ labelWidget.setToolTipText(getToolTip());
+ }
+ }
+
+ Composite composite = new Composite(container, SWT.NONE);
+ GridLayout layout1 = new GridLayout(1, false);
+ layout1.marginHeight = 0;
+ layout1.marginWidth = 0;
+ layout1.verticalSpacing = 0;
+ layout1.horizontalSpacing = 0;
+ composite.setLayout(layout1);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ createToolBar(composite);
+ stackedControl = new StackedControl();
+ stackedControl.createControl(composite);
+ createMessageArea(composite);
+
+ addToolTip(container, getToolTip());
+ stackedControl.next();
+ refresh();
+ }
+
+ private void createMessageArea(Composite parent) {
+ Composite messageArea = new Composite(parent, SWT.BORDER);
+ GridLayout layout = new GridLayout(2, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.marginLeft = 5;
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+ layout.marginBottom = 5;
+
+ messageArea.setLayout(layout);
+ messageArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ messageArea.setBackground(Displays.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+
+ messageIcon = new Label(messageArea, SWT.NONE);
+ messageIcon.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+
+ messageLabel = new Label(messageArea, SWT.NONE);
+ messageLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false));
+ }
+
+ private void createToolBar(Composite parent) {
+ Composite composite = new Composite(parent, SWT.BORDER);
+ GridLayout layout = new GridLayout(3, false);
+ layout.marginHeight = 0;
+ layout.marginLeft = 5;
+ layout.marginWidth = 2;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ composite.setBackground(Displays.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
+
+ currentPageLabel = new StyledText(composite, SWT.READ_ONLY | SWT.SINGLE | SWT.WRAP);
+ currentPageLabel.setAlignment(SWT.RIGHT);
+ currentPageLabel.setFont(JFaceResources.getBannerFont());
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ gd.minimumWidth = 10;
+ currentPageLabel.setLayoutData(gd);
+ currentPageLabel.setText("0 of 0");
+
+ Composite filler = new Composite(composite, SWT.NONE);
+ GridLayout layout1 = new GridLayout(1, false);
+ filler.setLayout(layout1);
+ filler.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ ToolBar toolbar = new ToolBar(composite, SWT.FLAT | SWT.HORIZONTAL);
+ toolbar.setLayoutData(new GridData(SWT.NONE, SWT.NONE, false, false));
+ ToolBarManager manager = new ToolBarManager(toolbar);
+ manager.add(new Separator());
+ manager.add(new Back());
+ manager.add(new Forward());
+ manager.add(new Separator());
+ manager.add(new AddPage());
+ manager.add(new RemovePage());
+ manager.update(true);
+ }
+
+ private void addToolTip(Control control, String toolTipText) {
+ if (Strings.isValid(toolTipText)) {
+ control.setToolTipText(toolTipText);
+ if (control instanceof Composite) {
+ for (Control child : ((Composite) control).getChildren()) {
+ child.setToolTipText(toolTipText);
+ }
+ }
+ }
+ }
+
+ private void updateCurrentPageLabel() {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (Widgets.isAccessible(currentPageLabel)) {
+ int totalPages = stackedControl.getTotalPages();
+ int currentPage = stackedControl.getCurrentPageIndex() + 1;
+ if (currentPage > totalPages) {
+ currentPage = totalPages;
+ }
+ currentPageLabel.setText(String.format("Page %s of %s - Page Id (%s)", currentPage, totalPages,
+ stackedControl.getCurrentPageId()));
+ }
+ }
+ });
+ }
+
+ public void addPage(T value) {
+ stackedControl.addPage(value);
+ }
+
+ protected String getCurrentPageId() {
+ return stackedControl.getCurrentPageId();
+ }
+
+ private void setMessage(final int severity, final String message) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (Widgets.isAccessible(messageLabel)) {
+ Composite parent = messageLabel.getParent();
+
+ String text = message;
+ boolean isVisible = Strings.isValid(text);
+
+ String imageName = null;
+ switch (severity) {
+ case IStatus.INFO:
+ imageName = ISharedImages.IMG_OBJS_INFO_TSK;
+ break;
+ case IStatus.ERROR:
+ imageName = ISharedImages.IMG_OBJS_ERROR_TSK;
+ break;
+ case IStatus.WARNING:
+ imageName = ISharedImages.IMG_OBJS_WARN_TSK;
+ break;
+ default:
+ break;
+ }
+ Image image =
+ Strings.isValid(imageName) ? PlatformUI.getWorkbench().getSharedImages().getImage(imageName) : null;
+ messageIcon.setImage(image);
+ messageLabel.setText(isVisible ? " " + text : text);
+
+ messageIcon.setVisible(isVisible);
+ messageLabel.setVisible(isVisible);
+ parent.setVisible(isVisible);
+ parent.layout();
+ }
+ }
+ });
+ }
+
+ protected abstract void createPage(String id, Composite parent, T value);
+
+ protected abstract void onRemovePage(String id);
+
+ private final class Back extends Action {
+ public Back() {
+ super();
+ setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.NAV_BACKWARD));
+ setToolTipText("Back to previous page");
+ }
+
+ @Override
+ public void run() {
+ stackedControl.previous();
+ }
+ }
+
+ private final class Forward extends Action {
+ public Forward() {
+ super();
+ setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.NAV_FORWARD));
+ setToolTipText("Forward to next page");
+ }
+
+ @Override
+ public void run() {
+ stackedControl.next();
+ }
+ }
+
+ private final class AddPage extends Action {
+ public AddPage() {
+ super();
+ setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.ADD_GREEN));
+ setToolTipText("Adds a page");
+ }
+
+ @Override
+ public void run() {
+ stackedControl.addPage((T) null);
+ }
+ }
+
+ private final class RemovePage extends Action {
+ public RemovePage() {
+ super();
+ setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.X_RED));
+ setToolTipText("Removes a page");
+ }
+
+ @Override
+ public void run() {
+ stackedControl.removePage();
+ }
+ }
+
+ private final class StackedControl {
+ private StackedViewer stackedViewer;
+ private int currentPage;
+ private final List<String> pageIds;
+
+ public StackedControl() {
+ this.stackedViewer = null;
+ this.currentPage = -1;
+ this.pageIds = new ArrayList<String>();
+ }
+
+ private void createControl(Composite parent) {
+ pageIds.clear();
+ stackedViewer = new StackedViewer(parent, SWT.BORDER);
+ stackedViewer.setLayout(ALayout.getZeroMarginLayout());
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, false, false);
+ gd.minimumHeight = 60;
+ gd.minimumWidth = 60;
+ stackedViewer.setLayoutData(gd);
+ stackedViewer.setCurrentControl(StackedViewer.DEFAULT_CONTROL);
+ stackedViewer.layout();
+ }
+
+ public void dispose() {
+ pageIds.clear();
+ Widgets.disposeWidget(stackedViewer);
+ }
+
+ public void refresh() {
+ stackedViewer.getStackComposite().layout();
+ stackedViewer.getStackComposite().getParent().layout();
+ }
+
+ private int getTotalPages() {
+ return Widgets.isAccessible(stackedViewer) ? stackedViewer.getControlCount() : 0;
+ }
+
+ private int getCurrentPageIndex() {
+ return currentPage;
+ }
+
+ private String getCurrentPageId() {
+ String toReturn = null;
+ int index = getCurrentPageIndex();
+ if (index >= 0 && index < pageIds.size()) {
+ toReturn = pageIds.get(index);
+ }
+ return toReturn;
+ }
+
+ private void next() {
+ int next = getCurrentPageIndex();
+ if (next + 1 < getTotalPages()) {
+ next++;
+ } else {
+ next = 0;
+ }
+ setCurrentPage(next);
+ }
+
+ private void previous() {
+ int previous = getCurrentPageIndex();
+ if (previous - 1 >= 0) {
+ previous--;
+ } else {
+ previous = getTotalPages() - 1;
+ }
+ setCurrentPage(previous);
+ }
+
+ public void setCurrentPage(int index) {
+ String pageId = null;
+ setMessage(IStatus.OK, "");
+ if (index >= 0 && index < pageIds.size()) {
+ pageId = pageIds.get(index);
+ if (pageId == null) {
+ setMessage(IStatus.ERROR, String.format("Page [%s] not found.", index));
+ }
+ } else {
+ setMessage(IStatus.ERROR, String.format("Page [%s] out of bounds.", index));
+ }
+
+ if (pageId == null) {
+ index = 0;
+ pageId = StackedViewer.DEFAULT_CONTROL;
+ }
+ this.currentPage = index;
+ stackedViewer.setCurrentControl(pageId);
+ updateCurrentPageLabel();
+ }
+
+ private void addPage(T value) {
+ int numberOfPages = getTotalPages();
+ IStatus status = validate(numberOfPages + 1);
+ if (status.isOK()) {
+ setMessage(IStatus.OK, "");
+ String id = GUID.create();
+ if (pageIds.add(id)) {
+ Composite composite = new Composite(stackedViewer.getStackComposite(), SWT.WRAP);
+ composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
+
+ createPage(id, composite, value);
+ stackedViewer.addControl(id, composite);
+ setCurrentPage(numberOfPages);
+ notifyXModifiedListeners();
+ } else {
+ setMessage(IStatus.WARNING,
+ String.format("Add page error - page at index [%s] already exists", getCurrentPageIndex()));
+ }
+ } else {
+ setMessage(IStatus.ERROR, status.getMessage());
+ }
+ }
+
+ private void removePage() {
+ int numberOfPages = getTotalPages();
+ IStatus status = validate(numberOfPages - 1);
+ if (status.isOK()) {
+ setMessage(IStatus.OK, "");
+ System.out.println("Delete Page");
+
+ String pageId = pageIds.remove(getCurrentPageIndex());
+ if (pageId != null) {
+ onRemovePage(pageId);
+ Control control = stackedViewer.removeControl(pageId);
+ Widgets.disposeWidget(control);
+ previous();
+ notifyXModifiedListeners();
+ } else {
+ setMessage(IStatus.WARNING,
+ String.format("Remove page error - page at index [%s] does not exist", getCurrentPageIndex()));
+ }
+ } else {
+ setMessage(IStatus.ERROR, status.getMessage());
+ }
+ }
+
+ private IStatus validate(int numberOfPages) {
+ IStatus status = null;
+ if (minPage <= numberOfPages && maxPage >= numberOfPages) {
+ status = Status.OK_STATUS;
+ } else {
+ List<String> message = new ArrayList<String>();
+ if (numberOfPages < minPage) {
+ message.add(String.format("Must have at least [%s] page%s", minPage, minPage == 1 ? "" : "s"));
+ }
+ if (numberOfPages > maxPage) {
+ message.add(String.format("Can't add more than [%s] page%s", maxPage, maxPage == 1 ? "" : "s"));
+ }
+ status = new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, Collections.toString(" &", message));
+ }
+ return status;
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XText.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XText.java
index f276aa23afb..8f5e6654a7b 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XText.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XText.java
@@ -1,609 +1,609 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets;
-
-import java.text.NumberFormat;
-import java.text.ParseException;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.jdk.core.util.AXml;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.util.OseeDictionary;
-import org.eclipse.osee.framework.ui.swt.ALayout;
-import org.eclipse.osee.framework.ui.swt.Widgets;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTException;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Font;
-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.Label;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-
-/**
- * Generic label and text field object for use by single entry artifact attributes
- *
- * @author Donald G. Dunne
- */
-public class XText extends XWidget {
-
- protected StyledText sText; // Contains visable representation of text
- private Composite parent;
- protected String text = ""; // Where actual text with xml tags is stored
- private int maxTextChars = 0;
-
- private boolean dragableArtifact = false;
- private boolean spellCheck = true;
- private final boolean debug = false;
- private int width = 0;
- private int height = 0;
- private XTextSpellCheckPaintListener spellPaintListener;
- private XTextSpellModifyDictionary modDict;
- private Font font;
-
- public XText() {
- super("AText", "text");
- }
-
- public XText(String displayLabel) {
- this(displayLabel, "text");
- }
-
- public XText(String displayLabel, String xmlRoot) {
- this(displayLabel, xmlRoot, "");
- }
-
- public XText(String displayLabel, String xmlRoot, String xmlSubRoot) {
- super(displayLabel, xmlRoot, xmlSubRoot);
- }
-
- public void setEnabled(boolean enabled) {
- sText.setEnabled(enabled);
- }
-
- public void setSize(int width, int height) {
- this.width = width;
- this.height = height;
- if (sText != null && !sText.isDisposed()) {
- sText.setSize(width, height);
- }
- }
-
- public void setHeight(int height) {
- this.height = height;
- if (sText != null && !sText.isDisposed()) {
- sText.setSize(sText.getSize().x, height);
- }
- }
-
- @Override
- public String toString() {
- return getLabel() + ": *" + text + "*";
- }
-
- @Override
- public Control getControl() {
- return sText;
- }
-
- /**
- * Create Text Widgets. Widgets Created: Label: "text entry" horizonatalSpan takes up 2 columns; horizontalSpan must
- * be >=2
- */
- @Override
- protected void createControls(Composite parent, int horizontalSpan) {
- createControls(parent, horizontalSpan, true);
- }
-
- protected void createControls(Composite parent, int horizontalSpan, boolean fillText) {
- setNotificationsAllowed(false);
- try {
- if (!verticalLabel && horizontalSpan < 2) {
- horizontalSpan = 2;
- }
-
- this.parent = parent;
- Composite composite = null;
-
- ModifyListener textListener = new ModifyListener() {
-
- public void modifyText(ModifyEvent e) {
- if (sText != null) {
- debug("modifyText");
- text = sText.getText();
- validate();
- notifyXModifiedListeners();
- }
- }
- };
-
- if (fillVertically) {
- composite = new Composite(parent, SWT.NONE);
- GridLayout layout = ALayout.getZeroMarginLayout(1, false);
- layout.verticalSpacing = 4;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- } else {
- composite = new Composite(parent, SWT.NONE);
- GridLayout layout = ALayout.getZeroMarginLayout(2, false);
- layout.verticalSpacing = 4;
- composite.setLayout(layout);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = horizontalSpan;
- composite.setLayoutData(gd);
- }
- // composite = parent;
-
- // Create Text Widgets
- if (isDisplayLabel() && !getLabel().equals("")) {
- labelWidget = new Label(composite, SWT.NONE);
- labelWidget.setText(getLabel() + ":");
- if (getToolTip() != null) {
- labelWidget.setToolTipText(getToolTip());
- }
- }
-
- sText = new StyledText(composite, getTextStyle());
-
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- if (verticalLabel) {
- gd.horizontalSpan = horizontalSpan;
- } else {
- gd.horizontalSpan = horizontalSpan - 1;
- }
- gd.grabExcessHorizontalSpace = true;
- gd.horizontalAlignment = GridData.FILL;
- if (fillVertically) {
- gd.grabExcessVerticalSpace = true;
- gd.verticalAlignment = GridData.FILL;
- }
- if (fillVertically) {
- if (height > 0) {
- gd.heightHint = height;
- }
- }
- // gd.widthHint = 200;
- sText.setLayoutData(gd);
- sText.setMenu(getDefaultMenu());
- sText.addModifyListener(textListener);
- if (text != null) {
- sText.setText(text);
- }
- if (spellCheck) {
- spellPaintListener = new XTextSpellCheckPaintListener(this, OseeDictionary.getInstance());
- sText.addPaintListener(spellPaintListener);
- if (modDict != null) {
- spellPaintListener.addXTextSpellModifyDictionary(modDict);
- }
- }
- if (width != 0 && height != 0) {
- sText.setSize(width, height);
- }
-
- if (maxTextChars > 0) {
- sText.setTextLimit(maxTextChars);
- }
- if (fillText) {
- updateTextWidget();
- }
- validate();
- sText.setEditable(isEditable());
- if (font != null) {
- sText.setFont(font);
- }
- parent.layout();
- } finally {
- setNotificationsAllowed(true);
- }
- }
-
- protected int getTextStyle() {
- int styleBase = SWT.BORDER;
- if (isEditable()) {
- styleBase |= SWT.READ_ONLY;
- }
- return styleBase | (fillVertically ? SWT.MULTI | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL : SWT.SINGLE);
- }
-
- public void addXTextSpellModifyDictionary(XTextSpellModifyDictionary modDict) {
- this.modDict = modDict;
- if (spellPaintListener != null) {
- spellPaintListener.addXTextSpellModifyDictionary(modDict);
- }
- }
-
- /**
- * @return text including xml tags replaced for references
- */
- public String getText() {
- String text = sText.getText();
- return text;
- }
-
- /**
- * @param text
- */
- public void setText(String text) {
- this.text = text;
- if (sText != null) {
- sText.setText(text);
- }
- }
-
- public Menu getDefaultMenu() {
- Menu menu = new Menu(sText.getShell());
- MenuItem cut = new MenuItem(menu, SWT.NONE);
- cut.setText("Cut");
- cut.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- sText.cut();
- sText.redraw();
- }
- });
- MenuItem copy = new MenuItem(menu, SWT.NONE);
- copy.setText("Copy");
- copy.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- sText.copy();
- }
- });
- MenuItem paste = new MenuItem(menu, SWT.NONE);
- paste.setText("Paste");
- paste.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- sText.paste();
- sText.redraw();
- }
- });
- return menu;
- }
-
- @Override
- public void dispose() {
- if (labelWidget != null) {
- labelWidget.dispose();
- }
- if (sText != null) {
- if (spellPaintListener != null && !sText.isDisposed()) {
- sText.removePaintListener(spellPaintListener);
- }
- sText.dispose();
- }
- if (parent != null && !parent.isDisposed()) {
- parent.layout();
- }
- }
-
- @Override
- public void setFocus() {
- if (sText != null) {
- sText.setFocus();
- }
- }
-
- public void setSpellChecking(boolean spellCheck) {
- if (sText != null) {
- if (spellCheck) {
- sText.addPaintListener(spellPaintListener);
- } else if (spellPaintListener != null) {
- sText.removePaintListener(spellPaintListener);
- }
- }
- this.spellCheck = spellCheck;
- }
-
- @Override
- public void setEditable(boolean editable) {
- super.setEditable(editable);
- if (Widgets.isAccessible(sText)) {
- sText.setEditable(editable);
- }
- }
-
- /**
- * Set max character limit on text field
- *
- * @param limit - if 0, then limit is 999, else sets to limit
- */
- public void setMaxTextLimit(int limit) {
- this.maxTextChars = limit;
- if (sText != null) {
- if (limit == 0) {
- sText.setTextLimit(999);
- } else {
- sText.setTextLimit(limit);
- }
- }
- }
-
- public void forceFocus() {
- if (sText != null) {
- sText.forceFocus();
- }
- }
-
- @Override
- public void setFillVertically(boolean fillVertically) {
- super.setFillVertically(fillVertically);
- }
-
- public boolean isInteger() {
- try {
- new Integer(text);
- } catch (NumberFormatException e) {
- return false;
- }
- return true;
- }
-
- public boolean isFloat() {
- try {
- NumberFormat.getInstance().parse(text);
- } catch (ParseException e) {
- return false;
- }
- return true;
- }
-
- public int getInteger() {
- Integer num;
- try {
- num = new Integer(text);
- } catch (NumberFormatException e) {
- return 0;
- }
- return num.intValue();
- }
-
- public double getFloat() {
- Number num;
- try {
- num = NumberFormat.getInstance().parse(text);
- } catch (ParseException e) {
- return 0.0;
- }
- return num.doubleValue();
- }
-
- @Override
- public void setRequiredEntry(boolean requiredEntry) {
- super.setRequiredEntry(requiredEntry);
- validate();
- }
-
- public void addModifyListener(ModifyListener modifyListener) {
- if (sText != null) {
- sText.addModifyListener(modifyListener);
- }
- }
-
- public String get() {
- if (debug) {
- System.err.println("text set *" + text + "*");
- }
- return text;
- }
-
- @Override
- public String getXmlData() {
- if (sText == null || sText.isDisposed()) {
- return AXml.textToXml(text);
- } else {
- try {
- return AXml.textToXml(sText.getText());
- } catch (SWTException e) {
- return AXml.textToXml(text);
- }
- }
- }
-
- @Override
- protected String toXml() {
- if (getXmlSubRoot().equals("")) {
- return toXml(getXmlRoot());
- } else {
- return toXml(getXmlRoot(), getXmlSubRoot());
- }
- }
-
- @Override
- public String toXml(String xmlRoot) {
- String s = "<" + xmlRoot + ">" + getXmlData() + "</" + xmlRoot + ">\n";
- return s;
- }
-
- @Override
- public String toXml(String xmlRoot, String xmlSubRoot) {
- String s =
- "<" + xmlRoot + ">" + "<" + xmlSubRoot + ">" + getXmlData() + "</" + xmlSubRoot + ">" + "</" + xmlRoot + ">\n";
- return s;
- }
-
- @Override
- public void setXmlData(String str) {
- set(str);
- if (debug) {
- System.err.println("setFromXml *" + str + "*");
- }
- }
-
- @Override
- public void setFromXml(String xml) {
- Matcher m;
- m =
- Pattern.compile("<" + getXmlRoot() + ">(.*?)</" + getXmlRoot() + ">", Pattern.MULTILINE | Pattern.DOTALL).matcher(
- xml);
-
- if (m.find()) {
- String xmlStr = m.group(1);
- if (debug) {
- System.err.println("xmlStr *" + xmlStr + "*");
- }
- String str = AXml.xmlToText(xmlStr);
- if (debug) {
- System.err.println("str *" + str + "*");
- }
- setXmlData(str);
- }
- }
-
- public int getInt() {
- Integer percent = new Integer(0);
- try {
- percent = new Integer(text);
- } catch (NumberFormatException e) {
- }
- return percent.intValue();
- }
-
- protected void updateTextWidget() {
- if (Widgets.isAccessible(sText)) {
- if (!text.equals(sText.getText())) {
- // Disable Listeners so not to fill Undo List
- sText.setText(text);
- // Reenable Listeners
- validate();
- }
- }
- }
-
- public void set(String text) {
- if (text == null) {
- this.text = "";
- } else {
- this.text = text;
- }
- if (debug) {
- System.err.println("set *" + text + "*");
- }
- updateTextWidget();
- }
-
- public void set(XText text) {
- set(text.get());
- }
-
- public void append(String text) {
- this.text = this.text + text;
- updateTextWidget();
- }
-
- @Override
- public void refresh() {
- updateTextWidget();
- }
-
- @Override
- public String getReportData() {
- String s = "";
- String textStr = new String(text);
- if (fillVertically) {
- s = s + "\n";
- textStr = textStr.replaceAll("\n", "\n" + " ");
- textStr = " " + textStr;
- }
- s = s + textStr;
- s = s.replaceAll("\n$", "");
- return s;
- }
-
- public String toHTML(String labelFont, boolean newLineText) {
- String result = AHTML.getLabelStr(labelFont, getLabel() + ": ");
- if (newLineText) {
- result = "<dl><dt>" + result + "<dd>";
- }
- result += AHTML.textToHtml(text);
- if (newLineText) {
- result += "</dl>";
- }
- return result;
- }
-
- @Override
- public String toHTML(String labelFont) {
- return toHTML(labelFont, false);
- }
-
- /**
- * @return Returns the dragableArtifact.
- */
- public boolean isDragableArtifact() {
- return dragableArtifact;
- }
-
- /**
- * @param dragableArtifact The dragableArtifact to set.
- */
- public void setDragableArtifact(boolean dragableArtifact) {
- this.dragableArtifact = dragableArtifact;
- }
-
- public void debug(String str) {
- if (debug) {
- System.err.println("AText :" + str);
- }
- }
-
- @Override
- public IStatus isValid() {
- if (isRequiredEntry() && !Strings.isValid(get())) {
- return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, String.format("Must enter \"%s\"", getLabel()));
- }
- return Status.OK_STATUS;
- }
-
- @Override
- public Object getData() {
- return sText.getText();
- }
-
- /**
- * @return the sText
- */
- public StyledText getStyledText() {
- return sText;
- }
-
- /**
- * @return the font
- */
- public Font getFont() {
- return font;
- }
-
- /**
- * @param font the font to set
- */
- public void setFont(Font font) {
- this.font = font;
- if (sText != null) {
- sText.setFont(font);
- }
- }
-
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+import java.text.NumberFormat;
+import java.text.ParseException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.jdk.core.util.AXml;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.util.OseeDictionary;
+import org.eclipse.osee.framework.ui.swt.ALayout;
+import org.eclipse.osee.framework.ui.swt.Widgets;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.SWTException;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Font;
+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.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+
+/**
+ * Generic label and text field object for use by single entry artifact attributes
+ *
+ * @author Donald G. Dunne
+ */
+public class XText extends XWidget {
+
+ protected StyledText sText; // Contains visable representation of text
+ private Composite parent;
+ protected String text = ""; // Where actual text with xml tags is stored
+ private int maxTextChars = 0;
+
+ private boolean dragableArtifact = false;
+ private boolean spellCheck = true;
+ private final boolean debug = false;
+ private int width = 0;
+ private int height = 0;
+ private XTextSpellCheckPaintListener spellPaintListener;
+ private XTextSpellModifyDictionary modDict;
+ private Font font;
+
+ public XText() {
+ super("AText", "text");
+ }
+
+ public XText(String displayLabel) {
+ this(displayLabel, "text");
+ }
+
+ public XText(String displayLabel, String xmlRoot) {
+ this(displayLabel, xmlRoot, "");
+ }
+
+ public XText(String displayLabel, String xmlRoot, String xmlSubRoot) {
+ super(displayLabel, xmlRoot, xmlSubRoot);
+ }
+
+ public void setEnabled(boolean enabled) {
+ sText.setEnabled(enabled);
+ }
+
+ public void setSize(int width, int height) {
+ this.width = width;
+ this.height = height;
+ if (sText != null && !sText.isDisposed()) {
+ sText.setSize(width, height);
+ }
+ }
+
+ public void setHeight(int height) {
+ this.height = height;
+ if (sText != null && !sText.isDisposed()) {
+ sText.setSize(sText.getSize().x, height);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getLabel() + ": *" + text + "*";
+ }
+
+ @Override
+ public Control getControl() {
+ return sText;
+ }
+
+ /**
+ * Create Text Widgets. Widgets Created: Label: "text entry" horizonatalSpan takes up 2 columns; horizontalSpan must
+ * be >=2
+ */
+ @Override
+ protected void createControls(Composite parent, int horizontalSpan) {
+ createControls(parent, horizontalSpan, true);
+ }
+
+ protected void createControls(Composite parent, int horizontalSpan, boolean fillText) {
+ setNotificationsAllowed(false);
+ try {
+ if (!verticalLabel && horizontalSpan < 2) {
+ horizontalSpan = 2;
+ }
+
+ this.parent = parent;
+ Composite composite = null;
+
+ ModifyListener textListener = new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ if (sText != null) {
+ debug("modifyText");
+ text = sText.getText();
+ validate();
+ notifyXModifiedListeners();
+ }
+ }
+ };
+
+ if (fillVertically) {
+ composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = ALayout.getZeroMarginLayout(1, false);
+ layout.verticalSpacing = 4;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ } else {
+ composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = ALayout.getZeroMarginLayout(2, false);
+ layout.verticalSpacing = 4;
+ composite.setLayout(layout);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = horizontalSpan;
+ composite.setLayoutData(gd);
+ }
+ // composite = parent;
+
+ // Create Text Widgets
+ if (isDisplayLabel() && !getLabel().equals("")) {
+ labelWidget = new Label(composite, SWT.NONE);
+ labelWidget.setText(getLabel() + ":");
+ if (getToolTip() != null) {
+ labelWidget.setToolTipText(getToolTip());
+ }
+ }
+
+ sText = new StyledText(composite, getTextStyle());
+
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ if (verticalLabel) {
+ gd.horizontalSpan = horizontalSpan;
+ } else {
+ gd.horizontalSpan = horizontalSpan - 1;
+ }
+ gd.grabExcessHorizontalSpace = true;
+ gd.horizontalAlignment = GridData.FILL;
+ if (fillVertically) {
+ gd.grabExcessVerticalSpace = true;
+ gd.verticalAlignment = GridData.FILL;
+ }
+ if (fillVertically) {
+ if (height > 0) {
+ gd.heightHint = height;
+ }
+ }
+ // gd.widthHint = 200;
+ sText.setLayoutData(gd);
+ sText.setMenu(getDefaultMenu());
+ sText.addModifyListener(textListener);
+ if (text != null) {
+ sText.setText(text);
+ }
+ if (spellCheck) {
+ spellPaintListener = new XTextSpellCheckPaintListener(this, OseeDictionary.getInstance());
+ sText.addPaintListener(spellPaintListener);
+ if (modDict != null) {
+ spellPaintListener.addXTextSpellModifyDictionary(modDict);
+ }
+ }
+ if (width != 0 && height != 0) {
+ sText.setSize(width, height);
+ }
+
+ if (maxTextChars > 0) {
+ sText.setTextLimit(maxTextChars);
+ }
+ if (fillText) {
+ updateTextWidget();
+ }
+ validate();
+ sText.setEditable(isEditable());
+ if (font != null) {
+ sText.setFont(font);
+ }
+ parent.layout();
+ } finally {
+ setNotificationsAllowed(true);
+ }
+ }
+
+ protected int getTextStyle() {
+ int styleBase = SWT.BORDER;
+ if (isEditable()) {
+ styleBase |= SWT.READ_ONLY;
+ }
+ return styleBase | (fillVertically ? SWT.MULTI | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL : SWT.SINGLE);
+ }
+
+ public void addXTextSpellModifyDictionary(XTextSpellModifyDictionary modDict) {
+ this.modDict = modDict;
+ if (spellPaintListener != null) {
+ spellPaintListener.addXTextSpellModifyDictionary(modDict);
+ }
+ }
+
+ /**
+ * @return text including xml tags replaced for references
+ */
+ public String getText() {
+ String text = sText.getText();
+ return text;
+ }
+
+ /**
+ * @param text
+ */
+ public void setText(String text) {
+ this.text = text;
+ if (sText != null) {
+ sText.setText(text);
+ }
+ }
+
+ public Menu getDefaultMenu() {
+ Menu menu = new Menu(sText.getShell());
+ MenuItem cut = new MenuItem(menu, SWT.NONE);
+ cut.setText("Cut");
+ cut.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ sText.cut();
+ sText.redraw();
+ }
+ });
+ MenuItem copy = new MenuItem(menu, SWT.NONE);
+ copy.setText("Copy");
+ copy.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ sText.copy();
+ }
+ });
+ MenuItem paste = new MenuItem(menu, SWT.NONE);
+ paste.setText("Paste");
+ paste.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ sText.paste();
+ sText.redraw();
+ }
+ });
+ return menu;
+ }
+
+ @Override
+ public void dispose() {
+ if (labelWidget != null) {
+ labelWidget.dispose();
+ }
+ if (sText != null) {
+ if (spellPaintListener != null && !sText.isDisposed()) {
+ sText.removePaintListener(spellPaintListener);
+ }
+ sText.dispose();
+ }
+ if (parent != null && !parent.isDisposed()) {
+ parent.layout();
+ }
+ }
+
+ @Override
+ public void setFocus() {
+ if (sText != null) {
+ sText.setFocus();
+ }
+ }
+
+ public void setSpellChecking(boolean spellCheck) {
+ if (sText != null) {
+ if (spellCheck) {
+ sText.addPaintListener(spellPaintListener);
+ } else if (spellPaintListener != null) {
+ sText.removePaintListener(spellPaintListener);
+ }
+ }
+ this.spellCheck = spellCheck;
+ }
+
+ @Override
+ public void setEditable(boolean editable) {
+ super.setEditable(editable);
+ if (Widgets.isAccessible(sText)) {
+ sText.setEditable(editable);
+ }
+ }
+
+ /**
+ * Set max character limit on text field
+ *
+ * @param limit - if 0, then limit is 999, else sets to limit
+ */
+ public void setMaxTextLimit(int limit) {
+ this.maxTextChars = limit;
+ if (sText != null) {
+ if (limit == 0) {
+ sText.setTextLimit(999);
+ } else {
+ sText.setTextLimit(limit);
+ }
+ }
+ }
+
+ public void forceFocus() {
+ if (sText != null) {
+ sText.forceFocus();
+ }
+ }
+
+ @Override
+ public void setFillVertically(boolean fillVertically) {
+ super.setFillVertically(fillVertically);
+ }
+
+ public boolean isInteger() {
+ try {
+ new Integer(text);
+ } catch (NumberFormatException e) {
+ return false;
+ }
+ return true;
+ }
+
+ public boolean isFloat() {
+ try {
+ NumberFormat.getInstance().parse(text);
+ } catch (ParseException e) {
+ return false;
+ }
+ return true;
+ }
+
+ public int getInteger() {
+ Integer num;
+ try {
+ num = new Integer(text);
+ } catch (NumberFormatException e) {
+ return 0;
+ }
+ return num.intValue();
+ }
+
+ public double getFloat() {
+ Number num;
+ try {
+ num = NumberFormat.getInstance().parse(text);
+ } catch (ParseException e) {
+ return 0.0;
+ }
+ return num.doubleValue();
+ }
+
+ @Override
+ public void setRequiredEntry(boolean requiredEntry) {
+ super.setRequiredEntry(requiredEntry);
+ validate();
+ }
+
+ public void addModifyListener(ModifyListener modifyListener) {
+ if (sText != null) {
+ sText.addModifyListener(modifyListener);
+ }
+ }
+
+ public String get() {
+ if (debug) {
+ System.err.println("text set *" + text + "*");
+ }
+ return text;
+ }
+
+ @Override
+ public String getXmlData() {
+ if (sText == null || sText.isDisposed()) {
+ return AXml.textToXml(text);
+ } else {
+ try {
+ return AXml.textToXml(sText.getText());
+ } catch (SWTException e) {
+ return AXml.textToXml(text);
+ }
+ }
+ }
+
+ @Override
+ protected String toXml() {
+ if (getXmlSubRoot().equals("")) {
+ return toXml(getXmlRoot());
+ } else {
+ return toXml(getXmlRoot(), getXmlSubRoot());
+ }
+ }
+
+ @Override
+ public String toXml(String xmlRoot) {
+ String s = "<" + xmlRoot + ">" + getXmlData() + "</" + xmlRoot + ">\n";
+ return s;
+ }
+
+ @Override
+ public String toXml(String xmlRoot, String xmlSubRoot) {
+ String s =
+ "<" + xmlRoot + ">" + "<" + xmlSubRoot + ">" + getXmlData() + "</" + xmlSubRoot + ">" + "</" + xmlRoot + ">\n";
+ return s;
+ }
+
+ @Override
+ public void setXmlData(String str) {
+ set(str);
+ if (debug) {
+ System.err.println("setFromXml *" + str + "*");
+ }
+ }
+
+ @Override
+ public void setFromXml(String xml) {
+ Matcher m;
+ m =
+ Pattern.compile("<" + getXmlRoot() + ">(.*?)</" + getXmlRoot() + ">", Pattern.MULTILINE | Pattern.DOTALL).matcher(
+ xml);
+
+ if (m.find()) {
+ String xmlStr = m.group(1);
+ if (debug) {
+ System.err.println("xmlStr *" + xmlStr + "*");
+ }
+ String str = AXml.xmlToText(xmlStr);
+ if (debug) {
+ System.err.println("str *" + str + "*");
+ }
+ setXmlData(str);
+ }
+ }
+
+ public int getInt() {
+ Integer percent = new Integer(0);
+ try {
+ percent = new Integer(text);
+ } catch (NumberFormatException e) {
+ }
+ return percent.intValue();
+ }
+
+ protected void updateTextWidget() {
+ if (Widgets.isAccessible(sText)) {
+ if (!text.equals(sText.getText())) {
+ // Disable Listeners so not to fill Undo List
+ sText.setText(text);
+ // Reenable Listeners
+ validate();
+ }
+ }
+ }
+
+ public void set(String text) {
+ if (text == null) {
+ this.text = "";
+ } else {
+ this.text = text;
+ }
+ if (debug) {
+ System.err.println("set *" + text + "*");
+ }
+ updateTextWidget();
+ }
+
+ public void set(XText text) {
+ set(text.get());
+ }
+
+ public void append(String text) {
+ this.text = this.text + text;
+ updateTextWidget();
+ }
+
+ @Override
+ public void refresh() {
+ updateTextWidget();
+ }
+
+ @Override
+ public String getReportData() {
+ String s = "";
+ String textStr = new String(text);
+ if (fillVertically) {
+ s = s + "\n";
+ textStr = textStr.replaceAll("\n", "\n" + " ");
+ textStr = " " + textStr;
+ }
+ s = s + textStr;
+ s = s.replaceAll("\n$", "");
+ return s;
+ }
+
+ public String toHTML(String labelFont, boolean newLineText) {
+ String result = AHTML.getLabelStr(labelFont, getLabel() + ": ");
+ if (newLineText) {
+ result = "<dl><dt>" + result + "<dd>";
+ }
+ result += AHTML.textToHtml(text);
+ if (newLineText) {
+ result += "</dl>";
+ }
+ return result;
+ }
+
+ @Override
+ public String toHTML(String labelFont) {
+ return toHTML(labelFont, false);
+ }
+
+ /**
+ * @return Returns the dragableArtifact.
+ */
+ public boolean isDragableArtifact() {
+ return dragableArtifact;
+ }
+
+ /**
+ * @param dragableArtifact The dragableArtifact to set.
+ */
+ public void setDragableArtifact(boolean dragableArtifact) {
+ this.dragableArtifact = dragableArtifact;
+ }
+
+ public void debug(String str) {
+ if (debug) {
+ System.err.println("AText :" + str);
+ }
+ }
+
+ @Override
+ public IStatus isValid() {
+ if (isRequiredEntry() && !Strings.isValid(get())) {
+ return new Status(IStatus.ERROR, SkynetGuiPlugin.PLUGIN_ID, String.format("Must enter \"%s\"", getLabel()));
+ }
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public Object getData() {
+ return sText.getText();
+ }
+
+ /**
+ * @return the sText
+ */
+ public StyledText getStyledText() {
+ return sText;
+ }
+
+ /**
+ * @return the font
+ */
+ public Font getFont() {
+ return font;
+ }
+
+ /**
+ * @param font the font to set
+ */
+ public void setFont(Font font) {
+ this.font = font;
+ if (sText != null) {
+ sText.setFont(font);
+ }
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XTextSpellCheckPaintListener.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XTextSpellCheckPaintListener.java
index 5522430eeed..4b4daac8c47 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XTextSpellCheckPaintListener.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XTextSpellCheckPaintListener.java
@@ -1,246 +1,246 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets;
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.StringTokenizer;
-import org.eclipse.osee.framework.ui.skynet.util.OseeDictionary;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.styledText.ASpellWord;
-import org.eclipse.osee.framework.ui.swt.styledText.IDictionary;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.MenuEvent;
-import org.eclipse.swt.events.MenuListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-
-/**
- * PaintListener that will underline all misspelled words in a StyledText widget. This class must be extended to provide
- * for getting the dictionary and activating/deactivating certain functionality.
- *
- * @author Donald G. Dunne
- */
-public class XTextSpellCheckPaintListener implements PaintListener {
-
- private final IDictionary dict;
- private final XText xText;
- private final Set<ASpellWord> errors = new HashSet<ASpellWord>();
- private XTextSpellModifyDictionary modDict;
-
- public XTextSpellCheckPaintListener(final XText xText, IDictionary dict) {
- this.xText = xText;
- this.dict = dict;
- if (modDict != null) {
- addXTextSpellModifyDictionary(modDict);
- }
- }
-
- public void addXTextSpellModifyDictionary(XTextSpellModifyDictionary modDict) {
- if (xText == null || xText.getStyledText() == null || xText.getStyledText().isDisposed()) {
- return;
- }
- this.modDict = modDict;
- xText.getStyledText().addMouseListener(mouseListener);
- xText.getStyledText().addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (xText == null || xText.getStyledText() == null || xText.getStyledText().isDisposed()) {
- return;
- }
- xText.getStyledText().removeMouseListener(mouseListener);
- }
- });
- }
-
- public void paintControl(PaintEvent e) {
- if (xText == null || xText.getStyledText() == null || xText.getStyledText().isDisposed()) {
- return;
- }
- GC gc = e.gc;
- gc.setForeground(Displays.getSystemColor(SWT.COLOR_BLUE));
- if (xText != null) {
- String text = xText.getStyledText().getText();
-
- // Get spelling errors
- getErrors(text);
- for (ASpellWord sw : errors) {
- drawError(sw.start, sw.word.length(), xText.getStyledText(), gc);
- }
- }
- }
-
- private final MouseListener mouseListener = new MouseListener() {
- public void mouseUp(org.eclipse.swt.events.MouseEvent e) {
- StyledText styledText = (StyledText) e.widget;
- int offset = 0;
- try {
- offset = styledText.getOffsetAtLocation(new Point(e.x, e.y));
- } catch (IllegalArgumentException ex) {
- // Illegal arguement exception happens when selected point is outside
- // the range of the rectangle. Since it does it's own calculation, just
- // throw this exception away.
- return;
- }
- for (ASpellWord sw : errors) {
- if (sw.start < offset && (sw.start + sw.word.length()) > offset) {
- // System.out.println("Found error word " + sw.word);
- handleErrorSelected(sw);
- break;
- }
- }
- };
-
- public void mouseDoubleClick(MouseEvent e) {
- }
-
- public void mouseDown(MouseEvent e) {
- }
- };
-
- private void handleErrorSelected(final ASpellWord sw) {
- Menu menu = xText.getStyledText().getMenu();
-
- new MenuItem(menu, SWT.SEPARATOR);
-
- MenuItem addLocal = new MenuItem(menu, SWT.NONE);
- addLocal.setText("Add \"" + sw.word + "\" to Personal dictionary.");
- addLocal.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (modDict.addToLocalDictionary(sw.word)) {
- xText.getStyledText().redraw();
- }
- }
- });
-
- MenuItem addGlobal = new MenuItem(menu, SWT.NONE);
- addGlobal.setText("Add \"" + sw.word + "\" to Global dictionary.");
- addGlobal.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (modDict.addToGlobalDictionary(sw.word)) {
- xText.getStyledText().redraw();
- }
- }
- });
- menu.addMenuListener(new MenuListener() {
- public void menuHidden(MenuEvent e) {
- xText.getStyledText().setMenu(xText.getDefaultMenu());
- }
-
- public void menuShown(MenuEvent e) {
- };
- });
- }
-
- /**
- * Draws a single spelling error squiggly line
- *
- * @param offset - offset of bad word
- * @param len - length of bad word
- */
- private void drawError(int offset, int len, StyledText sText, GC gc) {
- if (sText.isDisposed()) {
- return;
- }
- // Convert to coordinates
- try {
- Point off1 = sText.getLocationAtOffset(offset);
- off1.y--;
- Point off2 = sText.getLocationAtOffset(offset + len);
- off2.y--;
- int h = sText.getLineHeight();
- int[] polyline = computePolyline(off1, off2, h);
- gc.drawPolyline(polyline);
- } catch (RuntimeException e) {
- }
- }
-
- /**
- */
- private void getErrors(String str) {
- errors.clear();
- StringTokenizer st = new StringTokenizer(str, "[\t\r\n ]", true);
- int loc = 0;
- while (st.hasMoreTokens()) {
- String string = st.nextToken();
- // if not a whitespace character
- if (!string.matches("^\\s*$")) {
- // System.out.println("isWord: orig *" + string + "* => *" + word + "*");
- if (!dict.isWord(string)) {
- // System.out.println("word " + word + " is error");
- String cleanError = OseeDictionary.getInstance().getCleanWord(string);
- ASpellWord sw = new ASpellWord(cleanError, loc);
- errors.add(sw);
- }
- }
- loc += string.length();
- }
- }
-
- /**
- * Computes the squiggly line.
- *
- * @param left the left end point
- * @param right the right end point
- * @param height the height of the squiggly line
- * @return the polyline array
- */
- private int[] computePolyline(Point left, Point right, int height) {
-
- final int WIDTH = 3;
- final int HEIGHT = 0;
-
- int w2 = 2 * WIDTH;
- int peeks = (right.x - left.x) / w2;
-
- int leftX = left.x;
-
- // compute (number of points) * 2
- int length = 4 * peeks + 2;
- if (length <= 0) {
- return new int[0];
- }
-
- int[] coordinates = new int[length];
-
- // compute top and bottom of peeks
- int bottom = left.y + height;
- int top = bottom - HEIGHT;
-
- // populate array with peek coordinates
- int index = 0;
- for (int i = 0; i < peeks; i++) {
- coordinates[index++] = leftX + (w2 * i);
- coordinates[index++] = bottom;
- coordinates[index++] = coordinates[index - 3] + WIDTH;
- coordinates[index++] = top;
- }
- // add the last down flank
- coordinates[length - 2] = left.x + (w2 * peeks);
- coordinates[length - 1] = bottom;
- return coordinates;
- }
-
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.StringTokenizer;
+import org.eclipse.osee.framework.ui.skynet.util.OseeDictionary;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.styledText.ASpellWord;
+import org.eclipse.osee.framework.ui.swt.styledText.IDictionary;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.events.MenuListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+
+/**
+ * PaintListener that will underline all misspelled words in a StyledText widget. This class must be extended to provide
+ * for getting the dictionary and activating/deactivating certain functionality.
+ *
+ * @author Donald G. Dunne
+ */
+public class XTextSpellCheckPaintListener implements PaintListener {
+
+ private final IDictionary dict;
+ private final XText xText;
+ private final Set<ASpellWord> errors = new HashSet<ASpellWord>();
+ private XTextSpellModifyDictionary modDict;
+
+ public XTextSpellCheckPaintListener(final XText xText, IDictionary dict) {
+ this.xText = xText;
+ this.dict = dict;
+ if (modDict != null) {
+ addXTextSpellModifyDictionary(modDict);
+ }
+ }
+
+ public void addXTextSpellModifyDictionary(XTextSpellModifyDictionary modDict) {
+ if (xText == null || xText.getStyledText() == null || xText.getStyledText().isDisposed()) {
+ return;
+ }
+ this.modDict = modDict;
+ xText.getStyledText().addMouseListener(mouseListener);
+ xText.getStyledText().addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ if (xText == null || xText.getStyledText() == null || xText.getStyledText().isDisposed()) {
+ return;
+ }
+ xText.getStyledText().removeMouseListener(mouseListener);
+ }
+ });
+ }
+
+ public void paintControl(PaintEvent e) {
+ if (xText == null || xText.getStyledText() == null || xText.getStyledText().isDisposed()) {
+ return;
+ }
+ GC gc = e.gc;
+ gc.setForeground(Displays.getSystemColor(SWT.COLOR_BLUE));
+ if (xText != null) {
+ String text = xText.getStyledText().getText();
+
+ // Get spelling errors
+ getErrors(text);
+ for (ASpellWord sw : errors) {
+ drawError(sw.start, sw.word.length(), xText.getStyledText(), gc);
+ }
+ }
+ }
+
+ private final MouseListener mouseListener = new MouseListener() {
+ public void mouseUp(org.eclipse.swt.events.MouseEvent e) {
+ StyledText styledText = (StyledText) e.widget;
+ int offset = 0;
+ try {
+ offset = styledText.getOffsetAtLocation(new Point(e.x, e.y));
+ } catch (IllegalArgumentException ex) {
+ // Illegal arguement exception happens when selected point is outside
+ // the range of the rectangle. Since it does it's own calculation, just
+ // throw this exception away.
+ return;
+ }
+ for (ASpellWord sw : errors) {
+ if (sw.start < offset && (sw.start + sw.word.length()) > offset) {
+ // System.out.println("Found error word " + sw.word);
+ handleErrorSelected(sw);
+ break;
+ }
+ }
+ };
+
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+
+ public void mouseDown(MouseEvent e) {
+ }
+ };
+
+ private void handleErrorSelected(final ASpellWord sw) {
+ Menu menu = xText.getStyledText().getMenu();
+
+ new MenuItem(menu, SWT.SEPARATOR);
+
+ MenuItem addLocal = new MenuItem(menu, SWT.NONE);
+ addLocal.setText("Add \"" + sw.word + "\" to Personal dictionary.");
+ addLocal.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (modDict.addToLocalDictionary(sw.word)) {
+ xText.getStyledText().redraw();
+ }
+ }
+ });
+
+ MenuItem addGlobal = new MenuItem(menu, SWT.NONE);
+ addGlobal.setText("Add \"" + sw.word + "\" to Global dictionary.");
+ addGlobal.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (modDict.addToGlobalDictionary(sw.word)) {
+ xText.getStyledText().redraw();
+ }
+ }
+ });
+ menu.addMenuListener(new MenuListener() {
+ public void menuHidden(MenuEvent e) {
+ xText.getStyledText().setMenu(xText.getDefaultMenu());
+ }
+
+ public void menuShown(MenuEvent e) {
+ };
+ });
+ }
+
+ /**
+ * Draws a single spelling error squiggly line
+ *
+ * @param offset - offset of bad word
+ * @param len - length of bad word
+ */
+ private void drawError(int offset, int len, StyledText sText, GC gc) {
+ if (sText.isDisposed()) {
+ return;
+ }
+ // Convert to coordinates
+ try {
+ Point off1 = sText.getLocationAtOffset(offset);
+ off1.y--;
+ Point off2 = sText.getLocationAtOffset(offset + len);
+ off2.y--;
+ int h = sText.getLineHeight();
+ int[] polyline = computePolyline(off1, off2, h);
+ gc.drawPolyline(polyline);
+ } catch (RuntimeException e) {
+ }
+ }
+
+ /**
+ */
+ private void getErrors(String str) {
+ errors.clear();
+ StringTokenizer st = new StringTokenizer(str, "[\t\r\n ]", true);
+ int loc = 0;
+ while (st.hasMoreTokens()) {
+ String string = st.nextToken();
+ // if not a whitespace character
+ if (!string.matches("^\\s*$")) {
+ // System.out.println("isWord: orig *" + string + "* => *" + word + "*");
+ if (!dict.isWord(string)) {
+ // System.out.println("word " + word + " is error");
+ String cleanError = OseeDictionary.getInstance().getCleanWord(string);
+ ASpellWord sw = new ASpellWord(cleanError, loc);
+ errors.add(sw);
+ }
+ }
+ loc += string.length();
+ }
+ }
+
+ /**
+ * Computes the squiggly line.
+ *
+ * @param left the left end point
+ * @param right the right end point
+ * @param height the height of the squiggly line
+ * @return the polyline array
+ */
+ private int[] computePolyline(Point left, Point right, int height) {
+
+ final int WIDTH = 3;
+ final int HEIGHT = 0;
+
+ int w2 = 2 * WIDTH;
+ int peeks = (right.x - left.x) / w2;
+
+ int leftX = left.x;
+
+ // compute (number of points) * 2
+ int length = 4 * peeks + 2;
+ if (length <= 0) {
+ return new int[0];
+ }
+
+ int[] coordinates = new int[length];
+
+ // compute top and bottom of peeks
+ int bottom = left.y + height;
+ int top = bottom - HEIGHT;
+
+ // populate array with peek coordinates
+ int index = 0;
+ for (int i = 0; i < peeks; i++) {
+ coordinates[index++] = leftX + (w2 * i);
+ coordinates[index++] = bottom;
+ coordinates[index++] = coordinates[index - 3] + WIDTH;
+ coordinates[index++] = top;
+ }
+ // add the last down flank
+ coordinates[length - 2] = left.x + (w2 * peeks);
+ coordinates[length - 1] = bottom;
+ return coordinates;
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XTypeListViewer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XTypeListViewer.java
index ce9d058459b..69aacfbf978 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XTypeListViewer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XTypeListViewer.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.framework.ui.skynet.widgets;
-
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.ViewerSorter;
-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.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-
-/**
- * @author Jeff C. Phillips
- */
-public abstract class XTypeListViewer extends XListViewer {
-
- public XTypeListViewer(String name) {
- super(name);
- setLabelProvider(new LabelProvider());
- setSorter(new ViewerSorter());
- }
-
- public Branch resolveBranch(String branchGuid) {
- try {
- if (branchGuid != null) {
- return BranchManager.getBranchByGuid(branchGuid);
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return BranchManager.getLastBranch();
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.ViewerSorter;
+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.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public abstract class XTypeListViewer extends XListViewer {
+
+ public XTypeListViewer(String name) {
+ super(name);
+ setLabelProvider(new LabelProvider());
+ setSorter(new ViewerSorter());
+ }
+
+ public Branch resolveBranch(String branchGuid) {
+ try {
+ if (branchGuid != null) {
+ return BranchManager.getBranchByGuid(branchGuid);
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return BranchManager.getLastBranch();
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XWidget.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XWidget.java
index 169715c9861..ec2b83acbbd 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XWidget.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XWidget.java
@@ -1,421 +1,421 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.widgets;
-
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.Vector;
-import java.util.logging.Level;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.osee.framework.jdk.core.type.MutableBoolean;
-import org.eclipse.osee.framework.jdk.core.util.AXml;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.Widgets;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.IManagedForm;
-import org.eclipse.ui.forms.IMessageManager;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * Abstract class for all widgets used in Wizards and Editors
- */
-public abstract class XWidget {
- public final static String XWIDGET_DATA_KEY = "xWidget";
-
- private IManagedForm managedForm;
-
- protected Label labelWidget = null;
- private String label = "";
- private String xmlRoot = "";
- private String xmlSubRoot = "";
- private String toolTip = null;
- private boolean requiredEntry = false;
- private boolean editable = true;
- private final MutableBoolean isNotificationAllowed = new MutableBoolean(true);
-
- protected boolean verticalLabel = false;
- protected boolean fillVertically = false;
- protected boolean fillHorizontally = false;
-
- public boolean isFillHorizontally() {
- return fillHorizontally;
- }
-
- private boolean displayLabel = true;
- private final Set<XModifiedListener> modifiedListeners = new LinkedHashSet<XModifiedListener>();
- private MouseListener mouseLabelListener;
- protected FormToolkit toolkit;
-
- public XWidget(String label) {
- this.label = label;
- }
-
- public XWidget(String label, String xmlRoot) {
- this.label = label;
- this.xmlRoot = xmlRoot;
- }
-
- public XWidget(String label, String xmlRoot, String xmlSubRoot) {
- this.label = label;
- this.xmlRoot = xmlRoot;
- this.xmlSubRoot = xmlSubRoot;
- }
-
- public void setToolTip(String toolTip) {
- this.toolTip = toolTip;
- if (this.labelWidget != null && !labelWidget.isDisposed()) {
- this.labelWidget.setToolTipText(toolTip);
- }
- }
-
- public void addXModifiedListener(XModifiedListener listener) {
- modifiedListeners.add(listener);
- }
-
- public void notifyXModifiedListeners() {
- if (areNotificationsAllowed()) {
- for (XModifiedListener listener : modifiedListeners) {
- listener.widgetModified(this);
- }
- }
- }
-
- public boolean areNotificationsAllowed() {
- return isNotificationAllowed.getValue();
- }
-
- protected IManagedForm getManagedForm() {
- return managedForm;
- }
-
- public boolean isInForm() {
- return getManagedForm() != null;
- }
-
- protected IMessageManager getMessageManager() {
- return getManagedForm() != null ? managedForm.getMessageManager() : null;
- }
-
- public void setMessage(String messageId, String messageText, int type) {
- IMessageManager messageManager = getMessageManager();
- if (messageManager != null && isFormReady()) {
- messageManager.addMessage(messageId, messageText, null, type);
- }
- }
-
- public boolean isFormReady() {
- // Set to true if outside of a form;
- boolean result = managedForm == null;
- if (managedForm != null) {
- result = !managedForm.getForm().isDisposed();
- }
- return result;
- }
-
- public void setControlCausedMessage(String messageId, String messageText, int type) {
- IMessageManager messageManager = getMessageManager();
- if (messageManager != null && isFormReady()) {
- messageManager.addMessage(messageId, messageText, null, type, getErrorMessageControl());
- }
- }
-
- public void setControlCausedMessageByObject(String messageText, int type) {
- IMessageManager messageManager = getMessageManager();
- if (messageManager != null && isFormReady()) {
- messageManager.addMessage(this, messageText, null, type, getErrorMessageControl());
- }
- }
-
- public void removeControlCausedMessageByObject() {
- IMessageManager messageManager = getMessageManager();
- if (messageManager != null && isFormReady()) {
- messageManager.removeMessage(this, getErrorMessageControl());
- }
- }
-
- public void removeControlCausedMessage(String messageId) {
- IMessageManager messageManager = getMessageManager();
- if (messageManager != null && isFormReady()) {
- messageManager.removeMessage(messageId, getErrorMessageControl());
- }
- }
-
- public void validate() {
- if (isEditable() && Widgets.isAccessible(getControl()) && isFormReady() && areNotificationsAllowed()) {
- IStatus status = isValid();
- if (isInForm()) {
- XWidgetValidateUtility.setStatus(status, this);
- } else {
- if (Widgets.isAccessible(labelWidget)) {
- labelWidget.setForeground(status.isOK() ? null : Displays.getSystemColor(SWT.COLOR_RED));
- if (mouseLabelListener == null) {
- mouseLabelListener = new MouseListener() {
- @Override
- public void mouseDoubleClick(MouseEvent e) {
- openHelp();
- }
-
- @Override
- public void mouseDown(MouseEvent e) {
- }
-
- @Override
- public void mouseUp(MouseEvent e) {
- }
- };
- labelWidget.addMouseListener(mouseLabelListener);
- }
- }
- }
- }
- }
-
- /**
- * Return the control that the error message is to be placed. By default the getControl() will be used. Override to
- * change.
- *
- * @return control
- */
- public Control getErrorMessageControl() {
- return getControl();
- }
-
- public abstract Control getControl();
-
- public void openHelp() {
- try {
- if (toolTip != null && label != null) {
- MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- label + " Tool Tip", toolTip);
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
-
- protected void setNotificationsAllowed(boolean areAllowed) {
- this.isNotificationAllowed.setValue(areAllowed);
- }
-
- protected void createControls(Composite parent, int horizontalSpan) {
-
- }
-
- public final void createWidgets(Composite parent, int horizontalSpan) {
- setNotificationsAllowed(false);
- try {
- createControls(parent, horizontalSpan);
- } finally {
- setNotificationsAllowed(true);
- }
- }
-
- public final void createWidgets(IManagedForm managedForm, Composite parent, int horizontalSpan) {
- if (managedForm != null) {
- this.toolkit = managedForm.getToolkit();
- this.managedForm = managedForm;
- }
- createWidgets(parent, horizontalSpan);
- adaptControls(toolkit);
-
- // Added to be able to operate on XWidget who create the control
- Control internalControl = getControl();
- if (internalControl != null) {
- internalControl.setData(XWIDGET_DATA_KEY, this);
- }
- }
-
- public void adaptControls(FormToolkit toolkit) {
- if (toolkit != null) {
- if (getControl() != null) {
- toolkit.adapt(getControl(), true, false);
- }
- if (labelWidget != null) {
- toolkit.adapt(labelWidget, true, true);
- toolkit.adapt(labelWidget.getParent(), true, true);
- }
- }
- }
-
- /**
- * Create Widgets used to display label and entry for wizards and editors
- */
- public void dispose() {
- if (Widgets.isAccessible(managedForm.getForm())) {
- removeControlCausedMessageByObject();
- }
- }
-
- public abstract void setFocus();
-
- public abstract void refresh();
-
- public abstract IStatus isValid();
-
- /**
- * Called with string found between xml tags Used by setFromXml() String will be sent through AXml.xmlToText() before
- * being sent to setXmlData implementation. Used by: setFromXml
- *
- * @param str - value to set
- */
- public abstract void setXmlData(String str);
-
- /**
- * Return string to save off between xml tags Used by call to toXml() String returned will be sent through
- * AXml.textToXml() before being saved Used by: toXml
- *
- * @return Return Xml data string.
- */
- protected abstract String getXmlData();
-
- public abstract String toHTML(String labelFont);
-
- protected String toXml() throws Exception {
- if (xmlSubRoot.equals("")) {
- return toXml(xmlRoot);
- } else {
- return toXml(xmlRoot, xmlSubRoot);
- }
- }
-
- protected String toXml(String xmlRoot) throws Exception {
- String s = "<" + xmlRoot + ">" + AXml.textToXml(getXmlData()) + "</" + xmlRoot + ">\n";
- return s;
- }
-
- public String toXml(String xmlRoot, String xmlSubRoot) throws Exception {
- String s =
- "<" + xmlRoot + ">" + "<" + xmlSubRoot + ">" + AXml.textToXml(getXmlData()) + "</" + xmlSubRoot + ">" + "</" + xmlRoot + ">\n";
- return s;
- }
-
- public void setFromXml(String xml) throws IllegalStateException {
- Matcher m;
- m = Pattern.compile("<" + xmlRoot + ">(.*?)</" + xmlRoot + ">", Pattern.MULTILINE | Pattern.DOTALL).matcher(xml);
- if (m.find()) {
- setXmlData(AXml.xmlToText(m.group(1)));
- }
- }
-
- public Vector<String> getDisplayLabels() {
- Vector<String> l = new Vector<String>();
- l.add(label);
- return l;
- }
-
- public void setDisplayLabel(String displayLabel) {
- this.label = displayLabel;
- }
-
- public boolean isEditable() {
- return editable;
- }
-
- public void setEditable(boolean editable) {
- this.editable = editable;
- }
-
- public boolean isVerticalLabel() {
- return verticalLabel;
- }
-
- public void setVerticalLabel(boolean verticalLabel) {
- this.verticalLabel = verticalLabel;
- }
-
- public String getXmlRoot() {
- return xmlRoot;
- }
-
- public void setXmlRoot(String xmlRoot) {
- this.xmlRoot = xmlRoot;
- }
-
- public String getXmlSubRoot() {
- return xmlSubRoot;
- }
-
- public void setXmlSubRoot(String xmlSubRoot) {
- this.xmlSubRoot = xmlSubRoot;
- }
-
- public String getToolTip() {
- return toolTip;
- }
-
- public boolean isFillVertically() {
- return fillVertically;
- }
-
- public void setFillVertically(boolean fillVertically) {
- this.fillVertically = fillVertically;
- }
-
- public String getLabel() {
- return label;
- }
-
- public void setLabel(String label) {
- this.label = label;
- if (labelWidget != null && !labelWidget.isDisposed()) {
- labelWidget.setText(label);
- }
- }
-
- public Label getLabelWidget() {
- return labelWidget;
- }
-
- protected void setLabelWidget(Label labelWidget) {
- this.labelWidget = labelWidget;
- }
-
- public boolean isRequiredEntry() {
- return requiredEntry;
- }
-
- public void setRequiredEntry(boolean requiredEntry) {
- this.requiredEntry = requiredEntry;
- }
-
- protected abstract String getReportData();
-
- @Override
- public String toString() {
- return String.format("%s: %s\n\n", getLabel(), getReportData());
- }
-
- public void setDisplayLabel(boolean displayLabel) {
- this.displayLabel = displayLabel;
- }
-
- public void setFillHorizontally(boolean fillHorizontally) {
- this.fillHorizontally = fillHorizontally;
- }
-
- public abstract Object getData();
-
- public boolean isDisplayLabel() {
- return displayLabel;
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+import java.util.LinkedHashSet;
+import java.util.Set;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osee.framework.jdk.core.type.MutableBoolean;
+import org.eclipse.osee.framework.jdk.core.util.AXml;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.Widgets;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.IMessageManager;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * Abstract class for all widgets used in Wizards and Editors
+ */
+public abstract class XWidget {
+ public final static String XWIDGET_DATA_KEY = "xWidget";
+
+ private IManagedForm managedForm;
+
+ protected Label labelWidget = null;
+ private String label = "";
+ private String xmlRoot = "";
+ private String xmlSubRoot = "";
+ private String toolTip = null;
+ private boolean requiredEntry = false;
+ private boolean editable = true;
+ private final MutableBoolean isNotificationAllowed = new MutableBoolean(true);
+
+ protected boolean verticalLabel = false;
+ protected boolean fillVertically = false;
+ protected boolean fillHorizontally = false;
+
+ public boolean isFillHorizontally() {
+ return fillHorizontally;
+ }
+
+ private boolean displayLabel = true;
+ private final Set<XModifiedListener> modifiedListeners = new LinkedHashSet<XModifiedListener>();
+ private MouseListener mouseLabelListener;
+ protected FormToolkit toolkit;
+
+ public XWidget(String label) {
+ this.label = label;
+ }
+
+ public XWidget(String label, String xmlRoot) {
+ this.label = label;
+ this.xmlRoot = xmlRoot;
+ }
+
+ public XWidget(String label, String xmlRoot, String xmlSubRoot) {
+ this.label = label;
+ this.xmlRoot = xmlRoot;
+ this.xmlSubRoot = xmlSubRoot;
+ }
+
+ public void setToolTip(String toolTip) {
+ this.toolTip = toolTip;
+ if (this.labelWidget != null && !labelWidget.isDisposed()) {
+ this.labelWidget.setToolTipText(toolTip);
+ }
+ }
+
+ public void addXModifiedListener(XModifiedListener listener) {
+ modifiedListeners.add(listener);
+ }
+
+ public void notifyXModifiedListeners() {
+ if (areNotificationsAllowed()) {
+ for (XModifiedListener listener : modifiedListeners) {
+ listener.widgetModified(this);
+ }
+ }
+ }
+
+ public boolean areNotificationsAllowed() {
+ return isNotificationAllowed.getValue();
+ }
+
+ protected IManagedForm getManagedForm() {
+ return managedForm;
+ }
+
+ public boolean isInForm() {
+ return getManagedForm() != null;
+ }
+
+ protected IMessageManager getMessageManager() {
+ return getManagedForm() != null ? managedForm.getMessageManager() : null;
+ }
+
+ public void setMessage(String messageId, String messageText, int type) {
+ IMessageManager messageManager = getMessageManager();
+ if (messageManager != null && isFormReady()) {
+ messageManager.addMessage(messageId, messageText, null, type);
+ }
+ }
+
+ public boolean isFormReady() {
+ // Set to true if outside of a form;
+ boolean result = managedForm == null;
+ if (managedForm != null) {
+ result = !managedForm.getForm().isDisposed();
+ }
+ return result;
+ }
+
+ public void setControlCausedMessage(String messageId, String messageText, int type) {
+ IMessageManager messageManager = getMessageManager();
+ if (messageManager != null && isFormReady()) {
+ messageManager.addMessage(messageId, messageText, null, type, getErrorMessageControl());
+ }
+ }
+
+ public void setControlCausedMessageByObject(String messageText, int type) {
+ IMessageManager messageManager = getMessageManager();
+ if (messageManager != null && isFormReady()) {
+ messageManager.addMessage(this, messageText, null, type, getErrorMessageControl());
+ }
+ }
+
+ public void removeControlCausedMessageByObject() {
+ IMessageManager messageManager = getMessageManager();
+ if (messageManager != null && isFormReady()) {
+ messageManager.removeMessage(this, getErrorMessageControl());
+ }
+ }
+
+ public void removeControlCausedMessage(String messageId) {
+ IMessageManager messageManager = getMessageManager();
+ if (messageManager != null && isFormReady()) {
+ messageManager.removeMessage(messageId, getErrorMessageControl());
+ }
+ }
+
+ public void validate() {
+ if (isEditable() && Widgets.isAccessible(getControl()) && isFormReady() && areNotificationsAllowed()) {
+ IStatus status = isValid();
+ if (isInForm()) {
+ XWidgetValidateUtility.setStatus(status, this);
+ } else {
+ if (Widgets.isAccessible(labelWidget)) {
+ labelWidget.setForeground(status.isOK() ? null : Displays.getSystemColor(SWT.COLOR_RED));
+ if (mouseLabelListener == null) {
+ mouseLabelListener = new MouseListener() {
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ openHelp();
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ }
+ };
+ labelWidget.addMouseListener(mouseLabelListener);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Return the control that the error message is to be placed. By default the getControl() will be used. Override to
+ * change.
+ *
+ * @return control
+ */
+ public Control getErrorMessageControl() {
+ return getControl();
+ }
+
+ public abstract Control getControl();
+
+ public void openHelp() {
+ try {
+ if (toolTip != null && label != null) {
+ MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ label + " Tool Tip", toolTip);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ protected void setNotificationsAllowed(boolean areAllowed) {
+ this.isNotificationAllowed.setValue(areAllowed);
+ }
+
+ protected void createControls(Composite parent, int horizontalSpan) {
+
+ }
+
+ public final void createWidgets(Composite parent, int horizontalSpan) {
+ setNotificationsAllowed(false);
+ try {
+ createControls(parent, horizontalSpan);
+ } finally {
+ setNotificationsAllowed(true);
+ }
+ }
+
+ public final void createWidgets(IManagedForm managedForm, Composite parent, int horizontalSpan) {
+ if (managedForm != null) {
+ this.toolkit = managedForm.getToolkit();
+ this.managedForm = managedForm;
+ }
+ createWidgets(parent, horizontalSpan);
+ adaptControls(toolkit);
+
+ // Added to be able to operate on XWidget who create the control
+ Control internalControl = getControl();
+ if (internalControl != null) {
+ internalControl.setData(XWIDGET_DATA_KEY, this);
+ }
+ }
+
+ public void adaptControls(FormToolkit toolkit) {
+ if (toolkit != null) {
+ if (getControl() != null) {
+ toolkit.adapt(getControl(), true, false);
+ }
+ if (labelWidget != null) {
+ toolkit.adapt(labelWidget, true, true);
+ toolkit.adapt(labelWidget.getParent(), true, true);
+ }
+ }
+ }
+
+ /**
+ * Create Widgets used to display label and entry for wizards and editors
+ */
+ public void dispose() {
+ if (Widgets.isAccessible(managedForm.getForm())) {
+ removeControlCausedMessageByObject();
+ }
+ }
+
+ public abstract void setFocus();
+
+ public abstract void refresh();
+
+ public abstract IStatus isValid();
+
+ /**
+ * Called with string found between xml tags Used by setFromXml() String will be sent through AXml.xmlToText() before
+ * being sent to setXmlData implementation. Used by: setFromXml
+ *
+ * @param str - value to set
+ */
+ public abstract void setXmlData(String str);
+
+ /**
+ * Return string to save off between xml tags Used by call to toXml() String returned will be sent through
+ * AXml.textToXml() before being saved Used by: toXml
+ *
+ * @return Return Xml data string.
+ */
+ protected abstract String getXmlData();
+
+ public abstract String toHTML(String labelFont);
+
+ protected String toXml() throws Exception {
+ if (xmlSubRoot.equals("")) {
+ return toXml(xmlRoot);
+ } else {
+ return toXml(xmlRoot, xmlSubRoot);
+ }
+ }
+
+ protected String toXml(String xmlRoot) throws Exception {
+ String s = "<" + xmlRoot + ">" + AXml.textToXml(getXmlData()) + "</" + xmlRoot + ">\n";
+ return s;
+ }
+
+ public String toXml(String xmlRoot, String xmlSubRoot) throws Exception {
+ String s =
+ "<" + xmlRoot + ">" + "<" + xmlSubRoot + ">" + AXml.textToXml(getXmlData()) + "</" + xmlSubRoot + ">" + "</" + xmlRoot + ">\n";
+ return s;
+ }
+
+ public void setFromXml(String xml) throws IllegalStateException {
+ Matcher m;
+ m = Pattern.compile("<" + xmlRoot + ">(.*?)</" + xmlRoot + ">", Pattern.MULTILINE | Pattern.DOTALL).matcher(xml);
+ if (m.find()) {
+ setXmlData(AXml.xmlToText(m.group(1)));
+ }
+ }
+
+ public Vector<String> getDisplayLabels() {
+ Vector<String> l = new Vector<String>();
+ l.add(label);
+ return l;
+ }
+
+ public void setDisplayLabel(String displayLabel) {
+ this.label = displayLabel;
+ }
+
+ public boolean isEditable() {
+ return editable;
+ }
+
+ public void setEditable(boolean editable) {
+ this.editable = editable;
+ }
+
+ public boolean isVerticalLabel() {
+ return verticalLabel;
+ }
+
+ public void setVerticalLabel(boolean verticalLabel) {
+ this.verticalLabel = verticalLabel;
+ }
+
+ public String getXmlRoot() {
+ return xmlRoot;
+ }
+
+ public void setXmlRoot(String xmlRoot) {
+ this.xmlRoot = xmlRoot;
+ }
+
+ public String getXmlSubRoot() {
+ return xmlSubRoot;
+ }
+
+ public void setXmlSubRoot(String xmlSubRoot) {
+ this.xmlSubRoot = xmlSubRoot;
+ }
+
+ public String getToolTip() {
+ return toolTip;
+ }
+
+ public boolean isFillVertically() {
+ return fillVertically;
+ }
+
+ public void setFillVertically(boolean fillVertically) {
+ this.fillVertically = fillVertically;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ if (labelWidget != null && !labelWidget.isDisposed()) {
+ labelWidget.setText(label);
+ }
+ }
+
+ public Label getLabelWidget() {
+ return labelWidget;
+ }
+
+ protected void setLabelWidget(Label labelWidget) {
+ this.labelWidget = labelWidget;
+ }
+
+ public boolean isRequiredEntry() {
+ return requiredEntry;
+ }
+
+ public void setRequiredEntry(boolean requiredEntry) {
+ this.requiredEntry = requiredEntry;
+ }
+
+ protected abstract String getReportData();
+
+ @Override
+ public String toString() {
+ return String.format("%s: %s\n\n", getLabel(), getReportData());
+ }
+
+ public void setDisplayLabel(boolean displayLabel) {
+ this.displayLabel = displayLabel;
+ }
+
+ public void setFillHorizontally(boolean fillHorizontally) {
+ this.fillHorizontally = fillHorizontally;
+ }
+
+ public abstract Object getData();
+
+ public boolean isDisplayLabel() {
+ return displayLabel;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XWidgetUtility.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XWidgetUtility.java
index 3cf7680db4a..cab869c0a89 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XWidgetUtility.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XWidgetUtility.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.framework.ui.skynet.widgets;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- * @author Roberto E. Escobar
- */
-public final class XWidgetUtility {
-
- private XWidgetUtility() {
- }
-
- public static boolean isWidgetAccesible(Widget widget) {
- return widget != null && !widget.isDisposed();
- }
-
- public static List<XWidget> findXWidgetsInControl(Widget parent) {
- List<XWidget> xWidgets = new ArrayList<XWidget>();
- XWidget xWidget = asXWidget(parent);
- if (xWidget != null) {
- xWidgets.add(xWidget);
- }
- if (parent instanceof Composite) {
- Composite container = (Composite) parent;
- for (Control child : container.getChildren()) {
- xWidgets.addAll(findXWidgetsInControl(child));
- }
- }
- return xWidgets;
- }
-
- public static XWidget asXWidget(Widget widget) {
- XWidget toReturn = null;
- if (widget != null) {
- Object object = widget.getData(XWidget.XWIDGET_DATA_KEY);
- toReturn = object instanceof XWidget ? (XWidget) object : null;
- }
- return toReturn;
- }
-
- public static boolean hasXWidget(Widget widget) {
- boolean result = false;
- if (widget != null) {
- Object object = widget.getData(XWidget.XWIDGET_DATA_KEY);
- result = object instanceof XWidget;
- }
- return result;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Widget;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public final class XWidgetUtility {
+
+ private XWidgetUtility() {
+ }
+
+ public static boolean isWidgetAccesible(Widget widget) {
+ return widget != null && !widget.isDisposed();
+ }
+
+ public static List<XWidget> findXWidgetsInControl(Widget parent) {
+ List<XWidget> xWidgets = new ArrayList<XWidget>();
+ XWidget xWidget = asXWidget(parent);
+ if (xWidget != null) {
+ xWidgets.add(xWidget);
+ }
+ if (parent instanceof Composite) {
+ Composite container = (Composite) parent;
+ for (Control child : container.getChildren()) {
+ xWidgets.addAll(findXWidgetsInControl(child));
+ }
+ }
+ return xWidgets;
+ }
+
+ public static XWidget asXWidget(Widget widget) {
+ XWidget toReturn = null;
+ if (widget != null) {
+ Object object = widget.getData(XWidget.XWIDGET_DATA_KEY);
+ toReturn = object instanceof XWidget ? (XWidget) object : null;
+ }
+ return toReturn;
+ }
+
+ public static boolean hasXWidget(Widget widget) {
+ boolean result = false;
+ if (widget != null) {
+ Object object = widget.getData(XWidget.XWIDGET_DATA_KEY);
+ result = object instanceof XWidget;
+ }
+ return result;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XWidgetValidateUtility.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XWidgetValidateUtility.java
index cd1306709f9..906ebee57ed 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XWidgetValidateUtility.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XWidgetValidateUtility.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.framework.ui.skynet.widgets;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.validation.OseeValidator;
-
-/**
- * @author Roberto E. Escobar
- */
-public final class XWidgetValidateUtility {
-
- private XWidgetValidateUtility() {
- }
-
- public static void validate(int requiredQualityOfService, XWidget xWidget, Artifact artifact, String attributeTypeName, Object proposedValue) {
- IStatus status =
- OseeValidator.getInstance().validate(requiredQualityOfService, artifact, attributeTypeName,
- proposedValue);
- setStatus(status, xWidget);
- }
-
- public static void setStatus(IStatus status, XWidget xWidget) {
- if (status.isMultiStatus()) {
- for (IStatus item : status.getChildren()) {
- if (item.isOK()) {
- xWidget.removeControlCausedMessage(item.getPlugin());
- } else {
- xWidget.setControlCausedMessage(item.getPlugin(), item.getMessage(),
- toMessageProviderLevel(item.getSeverity()));
- }
- }
- } else {
- if (!status.isOK()) {
- xWidget.setControlCausedMessageByObject(status.getMessage(), toMessageProviderLevel(status.getSeverity()));
- } else {
- xWidget.removeControlCausedMessageByObject();
- }
- }
- }
-
- public static boolean isValueInRange(int value, int min, int max) {
- return min <= value && value < max;
- }
-
- public static int toMessageProviderLevel(int level) {
- int toReturn = IMessageProvider.NONE;
- if (level == IStatus.INFO) {
- toReturn = IMessageProvider.INFORMATION;
- } else if (level == IStatus.WARNING) {
- toReturn = IMessageProvider.WARNING;
- } else if (level == IStatus.ERROR) {
- toReturn = IMessageProvider.ERROR;
- }
- 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.framework.ui.skynet.widgets;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.validation.OseeValidator;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public final class XWidgetValidateUtility {
+
+ private XWidgetValidateUtility() {
+ }
+
+ public static void validate(int requiredQualityOfService, XWidget xWidget, Artifact artifact, String attributeTypeName, Object proposedValue) {
+ IStatus status =
+ OseeValidator.getInstance().validate(requiredQualityOfService, artifact, attributeTypeName,
+ proposedValue);
+ setStatus(status, xWidget);
+ }
+
+ public static void setStatus(IStatus status, XWidget xWidget) {
+ if (status.isMultiStatus()) {
+ for (IStatus item : status.getChildren()) {
+ if (item.isOK()) {
+ xWidget.removeControlCausedMessage(item.getPlugin());
+ } else {
+ xWidget.setControlCausedMessage(item.getPlugin(), item.getMessage(),
+ toMessageProviderLevel(item.getSeverity()));
+ }
+ }
+ } else {
+ if (!status.isOK()) {
+ xWidget.setControlCausedMessageByObject(status.getMessage(), toMessageProviderLevel(status.getSeverity()));
+ } else {
+ xWidget.removeControlCausedMessageByObject();
+ }
+ }
+ }
+
+ public static boolean isValueInRange(int value, int min, int max) {
+ return min <= value && value < max;
+ }
+
+ public static int toMessageProviderLevel(int level) {
+ int toReturn = IMessageProvider.NONE;
+ if (level == IStatus.INFO) {
+ toReturn = IMessageProvider.INFORMATION;
+ } else if (level == IStatus.WARNING) {
+ toReturn = IMessageProvider.WARNING;
+ } else if (level == IStatus.ERROR) {
+ toReturn = IMessageProvider.ERROR;
+ }
+ return toReturn;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/ArtifactListDialog.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/ArtifactListDialog.java
index 661dedfcf1e..b025d6b8b1b 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/ArtifactListDialog.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/ArtifactListDialog.java
@@ -1,89 +1,89 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.dialog;
-
-import java.util.Collection;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-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.util.ArtifactDescriptiveLabelProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.ListDialog;
-
-/**
- * @author Donald G. Dunne
- */
-public class ArtifactListDialog extends ListDialog {
-
- boolean requireSelection = true;
-
- /**
- * @return the requireSelection
- */
- public boolean isRequireSelection() {
- return requireSelection;
- }
-
- /**
- * @param requireSelection the requireSelection to set
- */
- public void setRequireSelection(boolean requireSelection) {
- this.requireSelection = requireSelection;
- }
-
- public ArtifactListDialog(Shell parent) {
- super(parent);
- setContentProvider(new ArrayContentProvider());
- setLabelProvider(new ArtifactDescriptiveLabelProvider());
- setShellStyle(getShellStyle() | SWT.RESIZE);
- }
-
- public Artifact getSelection() {
- return (Artifact) getResult()[0];
- }
-
- @Override
- protected Control createDialogArea(Composite container) {
- Control c = super.createDialogArea(container);
- getTableViewer().setSorter(new ViewerSorter() {
- @SuppressWarnings("unchecked")
- @Override
- public int compare(Viewer viewer, Object e1, Object e2) {
- return getComparator().compare(((Artifact) e1).getName(), ((Artifact) e2).getName());
- }
- });
- return c;
- }
-
- public void setArtifacts(Collection<? extends Artifact> artifacts) {
- setInput(artifacts);
- }
-
- public void updateArtifacts(Collection<? extends Artifact> artifacts) {
- getTableViewer().setInput(artifacts);
- getTableViewer().refresh();
- }
-
- @Override
- protected void okPressed() {
- if (requireSelection && getTableViewer().getSelection().isEmpty()) {
- AWorkbench.popup("ERROR", "Must make selection.");
- return;
- }
- super.okPressed();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.dialog;
+
+import java.util.Collection;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+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.util.ArtifactDescriptiveLabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.ListDialog;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ArtifactListDialog extends ListDialog {
+
+ boolean requireSelection = true;
+
+ /**
+ * @return the requireSelection
+ */
+ public boolean isRequireSelection() {
+ return requireSelection;
+ }
+
+ /**
+ * @param requireSelection the requireSelection to set
+ */
+ public void setRequireSelection(boolean requireSelection) {
+ this.requireSelection = requireSelection;
+ }
+
+ public ArtifactListDialog(Shell parent) {
+ super(parent);
+ setContentProvider(new ArrayContentProvider());
+ setLabelProvider(new ArtifactDescriptiveLabelProvider());
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ }
+
+ public Artifact getSelection() {
+ return (Artifact) getResult()[0];
+ }
+
+ @Override
+ protected Control createDialogArea(Composite container) {
+ Control c = super.createDialogArea(container);
+ getTableViewer().setSorter(new ViewerSorter() {
+ @SuppressWarnings("unchecked")
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ return getComparator().compare(((Artifact) e1).getName(), ((Artifact) e2).getName());
+ }
+ });
+ return c;
+ }
+
+ public void setArtifacts(Collection<? extends Artifact> artifacts) {
+ setInput(artifacts);
+ }
+
+ public void updateArtifacts(Collection<? extends Artifact> artifacts) {
+ getTableViewer().setInput(artifacts);
+ getTableViewer().refresh();
+ }
+
+ @Override
+ protected void okPressed() {
+ if (requireSelection && getTableViewer().getSelection().isEmpty()) {
+ AWorkbench.popup("ERROR", "Must make selection.");
+ return;
+ }
+ super.okPressed();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/ArtifactTypeFilteredTreeEntryDialog.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/ArtifactTypeFilteredTreeEntryDialog.java
index 22f5dce90e8..deb0769d97c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/ArtifactTypeFilteredTreeEntryDialog.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/ArtifactTypeFilteredTreeEntryDialog.java
@@ -1,77 +1,77 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.dialog;
-
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-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.widgets.Composite;
-
-/**
- * @author Donald G. Dunne
- */
-public class ArtifactTypeFilteredTreeEntryDialog extends ArtifactTypeFilteredTreeDialog {
-
- private String entryValue = null;
- private final String entryName;
- private XText xText = null;
-
- /**
- * @param title
- * @param message
- * @param artifactTypes
- */
- public ArtifactTypeFilteredTreeEntryDialog(String title, String message, String entryName) {
- super(title, message);
- this.entryName = entryName;
- }
-
- @Override
- protected void createPreCustomArea(Composite parent) {
- super.createPreCustomArea(parent);
- xText = new XText(entryName);
- if (entryValue != null) {
- xText.setText(entryValue);
- }
- xText.addXModifiedListener(new XModifiedListener() {
- @Override
- public void widgetModified(XWidget widget) {
- entryValue = xText.get();
- updateStatusLabel();
- }
- });
- xText.createWidgets(parent, 2);
- }
-
- /**
- * @return the entryValue
- */
- public String getEntryValue() {
- return entryValue;
- }
-
- /**
- * @param entryValue the entryValue to set
- */
- public void setEntryValue(String entryValue) {
- this.entryValue = entryValue;
- }
-
- @Override
- protected Result isComplete() {
- if (entryValue == null || entryValue.equals("")) {
- return new Result("Must enter Artifact name.");
- }
- return super.isComplete();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.dialog;
+
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+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.widgets.Composite;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ArtifactTypeFilteredTreeEntryDialog extends ArtifactTypeFilteredTreeDialog {
+
+ private String entryValue = null;
+ private final String entryName;
+ private XText xText = null;
+
+ /**
+ * @param title
+ * @param message
+ * @param artifactTypes
+ */
+ public ArtifactTypeFilteredTreeEntryDialog(String title, String message, String entryName) {
+ super(title, message);
+ this.entryName = entryName;
+ }
+
+ @Override
+ protected void createPreCustomArea(Composite parent) {
+ super.createPreCustomArea(parent);
+ xText = new XText(entryName);
+ if (entryValue != null) {
+ xText.setText(entryValue);
+ }
+ xText.addXModifiedListener(new XModifiedListener() {
+ @Override
+ public void widgetModified(XWidget widget) {
+ entryValue = xText.get();
+ updateStatusLabel();
+ }
+ });
+ xText.createWidgets(parent, 2);
+ }
+
+ /**
+ * @return the entryValue
+ */
+ public String getEntryValue() {
+ return entryValue;
+ }
+
+ /**
+ * @param entryValue the entryValue to set
+ */
+ public void setEntryValue(String entryValue) {
+ this.entryValue = entryValue;
+ }
+
+ @Override
+ protected Result isComplete() {
+ if (entryValue == null || entryValue.equals("")) {
+ return new Result("Must enter Artifact name.");
+ }
+ return super.isComplete();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryCheckDialog.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryCheckDialog.java
index 60f928f8aba..8f6dd82faa2 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryCheckDialog.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryCheckDialog.java
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.dialog;
-
-import org.eclipse.osee.framework.ui.skynet.widgets.XCheckBox;
-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 EntryCheckDialog extends EntryDialog {
-
- private final String checkBoxMessage;
- private boolean checked = false;
-
- public EntryCheckDialog(String dialogTitle, String dialogMessage, String checkBoxMessage) {
- super(dialogTitle, dialogMessage);
- this.checkBoxMessage = checkBoxMessage;
- }
-
- public EntryCheckDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage, String checkBoxMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex) {
- super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels,
- defaultIndex);
- this.checkBoxMessage = checkBoxMessage;
- }
-
- @Override
- protected void createExtendedArea(Composite parent) {
-
- final XCheckBox text = new XCheckBox(checkBoxMessage);
- text.setFillHorizontally(true);
- text.setFocus();
- text.setDisplayLabel(false);
- text.set(checked);
- text.createWidgets(parent, 2);
-
- SelectionListener selectionListener = new SelectionListener() {
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleModified();
- checked = text.isSelected();
- }
- };
- text.addSelectionListener(selectionListener);
-
- }
-
- public boolean isChecked() {
- return checked;
- }
-
- public void setChecked(boolean checked) {
- this.checked = checked;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.dialog;
+
+import org.eclipse.osee.framework.ui.skynet.widgets.XCheckBox;
+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 EntryCheckDialog extends EntryDialog {
+
+ private final String checkBoxMessage;
+ private boolean checked = false;
+
+ public EntryCheckDialog(String dialogTitle, String dialogMessage, String checkBoxMessage) {
+ super(dialogTitle, dialogMessage);
+ this.checkBoxMessage = checkBoxMessage;
+ }
+
+ public EntryCheckDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage, String checkBoxMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex) {
+ super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels,
+ defaultIndex);
+ this.checkBoxMessage = checkBoxMessage;
+ }
+
+ @Override
+ protected void createExtendedArea(Composite parent) {
+
+ final XCheckBox text = new XCheckBox(checkBoxMessage);
+ text.setFillHorizontally(true);
+ text.setFocus();
+ text.setDisplayLabel(false);
+ text.set(checked);
+ text.createWidgets(parent, 2);
+
+ SelectionListener selectionListener = new SelectionListener() {
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleModified();
+ checked = text.isSelected();
+ }
+ };
+ text.addSelectionListener(selectionListener);
+
+ }
+
+ public boolean isChecked() {
+ return checked;
+ }
+
+ public void setChecked(boolean checked) {
+ this.checked = checked;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryDialog.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryDialog.java
index 9b10e56670e..93c5775bb64 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryDialog.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryDialog.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.framework.ui.skynet.widgets.dialog;
-
-import java.text.NumberFormat;
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.jface.dialogs.MessageDialog;
-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.ui.plugin.util.IShellCloseEvent;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.framework.ui.skynet.widgets.XText;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.FontManager;
-import org.eclipse.osee.framework.ui.swt.HyperLinkLabel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.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;
-import org.eclipse.swt.widgets.Shell;
-
-public class EntryDialog extends MessageDialog {
-
- protected XText text;
- private Composite areaComposite;
- private String entryText = "";
- private NumberFormat numberFormat;
- private String errorString = "";
- private Button ok;
- private Label errorLabel;
- private boolean fillVertically = false;
- private Button fontButton;
- private String label;
- private Integer textHeight = null;
-
- private final List<IShellCloseEvent> closeEventListeners = new ArrayList<IShellCloseEvent>();
- private final String dialogTitle;
-
- public EntryDialog(String dialogTitle, String dialogMessage) {
- super(Displays.getActiveShell(), dialogTitle, null, dialogMessage, MessageDialog.QUESTION,
- new String[] {"OK", "Cancel"}, 0);
- this.dialogTitle = dialogTitle;
- }
-
- public EntryDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex) {
- super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels,
- defaultIndex);
- this.dialogTitle = dialogTitle;
- }
-
- private final ModifyListener textModifyListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- handleModified();
- }
- };
-
- private final MouseMoveListener compListener = new MouseMoveListener() {
- public void mouseMove(MouseEvent e) {
- setInitialButtonState();
- }
- };
- protected Composite customAreaParent;
-
- @Override
- protected Control createCustomArea(Composite parent) {
- this.customAreaParent = parent;
- areaComposite = new Composite(parent, SWT.NONE);
- areaComposite.setLayout(new GridLayout(2, false));
- GridData gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
- gd.widthHint = 500;
- areaComposite.setLayoutData(gd);
- areaComposite.addMouseMoveListener(compListener);
-
- createErrorLabel(areaComposite);
- createTextBox();
-
- createOpenInEditorHyperlink(parent);
- createExtendedArea(areaComposite);
- areaComposite.layout();
- parent.layout();
- return areaComposite;
- }
-
- protected void createOpenInEditorHyperlink(Composite parent) {
- if (isFillVertically()) {
- HyperLinkLabel edit = new HyperLinkLabel(parent, SWT.None);
- edit.setText("open in editor");
- edit.addListener(SWT.MouseUp, new Listener() {
-
- @Override
- public void handleEvent(Event event) {
- XResultData resultData = new XResultData();
- resultData.addRaw(entryText);
- try {
- resultData.report(dialogTitle);
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- close();
- }
- });
- }
- }
-
- private void createErrorLabel(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout(3, false));
- GridData gd1 = new GridData(GridData.FILL_HORIZONTAL);
- gd1.horizontalSpan = 2;
- composite.setLayoutData(gd1);
-
- if (fillVertically) {
- createClearFixedFontWidgets(composite);
- }
-
- errorLabel = new Label(composite, SWT.NONE);
- errorLabel.setSize(errorLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- errorLabel.setText("");
- if (!fillVertically) {
- GridData gd = new GridData();
- gd.horizontalSpan = 3;
- errorLabel.setLayoutData(gd);
- }
- }
-
- protected void createClearFixedFontWidgets(Composite headerComp) {
- // Create error label
- Button button = new Button(headerComp, SWT.PUSH);
- button.setText("Clear");
- button.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- super.widgetSelected(e);
- text.setText("");
- }
- });
-
- fontButton = new Button(headerComp, SWT.CHECK);
- fontButton.setText("Fixed Font");
- fontButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- super.widgetSelected(e);
- if (fontButton.getSelection()) {
- text.setFont(getFont());
- } else {
- text.setFont(null);
- }
- }
- });
- }
-
- protected Font getFont() {
- return FontManager.getFont("Courier New", 8, SWT.NORMAL);
- }
-
- private void createTextBox() {
- text = new XText(Strings.isValid(label) ? label : "");
- text.setFillHorizontally(true);
- text.setFocus();
- if (!Strings.isValid(label)) {
- text.setDisplayLabel(false);
- }
- if (fillVertically) {
- text.setFillVertically(true);
- text.setHeight(textHeight == null ? 200 : textHeight);
- text.setFont(getFont());
- }
- text.createWidgets(areaComposite, 2);
- text.setFocus();
- if (Strings.isValid(entryText)) {
- text.set(entryText);
- }
-
- text.addModifyListener(textModifyListener);
- }
-
- @Override
- protected boolean isResizable() {
- return true;
- }
-
- protected void createExtendedArea(Composite parent) {
- }
-
- public void setInitialButtonState() {
- if (ok == null) {
- ok = getButton(0);
- handleModified();
- }
- areaComposite.removeMouseMoveListener(compListener);
- }
-
- public void handleModified() {
- if (text != null) {
- entryText = text.get();
- if (!isEntryValid()) {
- getButton(getDefaultButtonIndex()).setEnabled(false);
- errorLabel.setText(errorString);
- errorLabel.update();
- areaComposite.layout();
- } else {
- getButton(getDefaultButtonIndex()).setEnabled(true);
- errorLabel.setText("");
- errorLabel.update();
- areaComposite.layout();
- }
- }
- }
-
- public String getEntry() {
- return entryText;
- }
-
- public void setEntry(String entry) {
- if (text != null) {
- text.set(entry);
- }
- this.entryText = entry;
- }
-
- /**
- * override this method to make own checks on entry this will be called with every keystroke
- *
- * @return true if entry is valid
- */
- public boolean isEntryValid() {
- if (numberFormat == null) {
- return true;
- }
-
- try {
- numberFormat.parse(text.get());
- } catch (ParseException ex) {
- return false;
- }
-
- return true;
- }
-
- public void setValidationErrorString(String errorString) {
- this.errorString = errorString;
- }
-
- public void setNumberFormat(NumberFormat numberFormat) {
- this.numberFormat = numberFormat;
- }
-
- /**
- * Calling will enable dialog to loose focus
- */
- public void setModeless() {
- setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS);
- setBlockOnOpen(false);
- }
-
- public void setSelectionListener(SelectionListener listener) {
- for (int i = 0; i < getButtonLabels().length; i++) {
- Button button = getButton(i);
- button.addSelectionListener(listener);
- }
- }
-
- public boolean isFillVertically() {
- return fillVertically;
- }
-
- public void setFillVertically(boolean fillVertically) {
- this.fillVertically = fillVertically;
- }
-
- @Override
- protected void handleShellCloseEvent() {
- super.handleShellCloseEvent();
- for (IShellCloseEvent event : closeEventListeners) {
- event.onClose();
- }
- }
-
- public void addShellCloseEventListeners(IShellCloseEvent event) {
- closeEventListeners.add(event);
- }
-
- public void setLabel(String label) {
- this.label = label;
- }
-
- public void setTextHeight(Integer textHeight) {
- this.textHeight = textHeight;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.dialog;
+
+import java.text.NumberFormat;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.jface.dialogs.MessageDialog;
+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.ui.plugin.util.IShellCloseEvent;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.framework.ui.skynet.widgets.XText;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.FontManager;
+import org.eclipse.osee.framework.ui.swt.HyperLinkLabel;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.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;
+import org.eclipse.swt.widgets.Shell;
+
+public class EntryDialog extends MessageDialog {
+
+ protected XText text;
+ private Composite areaComposite;
+ private String entryText = "";
+ private NumberFormat numberFormat;
+ private String errorString = "";
+ private Button ok;
+ private Label errorLabel;
+ private boolean fillVertically = false;
+ private Button fontButton;
+ private String label;
+ private Integer textHeight = null;
+
+ private final List<IShellCloseEvent> closeEventListeners = new ArrayList<IShellCloseEvent>();
+ private final String dialogTitle;
+
+ public EntryDialog(String dialogTitle, String dialogMessage) {
+ super(Displays.getActiveShell(), dialogTitle, null, dialogMessage, MessageDialog.QUESTION,
+ new String[] {"OK", "Cancel"}, 0);
+ this.dialogTitle = dialogTitle;
+ }
+
+ public EntryDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex) {
+ super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels,
+ defaultIndex);
+ this.dialogTitle = dialogTitle;
+ }
+
+ private final ModifyListener textModifyListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ handleModified();
+ }
+ };
+
+ private final MouseMoveListener compListener = new MouseMoveListener() {
+ public void mouseMove(MouseEvent e) {
+ setInitialButtonState();
+ }
+ };
+ protected Composite customAreaParent;
+
+ @Override
+ protected Control createCustomArea(Composite parent) {
+ this.customAreaParent = parent;
+ areaComposite = new Composite(parent, SWT.NONE);
+ areaComposite.setLayout(new GridLayout(2, false));
+ GridData gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
+ gd.widthHint = 500;
+ areaComposite.setLayoutData(gd);
+ areaComposite.addMouseMoveListener(compListener);
+
+ createErrorLabel(areaComposite);
+ createTextBox();
+
+ createOpenInEditorHyperlink(parent);
+ createExtendedArea(areaComposite);
+ areaComposite.layout();
+ parent.layout();
+ return areaComposite;
+ }
+
+ protected void createOpenInEditorHyperlink(Composite parent) {
+ if (isFillVertically()) {
+ HyperLinkLabel edit = new HyperLinkLabel(parent, SWT.None);
+ edit.setText("open in editor");
+ edit.addListener(SWT.MouseUp, new Listener() {
+
+ @Override
+ public void handleEvent(Event event) {
+ XResultData resultData = new XResultData();
+ resultData.addRaw(entryText);
+ try {
+ resultData.report(dialogTitle);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ close();
+ }
+ });
+ }
+ }
+
+ private void createErrorLabel(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(3, false));
+ GridData gd1 = new GridData(GridData.FILL_HORIZONTAL);
+ gd1.horizontalSpan = 2;
+ composite.setLayoutData(gd1);
+
+ if (fillVertically) {
+ createClearFixedFontWidgets(composite);
+ }
+
+ errorLabel = new Label(composite, SWT.NONE);
+ errorLabel.setSize(errorLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+ errorLabel.setText("");
+ if (!fillVertically) {
+ GridData gd = new GridData();
+ gd.horizontalSpan = 3;
+ errorLabel.setLayoutData(gd);
+ }
+ }
+
+ protected void createClearFixedFontWidgets(Composite headerComp) {
+ // Create error label
+ Button button = new Button(headerComp, SWT.PUSH);
+ button.setText("Clear");
+ button.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ super.widgetSelected(e);
+ text.setText("");
+ }
+ });
+
+ fontButton = new Button(headerComp, SWT.CHECK);
+ fontButton.setText("Fixed Font");
+ fontButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ super.widgetSelected(e);
+ if (fontButton.getSelection()) {
+ text.setFont(getFont());
+ } else {
+ text.setFont(null);
+ }
+ }
+ });
+ }
+
+ protected Font getFont() {
+ return FontManager.getFont("Courier New", 8, SWT.NORMAL);
+ }
+
+ private void createTextBox() {
+ text = new XText(Strings.isValid(label) ? label : "");
+ text.setFillHorizontally(true);
+ text.setFocus();
+ if (!Strings.isValid(label)) {
+ text.setDisplayLabel(false);
+ }
+ if (fillVertically) {
+ text.setFillVertically(true);
+ text.setHeight(textHeight == null ? 200 : textHeight);
+ text.setFont(getFont());
+ }
+ text.createWidgets(areaComposite, 2);
+ text.setFocus();
+ if (Strings.isValid(entryText)) {
+ text.set(entryText);
+ }
+
+ text.addModifyListener(textModifyListener);
+ }
+
+ @Override
+ protected boolean isResizable() {
+ return true;
+ }
+
+ protected void createExtendedArea(Composite parent) {
+ }
+
+ public void setInitialButtonState() {
+ if (ok == null) {
+ ok = getButton(0);
+ handleModified();
+ }
+ areaComposite.removeMouseMoveListener(compListener);
+ }
+
+ public void handleModified() {
+ if (text != null) {
+ entryText = text.get();
+ if (!isEntryValid()) {
+ getButton(getDefaultButtonIndex()).setEnabled(false);
+ errorLabel.setText(errorString);
+ errorLabel.update();
+ areaComposite.layout();
+ } else {
+ getButton(getDefaultButtonIndex()).setEnabled(true);
+ errorLabel.setText("");
+ errorLabel.update();
+ areaComposite.layout();
+ }
+ }
+ }
+
+ public String getEntry() {
+ return entryText;
+ }
+
+ public void setEntry(String entry) {
+ if (text != null) {
+ text.set(entry);
+ }
+ this.entryText = entry;
+ }
+
+ /**
+ * override this method to make own checks on entry this will be called with every keystroke
+ *
+ * @return true if entry is valid
+ */
+ public boolean isEntryValid() {
+ if (numberFormat == null) {
+ return true;
+ }
+
+ try {
+ numberFormat.parse(text.get());
+ } catch (ParseException ex) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public void setValidationErrorString(String errorString) {
+ this.errorString = errorString;
+ }
+
+ public void setNumberFormat(NumberFormat numberFormat) {
+ this.numberFormat = numberFormat;
+ }
+
+ /**
+ * Calling will enable dialog to loose focus
+ */
+ public void setModeless() {
+ setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS);
+ setBlockOnOpen(false);
+ }
+
+ public void setSelectionListener(SelectionListener listener) {
+ for (int i = 0; i < getButtonLabels().length; i++) {
+ Button button = getButton(i);
+ button.addSelectionListener(listener);
+ }
+ }
+
+ public boolean isFillVertically() {
+ return fillVertically;
+ }
+
+ public void setFillVertically(boolean fillVertically) {
+ this.fillVertically = fillVertically;
+ }
+
+ @Override
+ protected void handleShellCloseEvent() {
+ super.handleShellCloseEvent();
+ for (IShellCloseEvent event : closeEventListeners) {
+ event.onClose();
+ }
+ }
+
+ public void addShellCloseEventListeners(IShellCloseEvent event) {
+ closeEventListeners.add(event);
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public void setTextHeight(Integer textHeight) {
+ this.textHeight = textHeight;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryDialogWithBranchSelect.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryDialogWithBranchSelect.java
index 274361a5436..24b58c5c155 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryDialogWithBranchSelect.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryDialogWithBranchSelect.java
@@ -1,214 +1,214 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.dialog;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.ui.plugin.util.IShellCloseEvent;
-import org.eclipse.osee.framework.ui.skynet.branch.BranchSelectComposite;
-import org.eclipse.osee.framework.ui.skynet.widgets.XText;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-public class EntryDialogWithBranchSelect extends MessageDialog {
-
- XText text;
- Composite c;
- String entryText = "";
- String validationRegularExpression = null;
- String validationErrorString = "";
- Button ok;
- MouseMoveListener listener;
- Label errorLabel;
- BranchSelectComposite branchSelect;
- boolean fillVertically = false;
-
- private final List<IShellCloseEvent> closeEventListeners = new ArrayList<IShellCloseEvent>();
-
- public EntryDialogWithBranchSelect(String dialogTitle, String dialogMessage) {
- super(Displays.getActiveShell(), dialogTitle, null, dialogMessage, MessageDialog.QUESTION,
- new String[] {"OK", "Cancel"}, 0);
- }
-
- public EntryDialogWithBranchSelect(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex) {
- super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels,
- defaultIndex);
- }
-
- @Override
- protected Control createCustomArea(Composite parent) {
-
- c = new Composite(parent, SWT.NONE);
- c.setLayout(new GridLayout(2, false));
- c.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
-
- listener = new MouseMoveListener() {
-
- public void mouseMove(MouseEvent e) {
- setInitialButtonState();
- }
- };
- c.addMouseMoveListener(listener);
-
- // Create error label
- errorLabel = new Label(c, SWT.NONE);
- errorLabel.setSize(errorLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- errorLabel.setText("");
-
- text = new XText();
- text.setFillHorizontally(true);
- text.setFocus();
- text.setDisplayLabel(false);
- if (!entryText.equals("")) text.set(entryText);
- if (fillVertically) {
- text.setFillVertically(true);
- text.setHeight(200);
- }
- text.createWidgets(c, 2);
-
- ModifyListener modifyListener = new ModifyListener() {
-
- public void modifyText(ModifyEvent e) {
- handleModified();
- }
- };
- text.addModifyListener(modifyListener);
-
- branchSelect = new BranchSelectComposite(c, SWT.NONE, false);
- branchSelect.setDefaultSelectedBranch(BranchManager.getLastBranch());
- createExtendedArea(c);
- c.layout();
- parent.layout();
- return c;
- }
-
- /**
- * Override to provide other widgets
- *
- * @param parent
- */
- protected void createExtendedArea(Composite parent) {
- }
-
- public void setInitialButtonState() {
- if (ok == null) {
- ok = getButton(0);
- handleModified();
- }
- c.removeMouseMoveListener(listener);
- }
-
- public void handleModified() {
- if (text != null) {
- entryText = text.get();
- if (text.get().equals("") || !isEntryValid() || branchSelect.getSelectedBranch() == null) {
- getButton(getDefaultButtonIndex()).setEnabled(false);
- errorLabel.setText(validationErrorString);
- errorLabel.update();
- c.layout();
- } else {
- getButton(getDefaultButtonIndex()).setEnabled(true);
- errorLabel.setText("");
- errorLabel.update();
- c.layout();
- }
- }
- }
-
- public String getEntry() {
- return entryText;
- }
-
- public void setEntry(String entry) {
- if (text != null) text.set(entry);
- this.entryText = entry;
- }
-
- public Branch getBranch(){
- return branchSelect.getSelectedBranch();
- }
-
- /**
- * override this method to make own checks on entry this will be called with every keystroke
- *
- * @return true if entry is valid
- */
- public boolean isEntryValid() {
- if (validationRegularExpression == null) {
- return true;
- }
- // verify title is alpha-numeric with spaces and dashes
- Matcher m = Pattern.compile(validationRegularExpression).matcher(text.get());
- return m.find();
- }
-
- public void setValidationRegularExpression(String regExp) {
- validationRegularExpression = regExp;
- }
-
- public void setValidationErrorString(String errorText) {
- validationErrorString = errorText;
- }
-
- /**
- * Calling will enable dialog to loose focus
- */
- public void setModeless() {
- setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS);
- setBlockOnOpen(false);
- }
-
- public void setSelectionListener(SelectionListener listener) {
- for (int i = 0; i < getButtonLabels().length; i++) {
- Button button = getButton(i);
- button.addSelectionListener(listener);
- }
- }
-
- public boolean isFillVertically() {
- return fillVertically;
- }
-
- public void setFillVertically(boolean fillVertically) {
- this.fillVertically = fillVertically;
- }
-
- @Override
- protected void handleShellCloseEvent() {
- super.handleShellCloseEvent();
- for (IShellCloseEvent event : closeEventListeners) {
- event.onClose();
- }
- }
-
- public void addShellCloseEventListeners(IShellCloseEvent event) {
- closeEventListeners.add(event);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.dialog;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.ui.plugin.util.IShellCloseEvent;
+import org.eclipse.osee.framework.ui.skynet.branch.BranchSelectComposite;
+import org.eclipse.osee.framework.ui.skynet.widgets.XText;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+public class EntryDialogWithBranchSelect extends MessageDialog {
+
+ XText text;
+ Composite c;
+ String entryText = "";
+ String validationRegularExpression = null;
+ String validationErrorString = "";
+ Button ok;
+ MouseMoveListener listener;
+ Label errorLabel;
+ BranchSelectComposite branchSelect;
+ boolean fillVertically = false;
+
+ private final List<IShellCloseEvent> closeEventListeners = new ArrayList<IShellCloseEvent>();
+
+ public EntryDialogWithBranchSelect(String dialogTitle, String dialogMessage) {
+ super(Displays.getActiveShell(), dialogTitle, null, dialogMessage, MessageDialog.QUESTION,
+ new String[] {"OK", "Cancel"}, 0);
+ }
+
+ public EntryDialogWithBranchSelect(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex) {
+ super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels,
+ defaultIndex);
+ }
+
+ @Override
+ protected Control createCustomArea(Composite parent) {
+
+ c = new Composite(parent, SWT.NONE);
+ c.setLayout(new GridLayout(2, false));
+ c.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
+
+ listener = new MouseMoveListener() {
+
+ public void mouseMove(MouseEvent e) {
+ setInitialButtonState();
+ }
+ };
+ c.addMouseMoveListener(listener);
+
+ // Create error label
+ errorLabel = new Label(c, SWT.NONE);
+ errorLabel.setSize(errorLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+ errorLabel.setText("");
+
+ text = new XText();
+ text.setFillHorizontally(true);
+ text.setFocus();
+ text.setDisplayLabel(false);
+ if (!entryText.equals("")) text.set(entryText);
+ if (fillVertically) {
+ text.setFillVertically(true);
+ text.setHeight(200);
+ }
+ text.createWidgets(c, 2);
+
+ ModifyListener modifyListener = new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ handleModified();
+ }
+ };
+ text.addModifyListener(modifyListener);
+
+ branchSelect = new BranchSelectComposite(c, SWT.NONE, false);
+ branchSelect.setDefaultSelectedBranch(BranchManager.getLastBranch());
+ createExtendedArea(c);
+ c.layout();
+ parent.layout();
+ return c;
+ }
+
+ /**
+ * Override to provide other widgets
+ *
+ * @param parent
+ */
+ protected void createExtendedArea(Composite parent) {
+ }
+
+ public void setInitialButtonState() {
+ if (ok == null) {
+ ok = getButton(0);
+ handleModified();
+ }
+ c.removeMouseMoveListener(listener);
+ }
+
+ public void handleModified() {
+ if (text != null) {
+ entryText = text.get();
+ if (text.get().equals("") || !isEntryValid() || branchSelect.getSelectedBranch() == null) {
+ getButton(getDefaultButtonIndex()).setEnabled(false);
+ errorLabel.setText(validationErrorString);
+ errorLabel.update();
+ c.layout();
+ } else {
+ getButton(getDefaultButtonIndex()).setEnabled(true);
+ errorLabel.setText("");
+ errorLabel.update();
+ c.layout();
+ }
+ }
+ }
+
+ public String getEntry() {
+ return entryText;
+ }
+
+ public void setEntry(String entry) {
+ if (text != null) text.set(entry);
+ this.entryText = entry;
+ }
+
+ public Branch getBranch(){
+ return branchSelect.getSelectedBranch();
+ }
+
+ /**
+ * override this method to make own checks on entry this will be called with every keystroke
+ *
+ * @return true if entry is valid
+ */
+ public boolean isEntryValid() {
+ if (validationRegularExpression == null) {
+ return true;
+ }
+ // verify title is alpha-numeric with spaces and dashes
+ Matcher m = Pattern.compile(validationRegularExpression).matcher(text.get());
+ return m.find();
+ }
+
+ public void setValidationRegularExpression(String regExp) {
+ validationRegularExpression = regExp;
+ }
+
+ public void setValidationErrorString(String errorText) {
+ validationErrorString = errorText;
+ }
+
+ /**
+ * Calling will enable dialog to loose focus
+ */
+ public void setModeless() {
+ setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS);
+ setBlockOnOpen(false);
+ }
+
+ public void setSelectionListener(SelectionListener listener) {
+ for (int i = 0; i < getButtonLabels().length; i++) {
+ Button button = getButton(i);
+ button.addSelectionListener(listener);
+ }
+ }
+
+ public boolean isFillVertically() {
+ return fillVertically;
+ }
+
+ public void setFillVertically(boolean fillVertically) {
+ this.fillVertically = fillVertically;
+ }
+
+ @Override
+ protected void handleShellCloseEvent() {
+ super.handleShellCloseEvent();
+ for (IShellCloseEvent event : closeEventListeners) {
+ event.onClose();
+ }
+ }
+
+ public void addShellCloseEventListeners(IShellCloseEvent event) {
+ closeEventListeners.add(event);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryEntryDialog.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryEntryDialog.java
index d2d431435a3..b10881e7dd4 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryEntryDialog.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryEntryDialog.java
@@ -1,96 +1,96 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.dialog;
-
-import org.eclipse.osee.framework.ui.skynet.widgets.XText;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Listener;
-
-/**
- * Dialog with two entry boxes
- *
- * @author Donald G. Dunne
- */
-public class EntryEntryDialog extends EntryDialog {
-
- private XText text2;
- private String entryText2 = "";
- private final String label2;
- private Listener okListener;
-
- public EntryEntryDialog(String dialogTitle, String dialogMessage, String label1, String label2) {
- super(dialogTitle, dialogMessage);
- super.setLabel(label1);
- super.setTextHeight(100);
- this.label2 = label2;
- }
-
- @Override
- protected void createOpenInEditorHyperlink(Composite parent) {
- // do nothing, we don't want this here
- }
-
- @Override
- protected void createClearFixedFontWidgets(Composite headerComp) {
-
- }
-
- @Override
- protected void createExtendedArea(Composite parent) {
-
- text2 = new XText(label2);
- text2.setFillHorizontally(true);
- if (isFillVertically()) {
- text2.setFillVertically(true);
- text2.setHeight(100);
- text.setHeight(100);
- text2.setFont(getFont());
- }
- text2.set(entryText2);
- text2.createWidgets(customAreaParent, 1);
-
- text2.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- handleModified();
- entryText2 = text2.get();
- }
- });
-
- }
-
- public String getEntry2() {
- return entryText2;
- }
-
- public void setEntry2(String entry2) {
- if (text2 != null) {
- text2.set(entry2);
- }
- this.entryText2 = entry2;
- }
-
- public void setOkListener(Listener okListener) {
- this.okListener = okListener;
- }
-
- @Override
- protected void buttonPressed(int buttonId) {
- super.buttonPressed(buttonId);
- if (buttonId == 0 && okListener != null) {
- okListener.handleEvent(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.framework.ui.skynet.widgets.dialog;
+
+import org.eclipse.osee.framework.ui.skynet.widgets.XText;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Listener;
+
+/**
+ * Dialog with two entry boxes
+ *
+ * @author Donald G. Dunne
+ */
+public class EntryEntryDialog extends EntryDialog {
+
+ private XText text2;
+ private String entryText2 = "";
+ private final String label2;
+ private Listener okListener;
+
+ public EntryEntryDialog(String dialogTitle, String dialogMessage, String label1, String label2) {
+ super(dialogTitle, dialogMessage);
+ super.setLabel(label1);
+ super.setTextHeight(100);
+ this.label2 = label2;
+ }
+
+ @Override
+ protected void createOpenInEditorHyperlink(Composite parent) {
+ // do nothing, we don't want this here
+ }
+
+ @Override
+ protected void createClearFixedFontWidgets(Composite headerComp) {
+
+ }
+
+ @Override
+ protected void createExtendedArea(Composite parent) {
+
+ text2 = new XText(label2);
+ text2.setFillHorizontally(true);
+ if (isFillVertically()) {
+ text2.setFillVertically(true);
+ text2.setHeight(100);
+ text.setHeight(100);
+ text2.setFont(getFont());
+ }
+ text2.set(entryText2);
+ text2.createWidgets(customAreaParent, 1);
+
+ text2.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ handleModified();
+ entryText2 = text2.get();
+ }
+ });
+
+ }
+
+ public String getEntry2() {
+ return entryText2;
+ }
+
+ public void setEntry2(String entry2) {
+ if (text2 != null) {
+ text2.set(entry2);
+ }
+ this.entryText2 = entry2;
+ }
+
+ public void setOkListener(Listener okListener) {
+ this.okListener = okListener;
+ }
+
+ @Override
+ protected void buttonPressed(int buttonId) {
+ super.buttonPressed(buttonId);
+ if (buttonId == 0 && okListener != null) {
+ okListener.handleEvent(null);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/GroupListDialog.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/GroupListDialog.java
index 1c4a73adfd0..efaec41f403 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/GroupListDialog.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/GroupListDialog.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.framework.ui.skynet.widgets.dialog;
-
-import java.util.ArrayList;
-import java.util.logging.Level;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLog;
-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.BranchManager;
-import org.eclipse.osee.framework.skynet.core.artifact.UniversalGroup;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.branch.BranchSelectComposite;
-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.Listener;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @author Donald G. Dunne
- */
-public class GroupListDialog extends ArtifactListDialog {
- BranchSelectComposite branchSelect;
-
- public GroupListDialog(Shell parent) {
- super(parent);
- setTitle("Select group");
- setMessage("Select group");
- setLabelProvider(new GroupsDescriptiveLabelProvider());
-
- setGroupsForSelection();
- }
-
- private void setGroupsForSelection() {
- ArrayList<Artifact> arts = new ArrayList<Artifact>();
- try {
- for (Artifact art : UniversalGroup.getGroups(BranchManager.getCommonBranch())) {
- if (!art.getName().equals(OseeSystemArtifacts.ROOT_ARTIFACT_TYPE_NAME)) {
- arts.add(art);
- }
- }
- if (branchSelect != null && branchSelect.getSelectedBranch() != null && !branchSelect.getSelectedBranch().equals(
- BranchManager.getCommonBranch())) {
- for (Artifact art : UniversalGroup.getGroups(branchSelect.getSelectedBranch())) {
- if (!art.getName().equals(OseeSystemArtifacts.ROOT_ARTIFACT_TYPE_NAME)) {
- arts.add(art);
- }
- }
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- if (getTableViewer() == null) {
- setArtifacts(arts);
- } else {
- updateArtifacts(arts);
- }
-
- }
-
- public class GroupsDescriptiveLabelProvider implements ILabelProvider {
-
- public Image getImage(Object arg0) {
- return null;
- }
-
- public String getText(Object obj) {
- if (obj instanceof Artifact) {
- Artifact art = (Artifact) obj;
- try {
- if (art.isOfType(CoreArtifactTypes.UniversalGroup)) {
- return art.toString() + " (" + art.getBranch().getShortName() + ")";
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- art.toString();
- }
- return "";
- }
-
- public void addListener(ILabelProviderListener arg0) {
- }
-
- public void dispose() {
- }
-
- public boolean isLabelProperty(Object arg0, String arg1) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener arg0) {
- }
-
- }
-
- @Override
- protected Control createDialogArea(Composite container) {
- Control c = super.createDialogArea(container);
- branchSelect = new BranchSelectComposite(container, SWT.NONE, false);
- branchSelect.setDefaultSelectedBranch(BranchManager.getLastBranch());
- branchSelect.addListener(new Listener() {
- @Override
- public void handleEvent(Event event) {
- setGroupsForSelection();
- }
- });
- return c;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.dialog;
+
+import java.util.ArrayList;
+import java.util.logging.Level;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+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.BranchManager;
+import org.eclipse.osee.framework.skynet.core.artifact.UniversalGroup;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.branch.BranchSelectComposite;
+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.Listener;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class GroupListDialog extends ArtifactListDialog {
+ BranchSelectComposite branchSelect;
+
+ public GroupListDialog(Shell parent) {
+ super(parent);
+ setTitle("Select group");
+ setMessage("Select group");
+ setLabelProvider(new GroupsDescriptiveLabelProvider());
+
+ setGroupsForSelection();
+ }
+
+ private void setGroupsForSelection() {
+ ArrayList<Artifact> arts = new ArrayList<Artifact>();
+ try {
+ for (Artifact art : UniversalGroup.getGroups(BranchManager.getCommonBranch())) {
+ if (!art.getName().equals(OseeSystemArtifacts.ROOT_ARTIFACT_TYPE_NAME)) {
+ arts.add(art);
+ }
+ }
+ if (branchSelect != null && branchSelect.getSelectedBranch() != null && !branchSelect.getSelectedBranch().equals(
+ BranchManager.getCommonBranch())) {
+ for (Artifact art : UniversalGroup.getGroups(branchSelect.getSelectedBranch())) {
+ if (!art.getName().equals(OseeSystemArtifacts.ROOT_ARTIFACT_TYPE_NAME)) {
+ arts.add(art);
+ }
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ if (getTableViewer() == null) {
+ setArtifacts(arts);
+ } else {
+ updateArtifacts(arts);
+ }
+
+ }
+
+ public class GroupsDescriptiveLabelProvider implements ILabelProvider {
+
+ public Image getImage(Object arg0) {
+ return null;
+ }
+
+ public String getText(Object obj) {
+ if (obj instanceof Artifact) {
+ Artifact art = (Artifact) obj;
+ try {
+ if (art.isOfType(CoreArtifactTypes.UniversalGroup)) {
+ return art.toString() + " (" + art.getBranch().getShortName() + ")";
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ art.toString();
+ }
+ return "";
+ }
+
+ public void addListener(ILabelProviderListener arg0) {
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isLabelProperty(Object arg0, String arg1) {
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener arg0) {
+ }
+
+ }
+
+ @Override
+ protected Control createDialogArea(Composite container) {
+ Control c = super.createDialogArea(container);
+ branchSelect = new BranchSelectComposite(container, SWT.NONE, false);
+ branchSelect.setDefaultSelectedBranch(BranchManager.getLastBranch());
+ branchSelect.addListener(new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ setGroupsForSelection();
+ }
+ });
+ return c;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/AttributeXWidgetManager.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/AttributeXWidgetManager.java
index 41bf000e8cd..4329dcb56ec 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/AttributeXWidgetManager.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/AttributeXWidgetManager.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.workflow;
-
-import java.util.List;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-import org.eclipse.osee.framework.plugin.core.util.ExtensionDefinedObjects;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-
-/**
- * @author Donald G. Dunne
- */
-public class AttributeXWidgetManager {
- private static final String EXTENSION_NAME = "AttributeXWidgetProvider";
- private static final String EXTENSION_POINT = SkynetGuiPlugin.PLUGIN_ID + "." + EXTENSION_NAME;
- private static final String CLASS_NAME_ATTRIBUTE = "classname";
-
- private final static AttributeXWidgetManager instance = new AttributeXWidgetManager();
-
- private final ExtensionDefinedObjects<IAttributeXWidgetProvider> extensionObjects;
-
- private AttributeXWidgetManager() {
- this.extensionObjects =
- new ExtensionDefinedObjects<IAttributeXWidgetProvider>(EXTENSION_POINT, EXTENSION_NAME,
- CLASS_NAME_ATTRIBUTE, true);
- }
-
- private List<IAttributeXWidgetProvider> getProviders() {
- return extensionObjects.getObjects();
- }
-
- public static IAttributeXWidgetProvider getAttributeXWidgetProvider(AttributeType attributeType) throws OseeCoreException {
- for (IAttributeXWidgetProvider provider : instance.getProviders()) {
- List<DynamicXWidgetLayoutData> datas = provider.getDynamicXWidgetLayoutData(attributeType);
- if (!datas.isEmpty()) {
- return provider;
- }
- }
- return new DefaultAttributeXWidgetProvider();
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.workflow;
+
+import java.util.List;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.plugin.core.util.ExtensionDefinedObjects;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AttributeXWidgetManager {
+ private static final String EXTENSION_NAME = "AttributeXWidgetProvider";
+ private static final String EXTENSION_POINT = SkynetGuiPlugin.PLUGIN_ID + "." + EXTENSION_NAME;
+ private static final String CLASS_NAME_ATTRIBUTE = "classname";
+
+ private final static AttributeXWidgetManager instance = new AttributeXWidgetManager();
+
+ private final ExtensionDefinedObjects<IAttributeXWidgetProvider> extensionObjects;
+
+ private AttributeXWidgetManager() {
+ this.extensionObjects =
+ new ExtensionDefinedObjects<IAttributeXWidgetProvider>(EXTENSION_POINT, EXTENSION_NAME,
+ CLASS_NAME_ATTRIBUTE, true);
+ }
+
+ private List<IAttributeXWidgetProvider> getProviders() {
+ return extensionObjects.getObjects();
+ }
+
+ public static IAttributeXWidgetProvider getAttributeXWidgetProvider(AttributeType attributeType) throws OseeCoreException {
+ for (IAttributeXWidgetProvider provider : instance.getProviders()) {
+ List<DynamicXWidgetLayoutData> datas = provider.getDynamicXWidgetLayoutData(attributeType);
+ if (!datas.isEmpty()) {
+ return provider;
+ }
+ }
+ return new DefaultAttributeXWidgetProvider();
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/DefaultAttributeXWidgetProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/DefaultAttributeXWidgetProvider.java
index 0e4eba7e2ca..80615ec8760 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/DefaultAttributeXWidgetProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/DefaultAttributeXWidgetProvider.java
@@ -1,117 +1,117 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.widgets.workflow;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-import org.eclipse.osee.framework.jdk.core.util.Collections;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
-import org.eclipse.osee.framework.skynet.core.attribute.BinaryAttribute;
-import org.eclipse.osee.framework.skynet.core.attribute.BooleanAttribute;
-import org.eclipse.osee.framework.skynet.core.attribute.DateAttribute;
-import org.eclipse.osee.framework.skynet.core.attribute.EnumeratedAttribute;
-import org.eclipse.osee.framework.skynet.core.attribute.FloatingPointAttribute;
-import org.eclipse.osee.framework.skynet.core.attribute.IntegerAttribute;
-import org.eclipse.osee.framework.skynet.core.attribute.StringAttribute;
-import org.eclipse.osee.framework.skynet.core.attribute.WordAttribute;
-import org.eclipse.osee.framework.ui.skynet.widgets.XOption;
-
-/**
- * @author Donald G. Dunne
- */
-public class DefaultAttributeXWidgetProvider implements IAttributeXWidgetProvider {
-
- private DynamicXWidgetLayoutData createDynamicXWidgetLayout(AttributeType attributeType) {
- DynamicXWidgetLayoutData defaultData = new DynamicXWidgetLayoutData(null);
- defaultData.setName(attributeType.getName());
- defaultData.setStorageName(attributeType.getName());
- defaultData.setToolTip(attributeType.getDescription());
- if (attributeType.getMinOccurrences() > 0) {
- defaultData.getXOptionHandler().add(XOption.REQUIRED);
- }
- defaultData.getXOptionHandler().add(XOption.HORIZONTAL_LABEL);
- return defaultData;
- }
-
- @Override
- public List<DynamicXWidgetLayoutData> getDynamicXWidgetLayoutData(AttributeType attributeType) throws OseeCoreException {
- int minOccurrence = attributeType.getMinOccurrences();
- int maxOccurrence = attributeType.getMaxOccurrences();
-
- List<DynamicXWidgetLayoutData> xWidgetLayoutData = new ArrayList<DynamicXWidgetLayoutData>();
-
- DynamicXWidgetLayoutData defaultData = createDynamicXWidgetLayout(attributeType);
- xWidgetLayoutData.add(defaultData);
-
- String xWidgetName;
- try {
- xWidgetName = getXWidgetName(defaultData, attributeType, minOccurrence, maxOccurrence);
- } catch (OseeCoreException ex) {
- xWidgetName = "XTextDam";
- StringBuilder builder = new StringBuilder();
- builder.append("Unable to determine base type for attribute type");
- builder.append(String.format("[%]", attributeType.getName()));
- builder.append(Lib.exceptionToString(ex));
- defaultData.setDefaultValue(builder.toString());
- }
-
- defaultData.setXWidgetName(xWidgetName);
- defaultData.getXOptionHandler().add(XOption.FILL_HORIZONTALLY);
- defaultData.getXOptionHandler().add(XOption.NO_DEFAULT_VALUE);
-
- return xWidgetLayoutData;
- }
-
- private String getXWidgetName(DynamicXWidgetLayoutData defaultData, AttributeType attributeType, int minOccurrence, int maxOccurrence) throws OseeCoreException {
- String xWidgetName = "";
- if (AttributeTypeManager.isBaseTypeCompatible(EnumeratedAttribute.class, attributeType)) {
- if (maxOccurrence == 1) {
- xWidgetName =
- "XComboDam(" + Collections.toString(",", AttributeTypeManager.getEnumerationValues(attributeType)) + ")";
- } else {
- xWidgetName =
- "XSelectFromMultiChoiceDam(" + Collections.toString(",",
- AttributeTypeManager.getEnumerationValues(attributeType)) + ")";
- }
- } else if (AttributeTypeManager.isBaseTypeCompatible(BooleanAttribute.class, attributeType)) {
- if (minOccurrence == 1) {
- xWidgetName = "XCheckBoxDam";
- } else {
- xWidgetName = "XComboBooleanDam";
- }
- } else if (AttributeTypeManager.isBaseTypeCompatible(WordAttribute.class, attributeType) || attributeType.equals(CoreAttributeTypes.RELATION_ORDER)) {
- xWidgetName = "XStackedDam";
- defaultData.getXOptionHandler().add(XOption.NOT_EDITABLE);
- } else if (AttributeTypeManager.isBaseTypeCompatible(DateAttribute.class, attributeType)) {
- xWidgetName = "XDateDam";
- } else if (AttributeTypeManager.isBaseTypeCompatible(IntegerAttribute.class, attributeType)) {
- xWidgetName = "XIntegerDam";
- } else if (AttributeTypeManager.isBaseTypeCompatible(FloatingPointAttribute.class, attributeType)) {
- xWidgetName = "XFloatDam";
- } else if (AttributeTypeManager.isBaseTypeCompatible(BinaryAttribute.class, attributeType)) {
- xWidgetName = "XLabelDam";
- } else if (AttributeTypeManager.isBaseTypeCompatible(StringAttribute.class, attributeType)) {
- if (maxOccurrence == 1) {
- xWidgetName = "XTextDam";
- } else {
- xWidgetName = "XStackedDam";
- }
- } else {
- xWidgetName = "XStackedDam";
- }
- return xWidgetName;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.widgets.workflow;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
+import org.eclipse.osee.framework.skynet.core.attribute.BinaryAttribute;
+import org.eclipse.osee.framework.skynet.core.attribute.BooleanAttribute;
+import org.eclipse.osee.framework.skynet.core.attribute.DateAttribute;
+import org.eclipse.osee.framework.skynet.core.attribute.EnumeratedAttribute;
+import org.eclipse.osee.framework.skynet.core.attribute.FloatingPointAttribute;
+import org.eclipse.osee.framework.skynet.core.attribute.IntegerAttribute;
+import org.eclipse.osee.framework.skynet.core.attribute.StringAttribute;
+import org.eclipse.osee.framework.skynet.core.attribute.WordAttribute;
+import org.eclipse.osee.framework.ui.skynet.widgets.XOption;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class DefaultAttributeXWidgetProvider implements IAttributeXWidgetProvider {
+
+ private DynamicXWidgetLayoutData createDynamicXWidgetLayout(AttributeType attributeType) {
+ DynamicXWidgetLayoutData defaultData = new DynamicXWidgetLayoutData(null);
+ defaultData.setName(attributeType.getName());
+ defaultData.setStorageName(attributeType.getName());
+ defaultData.setToolTip(attributeType.getDescription());
+ if (attributeType.getMinOccurrences() > 0) {
+ defaultData.getXOptionHandler().add(XOption.REQUIRED);
+ }
+ defaultData.getXOptionHandler().add(XOption.HORIZONTAL_LABEL);
+ return defaultData;
+ }
+
+ @Override
+ public List<DynamicXWidgetLayoutData> getDynamicXWidgetLayoutData(AttributeType attributeType) throws OseeCoreException {
+ int minOccurrence = attributeType.getMinOccurrences();
+ int maxOccurrence = attributeType.getMaxOccurrences();
+
+ List<DynamicXWidgetLayoutData> xWidgetLayoutData = new ArrayList<DynamicXWidgetLayoutData>();
+
+ DynamicXWidgetLayoutData defaultData = createDynamicXWidgetLayout(attributeType);
+ xWidgetLayoutData.add(defaultData);
+
+ String xWidgetName;
+ try {
+ xWidgetName = getXWidgetName(defaultData, attributeType, minOccurrence, maxOccurrence);
+ } catch (OseeCoreException ex) {
+ xWidgetName = "XTextDam";
+ StringBuilder builder = new StringBuilder();
+ builder.append("Unable to determine base type for attribute type");
+ builder.append(String.format("[%]", attributeType.getName()));
+ builder.append(Lib.exceptionToString(ex));
+ defaultData.setDefaultValue(builder.toString());
+ }
+
+ defaultData.setXWidgetName(xWidgetName);
+ defaultData.getXOptionHandler().add(XOption.FILL_HORIZONTALLY);
+ defaultData.getXOptionHandler().add(XOption.NO_DEFAULT_VALUE);
+
+ return xWidgetLayoutData;
+ }
+
+ private String getXWidgetName(DynamicXWidgetLayoutData defaultData, AttributeType attributeType, int minOccurrence, int maxOccurrence) throws OseeCoreException {
+ String xWidgetName = "";
+ if (AttributeTypeManager.isBaseTypeCompatible(EnumeratedAttribute.class, attributeType)) {
+ if (maxOccurrence == 1) {
+ xWidgetName =
+ "XComboDam(" + Collections.toString(",", AttributeTypeManager.getEnumerationValues(attributeType)) + ")";
+ } else {
+ xWidgetName =
+ "XSelectFromMultiChoiceDam(" + Collections.toString(",",
+ AttributeTypeManager.getEnumerationValues(attributeType)) + ")";
+ }
+ } else if (AttributeTypeManager.isBaseTypeCompatible(BooleanAttribute.class, attributeType)) {
+ if (minOccurrence == 1) {
+ xWidgetName = "XCheckBoxDam";
+ } else {
+ xWidgetName = "XComboBooleanDam";
+ }
+ } else if (AttributeTypeManager.isBaseTypeCompatible(WordAttribute.class, attributeType) || attributeType.equals(CoreAttributeTypes.RELATION_ORDER)) {
+ xWidgetName = "XStackedDam";
+ defaultData.getXOptionHandler().add(XOption.NOT_EDITABLE);
+ } else if (AttributeTypeManager.isBaseTypeCompatible(DateAttribute.class, attributeType)) {
+ xWidgetName = "XDateDam";
+ } else if (AttributeTypeManager.isBaseTypeCompatible(IntegerAttribute.class, attributeType)) {
+ xWidgetName = "XIntegerDam";
+ } else if (AttributeTypeManager.isBaseTypeCompatible(FloatingPointAttribute.class, attributeType)) {
+ xWidgetName = "XFloatDam";
+ } else if (AttributeTypeManager.isBaseTypeCompatible(BinaryAttribute.class, attributeType)) {
+ xWidgetName = "XLabelDam";
+ } else if (AttributeTypeManager.isBaseTypeCompatible(StringAttribute.class, attributeType)) {
+ if (maxOccurrence == 1) {
+ xWidgetName = "XTextDam";
+ } else {
+ xWidgetName = "XStackedDam";
+ }
+ } else {
+ xWidgetName = "XStackedDam";
+ }
+ return xWidgetName;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/IAttributeXWidgetProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/IAttributeXWidgetProvider.java
index 1342bf5f1d6..417d3ce30ba 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/IAttributeXWidgetProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/IAttributeXWidgetProvider.java
@@ -1,24 +1,24 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.widgets.workflow;
-
-import java.util.List;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-
-/**
- * @author Donald G. Dunne
- */
-public interface IAttributeXWidgetProvider {
-
- public List<DynamicXWidgetLayoutData> getDynamicXWidgetLayoutData(AttributeType attributeType) 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.framework.ui.skynet.widgets.workflow;
+
+import java.util.List;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IAttributeXWidgetProvider {
+
+ public List<DynamicXWidgetLayoutData> getDynamicXWidgetLayoutData(AttributeType attributeType) throws OseeCoreException;
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/IWorkDefinitionProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/IWorkDefinitionProvider.java
index c000f074ea5..e5b3718fb99 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/IWorkDefinitionProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/IWorkDefinitionProvider.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.workflow;
-
-import java.util.Collection;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-
-/**
- * @author Donald G. Dunne
- */
-public interface IWorkDefinitionProvider {
-
- /**
- * Return WorkItemDefinitions to be contributed programatically to the WorkDefinitionFactory. This includes Page and
- * Workflow Definitions. This should only be used for development as all WorkItemDefinitions should be imported into
- * the DB using ImportWorkItemDefinitions.
- *
- * @throws Exception
- */
- public Collection<WorkItemDefinition> getProgramaticWorkItemDefinitions() throws OseeCoreException;
-
- /**
- * Return WorkFlowDefinition to use for the given state machine artifact.
- *
- * @param artifact
- * @throws Exception
- */
- public WorkFlowDefinition getWorkFlowDefinition(Artifact artifact) 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.framework.ui.skynet.widgets.workflow;
+
+import java.util.Collection;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+
+/**
+ * @author Donald G. Dunne
+ */
+public interface IWorkDefinitionProvider {
+
+ /**
+ * Return WorkItemDefinitions to be contributed programatically to the WorkDefinitionFactory. This includes Page and
+ * Workflow Definitions. This should only be used for development as all WorkItemDefinitions should be imported into
+ * the DB using ImportWorkItemDefinitions.
+ *
+ * @throws Exception
+ */
+ public Collection<WorkItemDefinition> getProgramaticWorkItemDefinitions() throws OseeCoreException;
+
+ /**
+ * Return WorkFlowDefinition to use for the given state machine artifact.
+ *
+ * @param artifact
+ * @throws Exception
+ */
+ public WorkFlowDefinition getWorkFlowDefinition(Artifact artifact) throws OseeCoreException;
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkDefinitionProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkDefinitionProvider.java
index 133197aa849..78b4dbbbcfb 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkDefinitionProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkDefinitionProvider.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.framework.ui.skynet.widgets.workflow;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.plugin.core.util.ExtensionPoints;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.osgi.framework.Bundle;
-
-/**
- * @author Donald G. Dunne
- */
-public class WorkDefinitionProvider {
-
- private static List<IWorkDefinitionProvider> workDefinitionProviders;
-
- public static List<IWorkDefinitionProvider> getWorkDefinitionProviders() {
- workDefinitionProviders = new ArrayList<IWorkDefinitionProvider>();
- for (IConfigurationElement el : ExtensionPoints.getExtensionElements(
- "org.eclipse.osee.framework.ui.skynet.WorkDefinitionProvider", "WorkDefinitionProvider")) {
- String classname = null;
- String bundleName = null;
- if (el.getName().equals("WorkDefinitionProvider")) {
- 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();
- workDefinitionProviders.add((IWorkDefinitionProvider) obj);
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP,
- "Error loading WorkDefinitionProvider extension", ex);
- }
- }
-
- }
- }
- return workDefinitionProviders;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.workflow;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.plugin.core.util.ExtensionPoints;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.osgi.framework.Bundle;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class WorkDefinitionProvider {
+
+ private static List<IWorkDefinitionProvider> workDefinitionProviders;
+
+ public static List<IWorkDefinitionProvider> getWorkDefinitionProviders() {
+ workDefinitionProviders = new ArrayList<IWorkDefinitionProvider>();
+ for (IConfigurationElement el : ExtensionPoints.getExtensionElements(
+ "org.eclipse.osee.framework.ui.skynet.WorkDefinitionProvider", "WorkDefinitionProvider")) {
+ String classname = null;
+ String bundleName = null;
+ if (el.getName().equals("WorkDefinitionProvider")) {
+ 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();
+ workDefinitionProviders.add((IWorkDefinitionProvider) obj);
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP,
+ "Error loading WorkDefinitionProvider extension", ex);
+ }
+ }
+
+ }
+ }
+ return workDefinitionProviders;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkFlowDefinition.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkFlowDefinition.java
index 0b54d78da6d..1ae1584223b 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkFlowDefinition.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkFlowDefinition.java
@@ -1,494 +1,494 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.workflow;
-
-import java.util.ArrayList;
-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 org.eclipse.osee.framework.core.data.IArtifactType;
-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.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.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-
-/**
- * @author Donald G. Dunne
- */
-public class WorkFlowDefinition extends WorkItemWithChildrenDefinition {
-
- public static String ARTIFACT_NAME = "Work Flow Definition";
-
- public static enum TransitionType {
- // Normal transition; will be provided as option in transition pulldown
- ToPage,
- // Allows the page to "return" to an earlier state; allows transition w/o page completion;
- // will be provided as an option in transition pulldown (don't need to register as ToPage)
- ToPageAsReturn,
- // ToPage that will also be registered as the default selected transition state
- ToPageAsDefault,
- }
- // fromPageId --- TransitionType ---> toPageIds
- // Contains locally defined transitions
- private final Map<String, Map<TransitionType, Set<String>>> pageIdToPageIdsViaTransitionType =
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.workflow;
+
+import java.util.ArrayList;
+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 org.eclipse.osee.framework.core.data.IArtifactType;
+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.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.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class WorkFlowDefinition extends WorkItemWithChildrenDefinition {
+
+ public static String ARTIFACT_NAME = "Work Flow Definition";
+
+ public static enum TransitionType {
+ // Normal transition; will be provided as option in transition pulldown
+ ToPage,
+ // Allows the page to "return" to an earlier state; allows transition w/o page completion;
+ // will be provided as an option in transition pulldown (don't need to register as ToPage)
+ ToPageAsReturn,
+ // ToPage that will also be registered as the default selected transition state
+ ToPageAsDefault,
+ }
+ // fromPageId --- TransitionType ---> toPageIds
+ // Contains locally defined transitions
+ private final Map<String, Map<TransitionType, Set<String>>> pageIdToPageIdsViaTransitionType =
new HashMap<String, Map<TransitionType, Set<String>>>();
- // Contains locally and inherited transitions
- protected Map<String, Map<TransitionType, Set<String>>> inheritedPageIdToPageIdsViaTransitionType;
- // Contains local and inherited pageNameToPageIds
- protected Map<String, String> pageNameToPageId;
- protected List<WorkPageDefinition> pages = new ArrayList<WorkPageDefinition>();
- protected String startPageId;
- protected String resolvedStartPageId;
+ // Contains locally and inherited transitions
+ protected Map<String, Map<TransitionType, Set<String>>> inheritedPageIdToPageIdsViaTransitionType;
+ // Contains local and inherited pageNameToPageIds
+ protected Map<String, String> pageNameToPageId;
+ protected List<WorkPageDefinition> pages = new ArrayList<WorkPageDefinition>();
+ protected String startPageId;
+ protected String resolvedStartPageId;
private Artifact artifact;
-
- public WorkFlowDefinition(String name, String id, String parentId) {
- super(name, id, parentId);
- }
-
- public WorkFlowDefinition(Artifact artifact) throws OseeCoreException {
- this(artifact.getName(), artifact.getSoleAttributeValue(WorkItemAttributes.WORK_ID.getAttributeTypeName(), ""),
+
+ public WorkFlowDefinition(String name, String id, String parentId) {
+ super(name, id, parentId);
+ }
+
+ public WorkFlowDefinition(Artifact artifact) throws OseeCoreException {
+ this(artifact.getName(), artifact.getSoleAttributeValue(WorkItemAttributes.WORK_ID.getAttributeTypeName(), ""),
artifact.getSoleAttributeValue(WorkItemAttributes.WORK_PARENT_ID.getAttributeTypeName(), (String) null));
- setType(artifact.getSoleAttributeValue(WorkItemAttributes.WORK_TYPE.getAttributeTypeName(), (String) null));
- loadWorkDataKeyValueMap(artifact);
-
- // Add local transitions from this artifact
- addTransitionsFromArtifact(artifact, pageIdToPageIdsViaTransitionType, getId());
-
- // Read in this workflow's start page
- startPageId =
+ setType(artifact.getSoleAttributeValue(WorkItemAttributes.WORK_TYPE.getAttributeTypeName(), (String) null));
+ loadWorkDataKeyValueMap(artifact);
+
+ // Add local transitions from this artifact
+ addTransitionsFromArtifact(artifact, pageIdToPageIdsViaTransitionType, getId());
+
+ // Read in this workflow's start page
+ startPageId =
artifact.getSoleAttributeValue(WorkItemAttributes.START_PAGE.getAttributeTypeName(), null, String.class);
this.artifact = artifact;
- }
-
- @Override
- public Artifact toArtifact(WriteType writeType) throws OseeCoreException {
- Artifact art = super.toArtifact(writeType);
- // Make sure start page is defined in this or parent's definition
- if (getResolvedStartPageId() == null) {
- throw new IllegalStateException(
+ }
+
+ @Override
+ public Artifact toArtifact(WriteType writeType) throws OseeCoreException {
+ Artifact art = super.toArtifact(writeType);
+ // Make sure start page is defined in this or parent's definition
+ if (getResolvedStartPageId() == null) {
+ throw new IllegalStateException(
"For WorkFlowDefinition " + getId() + ". Start Page not defined. Must be in this or a parent's WorkFlowDefinition.");
- }
- // Only store start page if it's part of this definition
- if (startPageId != null) {
- art.setSoleAttributeFromString(WorkItemAttributes.START_PAGE.getAttributeTypeName(), startPageId);
- }
- // Store transition items declared as part of this definition
- List<String> transitionItems = new ArrayList<String>();
- for (Entry<String, Map<TransitionType, Set<String>>> pageToTransEntry : pageIdToPageIdsViaTransitionType.entrySet()) {
- for (Entry<TransitionType, Set<String>> transToPageIdsEntry : pageIdToPageIdsViaTransitionType.get(
+ }
+ // Only store start page if it's part of this definition
+ if (startPageId != null) {
+ art.setSoleAttributeFromString(WorkItemAttributes.START_PAGE.getAttributeTypeName(), startPageId);
+ }
+ // Store transition items declared as part of this definition
+ List<String> transitionItems = new ArrayList<String>();
+ for (Entry<String, Map<TransitionType, Set<String>>> pageToTransEntry : pageIdToPageIdsViaTransitionType.entrySet()) {
+ for (Entry<TransitionType, Set<String>> transToPageIdsEntry : pageIdToPageIdsViaTransitionType.get(
pageToTransEntry.getKey()).entrySet()) {
- for (String toPage : transToPageIdsEntry.getValue()) {
- transitionItems.add(pageToTransEntry.getKey() + ";" + transToPageIdsEntry.getKey().name() + ";" + toPage);
- }
- }
- }
- if (transitionItems.size() > 0) {
- art.setAttributeValues(WorkItemAttributes.TRANSITION.getAttributeTypeName(), transitionItems);
- }
- return art;
- }
-
- public Collection<String> getPageNames() throws OseeCoreException {
- loadPageData();
- return pageNameToPageId.keySet();
- }
-
- public static void loadInheritedData(WorkFlowDefinition workFlowDefinition, String workflowId, Map<String, Map<TransitionType, Set<String>>> inheritedPageIdToPageIdsViaTransitionType) throws OseeCoreException {
- addTransitionsFromArtifact(WorkItemDefinitionFactory.getWorkItemDefinitionArtifact(workFlowDefinition.getId()),
+ for (String toPage : transToPageIdsEntry.getValue()) {
+ transitionItems.add(pageToTransEntry.getKey() + ";" + transToPageIdsEntry.getKey().name() + ";" + toPage);
+ }
+ }
+ }
+ if (transitionItems.size() > 0) {
+ art.setAttributeValues(WorkItemAttributes.TRANSITION.getAttributeTypeName(), transitionItems);
+ }
+ return art;
+ }
+
+ public Collection<String> getPageNames() throws OseeCoreException {
+ loadPageData();
+ return pageNameToPageId.keySet();
+ }
+
+ public static void loadInheritedData(WorkFlowDefinition workFlowDefinition, String workflowId, Map<String, Map<TransitionType, Set<String>>> inheritedPageIdToPageIdsViaTransitionType) throws OseeCoreException {
+ addTransitionsFromArtifact(WorkItemDefinitionFactory.getWorkItemDefinitionArtifact(workFlowDefinition.getId()),
inheritedPageIdToPageIdsViaTransitionType, workflowId);
- if (workFlowDefinition.hasParent()) {
- WorkFlowDefinition.loadInheritedData((WorkFlowDefinition) workFlowDefinition.getParent(), workflowId,
+ if (workFlowDefinition.hasParent()) {
+ WorkFlowDefinition.loadInheritedData((WorkFlowDefinition) workFlowDefinition.getParent(), workflowId,
inheritedPageIdToPageIdsViaTransitionType);
- }
- }
-
- /**
- * If deCache, clears cache and reloads workflow data
- *
- * @param deCache
- * @throws OseeCoreException
- */
- public void loadPageData(boolean deCache) throws OseeCoreException {
- if (deCache) {
- inheritedPageIdToPageIdsViaTransitionType = null;
- pageNameToPageId = null;
- }
- loadPageData();
- }
-
- public synchronized void loadPageData() throws OseeCoreException {
- if (inheritedPageIdToPageIdsViaTransitionType == null) {
- inheritedPageIdToPageIdsViaTransitionType = new HashMap<String, Map<TransitionType, Set<String>>>();
- WorkFlowDefinition.loadInheritedData(this, getId(), inheritedPageIdToPageIdsViaTransitionType);
- }
- resolvedStartPageId = getResolvedStartPageId(this, getId());
- if (pageNameToPageId == null) {
- pageNameToPageId = new HashMap<String, String>();
- for (String pageNameOrId : inheritedPageIdToPageIdsViaTransitionType.keySet()) {
- WorkPageDefinition workPageDefinition =
+ }
+ }
+
+ /**
+ * If deCache, clears cache and reloads workflow data
+ *
+ * @param deCache
+ * @throws OseeCoreException
+ */
+ public void loadPageData(boolean deCache) throws OseeCoreException {
+ if (deCache) {
+ inheritedPageIdToPageIdsViaTransitionType = null;
+ pageNameToPageId = null;
+ }
+ loadPageData();
+ }
+
+ public synchronized void loadPageData() throws OseeCoreException {
+ if (inheritedPageIdToPageIdsViaTransitionType == null) {
+ inheritedPageIdToPageIdsViaTransitionType = new HashMap<String, Map<TransitionType, Set<String>>>();
+ WorkFlowDefinition.loadInheritedData(this, getId(), inheritedPageIdToPageIdsViaTransitionType);
+ }
+ resolvedStartPageId = getResolvedStartPageId(this, getId());
+ if (pageNameToPageId == null) {
+ pageNameToPageId = new HashMap<String, String>();
+ for (String pageNameOrId : inheritedPageIdToPageIdsViaTransitionType.keySet()) {
+ WorkPageDefinition workPageDefinition =
(WorkPageDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(getFullPageId(pageNameOrId));
- pages.add(workPageDefinition);
- pageNameToPageId.put(workPageDefinition.getPageName(), workPageDefinition.id);
- for (Map<TransitionType, Set<String>> transTypeToPageIds : inheritedPageIdToPageIdsViaTransitionType.values()) {
- for (TransitionType transType : transTypeToPageIds.keySet()) {
- for (String pageId2 : transTypeToPageIds.get(transType)) {
- workPageDefinition =
+ pages.add(workPageDefinition);
+ pageNameToPageId.put(workPageDefinition.getPageName(), workPageDefinition.id);
+ for (Map<TransitionType, Set<String>> transTypeToPageIds : inheritedPageIdToPageIdsViaTransitionType.values()) {
+ for (TransitionType transType : transTypeToPageIds.keySet()) {
+ for (String pageId2 : transTypeToPageIds.get(transType)) {
+ workPageDefinition =
(WorkPageDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(getFullPageId(pageId2));
- pageNameToPageId.put(workPageDefinition.getPageName(), workPageDefinition.id);
- }
- }
- }
- }
- }
- }
-
- /**
- * @return the pages
- */
- public List<WorkPageDefinition> getPages() {
- return pages;
- }
-
- /**
- * Since transitions can be defined by full ids or just page name (eg "Endorse"), check if pageId has namespace
- * characters and thus it's full name or add id to given pageId
- *
- * @param pageId
- * @return
- */
- private String getFullPageId(String pageId) {
- return pageId.contains(".") ? pageId : getId() + "." + pageId;
- }
-
- public WorkPageDefinition getWorkPageDefinitionByName(String name) throws OseeCoreException {
- loadPageData();
- return getWorkPageDefinitionById(pageNameToPageId.get(name));
- }
-
- public WorkPageDefinition getWorkPageDefinitionById(String id) throws OseeCoreException {
- loadPageData();
- return (WorkPageDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(id);
- }
-
- public Collection<WorkRuleDefinition> getWorkRulesStartsWith(String ruleId) throws OseeCoreException {
- Set<WorkRuleDefinition> workRules = new HashSet<WorkRuleDefinition>();
- if (ruleId == null || ruleId.equals("")) {
- return workRules;
- }
- // Get work rules from team definition
- for (WorkRuleDefinition workRuleDefinition : getWorkRules()) {
- if (!workRuleDefinition.getId().equals("") && workRuleDefinition.getId().startsWith(ruleId)) {
- workRules.add(workRuleDefinition);
- }
- }
-
- return workRules;
- }
-
- public Collection<WorkRuleDefinition> getWorkRules() throws OseeCoreException {
- Set<WorkRuleDefinition> workRules = new HashSet<WorkRuleDefinition>();
- // Get work rules from team definition
- for (Artifact art : WorkItemDefinitionFactory.getWorkItemDefinitionArtifact(getId()).getRelatedArtifacts(
+ pageNameToPageId.put(workPageDefinition.getPageName(), workPageDefinition.id);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * @return the pages
+ */
+ public List<WorkPageDefinition> getPages() {
+ return pages;
+ }
+
+ /**
+ * Since transitions can be defined by full ids or just page name (eg "Endorse"), check if pageId has namespace
+ * characters and thus it's full name or add id to given pageId
+ *
+ * @param pageId
+ * @return
+ */
+ private String getFullPageId(String pageId) {
+ return pageId.contains(".") ? pageId : getId() + "." + pageId;
+ }
+
+ public WorkPageDefinition getWorkPageDefinitionByName(String name) throws OseeCoreException {
+ loadPageData();
+ return getWorkPageDefinitionById(pageNameToPageId.get(name));
+ }
+
+ public WorkPageDefinition getWorkPageDefinitionById(String id) throws OseeCoreException {
+ loadPageData();
+ return (WorkPageDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(id);
+ }
+
+ public Collection<WorkRuleDefinition> getWorkRulesStartsWith(String ruleId) throws OseeCoreException {
+ Set<WorkRuleDefinition> workRules = new HashSet<WorkRuleDefinition>();
+ if (ruleId == null || ruleId.equals("")) {
+ return workRules;
+ }
+ // Get work rules from team definition
+ for (WorkRuleDefinition workRuleDefinition : getWorkRules()) {
+ if (!workRuleDefinition.getId().equals("") && workRuleDefinition.getId().startsWith(ruleId)) {
+ workRules.add(workRuleDefinition);
+ }
+ }
+
+ return workRules;
+ }
+
+ public Collection<WorkRuleDefinition> getWorkRules() throws OseeCoreException {
+ Set<WorkRuleDefinition> workRules = new HashSet<WorkRuleDefinition>();
+ // Get work rules from team definition
+ for (Artifact art : WorkItemDefinitionFactory.getWorkItemDefinitionArtifact(getId()).getRelatedArtifacts(
CoreRelationTypes.WorkItem__Child)) {
- String id = art.getSoleAttributeValue(WorkItemAttributes.WORK_ID.getAttributeTypeName(), "");
- if (id != null && !id.equals("")) {
- workRules.add((WorkRuleDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(id));
- }
- }
-
- return workRules;
- }
-
- /**
- * @return Returns the defaultToPage.
- */
- public WorkPageDefinition getDefaultToPage(WorkPageDefinition workPageDefinition) throws OseeCoreException {
- if (getPageDefinitions(workPageDefinition.getId(), TransitionType.ToPageAsDefault).size() > 0) {
- return getPageDefinitions(workPageDefinition.getId(), TransitionType.ToPageAsDefault).iterator().next();
- }
- return null;
- }
-
- /**
- * This convenience method registers a transition forward and back. Useful for final/hold states like cancelled or
- * completed that can be returned from<br>
- * 1) fromPageId, toPageId, ToPage<br>
- * 2) toPageId, fromPageId, ToPageAsReturn
- *
- * @param fromPageId
- * @param toPageId
- * @param transitionType
- */
- public void addPageTransitionToPageAndReturn(String fromPageId, String toPageId) {
- addPageTransition(pageIdToPageIdsViaTransitionType, fromPageId, toPageId, TransitionType.ToPage);
- addPageTransition(pageIdToPageIdsViaTransitionType, toPageId, fromPageId, TransitionType.ToPageAsReturn);
- }
-
- public static void addTransitionsFromArtifact(Artifact artifact, Map<String, Map<TransitionType, Set<String>>> pageIdToPageIdsViaTransitionType, String workflowId) throws OseeCoreException {
- if (artifact == null) {
- return;
- }
- // Read in this workflow's transition information
- for (String transition : artifact.getAttributesToStringList(WorkItemAttributes.TRANSITION.getAttributeTypeName())) {
- String[] strs = transition.split(";");
- if (strs.length != 3) {
- OseeLog.log(
+ String id = art.getSoleAttributeValue(WorkItemAttributes.WORK_ID.getAttributeTypeName(), "");
+ if (id != null && !id.equals("")) {
+ workRules.add((WorkRuleDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(id));
+ }
+ }
+
+ return workRules;
+ }
+
+ /**
+ * @return Returns the defaultToPage.
+ */
+ public WorkPageDefinition getDefaultToPage(WorkPageDefinition workPageDefinition) throws OseeCoreException {
+ if (getPageDefinitions(workPageDefinition.getId(), TransitionType.ToPageAsDefault).size() > 0) {
+ return getPageDefinitions(workPageDefinition.getId(), TransitionType.ToPageAsDefault).iterator().next();
+ }
+ return null;
+ }
+
+ /**
+ * This convenience method registers a transition forward and back. Useful for final/hold states like cancelled or
+ * completed that can be returned from<br>
+ * 1) fromPageId, toPageId, ToPage<br>
+ * 2) toPageId, fromPageId, ToPageAsReturn
+ *
+ * @param fromPageId
+ * @param toPageId
+ * @param transitionType
+ */
+ public void addPageTransitionToPageAndReturn(String fromPageId, String toPageId) {
+ addPageTransition(pageIdToPageIdsViaTransitionType, fromPageId, toPageId, TransitionType.ToPage);
+ addPageTransition(pageIdToPageIdsViaTransitionType, toPageId, fromPageId, TransitionType.ToPageAsReturn);
+ }
+
+ public static void addTransitionsFromArtifact(Artifact artifact, Map<String, Map<TransitionType, Set<String>>> pageIdToPageIdsViaTransitionType, String workflowId) throws OseeCoreException {
+ if (artifact == null) {
+ return;
+ }
+ // Read in this workflow's transition information
+ for (String transition : artifact.getAttributesToStringList(WorkItemAttributes.TRANSITION.getAttributeTypeName())) {
+ String[] strs = transition.split(";");
+ if (strs.length != 3) {
+ OseeLog.log(
SkynetGuiPlugin.class,
OseeLevel.SEVERE_POPUP,
new OseeStateException(
"Transition attribute from artifact " + artifact.getGuid() + " is invalid. Must be <fromState>;<transitionType>;<toState>"));
- continue;
- }
- TransitionType transType = TransitionType.valueOf(strs[1]);
- // Since workflows can be defined by stateName or pageId, resolve any stateName to pageId so only dealing with one index
- // eg (Endorse -> <workflow id>.Endorse -> osee.ats.Endorse AND osee.ats.Endorse -> osee.ats.Endorse)
- String fromPage = strs[0].contains(".") ? strs[0] : workflowId + "." + strs[0];
- String toPage = strs[2].contains(".") ? strs[2] : workflowId + "." + strs[2];
- addPageTransition(pageIdToPageIdsViaTransitionType, fromPage, toPage, transType);
- }
-
- }
-
- /**
- * Register transition for from and to pages. The use of simple page names (eg "Endorse") allows for other workflows
- * to inherit this workflow by just using the same state names. id will be prepended to name prior to retrieving the
- * WorkPageDefinitions
- *
- * @param fromPageId either page Name "Endorse" or full namespace "osee.ats.Endorse"
- * @param toPageId either page Name "Endorse" or full namespace "osee.ats.Endorse"
- * @param transitionType
- */
- public void addPageTransition(String fromPageId, String toPageId, TransitionType... transitionType) {
- WorkFlowDefinition.addPageTransition(pageIdToPageIdsViaTransitionType, fromPageId, toPageId, transitionType);
- }
-
- public void removePageTransition(String fromPageId, String toPageId, TransitionType... transitionType) {
- WorkFlowDefinition.removePageTransition(pageIdToPageIdsViaTransitionType, fromPageId, toPageId, transitionType);
- }
-
- /**
- * Register transition for from and to pages. The use of simple page names (eg "Endorse") allows for other workflows
- * to inherit this workflow by just using the same state names. id will be prepended to name prior to retrieving the
- * WorkPageDefinitions
- *
- * @param fromPageId either page Name "Endorse" or full namespace "osee.ats.Endorse"
- * @param toPageId either page Name "Endorse" or full namespace "osee.ats.Endorse"
- * @param transitionType
- */
- public static void addPageTransition(Map<String, Map<TransitionType, Set<String>>> pageIdToPageIdsViaTransitionType, String fromPageId, String toPageId, TransitionType... transitionType) {
- List<Object> transTypes = Collections.getAggregate((Object[]) transitionType);
- Map<TransitionType, Set<String>> transitionTypeToPageIds = pageIdToPageIdsViaTransitionType.get(fromPageId);
- if (transitionTypeToPageIds == null) {
- transitionTypeToPageIds = new HashMap<TransitionType, Set<String>>();
- }
- for (TransitionType transType : transitionType) {
- Set<String> toPageIds = transitionTypeToPageIds.get(transType);
- if (toPageIds == null) {
- toPageIds = new HashSet<String>();
- }
- if (transTypes.contains(TransitionType.ToPageAsDefault) && toPageIds.size() > 0) {
- throw new IllegalArgumentException("Only allowed ONE DefaultToPage from " + fromPageId);
- }
- toPageIds.add(toPageId);
-
- transitionTypeToPageIds.put(transType, toPageIds);
- pageIdToPageIdsViaTransitionType.put(fromPageId, transitionTypeToPageIds);
- }
- }
-
- public static void removePageTransition(Map<String, Map<TransitionType, Set<String>>> pageIdToPageIdsViaTransitionType, String fromPageId, String toPageId, TransitionType... transitionType) {
- Map<TransitionType, Set<String>> transitionTypeToPageIds = pageIdToPageIdsViaTransitionType.get(fromPageId);
- if (transitionTypeToPageIds == null) {
- return;
- }
- for (TransitionType transType : transitionType) {
- Set<String> toPageIds = transitionTypeToPageIds.get(transType);
- if (toPageIds == null) {
- return;
- }
- toPageIds.remove(toPageId);
- transitionTypeToPageIds.put(transType, toPageIds);
- pageIdToPageIdsViaTransitionType.put(fromPageId, transitionTypeToPageIds);
- }
- }
-
- /**
- * Return all registered page definitions including those inherited from parent(s)
- *
- * @param fromPageId
- * @param transitionType
- * @return definitions
- * @throws Exception
- */
- public List<WorkPageDefinition> getPageDefinitions(String fromPageId, TransitionType... transitionType) throws OseeCoreException {
- return getPageDefinitions(this, fromPageId, true, transitionType);
- }
-
- public void clearTransitions() {
- pageIdToPageIdsViaTransitionType.clear();
- }
-
- public Map<TransitionType, Set<String>> getTransitionTypeToPageIds(String fromPageId) throws OseeCoreException {
- loadPageData();
- return pageIdToPageIdsViaTransitionType.get(fromPageId);
- }
-
- public Map<TransitionType, Set<String>> getInheritedTransitionTypeToPageIds(String fromPageId) throws OseeCoreException {
- loadPageData();
- return inheritedPageIdToPageIdsViaTransitionType.get(fromPageId);
- }
-
- public static List<WorkPageDefinition> getPageDefinitions(WorkFlowDefinition workFlowDefinition, String fromPageId, boolean includeInherited, TransitionType... transitionType) throws OseeCoreException {
- Map<TransitionType, Set<String>> transitionTypeToPageIds = null;
- if (includeInherited) {
- transitionTypeToPageIds = workFlowDefinition.getInheritedTransitionTypeToPageIds(fromPageId);
- } else {
- transitionTypeToPageIds = workFlowDefinition.getTransitionTypeToPageIds(fromPageId);
- }
- List<WorkPageDefinition> workPageDefs = new ArrayList<WorkPageDefinition>();
- if (transitionTypeToPageIds != null) {
- for (TransitionType transType : transitionType) {
- Set<String> toPageIds = transitionTypeToPageIds.get(transType);
- if (toPageIds == null) {
- continue;
- }
- for (WorkItemDefinition def : WorkItemDefinitionFactory.getWorkItemDefinitions(toPageIds)) {
- workPageDefs.add((WorkPageDefinition) def);
- }
- }
- }
- return workPageDefs;
- }
-
- public List<WorkPageDefinition> getPagesOrdered() throws OseeCoreException {
- WorkPageDefinition startWorkPageDefinition = getStartPage();
- if (startWorkPageDefinition == null) {
- throw new IllegalArgumentException("Can't locate Start WorkPageDefinition for workflow " + getName());
- }
-
- // Get ordered pages starting with start page
- List<WorkPageDefinition> orderedPages = new ArrayList<WorkPageDefinition>();
- getOrderedPages(startWorkPageDefinition, orderedPages);
-
- // Move completed to the end if it exists
- WorkPageDefinition completedPage = null;
- for (WorkPageDefinition workPageDefinition : orderedPages) {
- if (workPageDefinition.isCompletePage()) {
- completedPage = workPageDefinition;
- }
- }
- if (completedPage != null) {
- orderedPages.remove(completedPage);
- orderedPages.add(completedPage);
- }
- // for (WorkPage wPage : orderedPages)
- // System.out.println("Ordered Page: - " + wPage);
- return orderedPages;
- }
-
- private void getOrderedPages(WorkPageDefinition workPageDefinition, List<WorkPageDefinition> pages) throws OseeCoreException {
- // Add this page first
- if (!pages.contains(workPageDefinition)) {
- pages.add(workPageDefinition);
- }
- // Add default page
- if (getDefaultToPage(workPageDefinition) != null) {
- getOrderedPages(getDefaultToPage(workPageDefinition), pages);
- }
- // Add remaining pages
- for (WorkPageDefinition wPage : getToPages(workPageDefinition)) {
- if (!pages.contains(wPage)) {
- getOrderedPages(wPage, pages);
- }
- }
- }
-
- /**
- * @return Returns the toPages for given workPageDefinition including default and return toPages.
- */
- public List<WorkPageDefinition> getToPages(WorkPageDefinition workPageDefinition) throws OseeCoreException {
- return getPageDefinitions(workPageDefinition.getId(), TransitionType.ToPage, TransitionType.ToPageAsDefault,
+ continue;
+ }
+ TransitionType transType = TransitionType.valueOf(strs[1]);
+ // Since workflows can be defined by stateName or pageId, resolve any stateName to pageId so only dealing with one index
+ // eg (Endorse -> <workflow id>.Endorse -> osee.ats.Endorse AND osee.ats.Endorse -> osee.ats.Endorse)
+ String fromPage = strs[0].contains(".") ? strs[0] : workflowId + "." + strs[0];
+ String toPage = strs[2].contains(".") ? strs[2] : workflowId + "." + strs[2];
+ addPageTransition(pageIdToPageIdsViaTransitionType, fromPage, toPage, transType);
+ }
+
+ }
+
+ /**
+ * Register transition for from and to pages. The use of simple page names (eg "Endorse") allows for other workflows
+ * to inherit this workflow by just using the same state names. id will be prepended to name prior to retrieving the
+ * WorkPageDefinitions
+ *
+ * @param fromPageId either page Name "Endorse" or full namespace "osee.ats.Endorse"
+ * @param toPageId either page Name "Endorse" or full namespace "osee.ats.Endorse"
+ * @param transitionType
+ */
+ public void addPageTransition(String fromPageId, String toPageId, TransitionType... transitionType) {
+ WorkFlowDefinition.addPageTransition(pageIdToPageIdsViaTransitionType, fromPageId, toPageId, transitionType);
+ }
+
+ public void removePageTransition(String fromPageId, String toPageId, TransitionType... transitionType) {
+ WorkFlowDefinition.removePageTransition(pageIdToPageIdsViaTransitionType, fromPageId, toPageId, transitionType);
+ }
+
+ /**
+ * Register transition for from and to pages. The use of simple page names (eg "Endorse") allows for other workflows
+ * to inherit this workflow by just using the same state names. id will be prepended to name prior to retrieving the
+ * WorkPageDefinitions
+ *
+ * @param fromPageId either page Name "Endorse" or full namespace "osee.ats.Endorse"
+ * @param toPageId either page Name "Endorse" or full namespace "osee.ats.Endorse"
+ * @param transitionType
+ */
+ public static void addPageTransition(Map<String, Map<TransitionType, Set<String>>> pageIdToPageIdsViaTransitionType, String fromPageId, String toPageId, TransitionType... transitionType) {
+ List<Object> transTypes = Collections.getAggregate((Object[]) transitionType);
+ Map<TransitionType, Set<String>> transitionTypeToPageIds = pageIdToPageIdsViaTransitionType.get(fromPageId);
+ if (transitionTypeToPageIds == null) {
+ transitionTypeToPageIds = new HashMap<TransitionType, Set<String>>();
+ }
+ for (TransitionType transType : transitionType) {
+ Set<String> toPageIds = transitionTypeToPageIds.get(transType);
+ if (toPageIds == null) {
+ toPageIds = new HashSet<String>();
+ }
+ if (transTypes.contains(TransitionType.ToPageAsDefault) && toPageIds.size() > 0) {
+ throw new IllegalArgumentException("Only allowed ONE DefaultToPage from " + fromPageId);
+ }
+ toPageIds.add(toPageId);
+
+ transitionTypeToPageIds.put(transType, toPageIds);
+ pageIdToPageIdsViaTransitionType.put(fromPageId, transitionTypeToPageIds);
+ }
+ }
+
+ public static void removePageTransition(Map<String, Map<TransitionType, Set<String>>> pageIdToPageIdsViaTransitionType, String fromPageId, String toPageId, TransitionType... transitionType) {
+ Map<TransitionType, Set<String>> transitionTypeToPageIds = pageIdToPageIdsViaTransitionType.get(fromPageId);
+ if (transitionTypeToPageIds == null) {
+ return;
+ }
+ for (TransitionType transType : transitionType) {
+ Set<String> toPageIds = transitionTypeToPageIds.get(transType);
+ if (toPageIds == null) {
+ return;
+ }
+ toPageIds.remove(toPageId);
+ transitionTypeToPageIds.put(transType, toPageIds);
+ pageIdToPageIdsViaTransitionType.put(fromPageId, transitionTypeToPageIds);
+ }
+ }
+
+ /**
+ * Return all registered page definitions including those inherited from parent(s)
+ *
+ * @param fromPageId
+ * @param transitionType
+ * @return definitions
+ * @throws Exception
+ */
+ public List<WorkPageDefinition> getPageDefinitions(String fromPageId, TransitionType... transitionType) throws OseeCoreException {
+ return getPageDefinitions(this, fromPageId, true, transitionType);
+ }
+
+ public void clearTransitions() {
+ pageIdToPageIdsViaTransitionType.clear();
+ }
+
+ public Map<TransitionType, Set<String>> getTransitionTypeToPageIds(String fromPageId) throws OseeCoreException {
+ loadPageData();
+ return pageIdToPageIdsViaTransitionType.get(fromPageId);
+ }
+
+ public Map<TransitionType, Set<String>> getInheritedTransitionTypeToPageIds(String fromPageId) throws OseeCoreException {
+ loadPageData();
+ return inheritedPageIdToPageIdsViaTransitionType.get(fromPageId);
+ }
+
+ public static List<WorkPageDefinition> getPageDefinitions(WorkFlowDefinition workFlowDefinition, String fromPageId, boolean includeInherited, TransitionType... transitionType) throws OseeCoreException {
+ Map<TransitionType, Set<String>> transitionTypeToPageIds = null;
+ if (includeInherited) {
+ transitionTypeToPageIds = workFlowDefinition.getInheritedTransitionTypeToPageIds(fromPageId);
+ } else {
+ transitionTypeToPageIds = workFlowDefinition.getTransitionTypeToPageIds(fromPageId);
+ }
+ List<WorkPageDefinition> workPageDefs = new ArrayList<WorkPageDefinition>();
+ if (transitionTypeToPageIds != null) {
+ for (TransitionType transType : transitionType) {
+ Set<String> toPageIds = transitionTypeToPageIds.get(transType);
+ if (toPageIds == null) {
+ continue;
+ }
+ for (WorkItemDefinition def : WorkItemDefinitionFactory.getWorkItemDefinitions(toPageIds)) {
+ workPageDefs.add((WorkPageDefinition) def);
+ }
+ }
+ }
+ return workPageDefs;
+ }
+
+ public List<WorkPageDefinition> getPagesOrdered() throws OseeCoreException {
+ WorkPageDefinition startWorkPageDefinition = getStartPage();
+ if (startWorkPageDefinition == null) {
+ throw new IllegalArgumentException("Can't locate Start WorkPageDefinition for workflow " + getName());
+ }
+
+ // Get ordered pages starting with start page
+ List<WorkPageDefinition> orderedPages = new ArrayList<WorkPageDefinition>();
+ getOrderedPages(startWorkPageDefinition, orderedPages);
+
+ // Move completed to the end if it exists
+ WorkPageDefinition completedPage = null;
+ for (WorkPageDefinition workPageDefinition : orderedPages) {
+ if (workPageDefinition.isCompletePage()) {
+ completedPage = workPageDefinition;
+ }
+ }
+ if (completedPage != null) {
+ orderedPages.remove(completedPage);
+ orderedPages.add(completedPage);
+ }
+ // for (WorkPage wPage : orderedPages)
+ // System.out.println("Ordered Page: - " + wPage);
+ return orderedPages;
+ }
+
+ private void getOrderedPages(WorkPageDefinition workPageDefinition, List<WorkPageDefinition> pages) throws OseeCoreException {
+ // Add this page first
+ if (!pages.contains(workPageDefinition)) {
+ pages.add(workPageDefinition);
+ }
+ // Add default page
+ if (getDefaultToPage(workPageDefinition) != null) {
+ getOrderedPages(getDefaultToPage(workPageDefinition), pages);
+ }
+ // Add remaining pages
+ for (WorkPageDefinition wPage : getToPages(workPageDefinition)) {
+ if (!pages.contains(wPage)) {
+ getOrderedPages(wPage, pages);
+ }
+ }
+ }
+
+ /**
+ * @return Returns the toPages for given workPageDefinition including default and return toPages.
+ */
+ public List<WorkPageDefinition> getToPages(WorkPageDefinition workPageDefinition) throws OseeCoreException {
+ return getPageDefinitions(workPageDefinition.getId(), TransitionType.ToPage, TransitionType.ToPageAsDefault,
TransitionType.ToPageAsReturn);
- }
-
- /**
- * @return Returns the returnPages for given workPageDefinition.
- */
- public List<WorkPageDefinition> getReturnPages(WorkPageDefinition workPageDefinition) throws OseeCoreException {
- return getPageDefinitions(workPageDefinition.getId(), TransitionType.ToPageAsReturn);
- }
-
- public boolean isReturnPage(WorkPageDefinition fromWorkPageDefinition, WorkPageDefinition toWorkPageDefinition) throws OseeCoreException {
- return getReturnPages(fromWorkPageDefinition).contains(toWorkPageDefinition);
- }
-
- @Override
- public String toString() {
- try {
- return id + " - " + name + (parentId != null ? " - Parent: " + parentId : "") + getPageNames().toString();
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- return id + " - " + name;
- }
- }
-
+ }
+
+ /**
+ * @return Returns the returnPages for given workPageDefinition.
+ */
+ public List<WorkPageDefinition> getReturnPages(WorkPageDefinition workPageDefinition) throws OseeCoreException {
+ return getPageDefinitions(workPageDefinition.getId(), TransitionType.ToPageAsReturn);
+ }
+
+ public boolean isReturnPage(WorkPageDefinition fromWorkPageDefinition, WorkPageDefinition toWorkPageDefinition) throws OseeCoreException {
+ return getReturnPages(fromWorkPageDefinition).contains(toWorkPageDefinition);
+ }
+
+ @Override
+ public String toString() {
+ try {
+ return id + " - " + name + (parentId != null ? " - Parent: " + parentId : "") + getPageNames().toString();
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ return id + " - " + name;
+ }
+ }
+
@Override
- public IArtifactType getArtifactType() {
- return CoreArtifactTypes.WorkFlowDefinition;
- }
-
- public WorkPageDefinition getStartPage() throws OseeCoreException {
- loadPageData();
- if (resolvedStartPageId != null) {
- return (WorkPageDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(resolvedStartPageId);
- }
- return null;
- }
-
- public void setStartPageId(String startPageId) {
- this.startPageId = startPageId;
- }
-
- public String getStartPageId() throws OseeCoreException {
- loadPageData();
- return startPageId;
- }
-
- public String getResolvedStartPageId() throws OseeCoreException {
- loadPageData();
- return resolvedStartPageId;
- }
-
- private static String getResolvedStartPageId(WorkFlowDefinition workFlowDefinition, String workflowId) throws OseeCoreException {
- if (workFlowDefinition.startPageId != null) {
- return workFlowDefinition.startPageId.contains(".") ? workFlowDefinition.startPageId : workflowId + "." + workFlowDefinition.startPageId;
- }
- if (workFlowDefinition.hasParent()) {
- return getResolvedStartPageId((WorkFlowDefinition) workFlowDefinition.getParent(), workflowId);
- }
- return null;
- }
+ public IArtifactType getArtifactType() {
+ return CoreArtifactTypes.WorkFlowDefinition;
+ }
+
+ public WorkPageDefinition getStartPage() throws OseeCoreException {
+ loadPageData();
+ if (resolvedStartPageId != null) {
+ return (WorkPageDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(resolvedStartPageId);
+ }
+ return null;
+ }
+
+ public void setStartPageId(String startPageId) {
+ this.startPageId = startPageId;
+ }
+
+ public String getStartPageId() throws OseeCoreException {
+ loadPageData();
+ return startPageId;
+ }
+
+ public String getResolvedStartPageId() throws OseeCoreException {
+ loadPageData();
+ return resolvedStartPageId;
+ }
+
+ private static String getResolvedStartPageId(WorkFlowDefinition workFlowDefinition, String workflowId) throws OseeCoreException {
+ if (workFlowDefinition.startPageId != null) {
+ return workFlowDefinition.startPageId.contains(".") ? workFlowDefinition.startPageId : workflowId + "." + workFlowDefinition.startPageId;
+ }
+ if (workFlowDefinition.hasParent()) {
+ return getResolvedStartPageId((WorkFlowDefinition) workFlowDefinition.getParent(), workflowId);
+ }
+ return null;
+ }
public Artifact getArtifact() {
return artifact;
}
-}
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkFlowDefinitionFactory.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkFlowDefinitionFactory.java
index c913bcc167e..b35a47f3a73 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkFlowDefinitionFactory.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkFlowDefinitionFactory.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.framework.ui.skynet.widgets.workflow;
-
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-
-/**
- * @author Donald G. Dunne
- */
-public class WorkFlowDefinitionFactory {
-
- public static WorkFlowDefinition getWorkFlowDefinition(Artifact artifact) throws Exception {
-
- // Check extensions for WorkFlowDefinition for given artifact
- for (IWorkDefinitionProvider provider : WorkDefinitionProvider.getWorkDefinitionProviders()) {
- WorkFlowDefinition workFlowDefinition = provider.getWorkFlowDefinition(artifact);
- if (workFlowDefinition != null) {
- return workFlowDefinition;
- }
- }
- throw new OseeArgumentException(
- "No WorkFlowDefinition found for artifact " + artifact.getArtifactTypeName() + " - " + artifact.getGuid());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.workflow;
+
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class WorkFlowDefinitionFactory {
+
+ public static WorkFlowDefinition getWorkFlowDefinition(Artifact artifact) throws Exception {
+
+ // Check extensions for WorkFlowDefinition for given artifact
+ for (IWorkDefinitionProvider provider : WorkDefinitionProvider.getWorkDefinitionProviders()) {
+ WorkFlowDefinition workFlowDefinition = provider.getWorkFlowDefinition(artifact);
+ if (workFlowDefinition != null) {
+ return workFlowDefinition;
+ }
+ }
+ throw new OseeArgumentException(
+ "No WorkFlowDefinition found for artifact " + artifact.getArtifactTypeName() + " - " + artifact.getGuid());
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkItemAttributes.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkItemAttributes.java
index d1c4a2d99d3..b00ff0512c8 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkItemAttributes.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkItemAttributes.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.framework.ui.skynet.widgets.workflow;
-
-/**
- * @author Donald G. Dunne
- */
-public class WorkItemAttributes {
-
- public static WorkItemAttributes WORK_ID = new WorkItemAttributes("Work Id");
- public static WorkItemAttributes WORK_PARENT_ID = new WorkItemAttributes("Work Parent Id");
- public static WorkItemAttributes WORK_DATA = new WorkItemAttributes("Work Data");
- public static WorkItemAttributes WORK_DESCRIPTION = new WorkItemAttributes("Work Description");
- public static WorkItemAttributes WORK_PAGE_NAME = new WorkItemAttributes("Work Page Name");
- public static WorkItemAttributes WORK_TYPE = new WorkItemAttributes("Work Type");
- public static WorkItemAttributes TRANSITION = new WorkItemAttributes("Transition");
- public static WorkItemAttributes START_PAGE = new WorkItemAttributes("Start Page");
-
- private final String attributeTypeName;
-
- public WorkItemAttributes(String name, String attributeTypeName) {
- this.attributeTypeName = attributeTypeName;
- }
-
- /**
- * Creates attribute with displayName = "<name>" and storeName = "osee.wi.<name>"
- *
- * @param name
- */
- public WorkItemAttributes(String name) {
- this(name, "osee.wi." + name);
- }
-
- 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.framework.ui.skynet.widgets.workflow;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class WorkItemAttributes {
+
+ public static WorkItemAttributes WORK_ID = new WorkItemAttributes("Work Id");
+ public static WorkItemAttributes WORK_PARENT_ID = new WorkItemAttributes("Work Parent Id");
+ public static WorkItemAttributes WORK_DATA = new WorkItemAttributes("Work Data");
+ public static WorkItemAttributes WORK_DESCRIPTION = new WorkItemAttributes("Work Description");
+ public static WorkItemAttributes WORK_PAGE_NAME = new WorkItemAttributes("Work Page Name");
+ public static WorkItemAttributes WORK_TYPE = new WorkItemAttributes("Work Type");
+ public static WorkItemAttributes TRANSITION = new WorkItemAttributes("Transition");
+ public static WorkItemAttributes START_PAGE = new WorkItemAttributes("Start Page");
+
+ private final String attributeTypeName;
+
+ public WorkItemAttributes(String name, String attributeTypeName) {
+ this.attributeTypeName = attributeTypeName;
+ }
+
+ /**
+ * Creates attribute with displayName = "<name>" and storeName = "osee.wi.<name>"
+ *
+ * @param name
+ */
+ public WorkItemAttributes(String name) {
+ this(name, "osee.wi." + name);
+ }
+
+ public String getAttributeTypeName() {
+ return attributeTypeName;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkItemDefinition.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkItemDefinition.java
index f13c803c3d7..eada35789b7 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkItemDefinition.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkItemDefinition.java
@@ -1,239 +1,239 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.workflow;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.osee.framework.core.data.IArtifactType;
-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.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.search.ArtifactQuery;
-
-/**
- * Definition of WorkItem. Once created, nothing in this class, or any subclasses, should be modified as these
- * definitions are shared by all instantiations of pages, rules, workflows and widgets.
- *
- * @author Donald G. Dunne
- */
-public abstract class WorkItemDefinition {
-
- protected String id;
- protected String name;
- protected String parentId;
- protected String description;
- protected Map<String, String> workDataKeyValueMap = new HashMap<String, String>();
- private final Pattern keyValuePattern = Pattern.compile("^(.*?)=(.*)$", Pattern.MULTILINE | Pattern.DOTALL);
- protected String type;
- public static enum WriteType {
- Update, New
- };
-
- public Map<String, String> getWorkDataKeyValueMap() {
- return workDataKeyValueMap;
- }
-
- public void setWorkDataKeyValueMap(Map<String, String> workDataKeyValueMap) {
- this.workDataKeyValueMap = workDataKeyValueMap;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getDescription() {
- return description;
- }
-
- public WorkItemDefinition(String name, String id, String parentId) {
- this(name, id, parentId, null);
- }
-
- public WorkItemDefinition(String name, String id, String parentId, String type) {
- this(name, id, parentId, type, null);
- }
-
- private WorkItemDefinition(String name, String id, String parentId, String type, String description) {
- this.name = name;
- this.id = id;
- this.type = type;
- this.parentId = parentId;
- this.description = description;
- if (parentId != null && parentId.equals("")) {
- throw new IllegalArgumentException(
- "parentId must either be null or a valid parent Id. Invalid for WorkItemDefinition " + id);
- }
- if (type != null && type.equals("")) {
- throw new IllegalArgumentException(
- "type must either be null or a value, not empty string. Invalid for WorkItemDefinition " + id);
- }
- if (!Strings.isValid(id)) {
- throw new IllegalArgumentException("id must be unique and non-null");
- }
-
- }
-
- /**
- * Determine if this workItemDefinition is or has a parent definition of pageId. This will walk up the tree of
- * definition inheritance to answer the question
- *
- * @param pageId
- * @return boolean
- * @throws OseeCoreException
- */
- public boolean isInstanceOfPage(String pageId, String... visitedPageIds) throws OseeCoreException {
- // Collect all ids already visited
- Set<String> visitedIds = new HashSet<String>();
- for (String visitedId : visitedPageIds) {
- visitedIds.add(visitedId);
- }
-
- // Check for circular dependency
- if (visitedIds.contains(getId())) {
- throw new IllegalStateException("Circular dependency detected. Id already visited: " + getId());
- }
-
- // Check for instanceof
- if (getId().equals(pageId)) {
- return true;
- }
-
- // If parentId exists, check if it isInstanceOfPage
- if (getParentId() != null) {
- visitedIds.add(getId());
- WorkItemDefinition workItemDefinition = WorkItemDefinitionFactory.getWorkItemDefinition(getParentId());
- return workItemDefinition.isInstanceOfPage(pageId, visitedIds.toArray(new String[visitedIds.size()]));
- }
- return false;
- }
-
- public boolean hasParent() {
- return getParentId() != null;
- }
-
- public WorkItemDefinition getParent() throws OseeCoreException {
- if (!hasParent()) {
- return null;
- }
- return WorkItemDefinitionFactory.getWorkItemDefinition(getParentId());
- }
-
- @Override
- public String toString() {
- return getArtifactType() + ": Name: \"" + name +
- //
- "\" Id: \"" + id + "\" " +
- //
- (parentId != null ? " Parent: " + parentId : "");
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public String getType() {
- return type;
- }
-
- public String getParentId() {
- return parentId;
- }
-
- public Artifact toArtifact(WriteType writeType) throws OseeCoreException {
- Artifact artifact = WorkItemDefinitionFactory.getWorkItemDefinitionArtifact(getId());
- if (writeType == WriteType.New) {
- // Double-check that doesn't already exist in db. If so, exception cause duplicates
- if (ArtifactQuery.getArtifactListFromAttribute(WorkItemAttributes.WORK_ID.getAttributeTypeName(), getId(),
- BranchManager.getCommonBranch()).size() > 0) {
- throw new IllegalStateException(
- "WorkItemDefinition artifact creation failed. \"" + getId() + "\" already exists.");
- }
- }
- if (artifact == null) {
- // Create new
- artifact = ArtifactTypeManager.addArtifact(getArtifactType(), BranchManager.getCommonBranch());
- }
- // if (!getId().equals("atsStatePercentCompleteWeight.DefaultWorkflow")) {
- // System.err.println("Skipping all but atsStatePercentCompleteWeight.DefaultWorkflow - Remove This");
- // return artifact;
- // }
- artifact.setName(getName());
- if (getParentId() != null && !getParentId().equals("")) {
- artifact.setSoleAttributeValue(WorkItemAttributes.WORK_PARENT_ID.getAttributeTypeName(), getParentId());
- }
- if (getDescription() != null) {
- artifact.setSoleAttributeValue(WorkItemAttributes.WORK_DESCRIPTION.getAttributeTypeName(), getDescription());
- }
- artifact.setSoleAttributeValue(WorkItemAttributes.WORK_ID.getAttributeTypeName(), getId());
- if (getType() != null) {
- artifact.setSoleAttributeValue(WorkItemAttributes.WORK_TYPE.getAttributeTypeName(), getType());
- }
- if (workDataKeyValueMap.size() > 0) {
- Set<String> keyValues = new HashSet<String>();
- for (Entry<String, String> entry : workDataKeyValueMap.entrySet()) {
- keyValues.add(entry.getKey() + "=" + entry.getValue());
- }
- artifact.setAttributeValues(WorkItemAttributes.WORK_DATA.getAttributeTypeName(), keyValues);
- }
- WorkItemDefinitionFactory.cacheWorkItemDefinitionArtifact(writeType, this, artifact);
- return artifact;
- }
-
- public abstract IArtifactType getArtifactType();
-
- public void setType(String type) {
- this.type = type;
- }
-
- public void loadWorkDataKeyValueMap(Artifact artifact) throws OseeCoreException {
- for (String value : artifact.getAttributesToStringList(WorkItemAttributes.WORK_DATA.getAttributeTypeName())) {
- Matcher m = keyValuePattern.matcher(value);
- if (m.find()) {
- addWorkDataKeyValue(m.group(1), m.group(2));
- } else {
- throw new OseeStateException("Illegal value for WorkData; must be key=value");
- }
- }
- }
-
- public String getWorkDataValue(String key) {
- return workDataKeyValueMap.get(key);
- }
-
- public void addWorkDataKeyValue(String key, String value) {
- workDataKeyValueMap.put(key, value);
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setParentId(String parentId) {
- this.parentId = 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.framework.ui.skynet.widgets.workflow;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.osee.framework.core.data.IArtifactType;
+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.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.search.ArtifactQuery;
+
+/**
+ * Definition of WorkItem. Once created, nothing in this class, or any subclasses, should be modified as these
+ * definitions are shared by all instantiations of pages, rules, workflows and widgets.
+ *
+ * @author Donald G. Dunne
+ */
+public abstract class WorkItemDefinition {
+
+ protected String id;
+ protected String name;
+ protected String parentId;
+ protected String description;
+ protected Map<String, String> workDataKeyValueMap = new HashMap<String, String>();
+ private final Pattern keyValuePattern = Pattern.compile("^(.*?)=(.*)$", Pattern.MULTILINE | Pattern.DOTALL);
+ protected String type;
+ public static enum WriteType {
+ Update, New
+ };
+
+ public Map<String, String> getWorkDataKeyValueMap() {
+ return workDataKeyValueMap;
+ }
+
+ public void setWorkDataKeyValueMap(Map<String, String> workDataKeyValueMap) {
+ this.workDataKeyValueMap = workDataKeyValueMap;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public WorkItemDefinition(String name, String id, String parentId) {
+ this(name, id, parentId, null);
+ }
+
+ public WorkItemDefinition(String name, String id, String parentId, String type) {
+ this(name, id, parentId, type, null);
+ }
+
+ private WorkItemDefinition(String name, String id, String parentId, String type, String description) {
+ this.name = name;
+ this.id = id;
+ this.type = type;
+ this.parentId = parentId;
+ this.description = description;
+ if (parentId != null && parentId.equals("")) {
+ throw new IllegalArgumentException(
+ "parentId must either be null or a valid parent Id. Invalid for WorkItemDefinition " + id);
+ }
+ if (type != null && type.equals("")) {
+ throw new IllegalArgumentException(
+ "type must either be null or a value, not empty string. Invalid for WorkItemDefinition " + id);
+ }
+ if (!Strings.isValid(id)) {
+ throw new IllegalArgumentException("id must be unique and non-null");
+ }
+
+ }
+
+ /**
+ * Determine if this workItemDefinition is or has a parent definition of pageId. This will walk up the tree of
+ * definition inheritance to answer the question
+ *
+ * @param pageId
+ * @return boolean
+ * @throws OseeCoreException
+ */
+ public boolean isInstanceOfPage(String pageId, String... visitedPageIds) throws OseeCoreException {
+ // Collect all ids already visited
+ Set<String> visitedIds = new HashSet<String>();
+ for (String visitedId : visitedPageIds) {
+ visitedIds.add(visitedId);
+ }
+
+ // Check for circular dependency
+ if (visitedIds.contains(getId())) {
+ throw new IllegalStateException("Circular dependency detected. Id already visited: " + getId());
+ }
+
+ // Check for instanceof
+ if (getId().equals(pageId)) {
+ return true;
+ }
+
+ // If parentId exists, check if it isInstanceOfPage
+ if (getParentId() != null) {
+ visitedIds.add(getId());
+ WorkItemDefinition workItemDefinition = WorkItemDefinitionFactory.getWorkItemDefinition(getParentId());
+ return workItemDefinition.isInstanceOfPage(pageId, visitedIds.toArray(new String[visitedIds.size()]));
+ }
+ return false;
+ }
+
+ public boolean hasParent() {
+ return getParentId() != null;
+ }
+
+ public WorkItemDefinition getParent() throws OseeCoreException {
+ if (!hasParent()) {
+ return null;
+ }
+ return WorkItemDefinitionFactory.getWorkItemDefinition(getParentId());
+ }
+
+ @Override
+ public String toString() {
+ return getArtifactType() + ": Name: \"" + name +
+ //
+ "\" Id: \"" + id + "\" " +
+ //
+ (parentId != null ? " Parent: " + parentId : "");
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public String getParentId() {
+ return parentId;
+ }
+
+ public Artifact toArtifact(WriteType writeType) throws OseeCoreException {
+ Artifact artifact = WorkItemDefinitionFactory.getWorkItemDefinitionArtifact(getId());
+ if (writeType == WriteType.New) {
+ // Double-check that doesn't already exist in db. If so, exception cause duplicates
+ if (ArtifactQuery.getArtifactListFromAttribute(WorkItemAttributes.WORK_ID.getAttributeTypeName(), getId(),
+ BranchManager.getCommonBranch()).size() > 0) {
+ throw new IllegalStateException(
+ "WorkItemDefinition artifact creation failed. \"" + getId() + "\" already exists.");
+ }
+ }
+ if (artifact == null) {
+ // Create new
+ artifact = ArtifactTypeManager.addArtifact(getArtifactType(), BranchManager.getCommonBranch());
+ }
+ // if (!getId().equals("atsStatePercentCompleteWeight.DefaultWorkflow")) {
+ // System.err.println("Skipping all but atsStatePercentCompleteWeight.DefaultWorkflow - Remove This");
+ // return artifact;
+ // }
+ artifact.setName(getName());
+ if (getParentId() != null && !getParentId().equals("")) {
+ artifact.setSoleAttributeValue(WorkItemAttributes.WORK_PARENT_ID.getAttributeTypeName(), getParentId());
+ }
+ if (getDescription() != null) {
+ artifact.setSoleAttributeValue(WorkItemAttributes.WORK_DESCRIPTION.getAttributeTypeName(), getDescription());
+ }
+ artifact.setSoleAttributeValue(WorkItemAttributes.WORK_ID.getAttributeTypeName(), getId());
+ if (getType() != null) {
+ artifact.setSoleAttributeValue(WorkItemAttributes.WORK_TYPE.getAttributeTypeName(), getType());
+ }
+ if (workDataKeyValueMap.size() > 0) {
+ Set<String> keyValues = new HashSet<String>();
+ for (Entry<String, String> entry : workDataKeyValueMap.entrySet()) {
+ keyValues.add(entry.getKey() + "=" + entry.getValue());
+ }
+ artifact.setAttributeValues(WorkItemAttributes.WORK_DATA.getAttributeTypeName(), keyValues);
+ }
+ WorkItemDefinitionFactory.cacheWorkItemDefinitionArtifact(writeType, this, artifact);
+ return artifact;
+ }
+
+ public abstract IArtifactType getArtifactType();
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public void loadWorkDataKeyValueMap(Artifact artifact) throws OseeCoreException {
+ for (String value : artifact.getAttributesToStringList(WorkItemAttributes.WORK_DATA.getAttributeTypeName())) {
+ Matcher m = keyValuePattern.matcher(value);
+ if (m.find()) {
+ addWorkDataKeyValue(m.group(1), m.group(2));
+ } else {
+ throw new OseeStateException("Illegal value for WorkData; must be key=value");
+ }
+ }
+ }
+
+ public String getWorkDataValue(String key) {
+ return workDataKeyValueMap.get(key);
+ }
+
+ public void addWorkDataKeyValue(String key, String value) {
+ workDataKeyValueMap.put(key, value);
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setParentId(String parentId) {
+ this.parentId = parentId;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkItemDefinitionFactory.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkItemDefinitionFactory.java
index fb21236609d..51b5469b385 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkItemDefinitionFactory.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkItemDefinitionFactory.java
@@ -1,247 +1,247 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.workflow;
-
-import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.EXCLUDE_DELETED;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.logging.Level;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-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.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.search.ArtifactQuery;
-import org.eclipse.osee.framework.skynet.core.event2.artifact.EventBasicGuidArtifact;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinition.WriteType;
-
-/**
- * @author Donald G. Dunne
- */
-public class WorkItemDefinitionFactory {
-
- private static Map<String, WorkItemDefinition> itemIdToDefinition;
- private static Map<String, Artifact> itemIdToWidArtifact;
-
- public static void deCache(WorkItemDefinition workItemDefinition) {
- deCache(workItemDefinition.getId());
- }
-
- public synchronized static void deCache(String workItemDefinitionId) {
- itemIdToDefinition.remove(workItemDefinitionId);
- itemIdToWidArtifact.remove(workItemDefinitionId);
- }
-
- public static void deCache(Artifact artifact) {
- if (itemIdToWidArtifact.containsValue(artifact)) {
- for (Entry<String, Artifact> entry : itemIdToWidArtifact.entrySet()) {
- if (entry.getValue().equals(artifact)) {
- deCache(entry.getKey());
- return;
- }
- }
- }
- }
-
- public static void deCache(EventBasicGuidArtifact guidArt) {
- for (Entry<String, Artifact> entry : itemIdToWidArtifact.entrySet()) {
- if (entry.getValue().getGuid().equals(guidArt.getGuid())) {
- deCache(entry.getKey());
- return;
- }
- }
- }
-
- public synchronized static void loadDefinitions() throws OseeCoreException {
- if (itemIdToDefinition == null) {
- OseeLog.log(SkynetGuiPlugin.class, Level.INFO, "Loading Work Item Definitions");
- itemIdToDefinition = new HashMap<String, WorkItemDefinition>();
- itemIdToWidArtifact = new HashMap<String, Artifact>();
-
- // Add all work item definitions provided through extension points
- for (IWorkDefinitionProvider provider : WorkDefinitionProvider.getWorkDefinitionProviders()) {
- for (WorkItemDefinition def : provider.getProgramaticWorkItemDefinitions()) {
- addItemDefinition(WriteType.New, def);
- }
- }
-
- // This load is faster than loading each by artifact type
- for (Artifact art : ArtifactQuery.getArtifactListFromTypeWithInheritence(CoreArtifactTypes.WorkItemDefinition,
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.workflow;
+
+import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.EXCLUDE_DELETED;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.logging.Level;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+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.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.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.event2.artifact.EventBasicGuidArtifact;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinition.WriteType;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class WorkItemDefinitionFactory {
+
+ private static Map<String, WorkItemDefinition> itemIdToDefinition;
+ private static Map<String, Artifact> itemIdToWidArtifact;
+
+ public static void deCache(WorkItemDefinition workItemDefinition) {
+ deCache(workItemDefinition.getId());
+ }
+
+ public synchronized static void deCache(String workItemDefinitionId) {
+ itemIdToDefinition.remove(workItemDefinitionId);
+ itemIdToWidArtifact.remove(workItemDefinitionId);
+ }
+
+ public static void deCache(Artifact artifact) {
+ if (itemIdToWidArtifact.containsValue(artifact)) {
+ for (Entry<String, Artifact> entry : itemIdToWidArtifact.entrySet()) {
+ if (entry.getValue().equals(artifact)) {
+ deCache(entry.getKey());
+ return;
+ }
+ }
+ }
+ }
+
+ public static void deCache(EventBasicGuidArtifact guidArt) {
+ for (Entry<String, Artifact> entry : itemIdToWidArtifact.entrySet()) {
+ if (entry.getValue().getGuid().equals(guidArt.getGuid())) {
+ deCache(entry.getKey());
+ return;
+ }
+ }
+ }
+
+ public synchronized static void loadDefinitions() throws OseeCoreException {
+ if (itemIdToDefinition == null) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.INFO, "Loading Work Item Definitions");
+ itemIdToDefinition = new HashMap<String, WorkItemDefinition>();
+ itemIdToWidArtifact = new HashMap<String, Artifact>();
+
+ // Add all work item definitions provided through extension points
+ for (IWorkDefinitionProvider provider : WorkDefinitionProvider.getWorkDefinitionProviders()) {
+ for (WorkItemDefinition def : provider.getProgramaticWorkItemDefinitions()) {
+ addItemDefinition(WriteType.New, def);
+ }
+ }
+
+ // This load is faster than loading each by artifact type
+ for (Artifact art : ArtifactQuery.getArtifactListFromTypeWithInheritence(CoreArtifactTypes.WorkItemDefinition,
BranchManager.getCommonBranch(), EXCLUDE_DELETED)) {
- if (art.isOfType(CoreArtifactTypes.WorkRuleDefinition)) {
- addItemDefinition(WriteType.New, new WorkRuleDefinition(art), art);
- } else if (art.isOfType(CoreArtifactTypes.WorkWidgetDefinition)) {
- addItemDefinition(WriteType.New, new WorkWidgetDefinition(art), art);
- } else if (art.isOfType(CoreArtifactTypes.WorkPageDefinition)) {
- addItemDefinition(WriteType.New, new WorkPageDefinition(art), art);
- } else if (art.isOfType(CoreArtifactTypes.WorkFlowDefinition)) {
- addItemDefinition(WriteType.New, new WorkFlowDefinition(art), art);
- }
- }
- }
- }
-
- /**
- * This should only be called on database initialization or when new work item definitions are created during
- * run-time.
- *
- * @param workItemDefinition
- * @param artifact
- */
- public static void cacheWorkItemDefinitionArtifact(WriteType writeType, WorkItemDefinition workItemDefinition, Artifact artifact) throws OseeCoreException {
- addItemDefinition(writeType, workItemDefinition, artifact);
- }
-
- public static void relateWorkItemDefinitions(String parentWorkflowId, String childWorkflowId) throws OseeCoreException {
- List<Artifact> parentArts =
- ArtifactQuery.getArtifactListFromAttribute(WorkItemAttributes.WORK_ID.getAttributeTypeName(),
- parentWorkflowId, BranchManager.getCommonBranch());
- if (parentArts == null || parentArts.isEmpty()) {
- throw new IllegalArgumentException("Can't access parentWorkflowId " + parentWorkflowId);
- }
- Artifact parentArt = parentArts.iterator().next();
- List<Artifact> childArts =
- ArtifactQuery.getArtifactListFromAttribute(WorkItemAttributes.WORK_ID.getAttributeTypeName(),
- childWorkflowId, BranchManager.getCommonBranch());
- if (childArts == null || childArts.isEmpty()) {
- throw new IllegalArgumentException("Can't access childWorkflowId " + childWorkflowId);
- }
- Artifact childArt = childArts.iterator().next();
- if (!parentArt.getRelatedArtifacts(CoreRelationTypes.WorkItem__Child, Artifact.class).contains(childArt)) {
- parentArt.addRelation(CoreRelationTypes.WorkItem__Child, childArt);
- parentArt.persist();
- }
- }
-
- private static void addItemDefinition(WriteType writeType, WorkItemDefinition workItemDefinition) throws OseeCoreException {
- if (workItemDefinition.getId() == null) {
- throw new OseeArgumentException("Item Id can't be null");
- }
- if (writeType == WriteType.New && itemIdToDefinition.containsKey(workItemDefinition.getId())) {
- throw new OseeArgumentException(
- "Item Id must be unique. Already work item with id \"" + workItemDefinition.getId() + "\"");
- }
- itemIdToDefinition.put(workItemDefinition.getId(), workItemDefinition);
- }
-
- private static void addItemDefinition(WriteType writeType, WorkItemDefinition workItemDefinition, Artifact artifact) throws OseeCoreException {
- addItemDefinition(writeType, workItemDefinition);
- itemIdToWidArtifact.put(workItemDefinition.id, artifact);
- }
-
- public static void updateDefinitions(Collection<Artifact> arts) throws OseeCoreException {
- loadDefinitionsInternal(WriteType.Update, arts);
- }
-
- public static void loadDefinitions(Collection<Artifact> arts) throws OseeCoreException {
- loadDefinitionsInternal(WriteType.New, arts);
- }
-
- private static void loadDefinitionsInternal(WriteType writeType, Collection<Artifact> arts) throws OseeCoreException {
- for (Artifact art : arts) {
- if (art.isOfType(CoreArtifactTypes.WorkRuleDefinition)) {
- System.out.println("Updating WorkItemDefinition cache with " + art);
- addItemDefinition(writeType, new WorkRuleDefinition(art), art);
- }
- if (art.isOfType(CoreArtifactTypes.WorkWidgetDefinition)) {
- System.out.println("Updating WorkItemDefinition cache with " + art);
- addItemDefinition(writeType, new WorkWidgetDefinition(art), art);
- }
- if (art.isOfType(CoreArtifactTypes.WorkPageDefinition)) {
- System.out.println("Updating WorkItemDefinition cache with " + art);
- addItemDefinition(writeType, new WorkPageDefinition(art), art);
- }
- if (art.isOfType(CoreArtifactTypes.WorkFlowDefinition)) {
- System.out.println("Updating WorkItemDefinition cache with " + art);
- addItemDefinition(writeType, new WorkFlowDefinition(art), art);
- }
- }
- }
-
- public static WorkItemDefinition getWorkItemDefinition(String id) throws OseeCoreException {
- if (id == null) {
- throw new OseeStateException("WorkItemDefinition id can't be null");
- }
- loadDefinitions();
- WorkItemDefinition wid = itemIdToDefinition.get(id);
- if (wid == null) {
- // Attempt to get from DB
- loadDefinitions(ArtifactQuery.getArtifactListFromAttribute(WorkItemAttributes.WORK_ID.getAttributeTypeName(),
- id, BranchManager.getCommonBranch()));
- }
- return itemIdToDefinition.get(id);
- }
-
- public static Artifact getWorkItemDefinitionArtifact(String id) throws OseeCoreException {
- if (id == null) {
- throw new OseeStateException("WorkItemDefinition id can't be null");
- }
- loadDefinitions();
- Artifact art = itemIdToWidArtifact.get(id);
- if (art == null) {
- // Attempt to get from DB
- loadDefinitions(ArtifactQuery.getArtifactListFromAttribute(WorkItemAttributes.WORK_ID.getAttributeTypeName(),
- id, BranchManager.getCommonBranch()));
- }
- return itemIdToWidArtifact.get(id);
- }
-
- public static List<WorkItemDefinition> getWorkItemDefinition(java.util.Collection<String> ids) throws OseeCoreException {
- loadDefinitions();
- List<WorkItemDefinition> defs = new ArrayList<WorkItemDefinition>();
- for (String id : ids) {
- WorkItemDefinition def = getWorkItemDefinition(id);
- if (def == null) {
- throw new IllegalArgumentException("Work Item Id \"" + id + "\" is not a defined work item");
- }
- defs.add(def);
- }
- return defs;
- }
-
- public static List<WorkItemDefinition> getWorkItemDefinitionsStartsWithId(String id) throws OseeCoreException {
- loadDefinitions();
- List<WorkItemDefinition> defs = new ArrayList<WorkItemDefinition>();
- for (Entry<String, WorkItemDefinition> entry : itemIdToDefinition.entrySet()) {
- if (entry.getKey().startsWith(id)) {
- defs.add(entry.getValue());
- }
- }
- return defs;
- }
-
- public static List<WorkItemDefinition> getWorkItemDefinitions(Collection<String> pageids) throws OseeCoreException {
- loadDefinitions();
- List<WorkItemDefinition> defs = new ArrayList<WorkItemDefinition>();
- for (String itemId : pageids) {
- WorkItemDefinition def = getWorkItemDefinition(itemId);
- if (def == null) {
- throw new IllegalArgumentException("Item Id \"" + itemId + "\" is not a defined item");
- }
- defs.add(def);
- }
- return defs;
- }
-
- public static Collection<WorkItemDefinition> getWorkItemDefinitions() throws OseeCoreException {
- loadDefinitions();
- return itemIdToDefinition.values();
- }
-
-}
+ if (art.isOfType(CoreArtifactTypes.WorkRuleDefinition)) {
+ addItemDefinition(WriteType.New, new WorkRuleDefinition(art), art);
+ } else if (art.isOfType(CoreArtifactTypes.WorkWidgetDefinition)) {
+ addItemDefinition(WriteType.New, new WorkWidgetDefinition(art), art);
+ } else if (art.isOfType(CoreArtifactTypes.WorkPageDefinition)) {
+ addItemDefinition(WriteType.New, new WorkPageDefinition(art), art);
+ } else if (art.isOfType(CoreArtifactTypes.WorkFlowDefinition)) {
+ addItemDefinition(WriteType.New, new WorkFlowDefinition(art), art);
+ }
+ }
+ }
+ }
+
+ /**
+ * This should only be called on database initialization or when new work item definitions are created during
+ * run-time.
+ *
+ * @param workItemDefinition
+ * @param artifact
+ */
+ public static void cacheWorkItemDefinitionArtifact(WriteType writeType, WorkItemDefinition workItemDefinition, Artifact artifact) throws OseeCoreException {
+ addItemDefinition(writeType, workItemDefinition, artifact);
+ }
+
+ public static void relateWorkItemDefinitions(String parentWorkflowId, String childWorkflowId) throws OseeCoreException {
+ List<Artifact> parentArts =
+ ArtifactQuery.getArtifactListFromAttribute(WorkItemAttributes.WORK_ID.getAttributeTypeName(),
+ parentWorkflowId, BranchManager.getCommonBranch());
+ if (parentArts == null || parentArts.isEmpty()) {
+ throw new IllegalArgumentException("Can't access parentWorkflowId " + parentWorkflowId);
+ }
+ Artifact parentArt = parentArts.iterator().next();
+ List<Artifact> childArts =
+ ArtifactQuery.getArtifactListFromAttribute(WorkItemAttributes.WORK_ID.getAttributeTypeName(),
+ childWorkflowId, BranchManager.getCommonBranch());
+ if (childArts == null || childArts.isEmpty()) {
+ throw new IllegalArgumentException("Can't access childWorkflowId " + childWorkflowId);
+ }
+ Artifact childArt = childArts.iterator().next();
+ if (!parentArt.getRelatedArtifacts(CoreRelationTypes.WorkItem__Child, Artifact.class).contains(childArt)) {
+ parentArt.addRelation(CoreRelationTypes.WorkItem__Child, childArt);
+ parentArt.persist();
+ }
+ }
+
+ private static void addItemDefinition(WriteType writeType, WorkItemDefinition workItemDefinition) throws OseeCoreException {
+ if (workItemDefinition.getId() == null) {
+ throw new OseeArgumentException("Item Id can't be null");
+ }
+ if (writeType == WriteType.New && itemIdToDefinition.containsKey(workItemDefinition.getId())) {
+ throw new OseeArgumentException(
+ "Item Id must be unique. Already work item with id \"" + workItemDefinition.getId() + "\"");
+ }
+ itemIdToDefinition.put(workItemDefinition.getId(), workItemDefinition);
+ }
+
+ private static void addItemDefinition(WriteType writeType, WorkItemDefinition workItemDefinition, Artifact artifact) throws OseeCoreException {
+ addItemDefinition(writeType, workItemDefinition);
+ itemIdToWidArtifact.put(workItemDefinition.id, artifact);
+ }
+
+ public static void updateDefinitions(Collection<Artifact> arts) throws OseeCoreException {
+ loadDefinitionsInternal(WriteType.Update, arts);
+ }
+
+ public static void loadDefinitions(Collection<Artifact> arts) throws OseeCoreException {
+ loadDefinitionsInternal(WriteType.New, arts);
+ }
+
+ private static void loadDefinitionsInternal(WriteType writeType, Collection<Artifact> arts) throws OseeCoreException {
+ for (Artifact art : arts) {
+ if (art.isOfType(CoreArtifactTypes.WorkRuleDefinition)) {
+ System.out.println("Updating WorkItemDefinition cache with " + art);
+ addItemDefinition(writeType, new WorkRuleDefinition(art), art);
+ }
+ if (art.isOfType(CoreArtifactTypes.WorkWidgetDefinition)) {
+ System.out.println("Updating WorkItemDefinition cache with " + art);
+ addItemDefinition(writeType, new WorkWidgetDefinition(art), art);
+ }
+ if (art.isOfType(CoreArtifactTypes.WorkPageDefinition)) {
+ System.out.println("Updating WorkItemDefinition cache with " + art);
+ addItemDefinition(writeType, new WorkPageDefinition(art), art);
+ }
+ if (art.isOfType(CoreArtifactTypes.WorkFlowDefinition)) {
+ System.out.println("Updating WorkItemDefinition cache with " + art);
+ addItemDefinition(writeType, new WorkFlowDefinition(art), art);
+ }
+ }
+ }
+
+ public static WorkItemDefinition getWorkItemDefinition(String id) throws OseeCoreException {
+ if (id == null) {
+ throw new OseeStateException("WorkItemDefinition id can't be null");
+ }
+ loadDefinitions();
+ WorkItemDefinition wid = itemIdToDefinition.get(id);
+ if (wid == null) {
+ // Attempt to get from DB
+ loadDefinitions(ArtifactQuery.getArtifactListFromAttribute(WorkItemAttributes.WORK_ID.getAttributeTypeName(),
+ id, BranchManager.getCommonBranch()));
+ }
+ return itemIdToDefinition.get(id);
+ }
+
+ public static Artifact getWorkItemDefinitionArtifact(String id) throws OseeCoreException {
+ if (id == null) {
+ throw new OseeStateException("WorkItemDefinition id can't be null");
+ }
+ loadDefinitions();
+ Artifact art = itemIdToWidArtifact.get(id);
+ if (art == null) {
+ // Attempt to get from DB
+ loadDefinitions(ArtifactQuery.getArtifactListFromAttribute(WorkItemAttributes.WORK_ID.getAttributeTypeName(),
+ id, BranchManager.getCommonBranch()));
+ }
+ return itemIdToWidArtifact.get(id);
+ }
+
+ public static List<WorkItemDefinition> getWorkItemDefinition(java.util.Collection<String> ids) throws OseeCoreException {
+ loadDefinitions();
+ List<WorkItemDefinition> defs = new ArrayList<WorkItemDefinition>();
+ for (String id : ids) {
+ WorkItemDefinition def = getWorkItemDefinition(id);
+ if (def == null) {
+ throw new IllegalArgumentException("Work Item Id \"" + id + "\" is not a defined work item");
+ }
+ defs.add(def);
+ }
+ return defs;
+ }
+
+ public static List<WorkItemDefinition> getWorkItemDefinitionsStartsWithId(String id) throws OseeCoreException {
+ loadDefinitions();
+ List<WorkItemDefinition> defs = new ArrayList<WorkItemDefinition>();
+ for (Entry<String, WorkItemDefinition> entry : itemIdToDefinition.entrySet()) {
+ if (entry.getKey().startsWith(id)) {
+ defs.add(entry.getValue());
+ }
+ }
+ return defs;
+ }
+
+ public static List<WorkItemDefinition> getWorkItemDefinitions(Collection<String> pageids) throws OseeCoreException {
+ loadDefinitions();
+ List<WorkItemDefinition> defs = new ArrayList<WorkItemDefinition>();
+ for (String itemId : pageids) {
+ WorkItemDefinition def = getWorkItemDefinition(itemId);
+ if (def == null) {
+ throw new IllegalArgumentException("Item Id \"" + itemId + "\" is not a defined item");
+ }
+ defs.add(def);
+ }
+ return defs;
+ }
+
+ public static Collection<WorkItemDefinition> getWorkItemDefinitions() throws OseeCoreException {
+ loadDefinitions();
+ return itemIdToDefinition.values();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkItemWithChildrenDefinition.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkItemWithChildrenDefinition.java
index 17015345aab..4b9c168ddf8 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkItemWithChildrenDefinition.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkItemWithChildrenDefinition.java
@@ -1,95 +1,95 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.workflow;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-
-/**
- * @author Donald G. Dunne
- */
-public abstract class WorkItemWithChildrenDefinition extends WorkItemDefinition {
-
- private final List<String> workItemIds = new ArrayList<String>();
-
- public WorkItemWithChildrenDefinition(String itemName, String pageId, String parentId) {
- super(itemName, pageId, parentId);
- }
-
- public WorkItemWithChildrenDefinition(Artifact artifact, String itemName, String pageName, String pageId, String parentId) throws OseeCoreException {
- this(itemName, pageId, parentId);
- for (Artifact art : artifact.getRelatedArtifacts(CoreRelationTypes.WorkItem__Child)) {
- String widId = art.getSoleAttributeValue(WorkItemAttributes.WORK_ID.getAttributeTypeName(), (String) null);
- workItemIds.add(widId);
- }
- }
-
- public List<WorkItemDefinition> getWorkItems(boolean includeInherited) throws OseeCoreException {
- List<WorkItemDefinition> wids = new ArrayList<WorkItemDefinition>();
- getWorkItemsInherited(wids, includeInherited);
- return wids;
-
- }
-
- @Override
- public Artifact toArtifact(WriteType writeType) throws OseeCoreException {
- Artifact art = super.toArtifact(writeType);
- List<Artifact> children = new ArrayList<Artifact>();
- for (WorkItemDefinition wid : getWorkItems(false)) {
- Artifact widArt = WorkItemDefinitionFactory.getWorkItemDefinitionArtifact(wid.getId());
- if (widArt == null) {
- throw new IllegalStateException(
- "While processing Work Item \"" + getId() + "\": No Artifact found for WorkItemDefinition \"" + wid.getId() + "\"");
- }
- children.add(widArt);
- }
- // This supports both relating new children and when WriteType.Overwrite of updating
- art.setRelations(CoreRelationTypes.WorkItem__Child, children);
- art.setRelationOrder(CoreRelationTypes.WorkItem__Child, children);
- return art;
- }
-
- public void addWorkItem(String workItemDefintionId) {
- workItemIds.add(workItemDefintionId);
- }
-
- public void removeWorkItem(String workItemDefintionId) {
- workItemIds.remove(workItemDefintionId);
- }
-
- private void getWorkItemsInherited(List<WorkItemDefinition> workItemDefinitions, boolean includeInherited) throws OseeCoreException {
- workItemDefinitions.addAll(WorkItemDefinitionFactory.getWorkItemDefinition(workItemIds));
- if (includeInherited && getParentId() != null) {
- WorkItemWithChildrenDefinition widParent =
- (WorkPageDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(getParentId());
- if (widParent != null) widParent.getWorkItemsInherited(workItemDefinitions, includeInherited);
- }
- }
-
- public WorkItemDefinition getWorkItemDefinition(String id) throws OseeCoreException {
- if (workItemIds.contains(id)) {
- return WorkItemDefinitionFactory.getWorkItemDefinition(id);
- }
- return null;
- }
-
- /**
- * @param workItems the workItems to set
- */
- public void setWorkItems(List<String> workItemDefintionIds) {
- this.workItemIds.clear();
- this.workItemIds.addAll(workItemDefintionIds);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.workflow;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+
+/**
+ * @author Donald G. Dunne
+ */
+public abstract class WorkItemWithChildrenDefinition extends WorkItemDefinition {
+
+ private final List<String> workItemIds = new ArrayList<String>();
+
+ public WorkItemWithChildrenDefinition(String itemName, String pageId, String parentId) {
+ super(itemName, pageId, parentId);
+ }
+
+ public WorkItemWithChildrenDefinition(Artifact artifact, String itemName, String pageName, String pageId, String parentId) throws OseeCoreException {
+ this(itemName, pageId, parentId);
+ for (Artifact art : artifact.getRelatedArtifacts(CoreRelationTypes.WorkItem__Child)) {
+ String widId = art.getSoleAttributeValue(WorkItemAttributes.WORK_ID.getAttributeTypeName(), (String) null);
+ workItemIds.add(widId);
+ }
+ }
+
+ public List<WorkItemDefinition> getWorkItems(boolean includeInherited) throws OseeCoreException {
+ List<WorkItemDefinition> wids = new ArrayList<WorkItemDefinition>();
+ getWorkItemsInherited(wids, includeInherited);
+ return wids;
+
+ }
+
+ @Override
+ public Artifact toArtifact(WriteType writeType) throws OseeCoreException {
+ Artifact art = super.toArtifact(writeType);
+ List<Artifact> children = new ArrayList<Artifact>();
+ for (WorkItemDefinition wid : getWorkItems(false)) {
+ Artifact widArt = WorkItemDefinitionFactory.getWorkItemDefinitionArtifact(wid.getId());
+ if (widArt == null) {
+ throw new IllegalStateException(
+ "While processing Work Item \"" + getId() + "\": No Artifact found for WorkItemDefinition \"" + wid.getId() + "\"");
+ }
+ children.add(widArt);
+ }
+ // This supports both relating new children and when WriteType.Overwrite of updating
+ art.setRelations(CoreRelationTypes.WorkItem__Child, children);
+ art.setRelationOrder(CoreRelationTypes.WorkItem__Child, children);
+ return art;
+ }
+
+ public void addWorkItem(String workItemDefintionId) {
+ workItemIds.add(workItemDefintionId);
+ }
+
+ public void removeWorkItem(String workItemDefintionId) {
+ workItemIds.remove(workItemDefintionId);
+ }
+
+ private void getWorkItemsInherited(List<WorkItemDefinition> workItemDefinitions, boolean includeInherited) throws OseeCoreException {
+ workItemDefinitions.addAll(WorkItemDefinitionFactory.getWorkItemDefinition(workItemIds));
+ if (includeInherited && getParentId() != null) {
+ WorkItemWithChildrenDefinition widParent =
+ (WorkPageDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(getParentId());
+ if (widParent != null) widParent.getWorkItemsInherited(workItemDefinitions, includeInherited);
+ }
+ }
+
+ public WorkItemDefinition getWorkItemDefinition(String id) throws OseeCoreException {
+ if (workItemIds.contains(id)) {
+ return WorkItemDefinitionFactory.getWorkItemDefinition(id);
+ }
+ return null;
+ }
+
+ /**
+ * @param workItems the workItems to set
+ */
+ public void setWorkItems(List<String> workItemDefintionIds) {
+ this.workItemIds.clear();
+ this.workItemIds.addAll(workItemDefintionIds);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkPage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkPage.java
index b325e6c4dac..27506680676 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkPage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkPage.java
@@ -1,269 +1,269 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.workflow;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Level;
-import javax.xml.parsers.ParserConfigurationException;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.AHTML;
-import org.eclipse.osee.framework.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.Result;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-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.WorkFlowDefinition.TransitionType;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.IManagedForm;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.SAXException;
-
-/**
- * Instantiation of a workpagedefinition for a given workflow. This contains UI components that are specific to the
- * instantiation.
- *
- * @author Donald G. Dunne
- */
-public class WorkPage implements IDynamicWidgetLayoutListener {
-
- protected DynamicXWidgetLayout dynamicXWidgetLayout;
- protected final WorkPageDefinition workPageDefinition;
- protected final WorkFlowDefinition workFlowDefinition;
-
- private WorkPage(WorkFlowDefinition workFlowDefinition, WorkPageDefinition workPageDefinition, IXWidgetOptionResolver optionResolver, IDynamicWidgetLayoutListener dynamicWidgetLayoutListener) {
- this.workFlowDefinition = workFlowDefinition;
- this.workPageDefinition = workPageDefinition;
- if (dynamicWidgetLayoutListener == null) {
- dynamicXWidgetLayout = new DynamicXWidgetLayout(this, optionResolver);
- } else {
- dynamicXWidgetLayout = new DynamicXWidgetLayout(dynamicWidgetLayoutListener, optionResolver);
- }
- }
-
- /**
- * @param instructionLines input lines of WorkAttribute declarations
- */
- public WorkPage(WorkFlowDefinition workFlowDefinition, WorkPageDefinition workPageDefinition, String xWidgetsXml, IXWidgetOptionResolver optionResolver, IDynamicWidgetLayoutListener dynamicWidgetLayoutListener) {
- this(workFlowDefinition, workPageDefinition, optionResolver, dynamicWidgetLayoutListener);
- try {
- if (xWidgetsXml != null) {
- processXmlLayoutDatas(xWidgetsXml);
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, "Error processing attributes", ex);
- }
- }
-
- public WorkPage(WorkFlowDefinition workFlowDefinition, WorkPageDefinition workPageDefinition, List<DynamicXWidgetLayoutData> datas, IXWidgetOptionResolver optionResolver, IDynamicWidgetLayoutListener dynamicWidgetLayoutListener) {
- this(workFlowDefinition, workPageDefinition, optionResolver, dynamicWidgetLayoutListener);
- dynamicXWidgetLayout.setLayoutDatas(datas);
- }
-
- public WorkPage(List<DynamicXWidgetLayoutData> datas, IXWidgetOptionResolver optionResolver, IDynamicWidgetLayoutListener dynamicWidgetLayoutListener) {
- this(null, null, datas, optionResolver, dynamicWidgetLayoutListener);
- }
-
- public WorkPage(List<DynamicXWidgetLayoutData> datas, IXWidgetOptionResolver optionResolver) {
- this(null, null, datas, optionResolver, null);
- }
-
- public WorkPage(String xWidgetsXml, IXWidgetOptionResolver optionResolver) {
- this(null, null, xWidgetsXml, optionResolver, null);
- }
-
- public WorkPage(IXWidgetOptionResolver optionResolver) {
- this(null, null, (String) null, optionResolver, null);
- }
-
- public void widgetCreating(XWidget xWidget, FormToolkit toolkit, Artifact art, WorkPage page, XModifiedListener xModListener, boolean isEditable) throws OseeCoreException {
- }
-
- public void widgetCreated(XWidget xWidget, FormToolkit toolkit, Artifact art, WorkPage page, XModifiedListener xModListener, boolean isEditable) throws OseeCoreException {
- }
-
- public void createXWidgetLayoutData(DynamicXWidgetLayoutData workAttr, XWidget xWidget, FormToolkit toolkit, Artifact art, XModifiedListener xModListener, boolean isEditable) throws OseeCoreException {
- }
-
- public void widgetCreated(XWidget xWidget, FormToolkit toolkit, Artifact art, DynamicXWidgetLayout dynamicXWidgetLayout, XModifiedListener xModListener, boolean isEditable) throws OseeCoreException {
- widgetCreated(xWidget, toolkit, art, this, xModListener, isEditable);
- }
-
- public void widgetCreating(XWidget xWidget, FormToolkit toolkit, Artifact art, DynamicXWidgetLayout dynamicXWidgetLayout, XModifiedListener xModListener, boolean isEditable) throws OseeCoreException {
- widgetCreating(xWidget, toolkit, art, this, xModListener, isEditable);
- }
-
- public void dispose() {
- try {
- for (DynamicXWidgetLayoutData layoutData : getlayoutDatas()) {
- layoutData.getXWidget().dispose();
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof WorkPage) {
- return getId().equals(((WorkPage) obj).getId());
- }
- return false;
- }
-
- public DynamicXWidgetLayout createBody(IManagedForm managedForm, Composite parent, Artifact artifact, XModifiedListener xModListener, boolean isEditable) throws OseeCoreException {
- dynamicXWidgetLayout.createBody(managedForm, parent, artifact, xModListener, isEditable);
- return dynamicXWidgetLayout;
- }
-
- public Result isPageComplete() {
- try {
- for (DynamicXWidgetLayoutData layoutData : dynamicXWidgetLayout.getLayoutDatas()) {
- if (!layoutData.getXWidget().isValid().isOK()) {
- // Check to see if widget is part of a completed OR or XOR group
- if (!dynamicXWidgetLayout.isOrGroupFromAttrNameComplete(layoutData.getStorageName()) && !dynamicXWidgetLayout.isXOrGroupFromAttrNameComplete(layoutData.getStorageName())) {
- return new Result(layoutData.getXWidget().isValid().getMessage());
- }
- }
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return Result.TrueResult;
- }
-
- public String getHtml(String backgroundColor) throws OseeArgumentException {
- return getHtml(backgroundColor, "", "");
- }
-
- public String getHtml(String backgroundColor, String preHtml, String postHtml) throws OseeArgumentException {
- StringBuffer sb = new StringBuffer();
- sb.append(AHTML.startBorderTable(100, backgroundColor, getName()));
- if (preHtml != null) {
- sb.append(preHtml);
- }
- for (DynamicXWidgetLayoutData layoutData : dynamicXWidgetLayout.getLayoutDatas()) {
- sb.append(layoutData.getXWidget().toHTML(AHTML.LABEL_FONT) + AHTML.newline());
- }
- if (postHtml != null) {
- sb.append(postHtml);
- }
- sb.append(AHTML.endBorderTable());
- return sb.toString();
- }
-
- @Override
- public String toString() {
- StringBuffer sb =
- new StringBuffer(
- workPageDefinition.getPageName() + (workPageDefinition.getId() != null ? " (" + workPageDefinition.getId() + ") " : "") + "\n");
- try {
- for (WorkPageDefinition page : workFlowDefinition.getPageDefinitions(workPageDefinition.getId(),
- TransitionType.ToPage)) {
- sb.append("-> " + page.getPageName() + (workFlowDefinition.getPageDefinitions(workPageDefinition.getId(),
- TransitionType.ToPageAsReturn).contains(
- workFlowDefinition.getPageDefinitions(workPageDefinition.getId(), TransitionType.ToPage)) ? " (return)" : "") + "\n");
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- return sb.toString();
- }
-
- public Set<DynamicXWidgetLayoutData> getlayoutDatas() {
- return dynamicXWidgetLayout.getLayoutDatas();
- }
-
- public void addLayoutDatas(List<DynamicXWidgetLayoutData> datas) {
- dynamicXWidgetLayout.addWorkLayoutDatas(datas);
- }
-
- public void addLayoutData(DynamicXWidgetLayoutData data) {
- dynamicXWidgetLayout.addWorkLayoutData(data);
- }
-
- public DynamicXWidgetLayoutData getLayoutData(String layoutName) {
- return dynamicXWidgetLayout.getLayoutData(layoutName);
- }
-
- public void processInstructions(Document doc) throws IOException, ParserConfigurationException, SAXException {
- processLayoutDatas(doc.getDocumentElement());
- }
-
- protected void processXmlLayoutDatas(String xWidgetXml) throws IOException, ParserConfigurationException, SAXException {
- dynamicXWidgetLayout.processlayoutDatas(xWidgetXml);
- }
-
- protected void processLayoutDatas(Element element) throws IOException, ParserConfigurationException, SAXException {
- dynamicXWidgetLayout.processLayoutDatas(element);
- }
-
- public String getName() {
- return workPageDefinition.getPageName();
- }
-
- public String getId() {
- return workPageDefinition.id;
- }
-
- /**
- * @return Returns the toPages.
- */
- public List<WorkPageDefinition> getToPages() throws OseeCoreException {
- return workFlowDefinition.getToPages(workPageDefinition);
- }
-
- /**
- * @return Returns the toPages.
- */
- public List<WorkPageDefinition> getReturnPages() throws OseeCoreException {
- return workFlowDefinition.getReturnPages(workPageDefinition);
- }
-
- public boolean isReturnPage(WorkPageDefinition page) throws OseeCoreException {
- return getReturnPages().contains(page);
- }
-
- /**
- * @return Returns the defaultToPage.
- */
- public WorkPageDefinition getDefaultToPage() throws OseeCoreException {
- return workFlowDefinition.getDefaultToPage(workPageDefinition);
- }
-
- /**
- * @return the workPageDefinition
- */
- public WorkPageDefinition getWorkPageDefinition() {
- return workPageDefinition;
- }
-
- /**
- * @return the workFlowDefinition
- */
- public WorkFlowDefinition getWorkFlowDefinition() {
- return workFlowDefinition;
- }
-
- /**
- * @return the dynamicXWidgetLayout
- */
- public DynamicXWidgetLayout getDynamicXWidgetLayout() {
- return dynamicXWidgetLayout;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.workflow;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import javax.xml.parsers.ParserConfigurationException;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.AHTML;
+import org.eclipse.osee.framework.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.Result;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+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.WorkFlowDefinition.TransitionType;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.SAXException;
+
+/**
+ * Instantiation of a workpagedefinition for a given workflow. This contains UI components that are specific to the
+ * instantiation.
+ *
+ * @author Donald G. Dunne
+ */
+public class WorkPage implements IDynamicWidgetLayoutListener {
+
+ protected DynamicXWidgetLayout dynamicXWidgetLayout;
+ protected final WorkPageDefinition workPageDefinition;
+ protected final WorkFlowDefinition workFlowDefinition;
+
+ private WorkPage(WorkFlowDefinition workFlowDefinition, WorkPageDefinition workPageDefinition, IXWidgetOptionResolver optionResolver, IDynamicWidgetLayoutListener dynamicWidgetLayoutListener) {
+ this.workFlowDefinition = workFlowDefinition;
+ this.workPageDefinition = workPageDefinition;
+ if (dynamicWidgetLayoutListener == null) {
+ dynamicXWidgetLayout = new DynamicXWidgetLayout(this, optionResolver);
+ } else {
+ dynamicXWidgetLayout = new DynamicXWidgetLayout(dynamicWidgetLayoutListener, optionResolver);
+ }
+ }
+
+ /**
+ * @param instructionLines input lines of WorkAttribute declarations
+ */
+ public WorkPage(WorkFlowDefinition workFlowDefinition, WorkPageDefinition workPageDefinition, String xWidgetsXml, IXWidgetOptionResolver optionResolver, IDynamicWidgetLayoutListener dynamicWidgetLayoutListener) {
+ this(workFlowDefinition, workPageDefinition, optionResolver, dynamicWidgetLayoutListener);
+ try {
+ if (xWidgetsXml != null) {
+ processXmlLayoutDatas(xWidgetsXml);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, "Error processing attributes", ex);
+ }
+ }
+
+ public WorkPage(WorkFlowDefinition workFlowDefinition, WorkPageDefinition workPageDefinition, List<DynamicXWidgetLayoutData> datas, IXWidgetOptionResolver optionResolver, IDynamicWidgetLayoutListener dynamicWidgetLayoutListener) {
+ this(workFlowDefinition, workPageDefinition, optionResolver, dynamicWidgetLayoutListener);
+ dynamicXWidgetLayout.setLayoutDatas(datas);
+ }
+
+ public WorkPage(List<DynamicXWidgetLayoutData> datas, IXWidgetOptionResolver optionResolver, IDynamicWidgetLayoutListener dynamicWidgetLayoutListener) {
+ this(null, null, datas, optionResolver, dynamicWidgetLayoutListener);
+ }
+
+ public WorkPage(List<DynamicXWidgetLayoutData> datas, IXWidgetOptionResolver optionResolver) {
+ this(null, null, datas, optionResolver, null);
+ }
+
+ public WorkPage(String xWidgetsXml, IXWidgetOptionResolver optionResolver) {
+ this(null, null, xWidgetsXml, optionResolver, null);
+ }
+
+ public WorkPage(IXWidgetOptionResolver optionResolver) {
+ this(null, null, (String) null, optionResolver, null);
+ }
+
+ public void widgetCreating(XWidget xWidget, FormToolkit toolkit, Artifact art, WorkPage page, XModifiedListener xModListener, boolean isEditable) throws OseeCoreException {
+ }
+
+ public void widgetCreated(XWidget xWidget, FormToolkit toolkit, Artifact art, WorkPage page, XModifiedListener xModListener, boolean isEditable) throws OseeCoreException {
+ }
+
+ public void createXWidgetLayoutData(DynamicXWidgetLayoutData workAttr, XWidget xWidget, FormToolkit toolkit, Artifact art, XModifiedListener xModListener, boolean isEditable) throws OseeCoreException {
+ }
+
+ public void widgetCreated(XWidget xWidget, FormToolkit toolkit, Artifact art, DynamicXWidgetLayout dynamicXWidgetLayout, XModifiedListener xModListener, boolean isEditable) throws OseeCoreException {
+ widgetCreated(xWidget, toolkit, art, this, xModListener, isEditable);
+ }
+
+ public void widgetCreating(XWidget xWidget, FormToolkit toolkit, Artifact art, DynamicXWidgetLayout dynamicXWidgetLayout, XModifiedListener xModListener, boolean isEditable) throws OseeCoreException {
+ widgetCreating(xWidget, toolkit, art, this, xModListener, isEditable);
+ }
+
+ public void dispose() {
+ try {
+ for (DynamicXWidgetLayoutData layoutData : getlayoutDatas()) {
+ layoutData.getXWidget().dispose();
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof WorkPage) {
+ return getId().equals(((WorkPage) obj).getId());
+ }
+ return false;
+ }
+
+ public DynamicXWidgetLayout createBody(IManagedForm managedForm, Composite parent, Artifact artifact, XModifiedListener xModListener, boolean isEditable) throws OseeCoreException {
+ dynamicXWidgetLayout.createBody(managedForm, parent, artifact, xModListener, isEditable);
+ return dynamicXWidgetLayout;
+ }
+
+ public Result isPageComplete() {
+ try {
+ for (DynamicXWidgetLayoutData layoutData : dynamicXWidgetLayout.getLayoutDatas()) {
+ if (!layoutData.getXWidget().isValid().isOK()) {
+ // Check to see if widget is part of a completed OR or XOR group
+ if (!dynamicXWidgetLayout.isOrGroupFromAttrNameComplete(layoutData.getStorageName()) && !dynamicXWidgetLayout.isXOrGroupFromAttrNameComplete(layoutData.getStorageName())) {
+ return new Result(layoutData.getXWidget().isValid().getMessage());
+ }
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return Result.TrueResult;
+ }
+
+ public String getHtml(String backgroundColor) throws OseeArgumentException {
+ return getHtml(backgroundColor, "", "");
+ }
+
+ public String getHtml(String backgroundColor, String preHtml, String postHtml) throws OseeArgumentException {
+ StringBuffer sb = new StringBuffer();
+ sb.append(AHTML.startBorderTable(100, backgroundColor, getName()));
+ if (preHtml != null) {
+ sb.append(preHtml);
+ }
+ for (DynamicXWidgetLayoutData layoutData : dynamicXWidgetLayout.getLayoutDatas()) {
+ sb.append(layoutData.getXWidget().toHTML(AHTML.LABEL_FONT) + AHTML.newline());
+ }
+ if (postHtml != null) {
+ sb.append(postHtml);
+ }
+ sb.append(AHTML.endBorderTable());
+ return sb.toString();
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer sb =
+ new StringBuffer(
+ workPageDefinition.getPageName() + (workPageDefinition.getId() != null ? " (" + workPageDefinition.getId() + ") " : "") + "\n");
+ try {
+ for (WorkPageDefinition page : workFlowDefinition.getPageDefinitions(workPageDefinition.getId(),
+ TransitionType.ToPage)) {
+ sb.append("-> " + page.getPageName() + (workFlowDefinition.getPageDefinitions(workPageDefinition.getId(),
+ TransitionType.ToPageAsReturn).contains(
+ workFlowDefinition.getPageDefinitions(workPageDefinition.getId(), TransitionType.ToPage)) ? " (return)" : "") + "\n");
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ return sb.toString();
+ }
+
+ public Set<DynamicXWidgetLayoutData> getlayoutDatas() {
+ return dynamicXWidgetLayout.getLayoutDatas();
+ }
+
+ public void addLayoutDatas(List<DynamicXWidgetLayoutData> datas) {
+ dynamicXWidgetLayout.addWorkLayoutDatas(datas);
+ }
+
+ public void addLayoutData(DynamicXWidgetLayoutData data) {
+ dynamicXWidgetLayout.addWorkLayoutData(data);
+ }
+
+ public DynamicXWidgetLayoutData getLayoutData(String layoutName) {
+ return dynamicXWidgetLayout.getLayoutData(layoutName);
+ }
+
+ public void processInstructions(Document doc) throws IOException, ParserConfigurationException, SAXException {
+ processLayoutDatas(doc.getDocumentElement());
+ }
+
+ protected void processXmlLayoutDatas(String xWidgetXml) throws IOException, ParserConfigurationException, SAXException {
+ dynamicXWidgetLayout.processlayoutDatas(xWidgetXml);
+ }
+
+ protected void processLayoutDatas(Element element) throws IOException, ParserConfigurationException, SAXException {
+ dynamicXWidgetLayout.processLayoutDatas(element);
+ }
+
+ public String getName() {
+ return workPageDefinition.getPageName();
+ }
+
+ public String getId() {
+ return workPageDefinition.id;
+ }
+
+ /**
+ * @return Returns the toPages.
+ */
+ public List<WorkPageDefinition> getToPages() throws OseeCoreException {
+ return workFlowDefinition.getToPages(workPageDefinition);
+ }
+
+ /**
+ * @return Returns the toPages.
+ */
+ public List<WorkPageDefinition> getReturnPages() throws OseeCoreException {
+ return workFlowDefinition.getReturnPages(workPageDefinition);
+ }
+
+ public boolean isReturnPage(WorkPageDefinition page) throws OseeCoreException {
+ return getReturnPages().contains(page);
+ }
+
+ /**
+ * @return Returns the defaultToPage.
+ */
+ public WorkPageDefinition getDefaultToPage() throws OseeCoreException {
+ return workFlowDefinition.getDefaultToPage(workPageDefinition);
+ }
+
+ /**
+ * @return the workPageDefinition
+ */
+ public WorkPageDefinition getWorkPageDefinition() {
+ return workPageDefinition;
+ }
+
+ /**
+ * @return the workFlowDefinition
+ */
+ public WorkFlowDefinition getWorkFlowDefinition() {
+ return workFlowDefinition;
+ }
+
+ /**
+ * @return the dynamicXWidgetLayout
+ */
+ public DynamicXWidgetLayout getDynamicXWidgetLayout() {
+ return dynamicXWidgetLayout;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkPageDefinition.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkPageDefinition.java
index 1838d8fa946..66492b669f0 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkPageDefinition.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkPageDefinition.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.framework.ui.skynet.widgets.workflow;
-
-import java.util.ArrayList;
-import java.util.List;
-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.skynet.core.artifact.Artifact;
-
-/**
- * @author Donald G. Dunne
- */
-public class WorkPageDefinition extends WorkItemWithChildrenDefinition {
-
- private String pageName;
-
- public WorkPageDefinition(String pageName, String pageId, String parentId) {
- this(pageId, pageName, pageId, parentId);
- }
-
- public WorkPageDefinition(String itemName, String pageName, String pageId, String parentId) {
- super(itemName, pageId, parentId);
- this.pageName = pageName;
- }
-
- public WorkPageDefinition(Artifact artifact) throws OseeCoreException {
- super(artifact, artifact.getName(), //
- artifact.getSoleAttributeValue(WorkItemAttributes.WORK_PAGE_NAME.getAttributeTypeName(), (String) null),//
- artifact.getSoleAttributeValue(WorkItemAttributes.WORK_ID.getAttributeTypeName(), (String) null), //
- artifact.getSoleAttributeValue(WorkItemAttributes.WORK_PARENT_ID.getAttributeTypeName(), (String) null)//
- );
- setType(artifact.getSoleAttributeValue(WorkItemAttributes.WORK_TYPE.getAttributeTypeName(), (String) null));
- loadWorkDataKeyValueMap(artifact);
- setPageName(artifact.getSoleAttributeValue(WorkItemAttributes.WORK_PAGE_NAME.getAttributeTypeName(),
- (String) null));
-
- }
-
- public boolean hasWorkRule(String ruleId) throws OseeCoreException {
- return getWorkItemDefinition(ruleId) != null;
- }
-
- /**
- * Returns work flow definition with the assumption that WorkFlowDefinition workId = pageWorkId minus pageName
- */
- public WorkFlowDefinition getWorkFlowDefinitionById() throws OseeCoreException {
- String id = getId().replace("." + pageName, "");
- WorkItemDefinition workItemDefinition = WorkItemDefinitionFactory.getWorkItemDefinition(id);
- if (workItemDefinition instanceof WorkFlowDefinition) {
- return (WorkFlowDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(id);
- }
- return null;
- }
-
- @Override
- public Artifact toArtifact(WriteType writeType) throws OseeCoreException {
- Artifact art = super.toArtifact(writeType);
- // Only store start page if it's part of this definition
- if (pageName != null) {
- art.setSoleAttributeFromString(WorkItemAttributes.WORK_PAGE_NAME.getAttributeTypeName(), pageName);
- }
- return art;
- }
-
- public List<WorkItemDefinition> getWorkItemDefinitionsByType(String workType) throws OseeCoreException {
- List<WorkItemDefinition> wids = new ArrayList<WorkItemDefinition>();
- for (WorkItemDefinition workItemDefinition : getWorkItems(true)) {
- if (workItemDefinition.getType() != null && workItemDefinition.getType().equals(workType)) {
- wids.add(workItemDefinition);
- }
- }
- return wids;
- }
-
- public boolean isCompletePage() {
- return getPageName().equals("Completed");
- }
-
- public boolean isCancelledPage() {
- return getPageName().equals("Cancelled");
- }
-
- public boolean isInstanceof(String workPageDefinitionId) throws OseeCoreException {
- return isInstanceofRecurse(this, workPageDefinitionId);
- }
-
- private boolean isInstanceofRecurse(WorkPageDefinition workPageDefinition, String workPageDefinitionId) throws OseeCoreException {
- if (workPageDefinition.getId().equals(workPageDefinitionId)) {
- return true;
- }
- if (workPageDefinition.getParent() != null) {
- return isInstanceofRecurse((WorkPageDefinition) workPageDefinition.getParent(), workPageDefinitionId);
- }
- return false;
- }
-
- @Override
- public IArtifactType getArtifactType() {
- return CoreArtifactTypes.WorkPageDefinition;
- }
-
- public String getPageName() {
- return pageName;
- }
-
- public void setPageName(String pageName) {
- this.pageName = pageName;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.workflow;
+
+import java.util.ArrayList;
+import java.util.List;
+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.skynet.core.artifact.Artifact;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class WorkPageDefinition extends WorkItemWithChildrenDefinition {
+
+ private String pageName;
+
+ public WorkPageDefinition(String pageName, String pageId, String parentId) {
+ this(pageId, pageName, pageId, parentId);
+ }
+
+ public WorkPageDefinition(String itemName, String pageName, String pageId, String parentId) {
+ super(itemName, pageId, parentId);
+ this.pageName = pageName;
+ }
+
+ public WorkPageDefinition(Artifact artifact) throws OseeCoreException {
+ super(artifact, artifact.getName(), //
+ artifact.getSoleAttributeValue(WorkItemAttributes.WORK_PAGE_NAME.getAttributeTypeName(), (String) null),//
+ artifact.getSoleAttributeValue(WorkItemAttributes.WORK_ID.getAttributeTypeName(), (String) null), //
+ artifact.getSoleAttributeValue(WorkItemAttributes.WORK_PARENT_ID.getAttributeTypeName(), (String) null)//
+ );
+ setType(artifact.getSoleAttributeValue(WorkItemAttributes.WORK_TYPE.getAttributeTypeName(), (String) null));
+ loadWorkDataKeyValueMap(artifact);
+ setPageName(artifact.getSoleAttributeValue(WorkItemAttributes.WORK_PAGE_NAME.getAttributeTypeName(),
+ (String) null));
+
+ }
+
+ public boolean hasWorkRule(String ruleId) throws OseeCoreException {
+ return getWorkItemDefinition(ruleId) != null;
+ }
+
+ /**
+ * Returns work flow definition with the assumption that WorkFlowDefinition workId = pageWorkId minus pageName
+ */
+ public WorkFlowDefinition getWorkFlowDefinitionById() throws OseeCoreException {
+ String id = getId().replace("." + pageName, "");
+ WorkItemDefinition workItemDefinition = WorkItemDefinitionFactory.getWorkItemDefinition(id);
+ if (workItemDefinition instanceof WorkFlowDefinition) {
+ return (WorkFlowDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(id);
+ }
+ return null;
+ }
+
+ @Override
+ public Artifact toArtifact(WriteType writeType) throws OseeCoreException {
+ Artifact art = super.toArtifact(writeType);
+ // Only store start page if it's part of this definition
+ if (pageName != null) {
+ art.setSoleAttributeFromString(WorkItemAttributes.WORK_PAGE_NAME.getAttributeTypeName(), pageName);
+ }
+ return art;
+ }
+
+ public List<WorkItemDefinition> getWorkItemDefinitionsByType(String workType) throws OseeCoreException {
+ List<WorkItemDefinition> wids = new ArrayList<WorkItemDefinition>();
+ for (WorkItemDefinition workItemDefinition : getWorkItems(true)) {
+ if (workItemDefinition.getType() != null && workItemDefinition.getType().equals(workType)) {
+ wids.add(workItemDefinition);
+ }
+ }
+ return wids;
+ }
+
+ public boolean isCompletePage() {
+ return getPageName().equals("Completed");
+ }
+
+ public boolean isCancelledPage() {
+ return getPageName().equals("Cancelled");
+ }
+
+ public boolean isInstanceof(String workPageDefinitionId) throws OseeCoreException {
+ return isInstanceofRecurse(this, workPageDefinitionId);
+ }
+
+ private boolean isInstanceofRecurse(WorkPageDefinition workPageDefinition, String workPageDefinitionId) throws OseeCoreException {
+ if (workPageDefinition.getId().equals(workPageDefinitionId)) {
+ return true;
+ }
+ if (workPageDefinition.getParent() != null) {
+ return isInstanceofRecurse((WorkPageDefinition) workPageDefinition.getParent(), workPageDefinitionId);
+ }
+ return false;
+ }
+
+ @Override
+ public IArtifactType getArtifactType() {
+ return CoreArtifactTypes.WorkPageDefinition;
+ }
+
+ public String getPageName() {
+ return pageName;
+ }
+
+ public void setPageName(String pageName) {
+ this.pageName = pageName;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkRuleDefinition.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkRuleDefinition.java
index bf970b14d40..06f5e109686 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkRuleDefinition.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkRuleDefinition.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.framework.ui.skynet.widgets.workflow;
-
-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.skynet.core.artifact.Artifact;
-
-/**
- * @author Donald G. Dunne
- */
-public class WorkRuleDefinition extends WorkItemDefinition {
-
- /**
- * Instantiate rule with no value where name and id are same.
- */
- public WorkRuleDefinition(String id) {
- this(id, id, null, null);
- }
-
- /**
- * Instantiate rule with no value. This is for self describing rules such as atsAllowCommit.
- */
- public WorkRuleDefinition(String name, String id) {
- this(name, id, null, null);
- }
-
- public WorkRuleDefinition(String name, String id, Map<String, String> workDataKeyValueMap, String type) {
- super(name, id, null, type);
- if (workDataKeyValueMap != null) {
- setWorkDataKeyValueMap(workDataKeyValueMap);
- }
- }
-
- public WorkRuleDefinition(Artifact artifact) throws OseeCoreException {
- this(artifact.getName(), artifact.getSoleAttributeValue(WorkItemAttributes.WORK_ID.getAttributeTypeName(), ""),
- null, null);
- setDescription(artifact.getSoleAttributeValue(WorkItemAttributes.WORK_DESCRIPTION.getAttributeTypeName(), ""));
- setType(artifact.getSoleAttributeValue(WorkItemAttributes.WORK_TYPE.getAttributeTypeName(), (String) null));
- loadWorkDataKeyValueMap(artifact);
- }
-
- @Override
- public Artifact toArtifact(WriteType writeType) throws OseeCoreException {
- Artifact ruleArt = super.toArtifact(writeType);
- return ruleArt;
- }
-
- public IArtifactType getArtifactType() {
- return CoreArtifactTypes.WorkRuleDefinition;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.workflow;
+
+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.skynet.core.artifact.Artifact;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class WorkRuleDefinition extends WorkItemDefinition {
+
+ /**
+ * Instantiate rule with no value where name and id are same.
+ */
+ public WorkRuleDefinition(String id) {
+ this(id, id, null, null);
+ }
+
+ /**
+ * Instantiate rule with no value. This is for self describing rules such as atsAllowCommit.
+ */
+ public WorkRuleDefinition(String name, String id) {
+ this(name, id, null, null);
+ }
+
+ public WorkRuleDefinition(String name, String id, Map<String, String> workDataKeyValueMap, String type) {
+ super(name, id, null, type);
+ if (workDataKeyValueMap != null) {
+ setWorkDataKeyValueMap(workDataKeyValueMap);
+ }
+ }
+
+ public WorkRuleDefinition(Artifact artifact) throws OseeCoreException {
+ this(artifact.getName(), artifact.getSoleAttributeValue(WorkItemAttributes.WORK_ID.getAttributeTypeName(), ""),
+ null, null);
+ setDescription(artifact.getSoleAttributeValue(WorkItemAttributes.WORK_DESCRIPTION.getAttributeTypeName(), ""));
+ setType(artifact.getSoleAttributeValue(WorkItemAttributes.WORK_TYPE.getAttributeTypeName(), (String) null));
+ loadWorkDataKeyValueMap(artifact);
+ }
+
+ @Override
+ public Artifact toArtifact(WriteType writeType) throws OseeCoreException {
+ Artifact ruleArt = super.toArtifact(writeType);
+ return ruleArt;
+ }
+
+ public IArtifactType getArtifactType() {
+ return CoreArtifactTypes.WorkRuleDefinition;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkWidgetDefinition.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkWidgetDefinition.java
index 8ec93d3c4f5..a1d14175556 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkWidgetDefinition.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/WorkWidgetDefinition.java
@@ -1,124 +1,124 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.workflow;
-
-import java.io.IOException;
-import java.util.logging.Level;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerException;
-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.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.XWidgetParser;
-import org.xml.sax.SAXException;
-
-/**
- * @author Donald G. Dunne
- */
-public class WorkWidgetDefinition extends WorkItemDefinition {
-
- public static String tagName = DynamicXWidgetLayout.XWIDGET;
- private DynamicXWidgetLayoutData widgetLayoutData;
-
- public WorkWidgetDefinition(String name, String id) {
- super(name, id, null);
- }
-
- public WorkWidgetDefinition(DynamicXWidgetLayoutData xWidgetLayoutData) {
- super(xWidgetLayoutData.getName() + " - " + xWidgetLayoutData.getId(), xWidgetLayoutData.getId(), null);
- setXWidgetLayoutData(xWidgetLayoutData);
- }
-
- public void setXWidgetLayoutData(DynamicXWidgetLayoutData xWidgetLayoutData) {
- widgetLayoutData = xWidgetLayoutData;
- }
-
- public WorkWidgetDefinition(Artifact artifact) throws OseeCoreException {
- this(artifact.getName(), artifact.getSoleAttributeValue(WorkItemAttributes.WORK_ID.getAttributeTypeName(),
- artifact.getName()));
- setType(artifact.getSoleAttributeValue(WorkItemAttributes.WORK_TYPE.getAttributeTypeName(), (String) null));
- loadWorkDataKeyValueMap(artifact);
-
- DynamicXWidgetLayoutData data = getFromXml(getWorkDataValue(tagName));
- setXWidgetLayoutData(data);
- }
-
- @Override
- public Artifact toArtifact(WriteType writeType) throws OseeCoreException {
- Artifact art = super.toArtifact(writeType);
- try {
- art.setSoleAttributeFromString(WorkItemAttributes.WORK_DATA.getAttributeTypeName(),
- tagName + "=" + XWidgetParser.toXml(get()));
- } catch (ParserConfigurationException ex) {
- throw new OseeCoreException(ex);
- } catch (TransformerException ex) {
- throw new OseeCoreException(ex);
- }
-
- return art;
- }
-
- public DynamicXWidgetLayoutData get() {
- // Hand out an modifiable copy of the LayoutData to ensure widgets created off it aren't shared
- try {
- return (DynamicXWidgetLayoutData) widgetLayoutData.clone();
- } catch (CloneNotSupportedException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- return null;
- }
-
- public void set(DynamicXWidgetLayoutData xWidgetLayoutData) {
- setXWidgetLayoutData(xWidgetLayoutData);
- }
-
- public static boolean isWorkItemXWidget(String xml) {
- return xml.contains(tagName);
- }
-
- public String toXml() {
- throw new IllegalStateException("WorkItemXWidgetDefinition.toXml() Not implemented.");
- }
-
- /**
- * Create WorkItemXWidgetDefinition from xml
- *
- * @param xml <XWidget displayName="Problem" storageName="ats.Problem" xwidgetType="XTextDam" fill="Vertically"/>
- * @return WorkWidgetDefinition
- * @throws Exception
- */
- public static WorkWidgetDefinition createFromXml(String xml) throws OseeCoreException {
- DynamicXWidgetLayoutData data = getFromXml(xml);
- return new WorkWidgetDefinition(data);
- }
-
- public static DynamicXWidgetLayoutData getFromXml(String xml) throws OseeCoreException {
- try {
- DynamicXWidgetLayoutData data = XWidgetParser.extractlayoutData(null, xml);
- if (data == null) throw new IllegalArgumentException(
- "Unable to create WorkItemXWidgetDefinition from xml\"" + xml + "\"");
- return data;
- } catch (ParserConfigurationException ex) {
- throw new OseeCoreException(ex);
- } catch (IOException ex) {
- throw new OseeCoreException(ex);
- } catch (SAXException ex) {
- throw new OseeCoreException(ex);
- }
- }
-
- public IArtifactType getArtifactType() {
- return CoreArtifactTypes.WorkWidgetDefinition;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.workflow;
+
+import java.io.IOException;
+import java.util.logging.Level;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
+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.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.XWidgetParser;
+import org.xml.sax.SAXException;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class WorkWidgetDefinition extends WorkItemDefinition {
+
+ public static String tagName = DynamicXWidgetLayout.XWIDGET;
+ private DynamicXWidgetLayoutData widgetLayoutData;
+
+ public WorkWidgetDefinition(String name, String id) {
+ super(name, id, null);
+ }
+
+ public WorkWidgetDefinition(DynamicXWidgetLayoutData xWidgetLayoutData) {
+ super(xWidgetLayoutData.getName() + " - " + xWidgetLayoutData.getId(), xWidgetLayoutData.getId(), null);
+ setXWidgetLayoutData(xWidgetLayoutData);
+ }
+
+ public void setXWidgetLayoutData(DynamicXWidgetLayoutData xWidgetLayoutData) {
+ widgetLayoutData = xWidgetLayoutData;
+ }
+
+ public WorkWidgetDefinition(Artifact artifact) throws OseeCoreException {
+ this(artifact.getName(), artifact.getSoleAttributeValue(WorkItemAttributes.WORK_ID.getAttributeTypeName(),
+ artifact.getName()));
+ setType(artifact.getSoleAttributeValue(WorkItemAttributes.WORK_TYPE.getAttributeTypeName(), (String) null));
+ loadWorkDataKeyValueMap(artifact);
+
+ DynamicXWidgetLayoutData data = getFromXml(getWorkDataValue(tagName));
+ setXWidgetLayoutData(data);
+ }
+
+ @Override
+ public Artifact toArtifact(WriteType writeType) throws OseeCoreException {
+ Artifact art = super.toArtifact(writeType);
+ try {
+ art.setSoleAttributeFromString(WorkItemAttributes.WORK_DATA.getAttributeTypeName(),
+ tagName + "=" + XWidgetParser.toXml(get()));
+ } catch (ParserConfigurationException ex) {
+ throw new OseeCoreException(ex);
+ } catch (TransformerException ex) {
+ throw new OseeCoreException(ex);
+ }
+
+ return art;
+ }
+
+ public DynamicXWidgetLayoutData get() {
+ // Hand out an modifiable copy of the LayoutData to ensure widgets created off it aren't shared
+ try {
+ return (DynamicXWidgetLayoutData) widgetLayoutData.clone();
+ } catch (CloneNotSupportedException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ return null;
+ }
+
+ public void set(DynamicXWidgetLayoutData xWidgetLayoutData) {
+ setXWidgetLayoutData(xWidgetLayoutData);
+ }
+
+ public static boolean isWorkItemXWidget(String xml) {
+ return xml.contains(tagName);
+ }
+
+ public String toXml() {
+ throw new IllegalStateException("WorkItemXWidgetDefinition.toXml() Not implemented.");
+ }
+
+ /**
+ * Create WorkItemXWidgetDefinition from xml
+ *
+ * @param xml <XWidget displayName="Problem" storageName="ats.Problem" xwidgetType="XTextDam" fill="Vertically"/>
+ * @return WorkWidgetDefinition
+ * @throws Exception
+ */
+ public static WorkWidgetDefinition createFromXml(String xml) throws OseeCoreException {
+ DynamicXWidgetLayoutData data = getFromXml(xml);
+ return new WorkWidgetDefinition(data);
+ }
+
+ public static DynamicXWidgetLayoutData getFromXml(String xml) throws OseeCoreException {
+ try {
+ DynamicXWidgetLayoutData data = XWidgetParser.extractlayoutData(null, xml);
+ if (data == null) throw new IllegalArgumentException(
+ "Unable to create WorkItemXWidgetDefinition from xml\"" + xml + "\"");
+ return data;
+ } catch (ParserConfigurationException ex) {
+ throw new OseeCoreException(ex);
+ } catch (IOException ex) {
+ throw new OseeCoreException(ex);
+ } catch (SAXException ex) {
+ throw new OseeCoreException(ex);
+ }
+ }
+
+ public IArtifactType getArtifactType() {
+ return CoreArtifactTypes.WorkWidgetDefinition;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/XWidgetFactory.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/XWidgetFactory.java
index 98b1d0a0f31..45c797aca6d 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/XWidgetFactory.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/workflow/XWidgetFactory.java
@@ -1,360 +1,360 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.workflow;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Level;
-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.framework.core.enums.BranchArchivedState;
-import org.eclipse.osee.framework.core.enums.BranchType;
-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.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.artifact.BranchManager;
-import org.eclipse.osee.framework.skynet.core.attribute.BooleanAttribute;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.widgets.SkynetSpellModifyDictionary;
-import org.eclipse.osee.framework.ui.skynet.widgets.XArtifactList;
-import org.eclipse.osee.framework.ui.skynet.widgets.XArtifactTypeListViewer;
-import org.eclipse.osee.framework.ui.skynet.widgets.XAttributeTypeListViewer;
-import org.eclipse.osee.framework.ui.skynet.widgets.XButton;
-import org.eclipse.osee.framework.ui.skynet.widgets.XCheckBox;
-import org.eclipse.osee.framework.ui.skynet.widgets.XCheckBoxDam;
-import org.eclipse.osee.framework.ui.skynet.widgets.XCombo;
-import org.eclipse.osee.framework.ui.skynet.widgets.XComboBooleanDam;
-import org.eclipse.osee.framework.ui.skynet.widgets.XComboDam;
-import org.eclipse.osee.framework.ui.skynet.widgets.XComboViewer;
-import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
-import org.eclipse.osee.framework.ui.skynet.widgets.XDateDam;
-import org.eclipse.osee.framework.ui.skynet.widgets.XFileTextWithSelectionDialog;
-import org.eclipse.osee.framework.ui.skynet.widgets.XFileTextWithSelectionDialog.Type;
-import org.eclipse.osee.framework.ui.skynet.widgets.XFlatDam;
-import org.eclipse.osee.framework.ui.skynet.widgets.XFloat;
-import org.eclipse.osee.framework.ui.skynet.widgets.XFloatDam;
-import org.eclipse.osee.framework.ui.skynet.widgets.XHyperlabelMemberSelDam;
-import org.eclipse.osee.framework.ui.skynet.widgets.XInteger;
-import org.eclipse.osee.framework.ui.skynet.widgets.XIntegerDam;
-import org.eclipse.osee.framework.ui.skynet.widgets.XLabel;
-import org.eclipse.osee.framework.ui.skynet.widgets.XLabelDam;
-import org.eclipse.osee.framework.ui.skynet.widgets.XList;
-import org.eclipse.osee.framework.ui.skynet.widgets.XListDam;
-import org.eclipse.osee.framework.ui.skynet.widgets.XListDropViewer;
-import org.eclipse.osee.framework.ui.skynet.widgets.XMembersCombo;
-import org.eclipse.osee.framework.ui.skynet.widgets.XMembersList;
-import org.eclipse.osee.framework.ui.skynet.widgets.XOption;
-import org.eclipse.osee.framework.ui.skynet.widgets.XSelectFromMultiChoiceBranch;
-import org.eclipse.osee.framework.ui.skynet.widgets.XSelectFromMultiChoiceDam;
-import org.eclipse.osee.framework.ui.skynet.widgets.XStackedDam;
-import org.eclipse.osee.framework.ui.skynet.widgets.XText;
-import org.eclipse.osee.framework.ui.skynet.widgets.XTextDam;
-import org.eclipse.osee.framework.ui.skynet.widgets.XTextResourceDropDam;
-import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
-import org.osgi.framework.Bundle;
-
-/**
- * @author Jeff C. Phillips
- */
-public class XWidgetFactory {
-
- private static final XWidgetFactory reference = new XWidgetFactory();
-
- private XWidgetFactory() {
-
- }
-
- public static XWidgetFactory getInstance() {
- return reference;
- }
-
- public XWidget createXWidget(DynamicXWidgetLayoutData xWidgetLayoutData) throws OseeArgumentException {
- String xWidgetName = xWidgetLayoutData.getXWidgetName();
- String name = xWidgetLayoutData.getName();
- XWidget xWidget = null;
-
- // Look for widget provider to create widget
- for (IXWidgetProvider widgetProvider : getXWidgetProviders()) {
- xWidget = widgetProvider.createXWidget(xWidgetName, name, xWidgetLayoutData);
- if (xWidget != null) {
- return xWidget;
- }
- }
-
- // Otherwise, use default widget creation
- if (xWidgetName.equals("XText")) {
- xWidget = new XText(name);
- if (xWidgetLayoutData.getDefaultValue() != null && !xWidgetLayoutData.getDefaultValue().equals("")) {
- ((XText) xWidget).set(xWidgetLayoutData.getDefaultValue());
- }
- } else if (xWidgetName.equals("XSelectFromMultiChoiceBranch")) {
- XSelectFromMultiChoiceBranch multiBranchSelect = new XSelectFromMultiChoiceBranch(name);
- int maxSelectionRequired = 1;
- if (xWidgetLayoutData.getXOptionHandler().contains(XOption.MULTI_SELECT)) {
- maxSelectionRequired = Integer.MAX_VALUE;
- }
- try {
- List<Branch> branches =
- BranchManager.getBranches(BranchArchivedState.ALL, BranchType.WORKING, BranchType.BASELINE);
- Collections.sort(branches);
-
- multiBranchSelect.setSelectableItems(branches);
- multiBranchSelect.setRequiredSelection(1, maxSelectionRequired);
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- multiBranchSelect.setRequiredEntry(true);
- xWidget = multiBranchSelect;
- } else if (xWidgetName.equals("XInteger")) {
- xWidget = new XInteger(name);
- } else if (xWidgetName.equals("XTextDam")) {
- xWidget = new XTextDam(name);
- } else if (xWidgetName.equals("XButton")) {
- xWidget = new XButton(name);
- } else if (xWidgetName.equals("XLabelDam")) {
- xWidget = new XLabelDam(name);
- } else if (xWidgetName.equals("XMembersList")) {
- try {
- xWidget = new XMembersList(name);
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- } else if (xWidgetName.equals("XMembersCombo")) {
- xWidget = new XMembersCombo(name);
- } else if (xWidgetName.equals("XMembersComboAll")) {
- xWidget = new XMembersCombo(name, true);
- } else if (xWidgetName.equals("XDate")) {
- xWidget = new XDate(name);
- } else if (xWidgetName.equals("XFileSelectionDialog")) {
- xWidget = new XFileTextWithSelectionDialog(name);
- } else if (xWidgetName.equals("XDirectorySelectionDialog")) {
- String defaultValue = xWidgetLayoutData.getDefaultValue();
- if (Strings.isValid(defaultValue)) {
- xWidget = new XFileTextWithSelectionDialog(name, Type.Directory, defaultValue);
- } else {
- xWidget = new XFileTextWithSelectionDialog(name, Type.Directory);
- }
- } else if (xWidgetName.equals("XDateDam")) {
- xWidget = new XDateDam(name);
- } else if (xWidgetName.equals("XTextResourceDropDam")) {
- xWidget = new XTextResourceDropDam(name);
- } else if (xWidgetName.equals("XFloat")) {
- xWidget = new XFloat(name);
- } else if (xWidgetName.equals("XFloatDam")) {
- xWidget = new XFloatDam(name);
- } else if (xWidgetName.equals("XIntegerDam")) {
- xWidget = new XIntegerDam(name);
- } else if (xWidgetName.equals("XFileTextWithSelectionDialog")) {
- xWidget = new XFileTextWithSelectionDialog(name);
- } else if (xWidgetName.equals("XLabel")) {
- String defaultValue = xWidgetLayoutData.getDefaultValue();
- if (Strings.isValid(defaultValue)) {
- xWidget = new XLabel(name, xWidgetLayoutData.getDefaultValue());
- } else {
- xWidget = new XLabel(name);
- }
- } else if (xWidgetName.equals("XCheckBox")) {
- XCheckBox checkBox = new XCheckBox(name);
- checkBox.setLabelAfter(xWidgetLayoutData.getXOptionHandler().contains(XOption.LABEL_AFTER));
- if (xWidgetLayoutData.getDefaultValue() != null && !xWidgetLayoutData.getDefaultValue().equals("")) {
- checkBox.set(xWidgetLayoutData.getDefaultValue().equals("true"));
- }
- xWidget = checkBox;
- } else if (xWidgetName.equals("XCheckBoxDam")) {
- XCheckBoxDam checkBox = new XCheckBoxDam(name);
- checkBox.setLabelAfter(xWidgetLayoutData.getXOptionHandler().contains(XOption.LABEL_AFTER));
- xWidget = checkBox;
- } else if (xWidgetName.startsWith("XComboDam")) {
- if (xWidgetLayoutData.getDynamicXWidgetLayout() != null) {
- String values[] =
- xWidgetLayoutData.getDynamicXWidgetLayout().getOptionResolver().getWidgetOptions(xWidgetLayoutData);
- if (values.length > 0) {
- xWidget = new XComboDam(name);
- XComboDam combo = new XComboDam(name);
- combo.setDataStrings(values);
- if (xWidgetLayoutData.getXOptionHandler().contains(XOption.NO_DEFAULT_VALUE)) {
- combo.setDefaultSelectionAllowed(false);
- }
- if (xWidgetLayoutData.getXOptionHandler().contains(XOption.ADD_DEFAULT_VALUE)) {
- combo.setDefaultSelectionAllowed(true);
- }
- xWidget = combo;
- } else {
- throw new OseeArgumentException(
- "Invalid XComboDam. " + "Must be \"XComboDam(option1,option2,option3)\"");
- }
- }
- } else if (xWidgetName.startsWith("XSelectFromMultiChoiceDam")) {
- if (xWidgetLayoutData.getDynamicXWidgetLayout() != null) {
- String values[] =
- xWidgetLayoutData.getDynamicXWidgetLayout().getOptionResolver().getWidgetOptions(xWidgetLayoutData);
- if (values.length > 0) {
- XSelectFromMultiChoiceDam widget = new XSelectFromMultiChoiceDam(name);
- widget.setSelectableItems(Arrays.asList(values));
- xWidget = widget;
- } else {
- throw new OseeArgumentException(
- "Invalid XSelectFromMultiChoiceDam. " + "Must be \"XSelectFromMultiChoiceDam(option1,option2,option3)\"");
- }
- }
- } else if (xWidgetName.startsWith("XStackedDam")) {
- xWidget = new XStackedDam(name);
- } else if (xWidgetName.startsWith("XFlatDam")) {
- xWidget = new XFlatDam(name);
- } else if (xWidgetName.startsWith("XComboBooleanDam")) {
- xWidget = new XComboBooleanDam(name);
- XComboBooleanDam combo = new XComboBooleanDam(name);
- combo.setDataStrings(BooleanAttribute.booleanChoices);
- xWidget = combo;
- if (xWidgetLayoutData.getDefaultValue() != null && !xWidgetLayoutData.getDefaultValue().equals("")) {
- String value = xWidgetLayoutData.getDefaultValue();
- if (value == null) {
- combo.set("");
- } else if (value.equals("true") || value.equals("yes")) {
- combo.set("yes");
- } else if (value.equals("false") || value.equals("no")) {
- combo.set("no");
- } else {
- combo.set("");
- }
- }
- if (xWidgetLayoutData.getXOptionHandler().contains(XOption.NO_DEFAULT_VALUE)) {
- combo.setDefaultSelectionAllowed(false);
- }
- if (xWidgetLayoutData.getXOptionHandler().contains(XOption.ADD_DEFAULT_VALUE)) {
- combo.setDefaultSelectionAllowed(true);
- }
- } else if (xWidgetName.startsWith("XComboViewer")) {
- xWidget = new XComboViewer(name);
- } else if (xWidgetName.startsWith("XCombo")) {
- String values[] =
- xWidgetLayoutData.getDynamicXWidgetLayout().getOptionResolver().getWidgetOptions(xWidgetLayoutData);
- if (values.length > 0) {
- XCombo combo = new XCombo(name);
-
- if (xWidgetLayoutData.getXOptionHandler().contains(XOption.SORTED)) {
- Arrays.sort(values);
- }
- combo.setDataStrings(values);
-
- if (xWidgetLayoutData.getXOptionHandler().contains(XOption.NO_DEFAULT_VALUE)) {
- combo.setDefaultSelectionAllowed(false);
- }
- if (xWidgetLayoutData.getXOptionHandler().contains(XOption.ADD_DEFAULT_VALUE)) {
- combo.setDefaultSelectionAllowed(true);
- }
- xWidget = combo;
- } else {
- throw new OseeArgumentException("Invalid XCombo. " + "Must be \"XCombo(option1,option2,option3)\"");
- }
- } else if (xWidgetName.startsWith("XListDam")) {
- if (xWidgetLayoutData.getDynamicXWidgetLayout() != null) {
- String values[] =
- xWidgetLayoutData.getDynamicXWidgetLayout().getOptionResolver().getWidgetOptions(xWidgetLayoutData);
- if (values.length > 0) {
- XListDam list = new XListDam(name);
- list.add(values);
- xWidget = list;
- } else {
- throw new OseeArgumentException("Invalid XList. " + "Must be \"XList(option1,option2,option3)\"");
- }
- }
- } else if (xWidgetName.equals("XHyperlabelMemberSelDam")) {
- xWidget = new XHyperlabelMemberSelDam(name);
- } else if (xWidgetName.startsWith("XListDropViewer")) {
- xWidget = new XListDropViewer(name);
- } else if (xWidgetName.equals("XArtifactTypeListViewer")) {
- xWidget =
- new XArtifactTypeListViewer(xWidgetLayoutData.getKeyedBranchName(), xWidgetLayoutData.getDefaultValue());
- ((XArtifactTypeListViewer) xWidget).setMultiSelect(xWidgetLayoutData.getXOptionHandler().contains(
- XOption.MULTI_SELECT));
- } else if (xWidgetName.equals("XAttributeTypeListViewer")) {
- xWidget =
- new XAttributeTypeListViewer(xWidgetLayoutData.getKeyedBranchName(), xWidgetLayoutData.getDefaultValue());
- ((XAttributeTypeListViewer) xWidget).setMultiSelect(xWidgetLayoutData.getXOptionHandler().contains(
- XOption.MULTI_SELECT));
-
- } else if (xWidgetName.startsWith("XList")) {
- String values[] =
- xWidgetLayoutData.getDynamicXWidgetLayout().getOptionResolver().getWidgetOptions(xWidgetLayoutData);
- if (values.length > 0) {
- XList list = new XList(name);
- list.add(values);
- xWidget = list;
- String defaultValue = xWidgetLayoutData.getDefaultValue();
- if (Strings.isValid(defaultValue)) {
- list.setSelected(Arrays.asList(defaultValue.split(",")));
- }
- } else {
- throw new OseeArgumentException("Invalid XList. " + "Must be \"XList(option1,option2,option3)\"");
- }
- } else if (xWidgetName.startsWith("XArtifactList")) {
- XArtifactList artifactList = new XArtifactList(name);
- artifactList.setMultiSelect(xWidgetLayoutData.getXOptionHandler().contains(XOption.MULTI_SELECT));
- xWidget = artifactList;
- } else {
- xWidget = new XLabel("Error: Unhandled XWidget \"" + xWidgetName + "\"");
- }
-
- if (xWidget instanceof XText) {
- ((XText) xWidget).addXTextSpellModifyDictionary(new SkynetSpellModifyDictionary());
- }
-
- if (xWidget != null && xWidgetLayoutData.getXOptionHandler().contains(XOption.NO_LABEL)) {
- xWidget.setDisplayLabel(false);
- }
- return xWidget;
- }
- private static Set<IXWidgetProvider> widgetProviders;
-
- private static Set<IXWidgetProvider> getXWidgetProviders() {
- widgetProviders = new HashSet<IXWidgetProvider>();
- IExtensionPoint point =
- Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.osee.framework.ui.skynet.XWidgetProvider");
- if (point == null) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, "Can't access XWidgetProvider extension point");
- return null;
- }
- 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("XWidgetProvider")) {
- 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();
- widgetProviders.add((IXWidgetProvider) obj);
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP,
- "Error loading XWidgetProvider extension", ex);
- }
- }
-
- }
- }
- }
- return widgetProviders;
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.workflow;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+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.framework.core.enums.BranchArchivedState;
+import org.eclipse.osee.framework.core.enums.BranchType;
+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.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.artifact.BranchManager;
+import org.eclipse.osee.framework.skynet.core.attribute.BooleanAttribute;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.widgets.SkynetSpellModifyDictionary;
+import org.eclipse.osee.framework.ui.skynet.widgets.XArtifactList;
+import org.eclipse.osee.framework.ui.skynet.widgets.XArtifactTypeListViewer;
+import org.eclipse.osee.framework.ui.skynet.widgets.XAttributeTypeListViewer;
+import org.eclipse.osee.framework.ui.skynet.widgets.XButton;
+import org.eclipse.osee.framework.ui.skynet.widgets.XCheckBox;
+import org.eclipse.osee.framework.ui.skynet.widgets.XCheckBoxDam;
+import org.eclipse.osee.framework.ui.skynet.widgets.XCombo;
+import org.eclipse.osee.framework.ui.skynet.widgets.XComboBooleanDam;
+import org.eclipse.osee.framework.ui.skynet.widgets.XComboDam;
+import org.eclipse.osee.framework.ui.skynet.widgets.XComboViewer;
+import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
+import org.eclipse.osee.framework.ui.skynet.widgets.XDateDam;
+import org.eclipse.osee.framework.ui.skynet.widgets.XFileTextWithSelectionDialog;
+import org.eclipse.osee.framework.ui.skynet.widgets.XFileTextWithSelectionDialog.Type;
+import org.eclipse.osee.framework.ui.skynet.widgets.XFlatDam;
+import org.eclipse.osee.framework.ui.skynet.widgets.XFloat;
+import org.eclipse.osee.framework.ui.skynet.widgets.XFloatDam;
+import org.eclipse.osee.framework.ui.skynet.widgets.XHyperlabelMemberSelDam;
+import org.eclipse.osee.framework.ui.skynet.widgets.XInteger;
+import org.eclipse.osee.framework.ui.skynet.widgets.XIntegerDam;
+import org.eclipse.osee.framework.ui.skynet.widgets.XLabel;
+import org.eclipse.osee.framework.ui.skynet.widgets.XLabelDam;
+import org.eclipse.osee.framework.ui.skynet.widgets.XList;
+import org.eclipse.osee.framework.ui.skynet.widgets.XListDam;
+import org.eclipse.osee.framework.ui.skynet.widgets.XListDropViewer;
+import org.eclipse.osee.framework.ui.skynet.widgets.XMembersCombo;
+import org.eclipse.osee.framework.ui.skynet.widgets.XMembersList;
+import org.eclipse.osee.framework.ui.skynet.widgets.XOption;
+import org.eclipse.osee.framework.ui.skynet.widgets.XSelectFromMultiChoiceBranch;
+import org.eclipse.osee.framework.ui.skynet.widgets.XSelectFromMultiChoiceDam;
+import org.eclipse.osee.framework.ui.skynet.widgets.XStackedDam;
+import org.eclipse.osee.framework.ui.skynet.widgets.XText;
+import org.eclipse.osee.framework.ui.skynet.widgets.XTextDam;
+import org.eclipse.osee.framework.ui.skynet.widgets.XTextResourceDropDam;
+import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
+import org.osgi.framework.Bundle;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class XWidgetFactory {
+
+ private static final XWidgetFactory reference = new XWidgetFactory();
+
+ private XWidgetFactory() {
+
+ }
+
+ public static XWidgetFactory getInstance() {
+ return reference;
+ }
+
+ public XWidget createXWidget(DynamicXWidgetLayoutData xWidgetLayoutData) throws OseeArgumentException {
+ String xWidgetName = xWidgetLayoutData.getXWidgetName();
+ String name = xWidgetLayoutData.getName();
+ XWidget xWidget = null;
+
+ // Look for widget provider to create widget
+ for (IXWidgetProvider widgetProvider : getXWidgetProviders()) {
+ xWidget = widgetProvider.createXWidget(xWidgetName, name, xWidgetLayoutData);
+ if (xWidget != null) {
+ return xWidget;
+ }
+ }
+
+ // Otherwise, use default widget creation
+ if (xWidgetName.equals("XText")) {
+ xWidget = new XText(name);
+ if (xWidgetLayoutData.getDefaultValue() != null && !xWidgetLayoutData.getDefaultValue().equals("")) {
+ ((XText) xWidget).set(xWidgetLayoutData.getDefaultValue());
+ }
+ } else if (xWidgetName.equals("XSelectFromMultiChoiceBranch")) {
+ XSelectFromMultiChoiceBranch multiBranchSelect = new XSelectFromMultiChoiceBranch(name);
+ int maxSelectionRequired = 1;
+ if (xWidgetLayoutData.getXOptionHandler().contains(XOption.MULTI_SELECT)) {
+ maxSelectionRequired = Integer.MAX_VALUE;
+ }
+ try {
+ List<Branch> branches =
+ BranchManager.getBranches(BranchArchivedState.ALL, BranchType.WORKING, BranchType.BASELINE);
+ Collections.sort(branches);
+
+ multiBranchSelect.setSelectableItems(branches);
+ multiBranchSelect.setRequiredSelection(1, maxSelectionRequired);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ multiBranchSelect.setRequiredEntry(true);
+ xWidget = multiBranchSelect;
+ } else if (xWidgetName.equals("XInteger")) {
+ xWidget = new XInteger(name);
+ } else if (xWidgetName.equals("XTextDam")) {
+ xWidget = new XTextDam(name);
+ } else if (xWidgetName.equals("XButton")) {
+ xWidget = new XButton(name);
+ } else if (xWidgetName.equals("XLabelDam")) {
+ xWidget = new XLabelDam(name);
+ } else if (xWidgetName.equals("XMembersList")) {
+ try {
+ xWidget = new XMembersList(name);
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ } else if (xWidgetName.equals("XMembersCombo")) {
+ xWidget = new XMembersCombo(name);
+ } else if (xWidgetName.equals("XMembersComboAll")) {
+ xWidget = new XMembersCombo(name, true);
+ } else if (xWidgetName.equals("XDate")) {
+ xWidget = new XDate(name);
+ } else if (xWidgetName.equals("XFileSelectionDialog")) {
+ xWidget = new XFileTextWithSelectionDialog(name);
+ } else if (xWidgetName.equals("XDirectorySelectionDialog")) {
+ String defaultValue = xWidgetLayoutData.getDefaultValue();
+ if (Strings.isValid(defaultValue)) {
+ xWidget = new XFileTextWithSelectionDialog(name, Type.Directory, defaultValue);
+ } else {
+ xWidget = new XFileTextWithSelectionDialog(name, Type.Directory);
+ }
+ } else if (xWidgetName.equals("XDateDam")) {
+ xWidget = new XDateDam(name);
+ } else if (xWidgetName.equals("XTextResourceDropDam")) {
+ xWidget = new XTextResourceDropDam(name);
+ } else if (xWidgetName.equals("XFloat")) {
+ xWidget = new XFloat(name);
+ } else if (xWidgetName.equals("XFloatDam")) {
+ xWidget = new XFloatDam(name);
+ } else if (xWidgetName.equals("XIntegerDam")) {
+ xWidget = new XIntegerDam(name);
+ } else if (xWidgetName.equals("XFileTextWithSelectionDialog")) {
+ xWidget = new XFileTextWithSelectionDialog(name);
+ } else if (xWidgetName.equals("XLabel")) {
+ String defaultValue = xWidgetLayoutData.getDefaultValue();
+ if (Strings.isValid(defaultValue)) {
+ xWidget = new XLabel(name, xWidgetLayoutData.getDefaultValue());
+ } else {
+ xWidget = new XLabel(name);
+ }
+ } else if (xWidgetName.equals("XCheckBox")) {
+ XCheckBox checkBox = new XCheckBox(name);
+ checkBox.setLabelAfter(xWidgetLayoutData.getXOptionHandler().contains(XOption.LABEL_AFTER));
+ if (xWidgetLayoutData.getDefaultValue() != null && !xWidgetLayoutData.getDefaultValue().equals("")) {
+ checkBox.set(xWidgetLayoutData.getDefaultValue().equals("true"));
+ }
+ xWidget = checkBox;
+ } else if (xWidgetName.equals("XCheckBoxDam")) {
+ XCheckBoxDam checkBox = new XCheckBoxDam(name);
+ checkBox.setLabelAfter(xWidgetLayoutData.getXOptionHandler().contains(XOption.LABEL_AFTER));
+ xWidget = checkBox;
+ } else if (xWidgetName.startsWith("XComboDam")) {
+ if (xWidgetLayoutData.getDynamicXWidgetLayout() != null) {
+ String values[] =
+ xWidgetLayoutData.getDynamicXWidgetLayout().getOptionResolver().getWidgetOptions(xWidgetLayoutData);
+ if (values.length > 0) {
+ xWidget = new XComboDam(name);
+ XComboDam combo = new XComboDam(name);
+ combo.setDataStrings(values);
+ if (xWidgetLayoutData.getXOptionHandler().contains(XOption.NO_DEFAULT_VALUE)) {
+ combo.setDefaultSelectionAllowed(false);
+ }
+ if (xWidgetLayoutData.getXOptionHandler().contains(XOption.ADD_DEFAULT_VALUE)) {
+ combo.setDefaultSelectionAllowed(true);
+ }
+ xWidget = combo;
+ } else {
+ throw new OseeArgumentException(
+ "Invalid XComboDam. " + "Must be \"XComboDam(option1,option2,option3)\"");
+ }
+ }
+ } else if (xWidgetName.startsWith("XSelectFromMultiChoiceDam")) {
+ if (xWidgetLayoutData.getDynamicXWidgetLayout() != null) {
+ String values[] =
+ xWidgetLayoutData.getDynamicXWidgetLayout().getOptionResolver().getWidgetOptions(xWidgetLayoutData);
+ if (values.length > 0) {
+ XSelectFromMultiChoiceDam widget = new XSelectFromMultiChoiceDam(name);
+ widget.setSelectableItems(Arrays.asList(values));
+ xWidget = widget;
+ } else {
+ throw new OseeArgumentException(
+ "Invalid XSelectFromMultiChoiceDam. " + "Must be \"XSelectFromMultiChoiceDam(option1,option2,option3)\"");
+ }
+ }
+ } else if (xWidgetName.startsWith("XStackedDam")) {
+ xWidget = new XStackedDam(name);
+ } else if (xWidgetName.startsWith("XFlatDam")) {
+ xWidget = new XFlatDam(name);
+ } else if (xWidgetName.startsWith("XComboBooleanDam")) {
+ xWidget = new XComboBooleanDam(name);
+ XComboBooleanDam combo = new XComboBooleanDam(name);
+ combo.setDataStrings(BooleanAttribute.booleanChoices);
+ xWidget = combo;
+ if (xWidgetLayoutData.getDefaultValue() != null && !xWidgetLayoutData.getDefaultValue().equals("")) {
+ String value = xWidgetLayoutData.getDefaultValue();
+ if (value == null) {
+ combo.set("");
+ } else if (value.equals("true") || value.equals("yes")) {
+ combo.set("yes");
+ } else if (value.equals("false") || value.equals("no")) {
+ combo.set("no");
+ } else {
+ combo.set("");
+ }
+ }
+ if (xWidgetLayoutData.getXOptionHandler().contains(XOption.NO_DEFAULT_VALUE)) {
+ combo.setDefaultSelectionAllowed(false);
+ }
+ if (xWidgetLayoutData.getXOptionHandler().contains(XOption.ADD_DEFAULT_VALUE)) {
+ combo.setDefaultSelectionAllowed(true);
+ }
+ } else if (xWidgetName.startsWith("XComboViewer")) {
+ xWidget = new XComboViewer(name);
+ } else if (xWidgetName.startsWith("XCombo")) {
+ String values[] =
+ xWidgetLayoutData.getDynamicXWidgetLayout().getOptionResolver().getWidgetOptions(xWidgetLayoutData);
+ if (values.length > 0) {
+ XCombo combo = new XCombo(name);
+
+ if (xWidgetLayoutData.getXOptionHandler().contains(XOption.SORTED)) {
+ Arrays.sort(values);
+ }
+ combo.setDataStrings(values);
+
+ if (xWidgetLayoutData.getXOptionHandler().contains(XOption.NO_DEFAULT_VALUE)) {
+ combo.setDefaultSelectionAllowed(false);
+ }
+ if (xWidgetLayoutData.getXOptionHandler().contains(XOption.ADD_DEFAULT_VALUE)) {
+ combo.setDefaultSelectionAllowed(true);
+ }
+ xWidget = combo;
+ } else {
+ throw new OseeArgumentException("Invalid XCombo. " + "Must be \"XCombo(option1,option2,option3)\"");
+ }
+ } else if (xWidgetName.startsWith("XListDam")) {
+ if (xWidgetLayoutData.getDynamicXWidgetLayout() != null) {
+ String values[] =
+ xWidgetLayoutData.getDynamicXWidgetLayout().getOptionResolver().getWidgetOptions(xWidgetLayoutData);
+ if (values.length > 0) {
+ XListDam list = new XListDam(name);
+ list.add(values);
+ xWidget = list;
+ } else {
+ throw new OseeArgumentException("Invalid XList. " + "Must be \"XList(option1,option2,option3)\"");
+ }
+ }
+ } else if (xWidgetName.equals("XHyperlabelMemberSelDam")) {
+ xWidget = new XHyperlabelMemberSelDam(name);
+ } else if (xWidgetName.startsWith("XListDropViewer")) {
+ xWidget = new XListDropViewer(name);
+ } else if (xWidgetName.equals("XArtifactTypeListViewer")) {
+ xWidget =
+ new XArtifactTypeListViewer(xWidgetLayoutData.getKeyedBranchName(), xWidgetLayoutData.getDefaultValue());
+ ((XArtifactTypeListViewer) xWidget).setMultiSelect(xWidgetLayoutData.getXOptionHandler().contains(
+ XOption.MULTI_SELECT));
+ } else if (xWidgetName.equals("XAttributeTypeListViewer")) {
+ xWidget =
+ new XAttributeTypeListViewer(xWidgetLayoutData.getKeyedBranchName(), xWidgetLayoutData.getDefaultValue());
+ ((XAttributeTypeListViewer) xWidget).setMultiSelect(xWidgetLayoutData.getXOptionHandler().contains(
+ XOption.MULTI_SELECT));
+
+ } else if (xWidgetName.startsWith("XList")) {
+ String values[] =
+ xWidgetLayoutData.getDynamicXWidgetLayout().getOptionResolver().getWidgetOptions(xWidgetLayoutData);
+ if (values.length > 0) {
+ XList list = new XList(name);
+ list.add(values);
+ xWidget = list;
+ String defaultValue = xWidgetLayoutData.getDefaultValue();
+ if (Strings.isValid(defaultValue)) {
+ list.setSelected(Arrays.asList(defaultValue.split(",")));
+ }
+ } else {
+ throw new OseeArgumentException("Invalid XList. " + "Must be \"XList(option1,option2,option3)\"");
+ }
+ } else if (xWidgetName.startsWith("XArtifactList")) {
+ XArtifactList artifactList = new XArtifactList(name);
+ artifactList.setMultiSelect(xWidgetLayoutData.getXOptionHandler().contains(XOption.MULTI_SELECT));
+ xWidget = artifactList;
+ } else {
+ xWidget = new XLabel("Error: Unhandled XWidget \"" + xWidgetName + "\"");
+ }
+
+ if (xWidget instanceof XText) {
+ ((XText) xWidget).addXTextSpellModifyDictionary(new SkynetSpellModifyDictionary());
+ }
+
+ if (xWidget != null && xWidgetLayoutData.getXOptionHandler().contains(XOption.NO_LABEL)) {
+ xWidget.setDisplayLabel(false);
+ }
+ return xWidget;
+ }
+ private static Set<IXWidgetProvider> widgetProviders;
+
+ private static Set<IXWidgetProvider> getXWidgetProviders() {
+ widgetProviders = new HashSet<IXWidgetProvider>();
+ IExtensionPoint point =
+ Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.osee.framework.ui.skynet.XWidgetProvider");
+ if (point == null) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, "Can't access XWidgetProvider extension point");
+ return null;
+ }
+ 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("XWidgetProvider")) {
+ 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();
+ widgetProviders.add((IXWidgetProvider) obj);
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP,
+ "Error loading XWidgetProvider extension", ex);
+ }
+ }
+
+ }
+ }
+ }
+ return widgetProviders;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchOptions.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchOptions.java
index f757b88b8d2..53b8e666f2f 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchOptions.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchOptions.java
@@ -8,12 +8,12 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.xBranch;
-
-/**
- * @author Jeff C. Phillips
- *
- */
-public enum BranchOptions {
- FLAT, FAVORITES_FIRST, SHOW_MERGE_BRANCHES, SHOW_TRANSACTIONS, SHOW_ARCHIVED, SHOW_WORKING_BRANCHES_ONLY
-}
+package org.eclipse.osee.framework.ui.skynet.widgets.xBranch;
+
+/**
+ * @author Jeff C. Phillips
+ *
+ */
+public enum BranchOptions {
+ FLAT, FAVORITES_FIRST, SHOW_MERGE_BRANCHES, SHOW_TRANSACTIONS, SHOW_ARCHIVED, SHOW_WORKING_BRANCHES_ONLY
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchView.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchView.java
index 2e52aebcfbd..fcac0262c65 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchView.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchView.java
@@ -1,280 +1,280 @@
-/*******************************************************************************
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.widgets.xBranch;
-
-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.action.ColumnMultiEditAction;
-import org.eclipse.nebula.widgets.xviewer.action.TableCustomizationAction;
-import org.eclipse.nebula.widgets.xviewer.action.ViewSelectedCellDataAction;
-import org.eclipse.nebula.widgets.xviewer.action.ViewTableReportAction;
-import org.eclipse.osee.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-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.plugin.core.IActionable;
-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.ITransactionsDeletedEventListener;
-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.ITransactionEventListener;
-import org.eclipse.osee.framework.skynet.core.event2.TransactionEvent;
-import org.eclipse.osee.framework.skynet.core.event2.TransactionEventType;
-import org.eclipse.osee.framework.skynet.core.event2.filter.IEventFilter;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.OseeContributionItem;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * Displays persisted changes made to an artifact.
- *
- * @author Jeff C. Phillips
- */
-public class BranchView extends ViewPart implements IActionable, IBranchEventListener, ITransactionEventListener, ITransactionsDeletedEventListener {
- public static final String VIEW_ID = "org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView";
- private BranchViewPresentationPreferences branchViewPresentationPreferences;
- private static String HELP_CONTEXT_ID = "BranchView";
- public static final String BRANCH_ID = "branchId";
- private XBranchWidget xBranchWidget;
-
- public BranchView() {
- super();
-
- OseeEventManager.addListener(this);
- }
-
- @Override
- public void dispose() {
- super.dispose();
-
- branchViewPresentationPreferences.setDisposed(true);
- OseeEventManager.removeListener(this);
- }
-
- @Override
- public void setFocus() {
- }
-
- @Override
- public void createPartControl(Composite parent) {
- setPartName("Branch Manager");
-
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- layout.verticalSpacing = 0;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- parent.setLayout(layout);
- parent.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- xBranchWidget = new XBranchWidget();
- xBranchWidget.setDisplayLabel(false);
- xBranchWidget.createWidgets(parent, 1);
-
- branchViewPresentationPreferences = new BranchViewPresentationPreferences(this);
- xBranchWidget.loadData();
-
- MenuManager menuManager = new MenuManager();
- menuManager.setRemoveAllWhenShown(true);
- menuManager.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- MenuManager menuManager = (MenuManager) manager;
- xBranchWidget.getXViewer().setColumnMultiEditEnabled(true);
- menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- menuManager.add(new Separator());
- menuManager.add(new TableCustomizationAction(xBranchWidget.getXViewer()));
- menuManager.add(new ViewTableReportAction(xBranchWidget.getXViewer()));
- menuManager.add(new ViewSelectedCellDataAction(xBranchWidget.getXViewer()));
- try {
- if (AccessControlManager.isOseeAdmin()) {
- menuManager.add(new ColumnMultiEditAction(xBranchWidget.getXViewer()));
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- });
-
- menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- xBranchWidget.getXViewer().getTree().setMenu(menuManager.createContextMenu(xBranchWidget.getXViewer().getTree()));
- getSite().registerContextMenu(VIEW_ID, menuManager, xBranchWidget.getXViewer());
-
- getSite().setSelectionProvider(xBranchWidget.getXViewer());
- SkynetGuiPlugin.getInstance().setHelp(parent, HELP_CONTEXT_ID, "org.eclipse.osee.framework.help.ui");
- OseeContributionItem.addTo(this, true);
- getViewSite().getActionBars().updateActionBars();
-
- }
-
- public String getActionDescription() {
- return "";
- }
-
- public static void revealBranch(Branch branch) throws OseeCoreException {
- try {
- BranchView branchView = (BranchView) AWorkbench.getActivePage().showView(VIEW_ID);
- branchView.reveal(branch);
- } catch (PartInitException ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- }
-
- private void reveal(Branch branch) {
- xBranchWidget.reveal(branch);
- }
-
- @Override
- public void handleBranchEventREM1(Sender sender, final BranchEventType branchModType, final int branchId) {
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- try {
- if (branchModType.equals(BranchEventType.Renamed)) {
- xBranchWidget.refresh();
- } else {
- xBranchWidget.loadData();
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- });
- }
-
- @Override
- public void handleBranchEvent(Sender sender, final BranchEvent branchEvent) {
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- try {
- if (branchEvent.getEventType() == BranchEventType.Renamed) {
- xBranchWidget.refresh();
- } else {
- xBranchWidget.loadData();
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- });
- }
-
- @Override
- public void handleLocalBranchToArtifactCacheUpdateEvent(Sender sender) {
- }
-
- @Override
- public void handleTransactionEvent(Sender sender, TransactionEvent transEvent) {
- if (transEvent.getEventType() == TransactionEventType.Purged) {
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- try {
- xBranchWidget.refresh();
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- });
- }
- }
-
- @Override
- public void handleTransactionsDeletedEvent(Sender sender, int[] transactionIds) {
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- try {
- xBranchWidget.refresh();
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- });
- }
-
- public void changeBranchPresentation(boolean flat) {
- if (branchViewPresentationPreferences != null) {
- branchViewPresentationPreferences.getViewPreference().putBoolean(BranchViewPresentationPreferences.FLAT_KEY,
- flat);
- }
- }
-
- public void changeTransactionPresentation(boolean showTransactions) {
- if (branchViewPresentationPreferences != null) {
- branchViewPresentationPreferences.getViewPreference().putBoolean(
- BranchViewPresentationPreferences.SHOW_TRANSACTIONS, showTransactions);
- }
- }
-
- public void changeMergeBranchPresentation(boolean showMergeBranches) {
- if (branchViewPresentationPreferences != null) {
- branchViewPresentationPreferences.getViewPreference().putBoolean(
- BranchViewPresentationPreferences.SHOW_MERGE_BRANCHES, showMergeBranches);
- }
- }
-
- public void changeArchivedBranchPresentation(boolean showArchivedBranches) {
- if (branchViewPresentationPreferences != null) {
- branchViewPresentationPreferences.getViewPreference().putBoolean(
- BranchViewPresentationPreferences.SHOW_ARCHIVED_BRANCHES, showArchivedBranches);
- }
- }
-
- public void changeFavoritesFirstPresentation(boolean showArchivedBranches) {
- if (branchViewPresentationPreferences != null) {
- branchViewPresentationPreferences.getViewPreference().putBoolean(
- BranchViewPresentationPreferences.FAVORITE_KEY, showArchivedBranches);
- }
- }
-
- /**
- * These five methods is called by BranchViewPresentationPreferences to change the branch view data presentation. Not
- * part of the regular API.
- */
- protected void setPresentation(boolean flat) {
- xBranchWidget.setPresentation(flat);
- }
-
- protected void setFavoritesFirst(boolean favoritesFirst) {
- xBranchWidget.setFavoritesFirst(favoritesFirst);
- }
-
- protected void setShowMergeBranches(boolean showMergeBranches) {
- xBranchWidget.setShowMergeBranches(showMergeBranches);
- }
-
- protected void setShowTransactions(boolean showTransactions) {
- xBranchWidget.setShowTransactions(showTransactions);
- }
-
- protected void setShowArchivedBranches(boolean showArchivedBranches) {
- xBranchWidget.setShowArchivedBranches(showArchivedBranches);
- }
-
- @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.framework.ui.skynet.widgets.xBranch;
+
+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.action.ColumnMultiEditAction;
+import org.eclipse.nebula.widgets.xviewer.action.TableCustomizationAction;
+import org.eclipse.nebula.widgets.xviewer.action.ViewSelectedCellDataAction;
+import org.eclipse.nebula.widgets.xviewer.action.ViewTableReportAction;
+import org.eclipse.osee.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeExceptions;
+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.plugin.core.IActionable;
+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.ITransactionsDeletedEventListener;
+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.ITransactionEventListener;
+import org.eclipse.osee.framework.skynet.core.event2.TransactionEvent;
+import org.eclipse.osee.framework.skynet.core.event2.TransactionEventType;
+import org.eclipse.osee.framework.skynet.core.event2.filter.IEventFilter;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.OseeContributionItem;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * Displays persisted changes made to an artifact.
+ *
+ * @author Jeff C. Phillips
+ */
+public class BranchView extends ViewPart implements IActionable, IBranchEventListener, ITransactionEventListener, ITransactionsDeletedEventListener {
+ public static final String VIEW_ID = "org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView";
+ private BranchViewPresentationPreferences branchViewPresentationPreferences;
+ private static String HELP_CONTEXT_ID = "BranchView";
+ public static final String BRANCH_ID = "branchId";
+ private XBranchWidget xBranchWidget;
+
+ public BranchView() {
+ super();
+
+ OseeEventManager.addListener(this);
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+
+ branchViewPresentationPreferences.setDisposed(true);
+ OseeEventManager.removeListener(this);
+ }
+
+ @Override
+ public void setFocus() {
+ }
+
+ @Override
+ public void createPartControl(Composite parent) {
+ setPartName("Branch Manager");
+
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.verticalSpacing = 0;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ parent.setLayout(layout);
+ parent.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ xBranchWidget = new XBranchWidget();
+ xBranchWidget.setDisplayLabel(false);
+ xBranchWidget.createWidgets(parent, 1);
+
+ branchViewPresentationPreferences = new BranchViewPresentationPreferences(this);
+ xBranchWidget.loadData();
+
+ MenuManager menuManager = new MenuManager();
+ menuManager.setRemoveAllWhenShown(true);
+ menuManager.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager manager) {
+ MenuManager menuManager = (MenuManager) manager;
+ xBranchWidget.getXViewer().setColumnMultiEditEnabled(true);
+ menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ menuManager.add(new Separator());
+ menuManager.add(new TableCustomizationAction(xBranchWidget.getXViewer()));
+ menuManager.add(new ViewTableReportAction(xBranchWidget.getXViewer()));
+ menuManager.add(new ViewSelectedCellDataAction(xBranchWidget.getXViewer()));
+ try {
+ if (AccessControlManager.isOseeAdmin()) {
+ menuManager.add(new ColumnMultiEditAction(xBranchWidget.getXViewer()));
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ });
+
+ menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ xBranchWidget.getXViewer().getTree().setMenu(menuManager.createContextMenu(xBranchWidget.getXViewer().getTree()));
+ getSite().registerContextMenu(VIEW_ID, menuManager, xBranchWidget.getXViewer());
+
+ getSite().setSelectionProvider(xBranchWidget.getXViewer());
+ SkynetGuiPlugin.getInstance().setHelp(parent, HELP_CONTEXT_ID, "org.eclipse.osee.framework.help.ui");
+ OseeContributionItem.addTo(this, true);
+ getViewSite().getActionBars().updateActionBars();
+
+ }
+
+ public String getActionDescription() {
+ return "";
+ }
+
+ public static void revealBranch(Branch branch) throws OseeCoreException {
+ try {
+ BranchView branchView = (BranchView) AWorkbench.getActivePage().showView(VIEW_ID);
+ branchView.reveal(branch);
+ } catch (PartInitException ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ }
+
+ private void reveal(Branch branch) {
+ xBranchWidget.reveal(branch);
+ }
+
+ @Override
+ public void handleBranchEventREM1(Sender sender, final BranchEventType branchModType, final int branchId) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ try {
+ if (branchModType.equals(BranchEventType.Renamed)) {
+ xBranchWidget.refresh();
+ } else {
+ xBranchWidget.loadData();
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ });
+ }
+
+ @Override
+ public void handleBranchEvent(Sender sender, final BranchEvent branchEvent) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ try {
+ if (branchEvent.getEventType() == BranchEventType.Renamed) {
+ xBranchWidget.refresh();
+ } else {
+ xBranchWidget.loadData();
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ });
+ }
+
+ @Override
+ public void handleLocalBranchToArtifactCacheUpdateEvent(Sender sender) {
+ }
+
+ @Override
+ public void handleTransactionEvent(Sender sender, TransactionEvent transEvent) {
+ if (transEvent.getEventType() == TransactionEventType.Purged) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ try {
+ xBranchWidget.refresh();
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ });
+ }
+ }
+
+ @Override
+ public void handleTransactionsDeletedEvent(Sender sender, int[] transactionIds) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ try {
+ xBranchWidget.refresh();
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ });
+ }
+
+ public void changeBranchPresentation(boolean flat) {
+ if (branchViewPresentationPreferences != null) {
+ branchViewPresentationPreferences.getViewPreference().putBoolean(BranchViewPresentationPreferences.FLAT_KEY,
+ flat);
+ }
+ }
+
+ public void changeTransactionPresentation(boolean showTransactions) {
+ if (branchViewPresentationPreferences != null) {
+ branchViewPresentationPreferences.getViewPreference().putBoolean(
+ BranchViewPresentationPreferences.SHOW_TRANSACTIONS, showTransactions);
+ }
+ }
+
+ public void changeMergeBranchPresentation(boolean showMergeBranches) {
+ if (branchViewPresentationPreferences != null) {
+ branchViewPresentationPreferences.getViewPreference().putBoolean(
+ BranchViewPresentationPreferences.SHOW_MERGE_BRANCHES, showMergeBranches);
+ }
+ }
+
+ public void changeArchivedBranchPresentation(boolean showArchivedBranches) {
+ if (branchViewPresentationPreferences != null) {
+ branchViewPresentationPreferences.getViewPreference().putBoolean(
+ BranchViewPresentationPreferences.SHOW_ARCHIVED_BRANCHES, showArchivedBranches);
+ }
+ }
+
+ public void changeFavoritesFirstPresentation(boolean showArchivedBranches) {
+ if (branchViewPresentationPreferences != null) {
+ branchViewPresentationPreferences.getViewPreference().putBoolean(
+ BranchViewPresentationPreferences.FAVORITE_KEY, showArchivedBranches);
+ }
+ }
+
+ /**
+ * These five methods is called by BranchViewPresentationPreferences to change the branch view data presentation. Not
+ * part of the regular API.
+ */
+ protected void setPresentation(boolean flat) {
+ xBranchWidget.setPresentation(flat);
+ }
+
+ protected void setFavoritesFirst(boolean favoritesFirst) {
+ xBranchWidget.setFavoritesFirst(favoritesFirst);
+ }
+
+ protected void setShowMergeBranches(boolean showMergeBranches) {
+ xBranchWidget.setShowMergeBranches(showMergeBranches);
+ }
+
+ protected void setShowTransactions(boolean showTransactions) {
+ xBranchWidget.setShowTransactions(showTransactions);
+ }
+
+ protected void setShowArchivedBranches(boolean showArchivedBranches) {
+ xBranchWidget.setShowArchivedBranches(showArchivedBranches);
+ }
+
+ @Override
+ public List<? extends IEventFilter> getEventFilters() {
+ return null;
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchViewPresentationPreferences.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchViewPresentationPreferences.java
index 93a87132cd5..0f6bb6255c9 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchViewPresentationPreferences.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchViewPresentationPreferences.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.xBranch;
-
+package org.eclipse.osee.framework.ui.skynet.widgets.xBranch;
+
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
@@ -30,144 +30,144 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
import org.osgi.service.prefs.BackingStoreException;
import org.osgi.service.prefs.Preferences;
-
-/**
- * @author Jeff C. Phillips
- */
-public class BranchViewPresentationPreferences {
- public static final String FAVORITE_KEY = "favorites_first";
- public static final String SHOW_TRANSACTIONS = "show_transactions";
- public static final String SHOW_MERGE_BRANCHES = "show_merge_branches";
- public static final String SHOW_ARCHIVED_BRANCHES = "show_archived_branches";
- public static final String FLAT_KEY = "flat";
- public static final String BRANCH_ID = "branchId";
-
- private final IPreferencesService preferencesService;
- private IPreferenceChangeListener preferenceChangeListener;
- private BranchView branchView;
- private boolean disposed;
-
- public BranchViewPresentationPreferences(BranchView branchView) {
- this.preferencesService = Platform.getPreferencesService();
- this.preferenceChangeListener = null;
- this.branchView = branchView;
- this.disposed = false;
-
- IEclipsePreferences instanceNode =
- (IEclipsePreferences) preferencesService.getRootNode().node(InstanceScope.SCOPE);
-
- try {
- if (instanceNode.nodeExists(BranchView.VIEW_ID)) {
- ((IEclipsePreferences) instanceNode.node(BranchView.VIEW_ID)).addPreferenceChangeListener(singletonPreferenceChangeListener());
- }
- } catch (BackingStoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
-
- instanceNode.addNodeChangeListener(new IEclipsePreferences.INodeChangeListener() {
-
- public void added(NodeChangeEvent event) {
- if (event.getChild().name().equals(BranchView.VIEW_ID)) {
- ((IEclipsePreferences) event.getChild()).addPreferenceChangeListener(singletonPreferenceChangeListener());
- }
- }
-
- public void removed(NodeChangeEvent event) {
- if (event.getChild().name().equals(BranchView.VIEW_ID)) {
- ((IEclipsePreferences) event.getChild()).removePreferenceChangeListener(singletonPreferenceChangeListener());
- }
- }
- });
-
- loadPreferences();
- }
-
- private synchronized IPreferenceChangeListener singletonPreferenceChangeListener() {
- if (preferenceChangeListener == null) {
- preferenceChangeListener = new IPreferenceChangeListener() {
-
- public void preferenceChange(PreferenceChangeEvent event) {
- if (disposed) {
- ((IEclipsePreferences) event.getNode()).removePreferenceChangeListener(this);
- } else {
- String propertyName = event.getKey();
-
- refreshCommands();
-
- if (propertyName.equals(FLAT_KEY)) {
- setPresentation(getViewPreference().getBoolean(FLAT_KEY, true));
- }
- if (propertyName.equals(SHOW_TRANSACTIONS)) {
- setShowTransactions(getViewPreference().getBoolean(SHOW_TRANSACTIONS, true));
- }
- if (propertyName.equals(SHOW_MERGE_BRANCHES)) {
- setShowMergeBranches(getViewPreference().getBoolean(SHOW_MERGE_BRANCHES, true));
- }
- if (propertyName.equals(SHOW_ARCHIVED_BRANCHES)) {
- setShowArchivedBranches(getViewPreference().getBoolean(SHOW_ARCHIVED_BRANCHES, true));
- }
- if (propertyName.equals(FAVORITE_KEY)) {
- setFavoritesFirst(getViewPreference().getBoolean(FAVORITE_KEY, false));
- }
- }
- }
- };
- }
-
- return preferenceChangeListener;
- }
-
- private void refreshCommands(){
- ((ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(HierarchicalPresentationHandler.COMMAND_ID, null);
- ((ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(FlatPresentationHandler.COMMAND_ID, null);
- ((ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(ShowTransactionPresentationHandler.COMMAND_ID, null);
- ((ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(ShowMergeBranchPresentationHandler.COMMAND_ID, null);
- ((ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(ShowArchivedBranchHandler.COMMAND_ID, null);
- ((ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(ShowFavoriteBranchesFirstHandler.COMMAND_ID, null);
- }
-
- private void loadPreferences() {
- setPresentation(getViewPreference().getBoolean(FLAT_KEY, true));
- setShowTransactions(getViewPreference().getBoolean(SHOW_TRANSACTIONS, true));
- setShowMergeBranches(getViewPreference().getBoolean(SHOW_MERGE_BRANCHES, false));
- setShowArchivedBranches(getViewPreference().getBoolean(SHOW_ARCHIVED_BRANCHES, false));
- setFavoritesFirst(getViewPreference().getBoolean(FAVORITE_KEY, false));
- }
-
- private void setFavoritesFirst(boolean favoritesFirst) {
- branchView.setFavoritesFirst(favoritesFirst);
- }
-
- private void setPresentation(boolean flat) {
- branchView.setPresentation(flat);
- }
-
- private void setShowMergeBranches(boolean showMergeBranches) {
- branchView.setShowMergeBranches(showMergeBranches);
- }
-
- private void setShowTransactions(boolean showTransactions) {
- branchView.setShowTransactions(showTransactions);
- }
-
- private void setShowArchivedBranches(boolean showArchivedBranches) {
- branchView.setShowArchivedBranches(showArchivedBranches);
- }
-
- /**
- * @param disposed the disposed to set
- */
- public void setDisposed(boolean disposed) {
- this.disposed = disposed;
-
- try {
- getViewPreference().flush();
- } catch (BackingStoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- public Preferences getViewPreference() {
- return preferencesService.getRootNode().node(InstanceScope.SCOPE).node(BranchView.VIEW_ID);
- }
-}
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class BranchViewPresentationPreferences {
+ public static final String FAVORITE_KEY = "favorites_first";
+ public static final String SHOW_TRANSACTIONS = "show_transactions";
+ public static final String SHOW_MERGE_BRANCHES = "show_merge_branches";
+ public static final String SHOW_ARCHIVED_BRANCHES = "show_archived_branches";
+ public static final String FLAT_KEY = "flat";
+ public static final String BRANCH_ID = "branchId";
+
+ private final IPreferencesService preferencesService;
+ private IPreferenceChangeListener preferenceChangeListener;
+ private BranchView branchView;
+ private boolean disposed;
+
+ public BranchViewPresentationPreferences(BranchView branchView) {
+ this.preferencesService = Platform.getPreferencesService();
+ this.preferenceChangeListener = null;
+ this.branchView = branchView;
+ this.disposed = false;
+
+ IEclipsePreferences instanceNode =
+ (IEclipsePreferences) preferencesService.getRootNode().node(InstanceScope.SCOPE);
+
+ try {
+ if (instanceNode.nodeExists(BranchView.VIEW_ID)) {
+ ((IEclipsePreferences) instanceNode.node(BranchView.VIEW_ID)).addPreferenceChangeListener(singletonPreferenceChangeListener());
+ }
+ } catch (BackingStoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ instanceNode.addNodeChangeListener(new IEclipsePreferences.INodeChangeListener() {
+
+ public void added(NodeChangeEvent event) {
+ if (event.getChild().name().equals(BranchView.VIEW_ID)) {
+ ((IEclipsePreferences) event.getChild()).addPreferenceChangeListener(singletonPreferenceChangeListener());
+ }
+ }
+
+ public void removed(NodeChangeEvent event) {
+ if (event.getChild().name().equals(BranchView.VIEW_ID)) {
+ ((IEclipsePreferences) event.getChild()).removePreferenceChangeListener(singletonPreferenceChangeListener());
+ }
+ }
+ });
+
+ loadPreferences();
+ }
+
+ private synchronized IPreferenceChangeListener singletonPreferenceChangeListener() {
+ if (preferenceChangeListener == null) {
+ preferenceChangeListener = new IPreferenceChangeListener() {
+
+ public void preferenceChange(PreferenceChangeEvent event) {
+ if (disposed) {
+ ((IEclipsePreferences) event.getNode()).removePreferenceChangeListener(this);
+ } else {
+ String propertyName = event.getKey();
+
+ refreshCommands();
+
+ if (propertyName.equals(FLAT_KEY)) {
+ setPresentation(getViewPreference().getBoolean(FLAT_KEY, true));
+ }
+ if (propertyName.equals(SHOW_TRANSACTIONS)) {
+ setShowTransactions(getViewPreference().getBoolean(SHOW_TRANSACTIONS, true));
+ }
+ if (propertyName.equals(SHOW_MERGE_BRANCHES)) {
+ setShowMergeBranches(getViewPreference().getBoolean(SHOW_MERGE_BRANCHES, true));
+ }
+ if (propertyName.equals(SHOW_ARCHIVED_BRANCHES)) {
+ setShowArchivedBranches(getViewPreference().getBoolean(SHOW_ARCHIVED_BRANCHES, true));
+ }
+ if (propertyName.equals(FAVORITE_KEY)) {
+ setFavoritesFirst(getViewPreference().getBoolean(FAVORITE_KEY, false));
+ }
+ }
+ }
+ };
+ }
+
+ return preferenceChangeListener;
+ }
+
+ private void refreshCommands(){
+ ((ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(HierarchicalPresentationHandler.COMMAND_ID, null);
+ ((ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(FlatPresentationHandler.COMMAND_ID, null);
+ ((ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(ShowTransactionPresentationHandler.COMMAND_ID, null);
+ ((ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(ShowMergeBranchPresentationHandler.COMMAND_ID, null);
+ ((ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(ShowArchivedBranchHandler.COMMAND_ID, null);
+ ((ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(ShowFavoriteBranchesFirstHandler.COMMAND_ID, null);
+ }
+
+ private void loadPreferences() {
+ setPresentation(getViewPreference().getBoolean(FLAT_KEY, true));
+ setShowTransactions(getViewPreference().getBoolean(SHOW_TRANSACTIONS, true));
+ setShowMergeBranches(getViewPreference().getBoolean(SHOW_MERGE_BRANCHES, false));
+ setShowArchivedBranches(getViewPreference().getBoolean(SHOW_ARCHIVED_BRANCHES, false));
+ setFavoritesFirst(getViewPreference().getBoolean(FAVORITE_KEY, false));
+ }
+
+ private void setFavoritesFirst(boolean favoritesFirst) {
+ branchView.setFavoritesFirst(favoritesFirst);
+ }
+
+ private void setPresentation(boolean flat) {
+ branchView.setPresentation(flat);
+ }
+
+ private void setShowMergeBranches(boolean showMergeBranches) {
+ branchView.setShowMergeBranches(showMergeBranches);
+ }
+
+ private void setShowTransactions(boolean showTransactions) {
+ branchView.setShowTransactions(showTransactions);
+ }
+
+ private void setShowArchivedBranches(boolean showArchivedBranches) {
+ branchView.setShowArchivedBranches(showArchivedBranches);
+ }
+
+ /**
+ * @param disposed the disposed to set
+ */
+ public void setDisposed(boolean disposed) {
+ this.disposed = disposed;
+
+ try {
+ getViewPreference().flush();
+ } catch (BackingStoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ public Preferences getViewPreference() {
+ return preferencesService.getRootNode().node(InstanceScope.SCOPE).node(BranchView.VIEW_ID);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchXViewer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchXViewer.java
index 507bb3c9d14..62e3efa6d92 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchXViewer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/BranchXViewer.java
@@ -1,119 +1,119 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.xBranch;
-
-import java.util.ArrayList;
-import java.util.Collection;
-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.XViewer;
-import org.eclipse.nebula.widgets.xviewer.XViewerTextFilter;
-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.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.ui.skynet.ArtifactExplorer;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.util.PromptChangeUtil;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.swt.widgets.TreeItem;
-
-/**
- * @author Jeff C. Phillips
- */
-public class BranchXViewer extends XViewer {
- private final XBranchWidget xBranchViewer;
-
- public BranchXViewer(Composite parent, int style, XBranchWidget xBranchViewer, boolean filterRealTime, boolean searchRealTime) {
- super(parent, style, new BranchXViewerFactory(), filterRealTime, searchRealTime);
- this.xBranchViewer = xBranchViewer;
- }
-
- @Override
- public void handleDoubleClick() {
- ArrayList<Branch> branches = xBranchViewer.getSelectedBranches();
- if (branches != null && !branches.isEmpty()) {
- for (Branch branch : branches) {
- if (!branch.getBranchType().isSystemRootBranch()) {
- ArtifactExplorer.exploreBranch(branch);
- BranchManager.setLastBranch(branch);
- }
- }
- }
- }
-
- @Override
- public void handleColumnMultiEdit(TreeColumn treeColumn, Collection<TreeItem> treeItems) {
- try {
- if (treeColumn.getData().equals(BranchXViewerFactory.branchType)) {
- PromptChangeUtil.promptChangeBranchType(treeItems);
- }
- if (treeColumn.getData().equals(BranchXViewerFactory.branchState)) {
- PromptChangeUtil.promptChangeBranchState(treeItems);
- }
- if (treeColumn.getData().equals(BranchXViewerFactory.archivedState)) {
- PromptChangeUtil.promptChangeBranchArchivedState(treeItems);
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- @Override
- protected void createSupportWidgets(Composite parent) {
- super.createSupportWidgets(parent);
- createMenuActions();
- getFilterDataUI().setFocus();
- }
-
- public void createMenuActions() {
- MenuManager mm = getMenuManager();
- mm.createContextMenu(getControl());
- mm.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- updateMenuActionsForTable();
- }
- });
- }
-
- @Override
- public void updateMenuActionsForTable() {
- MenuManager mm = getMenuManager();
- mm.insertBefore(MENU_GROUP_PRE, new Separator());
- }
-
- /**
- * Release resources
- */
- @Override
- public void dispose() {
- if (getLabelProvider() != null) {
- getLabelProvider().dispose();
- }
- }
-
- /**
- * @return the xHistoryViewer
- */
- public XBranchWidget getXBranchViewer() {
- return xBranchViewer;
- }
-
- @Override
- public XViewerTextFilter getXViewerTextFilter() {
- return new XBranchTextFilter(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.framework.ui.skynet.widgets.xBranch;
+
+import java.util.ArrayList;
+import java.util.Collection;
+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.XViewer;
+import org.eclipse.nebula.widgets.xviewer.XViewerTextFilter;
+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.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.ui.skynet.ArtifactExplorer;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.util.PromptChangeUtil;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class BranchXViewer extends XViewer {
+ private final XBranchWidget xBranchViewer;
+
+ public BranchXViewer(Composite parent, int style, XBranchWidget xBranchViewer, boolean filterRealTime, boolean searchRealTime) {
+ super(parent, style, new BranchXViewerFactory(), filterRealTime, searchRealTime);
+ this.xBranchViewer = xBranchViewer;
+ }
+
+ @Override
+ public void handleDoubleClick() {
+ ArrayList<Branch> branches = xBranchViewer.getSelectedBranches();
+ if (branches != null && !branches.isEmpty()) {
+ for (Branch branch : branches) {
+ if (!branch.getBranchType().isSystemRootBranch()) {
+ ArtifactExplorer.exploreBranch(branch);
+ BranchManager.setLastBranch(branch);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void handleColumnMultiEdit(TreeColumn treeColumn, Collection<TreeItem> treeItems) {
+ try {
+ if (treeColumn.getData().equals(BranchXViewerFactory.branchType)) {
+ PromptChangeUtil.promptChangeBranchType(treeItems);
+ }
+ if (treeColumn.getData().equals(BranchXViewerFactory.branchState)) {
+ PromptChangeUtil.promptChangeBranchState(treeItems);
+ }
+ if (treeColumn.getData().equals(BranchXViewerFactory.archivedState)) {
+ PromptChangeUtil.promptChangeBranchArchivedState(treeItems);
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @Override
+ protected void createSupportWidgets(Composite parent) {
+ super.createSupportWidgets(parent);
+ createMenuActions();
+ getFilterDataUI().setFocus();
+ }
+
+ public void createMenuActions() {
+ MenuManager mm = getMenuManager();
+ mm.createContextMenu(getControl());
+ mm.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager manager) {
+ updateMenuActionsForTable();
+ }
+ });
+ }
+
+ @Override
+ public void updateMenuActionsForTable() {
+ MenuManager mm = getMenuManager();
+ mm.insertBefore(MENU_GROUP_PRE, new Separator());
+ }
+
+ /**
+ * Release resources
+ */
+ @Override
+ public void dispose() {
+ if (getLabelProvider() != null) {
+ getLabelProvider().dispose();
+ }
+ }
+
+ /**
+ * @return the xHistoryViewer
+ */
+ public XBranchWidget getXBranchViewer() {
+ return xBranchViewer;
+ }
+
+ @Override
+ public XViewerTextFilter getXViewerTextFilter() {
+ return new XBranchTextFilter(this);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/PolicyTableXViewerFactory.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/PolicyTableXViewerFactory.java
index ddf0fc74a7f..886ece9fcee 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/PolicyTableXViewerFactory.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/PolicyTableXViewerFactory.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.framework.ui.skynet.widgets.xBranch;
-
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.osee.framework.ui.skynet.access.PolicyTableColumns;
-import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.SkynetXViewerFactory;
-
-/**
- * @author Ryan Schmitt
- */
-public class PolicyTableXViewerFactory extends SkynetXViewerFactory {
- public static final String namespace = "osee.skynet.gui.branchAccessViewer";
-
- public PolicyTableXViewerFactory() {
- super(namespace);
- PolicyTableColumns[] columns = PolicyTableColumns.values();
- XViewerColumn[] xColumns = new XViewerColumn[columns.length];
- for (int i = 0; i < columns.length; i++)
- xColumns[i] = columns[i].getXViewerColumn();
- registerColumns(xColumns);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.xBranch;
+
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.osee.framework.ui.skynet.access.PolicyTableColumns;
+import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.SkynetXViewerFactory;
+
+/**
+ * @author Ryan Schmitt
+ */
+public class PolicyTableXViewerFactory extends SkynetXViewerFactory {
+ public static final String namespace = "osee.skynet.gui.branchAccessViewer";
+
+ public PolicyTableXViewerFactory() {
+ super(namespace);
+ PolicyTableColumns[] columns = PolicyTableColumns.values();
+ XViewerColumn[] xColumns = new XViewerColumn[columns.length];
+ for (int i = 0; i < columns.length; i++)
+ xColumns[i] = columns[i].getXViewerColumn();
+ registerColumns(xColumns);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchTextFilter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchTextFilter.java
index 75f3715e929..c966d9861a7 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchTextFilter.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchTextFilter.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.framework.ui.skynet.widgets.xBranch;
-
-import java.util.ArrayList;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.nebula.widgets.xviewer.XViewer;
-import org.eclipse.nebula.widgets.xviewer.XViewerTextFilter;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-
-/**
- * @author Donald G. Dunne
- */
-public class XBranchTextFilter extends XViewerTextFilter {
-
- /**
- * @param viewer
- */
- public XBranchTextFilter(XViewer viewer) {
- super(viewer);
- }
-
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (element instanceof TransactionRecord) {
- return true;
- }
- if (element instanceof ArrayList<?>) {
- return true;
- }
- return super.select(viewer, parentElement, 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.framework.ui.skynet.widgets.xBranch;
+
+import java.util.ArrayList;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.nebula.widgets.xviewer.XViewer;
+import org.eclipse.nebula.widgets.xviewer.XViewerTextFilter;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XBranchTextFilter extends XViewerTextFilter {
+
+ /**
+ * @param viewer
+ */
+ public XBranchTextFilter(XViewer viewer) {
+ super(viewer);
+ }
+
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (element instanceof TransactionRecord) {
+ return true;
+ }
+ if (element instanceof ArrayList<?>) {
+ return true;
+ }
+ return super.select(viewer, parentElement, element);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchWidget.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchWidget.java
index 93b9ad69634..70000b41fc6 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchWidget.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xBranch/XBranchWidget.java
@@ -1,378 +1,378 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.widgets.xBranch;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-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.plugin.core.IActionable;
-import org.eclipse.osee.framework.plugin.core.util.Jobs;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.ui.plugin.OseeUiActions;
-import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-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.ImageManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.swt.widgets.Tree;
-
-/**
- * @author Jeff C. Phillips
- */
-public class XBranchWidget extends XWidget implements IActionable {
- private BranchXViewer branchXViewer;
- public final static String normalColor = "#EEEEEE";
- private static final String LOADING = "Loading ...";
- protected Label extraInfoLabel;
- private XBranchContentProvider branchContentProvider;
- private XBranchLabelProvider xBranchLabelProvider;
- private FavoriteSorter sorter;
- private static final String VIEW_ID = "BrachView";
- private boolean filterRealTime;
- private boolean searchRealTime;
- private ToolBar toolBar;
-
- public XBranchWidget(boolean filterRealTime, boolean searchRealTime) {
- this();
-
- this.filterRealTime = filterRealTime;
- this.searchRealTime = searchRealTime;
- }
-
- /**
- * @param label
- */
- public XBranchWidget() {
- super(VIEW_ID);
-
- this.filterRealTime = false;
- this.searchRealTime = false;
- }
-
- public void setBranchOptions(BranchOptions... options) {
- for (BranchOptions option : options) {
-
- switch (option) {
- case FAVORITES_FIRST:
- setFavoritesFirst(true);
- break;
- case FLAT:
- setPresentation(true);
- break;
- case SHOW_MERGE_BRANCHES:
- setShowMergeBranches(true);
- break;
- case SHOW_TRANSACTIONS:
- setShowMergeBranches(true);
- break;
- case SHOW_ARCHIVED:
- setShowMergeBranches(true);
- break;
- }
- }
- }
-
- @Override
- protected void createControls(Composite parent, int horizontalSpan) {
- // Create Text Widgets
- if (isDisplayLabel() && !getLabel().equals("")) {
- labelWidget = new Label(parent, SWT.NONE);
- labelWidget.setText(getLabel() + ":");
- if (getToolTip() != null) {
- labelWidget.setToolTipText(getToolTip());
- }
- }
-
- Composite mainComp = new Composite(parent, SWT.BORDER);
- mainComp.setLayout(ALayout.getZeroMarginLayout());
- mainComp.setLayoutData(new GridData(GridData.FILL_BOTH));
- if (toolkit != null) {
- toolkit.paintBordersFor(mainComp);
- }
-
- try {
- createTaskActionBar(mainComp);
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
-
- branchXViewer =
- new BranchXViewer(mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, this, filterRealTime,
- searchRealTime);
- branchXViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
-
- branchContentProvider = new XBranchContentProvider(branchXViewer);
- branchXViewer.setContentProvider(branchContentProvider);
- xBranchLabelProvider = new XBranchLabelProvider(branchXViewer);
- branchXViewer.setLabelProvider(xBranchLabelProvider);
- sorter = new FavoriteSorter(branchXViewer);
- branchXViewer.setSorter(sorter);
-
- if (toolkit != null) {
- toolkit.adapt(branchXViewer.getStatusLabel(), false, false);
- }
- new ActionContributionItem(branchXViewer.getCustomizeAction()).fill(toolBar, -1);
-
- Tree tree = branchXViewer.getTree();
- GridData gridData = new GridData(GridData.FILL_BOTH);
- gridData.heightHint = 100;
- tree.setLayout(ALayout.getZeroMarginLayout());
- tree.setLayoutData(gridData);
- tree.setHeaderVisible(true);
- tree.setLinesVisible(true);
- }
-
- public void createTaskActionBar(Composite parent) throws OseeCoreException {
- // Button composite for state transitions, etc
- Composite composite = new Composite(parent, SWT.NONE);
- // composite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_CYAN));
- GridLayout layout = ALayout.getZeroMarginLayout(2, false);
- layout.marginLeft = 5;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- extraInfoLabel = new Label(composite, SWT.NONE);
- extraInfoLabel.setAlignment(SWT.LEFT);
- extraInfoLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- extraInfoLabel.setText("\n");
-
- toolBar = new ToolBar(composite, SWT.FLAT);
- 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) {
- loadData();
- }
- });
-
- OseeUiActions.addButtonToEditorToolBar(this, SkynetGuiPlugin.getInstance(), toolBar, BranchView.VIEW_ID,
- "Branch Manager");
- }
-
- public void loadTable() {
- refresh();
- }
-
- @SuppressWarnings("unchecked")
- public ArrayList<Branch> getSelectedBranches() {
- ArrayList<Branch> items = new ArrayList<Branch>();
- if (branchXViewer == null) {
- return items;
- }
- if (branchXViewer.getSelection().isEmpty()) {
- return items;
- }
- Iterator i = ((IStructuredSelection) branchXViewer.getSelection()).iterator();
- while (i.hasNext()) {
- Object obj = i.next();
-
- if (obj instanceof Branch) {
- items.add((Branch) obj);
- }
- }
- return items;
- }
-
- @Override
- public Control getControl() {
- return branchXViewer.getTree();
- }
-
- @Override
- public void dispose() {
- branchXViewer.dispose();
- }
-
- @Override
- public void setFocus() {
- branchXViewer.getTree().setFocus();
- }
-
- @Override
- public void refresh() {
- branchXViewer.refresh();
- validate();
- }
-
- @Override
- public IStatus isValid() {
- return Status.OK_STATUS;
- }
-
- @Override
- public String toHTML(String labelFont) {
- return AHTML.simplePage("Unhandled");
- }
-
- /**
- * @return Returns the xViewer.
- */
- public BranchXViewer getXViewer() {
- return branchXViewer;
- }
-
- @Override
- public Object getData() {
- return branchXViewer.getInput();
- }
-
- public void loadData() {
- loadData(BranchManager.getInstance());
- }
-
- public void loadData(final Object input) {
- final Object[] expandedBranches = getXViewer().getExpandedElements();
-
- if (extraInfoLabel != null && !extraInfoLabel.isDisposed()) {
- extraInfoLabel.setText(LOADING);
- }
-
- Job job = new Job("Banch Manager") {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
-
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
-
- if (extraInfoLabel != null && !extraInfoLabel.isDisposed()) {
- extraInfoLabel.setText("");
- }
- if (branchXViewer != null) {
- try {
- BranchManager.refreshBranches();
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- branchXViewer.setInput(input);
- getXViewer().setExpandedElements(expandedBranches);
- }
- }
- });
- return Status.OK_STATUS;
- }
- };
- Jobs.startJob(job);
- }
-
- @Override
- public String getReportData() {
- return null;
- }
-
- @Override
- public String getXmlData() {
- return null;
- }
-
- @Override
- public void setXmlData(String str) {
- }
-
- @Override
- public String getActionDescription() {
- return null;
- }
-
- /**
- * @param favoritesFirst
- */
- public void setFavoritesFirst(boolean favoritesFirst) {
- if (branchContentProvider != null) {
- sorter.setFavoritesFirst(favoritesFirst);
- refresh();
- }
- }
-
- /**
- * @param flat
- */
- public void setPresentation(boolean flat) {
- if (branchContentProvider != null) {
- branchContentProvider.setPresentation(flat);
- refresh();
- }
- }
-
- /**
- * @param showMergeBranches
- */
- public void setShowMergeBranches(boolean showMergeBranches) {
- if (branchContentProvider != null) {
- branchContentProvider.setShowMergeBranches(showMergeBranches);
- refresh();
- }
- }
-
- /**
- * @param showArchivedBranches
- */
- public void setShowArchivedBranches(boolean showArchivedBranches) {
- if (branchContentProvider != null) {
- branchContentProvider.setShowArchivedBranches(showArchivedBranches);
- refresh();
- }
- }
-
- /**
- * @param showTransactions
- */
- public void setShowTransactions(boolean showTransactions) {
- if (branchContentProvider != null) {
- branchContentProvider.setShowTransactions(showTransactions);
- refresh();
- }
- }
-
- /**
- * @param showTransactions
- */
- public void setShowWorkingBranchesOnly(boolean allowOnlyWorkingBranches) {
- if (branchContentProvider != null) {
- branchContentProvider.setShowOnlyWorkingBranches(allowOnlyWorkingBranches);
- refresh();
- }
- }
-
- public void reveal(Branch branch) {
- branchXViewer.reveal(branch);
- branchXViewer.setSelection(new StructuredSelection(branch), true);
- 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.framework.ui.skynet.widgets.xBranch;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.logging.Level;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+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.plugin.core.IActionable;
+import org.eclipse.osee.framework.plugin.core.util.Jobs;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.ui.plugin.OseeUiActions;
+import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+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.ImageManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.swt.widgets.Tree;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class XBranchWidget extends XWidget implements IActionable {
+ private BranchXViewer branchXViewer;
+ public final static String normalColor = "#EEEEEE";
+ private static final String LOADING = "Loading ...";
+ protected Label extraInfoLabel;
+ private XBranchContentProvider branchContentProvider;
+ private XBranchLabelProvider xBranchLabelProvider;
+ private FavoriteSorter sorter;
+ private static final String VIEW_ID = "BrachView";
+ private boolean filterRealTime;
+ private boolean searchRealTime;
+ private ToolBar toolBar;
+
+ public XBranchWidget(boolean filterRealTime, boolean searchRealTime) {
+ this();
+
+ this.filterRealTime = filterRealTime;
+ this.searchRealTime = searchRealTime;
+ }
+
+ /**
+ * @param label
+ */
+ public XBranchWidget() {
+ super(VIEW_ID);
+
+ this.filterRealTime = false;
+ this.searchRealTime = false;
+ }
+
+ public void setBranchOptions(BranchOptions... options) {
+ for (BranchOptions option : options) {
+
+ switch (option) {
+ case FAVORITES_FIRST:
+ setFavoritesFirst(true);
+ break;
+ case FLAT:
+ setPresentation(true);
+ break;
+ case SHOW_MERGE_BRANCHES:
+ setShowMergeBranches(true);
+ break;
+ case SHOW_TRANSACTIONS:
+ setShowMergeBranches(true);
+ break;
+ case SHOW_ARCHIVED:
+ setShowMergeBranches(true);
+ break;
+ }
+ }
+ }
+
+ @Override
+ protected void createControls(Composite parent, int horizontalSpan) {
+ // Create Text Widgets
+ if (isDisplayLabel() && !getLabel().equals("")) {
+ labelWidget = new Label(parent, SWT.NONE);
+ labelWidget.setText(getLabel() + ":");
+ if (getToolTip() != null) {
+ labelWidget.setToolTipText(getToolTip());
+ }
+ }
+
+ Composite mainComp = new Composite(parent, SWT.BORDER);
+ mainComp.setLayout(ALayout.getZeroMarginLayout());
+ mainComp.setLayoutData(new GridData(GridData.FILL_BOTH));
+ if (toolkit != null) {
+ toolkit.paintBordersFor(mainComp);
+ }
+
+ try {
+ createTaskActionBar(mainComp);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+
+ branchXViewer =
+ new BranchXViewer(mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, this, filterRealTime,
+ searchRealTime);
+ branchXViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ branchContentProvider = new XBranchContentProvider(branchXViewer);
+ branchXViewer.setContentProvider(branchContentProvider);
+ xBranchLabelProvider = new XBranchLabelProvider(branchXViewer);
+ branchXViewer.setLabelProvider(xBranchLabelProvider);
+ sorter = new FavoriteSorter(branchXViewer);
+ branchXViewer.setSorter(sorter);
+
+ if (toolkit != null) {
+ toolkit.adapt(branchXViewer.getStatusLabel(), false, false);
+ }
+ new ActionContributionItem(branchXViewer.getCustomizeAction()).fill(toolBar, -1);
+
+ Tree tree = branchXViewer.getTree();
+ GridData gridData = new GridData(GridData.FILL_BOTH);
+ gridData.heightHint = 100;
+ tree.setLayout(ALayout.getZeroMarginLayout());
+ tree.setLayoutData(gridData);
+ tree.setHeaderVisible(true);
+ tree.setLinesVisible(true);
+ }
+
+ public void createTaskActionBar(Composite parent) throws OseeCoreException {
+ // Button composite for state transitions, etc
+ Composite composite = new Composite(parent, SWT.NONE);
+ // composite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_CYAN));
+ GridLayout layout = ALayout.getZeroMarginLayout(2, false);
+ layout.marginLeft = 5;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ extraInfoLabel = new Label(composite, SWT.NONE);
+ extraInfoLabel.setAlignment(SWT.LEFT);
+ extraInfoLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ extraInfoLabel.setText("\n");
+
+ toolBar = new ToolBar(composite, SWT.FLAT);
+ 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) {
+ loadData();
+ }
+ });
+
+ OseeUiActions.addButtonToEditorToolBar(this, SkynetGuiPlugin.getInstance(), toolBar, BranchView.VIEW_ID,
+ "Branch Manager");
+ }
+
+ public void loadTable() {
+ refresh();
+ }
+
+ @SuppressWarnings("unchecked")
+ public ArrayList<Branch> getSelectedBranches() {
+ ArrayList<Branch> items = new ArrayList<Branch>();
+ if (branchXViewer == null) {
+ return items;
+ }
+ if (branchXViewer.getSelection().isEmpty()) {
+ return items;
+ }
+ Iterator i = ((IStructuredSelection) branchXViewer.getSelection()).iterator();
+ while (i.hasNext()) {
+ Object obj = i.next();
+
+ if (obj instanceof Branch) {
+ items.add((Branch) obj);
+ }
+ }
+ return items;
+ }
+
+ @Override
+ public Control getControl() {
+ return branchXViewer.getTree();
+ }
+
+ @Override
+ public void dispose() {
+ branchXViewer.dispose();
+ }
+
+ @Override
+ public void setFocus() {
+ branchXViewer.getTree().setFocus();
+ }
+
+ @Override
+ public void refresh() {
+ branchXViewer.refresh();
+ validate();
+ }
+
+ @Override
+ public IStatus isValid() {
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public String toHTML(String labelFont) {
+ return AHTML.simplePage("Unhandled");
+ }
+
+ /**
+ * @return Returns the xViewer.
+ */
+ public BranchXViewer getXViewer() {
+ return branchXViewer;
+ }
+
+ @Override
+ public Object getData() {
+ return branchXViewer.getInput();
+ }
+
+ public void loadData() {
+ loadData(BranchManager.getInstance());
+ }
+
+ public void loadData(final Object input) {
+ final Object[] expandedBranches = getXViewer().getExpandedElements();
+
+ if (extraInfoLabel != null && !extraInfoLabel.isDisposed()) {
+ extraInfoLabel.setText(LOADING);
+ }
+
+ Job job = new Job("Banch Manager") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+
+ if (extraInfoLabel != null && !extraInfoLabel.isDisposed()) {
+ extraInfoLabel.setText("");
+ }
+ if (branchXViewer != null) {
+ try {
+ BranchManager.refreshBranches();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ branchXViewer.setInput(input);
+ getXViewer().setExpandedElements(expandedBranches);
+ }
+ }
+ });
+ return Status.OK_STATUS;
+ }
+ };
+ Jobs.startJob(job);
+ }
+
+ @Override
+ public String getReportData() {
+ return null;
+ }
+
+ @Override
+ public String getXmlData() {
+ return null;
+ }
+
+ @Override
+ public void setXmlData(String str) {
+ }
+
+ @Override
+ public String getActionDescription() {
+ return null;
+ }
+
+ /**
+ * @param favoritesFirst
+ */
+ public void setFavoritesFirst(boolean favoritesFirst) {
+ if (branchContentProvider != null) {
+ sorter.setFavoritesFirst(favoritesFirst);
+ refresh();
+ }
+ }
+
+ /**
+ * @param flat
+ */
+ public void setPresentation(boolean flat) {
+ if (branchContentProvider != null) {
+ branchContentProvider.setPresentation(flat);
+ refresh();
+ }
+ }
+
+ /**
+ * @param showMergeBranches
+ */
+ public void setShowMergeBranches(boolean showMergeBranches) {
+ if (branchContentProvider != null) {
+ branchContentProvider.setShowMergeBranches(showMergeBranches);
+ refresh();
+ }
+ }
+
+ /**
+ * @param showArchivedBranches
+ */
+ public void setShowArchivedBranches(boolean showArchivedBranches) {
+ if (branchContentProvider != null) {
+ branchContentProvider.setShowArchivedBranches(showArchivedBranches);
+ refresh();
+ }
+ }
+
+ /**
+ * @param showTransactions
+ */
+ public void setShowTransactions(boolean showTransactions) {
+ if (branchContentProvider != null) {
+ branchContentProvider.setShowTransactions(showTransactions);
+ refresh();
+ }
+ }
+
+ /**
+ * @param showTransactions
+ */
+ public void setShowWorkingBranchesOnly(boolean allowOnlyWorkingBranches) {
+ if (branchContentProvider != null) {
+ branchContentProvider.setShowOnlyWorkingBranches(allowOnlyWorkingBranches);
+ refresh();
+ }
+ }
+
+ public void reveal(Branch branch) {
+ branchXViewer.reveal(branch);
+ branchXViewer.setSelection(new StructuredSelection(branch), true);
+ refresh();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xHistory/HistoryView.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xHistory/HistoryView.java
index 60625080c51..b39be0fafa9 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xHistory/HistoryView.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xHistory/HistoryView.java
@@ -1,345 +1,345 @@
-/*******************************************************************************
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.widgets.xHistory;
-
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.nebula.widgets.xviewer.customize.XViewerCustomMenu;
-import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
-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.plugin.core.util.Jobs;
-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.search.ArtifactQuery;
-import org.eclipse.osee.framework.skynet.core.change.Change;
-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.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.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.OpenWithMenuListener;
-import org.eclipse.osee.framework.ui.skynet.OseeContributionItem;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.change.ChangeUiUtil;
-import org.eclipse.osee.framework.ui.skynet.listener.IRebuildMenuListener;
-import org.eclipse.osee.framework.ui.skynet.menu.ArtifactDiffMenu;
-import org.eclipse.osee.framework.ui.skynet.util.SkynetViews;
-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.MenuEvent;
-import org.eclipse.swt.events.MenuListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * Displays persisted changes made to an artifact.
- *
- * @author Jeff C. Phillips
- */
-public class HistoryView extends ViewPart implements IActionable, IBranchEventListener, IRebuildMenuListener {
-
- public static final String VIEW_ID = "org.eclipse.osee.framework.ui.skynet.widgets.xHistory.HistoryView";
- private static String HELP_CONTEXT_ID = "HistoryView";
- private XHistoryWidget xHistoryWidget;
- private Artifact artifact;
-
- public HistoryView() {
- }
-
- public static void open(Artifact artifact) throws OseeArgumentException {
- if (artifact == null) {
- throw new OseeArgumentException("Artifact can't be null");
- }
- HistoryView.openViewUpon(artifact, true);
- }
-
- private static void openViewUpon(final Artifact artifact, final Boolean loadHistory) {
- Job job = new Job("Open History: " + artifact.getName()) {
-
- @Override
- protected IStatus run(final IProgressMonitor monitor) {
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- try {
- IWorkbenchPage page = AWorkbench.getActivePage();
- HistoryView historyView =
- (HistoryView) page.showView(VIEW_ID, artifact.getGuid() + artifact.getBranch().getId(),
- IWorkbenchPage.VIEW_ACTIVATE);
-
- historyView.explore(artifact, loadHistory);
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- });
- monitor.done();
- return Status.OK_STATUS;
- }
- };
-
- Jobs.startJob(job);
- }
-
- @Override
- public void dispose() {
- super.dispose();
- }
-
- @Override
- public void setFocus() {
- }
-
- /*
- * @see IWorkbenchPart#createPartControl(Composite)
- */
- @Override
- public void createPartControl(Composite parent) {
- /*
- * Create a grid layout object so the text and treeviewer are layed out the way I want.
- */
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- layout.verticalSpacing = 0;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- parent.setLayout(layout);
- parent.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- xHistoryWidget = new XHistoryWidget();
- xHistoryWidget.setDisplayLabel(false);
- xHistoryWidget.createWidgets(parent, 1);
-
- MenuManager menuManager = new MenuManager();
- menuManager.setRemoveAllWhenShown(true);
- menuManager.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- MenuManager menuManager = (MenuManager) manager;
- menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
- });
-
- menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- xHistoryWidget.getXViewer().getTree().setMenu(
- menuManager.createContextMenu(xHistoryWidget.getXViewer().getTree()));
- getSite().registerContextMenu(VIEW_ID, menuManager, xHistoryWidget.getXViewer());
-
- getSite().setSelectionProvider(xHistoryWidget.getXViewer());
- SkynetGuiPlugin.getInstance().setHelp(parent, HELP_CONTEXT_ID, "org.eclipse.osee.framework.help.ui");
- OseeContributionItem.addTo(this, true);
-
- setupMenus();
- }
-
- private void setupMenus() {
- Menu popupMenu = new Menu(xHistoryWidget.getXViewer().getTree().getParent());
- createOpenWithMenuItem(popupMenu);
- createChangeReportMenuItem(popupMenu);
- ArtifactDiffMenu.createDiffMenuItem(popupMenu, xHistoryWidget.getXViewer(), "Compare two Artifacts");
-
- // Setup generic xviewer menu items
- XViewerCustomMenu xMenu = new XViewerCustomMenu(xHistoryWidget.getXViewer());
- new MenuItem(popupMenu, SWT.SEPARATOR);
- xMenu.createTableCustomizationMenuItem(popupMenu);
- xMenu.createViewTableReportMenuItem(popupMenu);
- new MenuItem(popupMenu, SWT.SEPARATOR);
- xMenu.addCopyViewMenuBlock(popupMenu);
- new MenuItem(popupMenu, SWT.SEPARATOR);
- xMenu.addFilterMenuBlock(popupMenu);
- new MenuItem(popupMenu, SWT.SEPARATOR);
- xHistoryWidget.getXViewer().getTree().setMenu(popupMenu);
- }
-
- /**
- * @param popupMenu
- */
- private void createChangeReportMenuItem(Menu popupMenu) {
- final MenuItem changeReportMenuItem = new MenuItem(popupMenu, SWT.CASCADE);
- changeReportMenuItem.setText("&Change Report");
- changeReportMenuItem.setImage(ImageManager.getImage(FrameworkImage.BRANCH_CHANGE));
- popupMenu.addMenuListener(new MenuListener() {
-
- @Override
- public void menuHidden(MenuEvent e) {
- }
-
- @Override
- public void menuShown(MenuEvent e) {
- List<?> selections = ((IStructuredSelection) xHistoryWidget.getXViewer().getSelection()).toList();
- changeReportMenuItem.setEnabled(selections.size() == 1 && ((Change) selections.iterator().next()).getTxDelta().getStartTx().getTxType() != TransactionDetailsType.Baselined);
- }
-
- });
-
- changeReportMenuItem.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- IStructuredSelection selection = (IStructuredSelection) xHistoryWidget.getXViewer().getSelection();
- Object selectedObject = selection.getFirstElement();
-
- if (selectedObject instanceof Change) {
- try {
- ChangeUiUtil.open(((Change) selectedObject).getTxDelta().getStartTx());
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
-
- });
- }
-
- private void createOpenWithMenuItem(Menu parentMenu) {
- MenuItem openWithMenuItem = new MenuItem(parentMenu, SWT.CASCADE);
- openWithMenuItem.setText("&Open With");
- final Menu submenu = new Menu(openWithMenuItem);
- openWithMenuItem.setMenu(submenu);
- parentMenu.addMenuListener(new OpenWithMenuListener(submenu, xHistoryWidget.getXViewer(), this));
- }
-
- private void explore(final Artifact artifact, boolean loadHistory) {
- if (xHistoryWidget != null) {
- this.artifact = artifact;
-
- setPartName("History: " + artifact.getName());
- xHistoryWidget.setInputData(artifact, loadHistory);
- }
- }
-
- public String getActionDescription() {
- return "";
- }
-
- private static final String INPUT = "input";
- private static final String ART_GUID = "artifactGuid";
- private static final String BRANCH_ID = "branchId";
-
- @Override
- public void saveState(IMemento memento) {
- super.saveState(memento);
- memento = memento.createChild(INPUT);
- if (artifact != null) {
- memento.putString(ART_GUID, artifact.getGuid());
- memento.putInteger(BRANCH_ID, artifact.getBranch().getId());
- SkynetViews.addDatabaseSourceId(memento);
- }
- }
-
- @Override
- public void init(IViewSite site, IMemento memento) throws PartInitException {
- super.init(site, memento);
- try {
- if (memento != null) {
- memento = memento.getChild(INPUT);
- if (memento != null) {
- if (SkynetViews.isSourceValid(memento)) {
- String guid = memento.getString(ART_GUID);
- Integer branchId = memento.getInteger(BRANCH_ID);
- Artifact artifact = ArtifactQuery.getArtifactFromId(guid, BranchManager.getBranch(branchId));
- openViewUpon(artifact, false);
- } else {
- closeView();
- }
- }
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.WARNING, "History View error on init", ex);
- }
- }
-
- @Override
- public void handleBranchEventREM1(Sender sender, BranchEventType branchModType, final int branchId) {
- handleBranchEvent(branchModType);
- }
-
- private void handleBranchEvent(BranchEventType branchModType) {
- if (branchModType == BranchEventType.Deleted || branchModType == BranchEventType.Purged) {
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- closeView();
- }
- });
- return;
- } else if (branchModType == BranchEventType.Committed) {
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- try {
- explore(artifact, true);
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- });
- // refresh view with new branch and transaction id
- }
- }
-
- private void closeView() {
- SkynetViews.closeView(VIEW_ID, getViewSite().getSecondaryId());
- }
-
- @Override
- public void rebuildMenu() {
- setupMenus();
- }
-
- @Override
- public void handleBranchEvent(Sender sender, BranchEvent branchEvent) {
- handleBranchEvent(branchEvent.getEventType());
- }
-
- @Override
- public void handleLocalBranchToArtifactCacheUpdateEvent(Sender sender) {
- }
-
- @Override
- public List<? extends IEventFilter> getEventFilters() {
- if (artifact != null) {
- return OseeEventManager.getEventFiltersForBranch(artifact.getBranch());
- }
- 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.framework.ui.skynet.widgets.xHistory;
+
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.nebula.widgets.xviewer.customize.XViewerCustomMenu;
+import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
+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.plugin.core.util.Jobs;
+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.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.change.Change;
+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.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.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.OpenWithMenuListener;
+import org.eclipse.osee.framework.ui.skynet.OseeContributionItem;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.change.ChangeUiUtil;
+import org.eclipse.osee.framework.ui.skynet.listener.IRebuildMenuListener;
+import org.eclipse.osee.framework.ui.skynet.menu.ArtifactDiffMenu;
+import org.eclipse.osee.framework.ui.skynet.util.SkynetViews;
+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.MenuEvent;
+import org.eclipse.swt.events.MenuListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * Displays persisted changes made to an artifact.
+ *
+ * @author Jeff C. Phillips
+ */
+public class HistoryView extends ViewPart implements IActionable, IBranchEventListener, IRebuildMenuListener {
+
+ public static final String VIEW_ID = "org.eclipse.osee.framework.ui.skynet.widgets.xHistory.HistoryView";
+ private static String HELP_CONTEXT_ID = "HistoryView";
+ private XHistoryWidget xHistoryWidget;
+ private Artifact artifact;
+
+ public HistoryView() {
+ }
+
+ public static void open(Artifact artifact) throws OseeArgumentException {
+ if (artifact == null) {
+ throw new OseeArgumentException("Artifact can't be null");
+ }
+ HistoryView.openViewUpon(artifact, true);
+ }
+
+ private static void openViewUpon(final Artifact artifact, final Boolean loadHistory) {
+ Job job = new Job("Open History: " + artifact.getName()) {
+
+ @Override
+ protected IStatus run(final IProgressMonitor monitor) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ try {
+ IWorkbenchPage page = AWorkbench.getActivePage();
+ HistoryView historyView =
+ (HistoryView) page.showView(VIEW_ID, artifact.getGuid() + artifact.getBranch().getId(),
+ IWorkbenchPage.VIEW_ACTIVATE);
+
+ historyView.explore(artifact, loadHistory);
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ });
+ monitor.done();
+ return Status.OK_STATUS;
+ }
+ };
+
+ Jobs.startJob(job);
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ }
+
+ @Override
+ public void setFocus() {
+ }
+
+ /*
+ * @see IWorkbenchPart#createPartControl(Composite)
+ */
+ @Override
+ public void createPartControl(Composite parent) {
+ /*
+ * Create a grid layout object so the text and treeviewer are layed out the way I want.
+ */
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.verticalSpacing = 0;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ parent.setLayout(layout);
+ parent.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ xHistoryWidget = new XHistoryWidget();
+ xHistoryWidget.setDisplayLabel(false);
+ xHistoryWidget.createWidgets(parent, 1);
+
+ MenuManager menuManager = new MenuManager();
+ menuManager.setRemoveAllWhenShown(true);
+ menuManager.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager manager) {
+ MenuManager menuManager = (MenuManager) manager;
+ menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ }
+ });
+
+ menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ xHistoryWidget.getXViewer().getTree().setMenu(
+ menuManager.createContextMenu(xHistoryWidget.getXViewer().getTree()));
+ getSite().registerContextMenu(VIEW_ID, menuManager, xHistoryWidget.getXViewer());
+
+ getSite().setSelectionProvider(xHistoryWidget.getXViewer());
+ SkynetGuiPlugin.getInstance().setHelp(parent, HELP_CONTEXT_ID, "org.eclipse.osee.framework.help.ui");
+ OseeContributionItem.addTo(this, true);
+
+ setupMenus();
+ }
+
+ private void setupMenus() {
+ Menu popupMenu = new Menu(xHistoryWidget.getXViewer().getTree().getParent());
+ createOpenWithMenuItem(popupMenu);
+ createChangeReportMenuItem(popupMenu);
+ ArtifactDiffMenu.createDiffMenuItem(popupMenu, xHistoryWidget.getXViewer(), "Compare two Artifacts");
+
+ // Setup generic xviewer menu items
+ XViewerCustomMenu xMenu = new XViewerCustomMenu(xHistoryWidget.getXViewer());
+ new MenuItem(popupMenu, SWT.SEPARATOR);
+ xMenu.createTableCustomizationMenuItem(popupMenu);
+ xMenu.createViewTableReportMenuItem(popupMenu);
+ new MenuItem(popupMenu, SWT.SEPARATOR);
+ xMenu.addCopyViewMenuBlock(popupMenu);
+ new MenuItem(popupMenu, SWT.SEPARATOR);
+ xMenu.addFilterMenuBlock(popupMenu);
+ new MenuItem(popupMenu, SWT.SEPARATOR);
+ xHistoryWidget.getXViewer().getTree().setMenu(popupMenu);
+ }
+
+ /**
+ * @param popupMenu
+ */
+ private void createChangeReportMenuItem(Menu popupMenu) {
+ final MenuItem changeReportMenuItem = new MenuItem(popupMenu, SWT.CASCADE);
+ changeReportMenuItem.setText("&Change Report");
+ changeReportMenuItem.setImage(ImageManager.getImage(FrameworkImage.BRANCH_CHANGE));
+ popupMenu.addMenuListener(new MenuListener() {
+
+ @Override
+ public void menuHidden(MenuEvent e) {
+ }
+
+ @Override
+ public void menuShown(MenuEvent e) {
+ List<?> selections = ((IStructuredSelection) xHistoryWidget.getXViewer().getSelection()).toList();
+ changeReportMenuItem.setEnabled(selections.size() == 1 && ((Change) selections.iterator().next()).getTxDelta().getStartTx().getTxType() != TransactionDetailsType.Baselined);
+ }
+
+ });
+
+ changeReportMenuItem.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IStructuredSelection selection = (IStructuredSelection) xHistoryWidget.getXViewer().getSelection();
+ Object selectedObject = selection.getFirstElement();
+
+ if (selectedObject instanceof Change) {
+ try {
+ ChangeUiUtil.open(((Change) selectedObject).getTxDelta().getStartTx());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+
+ });
+ }
+
+ private void createOpenWithMenuItem(Menu parentMenu) {
+ MenuItem openWithMenuItem = new MenuItem(parentMenu, SWT.CASCADE);
+ openWithMenuItem.setText("&Open With");
+ final Menu submenu = new Menu(openWithMenuItem);
+ openWithMenuItem.setMenu(submenu);
+ parentMenu.addMenuListener(new OpenWithMenuListener(submenu, xHistoryWidget.getXViewer(), this));
+ }
+
+ private void explore(final Artifact artifact, boolean loadHistory) {
+ if (xHistoryWidget != null) {
+ this.artifact = artifact;
+
+ setPartName("History: " + artifact.getName());
+ xHistoryWidget.setInputData(artifact, loadHistory);
+ }
+ }
+
+ public String getActionDescription() {
+ return "";
+ }
+
+ private static final String INPUT = "input";
+ private static final String ART_GUID = "artifactGuid";
+ private static final String BRANCH_ID = "branchId";
+
+ @Override
+ public void saveState(IMemento memento) {
+ super.saveState(memento);
+ memento = memento.createChild(INPUT);
+ if (artifact != null) {
+ memento.putString(ART_GUID, artifact.getGuid());
+ memento.putInteger(BRANCH_ID, artifact.getBranch().getId());
+ SkynetViews.addDatabaseSourceId(memento);
+ }
+ }
+
+ @Override
+ public void init(IViewSite site, IMemento memento) throws PartInitException {
+ super.init(site, memento);
+ try {
+ if (memento != null) {
+ memento = memento.getChild(INPUT);
+ if (memento != null) {
+ if (SkynetViews.isSourceValid(memento)) {
+ String guid = memento.getString(ART_GUID);
+ Integer branchId = memento.getInteger(BRANCH_ID);
+ Artifact artifact = ArtifactQuery.getArtifactFromId(guid, BranchManager.getBranch(branchId));
+ openViewUpon(artifact, false);
+ } else {
+ closeView();
+ }
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.WARNING, "History View error on init", ex);
+ }
+ }
+
+ @Override
+ public void handleBranchEventREM1(Sender sender, BranchEventType branchModType, final int branchId) {
+ handleBranchEvent(branchModType);
+ }
+
+ private void handleBranchEvent(BranchEventType branchModType) {
+ if (branchModType == BranchEventType.Deleted || branchModType == BranchEventType.Purged) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ closeView();
+ }
+ });
+ return;
+ } else if (branchModType == BranchEventType.Committed) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ try {
+ explore(artifact, true);
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ });
+ // refresh view with new branch and transaction id
+ }
+ }
+
+ private void closeView() {
+ SkynetViews.closeView(VIEW_ID, getViewSite().getSecondaryId());
+ }
+
+ @Override
+ public void rebuildMenu() {
+ setupMenus();
+ }
+
+ @Override
+ public void handleBranchEvent(Sender sender, BranchEvent branchEvent) {
+ handleBranchEvent(branchEvent.getEventType());
+ }
+
+ @Override
+ public void handleLocalBranchToArtifactCacheUpdateEvent(Sender sender) {
+ }
+
+ @Override
+ public List<? extends IEventFilter> getEventFilters() {
+ if (artifact != null) {
+ return OseeEventManager.getEventFiltersForBranch(artifact.getBranch());
+ }
+ return null;
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xHistory/HistoryXViewer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xHistory/HistoryXViewer.java
index 6f92092d59e..d47ab5180d0 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xHistory/HistoryXViewer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xHistory/HistoryXViewer.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.framework.ui.skynet.widgets.xHistory;
-
-import java.util.ArrayList;
-import org.eclipse.core.runtime.IAdaptable;
-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.XViewer;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
-import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.TreeItem;
-
-/**
- * @author Jeff C. Phillips
- */
-public class HistoryXViewer extends XViewer {
- private final XHistoryWidget xHistoryViewer;
-
- public HistoryXViewer(Composite parent, int style, XHistoryWidget xRoleViewer) {
- super(parent, style, new HistoryXViewerFactory());
- this.xHistoryViewer = xRoleViewer;
- }
-
- @Override
- public void handleDoubleClick() {
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.xHistory;
+
+import java.util.ArrayList;
+import org.eclipse.core.runtime.IAdaptable;
+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.XViewer;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
+import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class HistoryXViewer extends XViewer {
+ private final XHistoryWidget xHistoryViewer;
+
+ public HistoryXViewer(Composite parent, int style, XHistoryWidget xRoleViewer) {
+ super(parent, style, new HistoryXViewerFactory());
+ this.xHistoryViewer = xRoleViewer;
+ }
+
+ @Override
+ public void handleDoubleClick() {
if (getSelectedChanges().isEmpty()) {
return;
}
-
+
Artifact artifact = getSelectedChanges().iterator().next();
-
+
if (artifact != null) {
RendererManager.openInJob(artifact, PresentationType.DEFAULT_OPEN);
- }
- }
-
- public ArrayList<Artifact> getSelectedChanges() {
- ArrayList<Artifact> arts = new ArrayList<Artifact>();
- TreeItem items[] = getTree().getSelection();
-
- if (items.length > 0) {
- for (TreeItem item : items) {
- Artifact artifact = null;
- if (item.getData() instanceof IAdaptable) {
- artifact = (Artifact) ((IAdaptable) item.getData()).getAdapter(Artifact.class);
-
- if (artifact != null) {
- arts.add(artifact);
- }
- }
- }
- }
- return arts;
- }
-
- @Override
- protected void createSupportWidgets(Composite parent) {
- super.createSupportWidgets(parent);
- createMenuActions();
- }
-
- public void createMenuActions() {
- MenuManager mm = getMenuManager();
- mm.createContextMenu(getControl());
- mm.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- updateMenuActionsForTable();
- }
- });
- }
-
- @Override
- public void updateMenuActionsForTable() {
- MenuManager mm = getMenuManager();
- mm.insertBefore(MENU_GROUP_PRE, new Separator());
- }
-
- /**
- * Release resources
- */
- @Override
- public void dispose() {
- getLabelProvider().dispose();
- }
-
- /**
- * @return the xHistoryViewer
- */
- public XHistoryWidget getXHisotryViewer() {
- return xHistoryViewer;
- }
-
-}
+ }
+ }
+
+ public ArrayList<Artifact> getSelectedChanges() {
+ ArrayList<Artifact> arts = new ArrayList<Artifact>();
+ TreeItem items[] = getTree().getSelection();
+
+ if (items.length > 0) {
+ for (TreeItem item : items) {
+ Artifact artifact = null;
+ if (item.getData() instanceof IAdaptable) {
+ artifact = (Artifact) ((IAdaptable) item.getData()).getAdapter(Artifact.class);
+
+ if (artifact != null) {
+ arts.add(artifact);
+ }
+ }
+ }
+ }
+ return arts;
+ }
+
+ @Override
+ protected void createSupportWidgets(Composite parent) {
+ super.createSupportWidgets(parent);
+ createMenuActions();
+ }
+
+ public void createMenuActions() {
+ MenuManager mm = getMenuManager();
+ mm.createContextMenu(getControl());
+ mm.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager manager) {
+ updateMenuActionsForTable();
+ }
+ });
+ }
+
+ @Override
+ public void updateMenuActionsForTable() {
+ MenuManager mm = getMenuManager();
+ mm.insertBefore(MENU_GROUP_PRE, new Separator());
+ }
+
+ /**
+ * Release resources
+ */
+ @Override
+ public void dispose() {
+ getLabelProvider().dispose();
+ }
+
+ /**
+ * @return the xHistoryViewer
+ */
+ public XHistoryWidget getXHisotryViewer() {
+ return xHistoryViewer;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xHistory/HistoryXViewerFactory.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xHistory/HistoryXViewerFactory.java
index 934c9efe5d4..0bd8bee93bf 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xHistory/HistoryXViewerFactory.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xHistory/HistoryXViewerFactory.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.framework.ui.skynet.widgets.xHistory;
-
-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.nebula.widgets.xviewer.customize.CustomizeData;
-import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.SkynetXViewerFactory;
-import org.eclipse.swt.SWT;
-
-/**
- * @author Jeff C. Phillips
- */
-public class HistoryXViewerFactory extends SkynetXViewerFactory {
- public static XViewerColumn transaction =
- new XViewerColumn("framework.history.transaction", "Transaction", 70, SWT.LEFT, true, SortDataType.Integer,
- false, null);
- public static XViewerColumn gamma =
- new XViewerColumn("framework.history.gamma", "Gamma", 60, SWT.LEFT, false, SortDataType.Integer, false, null);
- public static XViewerColumn itemType =
- new XViewerColumn("framework.history.itemType", "Item Type", 150, SWT.LEFT, true, SortDataType.String, false,
- null);
- public static XViewerColumn itemChange =
- new XViewerColumn("framework.history.itemChange", "Item Kind", 100, SWT.LEFT, true, SortDataType.String,
- false, null);
- public static XViewerColumn modType =
- new XViewerColumn("framework.history.modType", "Mod Type", 70, SWT.LEFT, true, SortDataType.String, false,
- null);
- public static XViewerColumn itemId =
- new XViewerColumn("framework.history.itemId", "Item ID", 55, SWT.LEFT, true, SortDataType.Integer, false, null);
- public static XViewerColumn was =
- new XViewerColumn("framework.history.was", "Was", 150, SWT.LEFT, true, SortDataType.String, false, null);
- public static XViewerColumn is =
- new XViewerColumn("framework.history.is", "Is", 150, SWT.LEFT, true, SortDataType.String, false, null);
- public static XViewerColumn timeStamp =
- new XViewerColumn("framework.history.timeStamp", "Time Stamp", 110, SWT.LEFT, true, SortDataType.Date, false,
- null);
- public static XViewerColumn author =
- new XViewerColumn("framework.history.author", "Author", 100, SWT.LEFT, true, SortDataType.String, false, null);
- public static XViewerColumn comment =
- new XViewerColumn("framework.history.comment", "Comment", 300, SWT.LEFT, true, SortDataType.String, false,
- null);
-
- public static String NAMESPACE = "osee.skynet.gui.HisotryXViewer";
-
- public HistoryXViewerFactory() {
- super(NAMESPACE);
- registerColumns(transaction, gamma, itemType, itemChange, modType, itemId, was, is, timeStamp, author, comment);
- registerAllAttributeColumns();
- }
-
- @Override
- public XViewerSorter createNewXSorter(XViewer xViewer) {
- return new XViewerSorter(xViewer);
- }
-
- @Override
- public CustomizeData getDefaultTableCustomizeData() {
- CustomizeData customizeData = super.getDefaultTableCustomizeData();
- for (XViewerColumn xCol : customizeData.getColumnData().getColumns()) {
- if (xCol.getId() == transaction.getId()) {
- xCol.setSortForward(false);
- }
- }
- customizeData.getSortingData().setSortingNames(transaction.getId());
- return 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.framework.ui.skynet.widgets.xHistory;
+
+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.nebula.widgets.xviewer.customize.CustomizeData;
+import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.SkynetXViewerFactory;
+import org.eclipse.swt.SWT;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class HistoryXViewerFactory extends SkynetXViewerFactory {
+ public static XViewerColumn transaction =
+ new XViewerColumn("framework.history.transaction", "Transaction", 70, SWT.LEFT, true, SortDataType.Integer,
+ false, null);
+ public static XViewerColumn gamma =
+ new XViewerColumn("framework.history.gamma", "Gamma", 60, SWT.LEFT, false, SortDataType.Integer, false, null);
+ public static XViewerColumn itemType =
+ new XViewerColumn("framework.history.itemType", "Item Type", 150, SWT.LEFT, true, SortDataType.String, false,
+ null);
+ public static XViewerColumn itemChange =
+ new XViewerColumn("framework.history.itemChange", "Item Kind", 100, SWT.LEFT, true, SortDataType.String,
+ false, null);
+ public static XViewerColumn modType =
+ new XViewerColumn("framework.history.modType", "Mod Type", 70, SWT.LEFT, true, SortDataType.String, false,
+ null);
+ public static XViewerColumn itemId =
+ new XViewerColumn("framework.history.itemId", "Item ID", 55, SWT.LEFT, true, SortDataType.Integer, false, null);
+ public static XViewerColumn was =
+ new XViewerColumn("framework.history.was", "Was", 150, SWT.LEFT, true, SortDataType.String, false, null);
+ public static XViewerColumn is =
+ new XViewerColumn("framework.history.is", "Is", 150, SWT.LEFT, true, SortDataType.String, false, null);
+ public static XViewerColumn timeStamp =
+ new XViewerColumn("framework.history.timeStamp", "Time Stamp", 110, SWT.LEFT, true, SortDataType.Date, false,
+ null);
+ public static XViewerColumn author =
+ new XViewerColumn("framework.history.author", "Author", 100, SWT.LEFT, true, SortDataType.String, false, null);
+ public static XViewerColumn comment =
+ new XViewerColumn("framework.history.comment", "Comment", 300, SWT.LEFT, true, SortDataType.String, false,
+ null);
+
+ public static String NAMESPACE = "osee.skynet.gui.HisotryXViewer";
+
+ public HistoryXViewerFactory() {
+ super(NAMESPACE);
+ registerColumns(transaction, gamma, itemType, itemChange, modType, itemId, was, is, timeStamp, author, comment);
+ registerAllAttributeColumns();
+ }
+
+ @Override
+ public XViewerSorter createNewXSorter(XViewer xViewer) {
+ return new XViewerSorter(xViewer);
+ }
+
+ @Override
+ public CustomizeData getDefaultTableCustomizeData() {
+ CustomizeData customizeData = super.getDefaultTableCustomizeData();
+ for (XViewerColumn xCol : customizeData.getColumnData().getColumns()) {
+ if (xCol.getId() == transaction.getId()) {
+ xCol.setSortForward(false);
+ }
+ }
+ customizeData.getSortingData().setSortingNames(transaction.getId());
+ return customizeData;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xHistory/XHistoryWidget.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xHistory/XHistoryWidget.java
index 46d500459ab..75cb682abd8 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xHistory/XHistoryWidget.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xHistory/XHistoryWidget.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.framework.ui.skynet.widgets.xHistory;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import org.eclipse.core.runtime.IAdaptable;
-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.ActionContributionItem;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-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.plugin.core.IActionable;
-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.change.Change;
-import org.eclipse.osee.framework.skynet.core.revision.ChangeManager;
-import org.eclipse.osee.framework.ui.plugin.OseeUiActions;
-import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.util.SkynetDragAndDrop;
-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.ImageManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DropTargetEvent;
-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.Label;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.swt.widgets.Tree;
-
-/**
- * @author Jeff C. Phillips
- */
-public class XHistoryWidget extends XWidget implements IActionable {
-
- private HistoryXViewer xHistoryViewer;
- public final static String normalColor = "#EEEEEE";
- private static final String LOADING = "Loading ...";
- private static final String NO_HISTORY = "No History changes were found";
- protected Label extraInfoLabel;
- private Artifact artifact;
- private ToolBar toolBar;
- private Composite rightComp;
-
- public XHistoryWidget() {
- super("History");
- }
-
- @Override
- protected void createControls(Composite parent, int horizontalSpan) {
- // Create Text Widgets
- if (isDisplayLabel() && !getLabel().equals("")) {
- labelWidget = new Label(parent, SWT.NONE);
- labelWidget.setText(getLabel() + ":");
- if (getToolTip() != null) {
- labelWidget.setToolTipText(getToolTip());
- }
- }
-
- Composite mainComp = new Composite(parent, SWT.BORDER);
- mainComp.setLayoutData(new GridData(GridData.FILL_BOTH));
- mainComp.setLayout(ALayout.getZeroMarginLayout());
- if (toolkit != null) {
- toolkit.paintBordersFor(mainComp);
- }
-
- createTaskActionBar(mainComp);
-
- xHistoryViewer = new HistoryXViewer(mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, this);
- xHistoryViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
-
- xHistoryViewer.setContentProvider(new XHistoryContentProvider(xHistoryViewer));
- xHistoryViewer.setLabelProvider(new XHistoryLabelProvider(xHistoryViewer));
-
- createToolBar();
-
- if (toolkit != null) {
- toolkit.adapt(xHistoryViewer.getStatusLabel(), false, false);
- }
-
- Tree tree = xHistoryViewer.getTree();
- GridData gridData = new GridData(GridData.FILL_BOTH);
- gridData.heightHint = 100;
- tree.setLayout(ALayout.getZeroMarginLayout());
- tree.setLayoutData(gridData);
- tree.setHeaderVisible(true);
- tree.setLinesVisible(true);
-
- new HistoryDragAndDrop(tree, HistoryXViewerFactory.NAMESPACE);
- }
-
- 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("\n");
-
- rightComp = new Composite(bComp, SWT.NONE);
- rightComp.setLayout(new GridLayout());
- rightComp.setLayoutData(new GridData(GridData.END));
- }
-
- public void createToolBar() {
-
- 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) {
- setInputData(artifact, true);
- }
- });
-
- OseeUiActions.addButtonToEditorToolBar(this, SkynetGuiPlugin.getInstance(), toolBar, HistoryView.VIEW_ID,
- "Resource History");
-
- new ActionContributionItem(xHistoryViewer.getCustomizeAction()).fill(toolBar, -1);
-
- rightComp.layout();
- rightComp.getParent().layout();
- }
-
- public void loadTable() {
- refresh();
- }
-
- @SuppressWarnings("unchecked")
- public ArrayList<Branch> getSelectedBranches() {
- ArrayList<Branch> items = new ArrayList<Branch>();
- if (xHistoryViewer == null) {
- return items;
- }
- if (xHistoryViewer.getSelection().isEmpty()) {
- return items;
- }
- Iterator i = ((IStructuredSelection) xHistoryViewer.getSelection()).iterator();
- while (i.hasNext()) {
- Object obj = i.next();
- items.add((Branch) obj);
- }
- return items;
- }
-
- @Override
- public Control getControl() {
- return xHistoryViewer.getTree();
- }
-
- @Override
- public void dispose() {
- xHistoryViewer.dispose();
- }
-
- @Override
- public void setFocus() {
- xHistoryViewer.getTree().setFocus();
- }
-
- @Override
- public void refresh() {
- xHistoryViewer.refresh();
- validate();
- }
-
- @Override
- public IStatus isValid() {
- return Status.OK_STATUS;
- }
-
- @Override
- public String toHTML(String labelFont) {
- return AHTML.simplePage("Unhandled");
- }
-
- /**
- * @return Returns the xViewer.
- */
- public HistoryXViewer getXViewer() {
- return xHistoryViewer;
- }
-
- @Override
- public Object getData() {
- return xHistoryViewer.getInput();
- }
-
- public void setInputData(final Artifact artifact, final boolean loadHistory) {
- this.artifact = artifact;
- extraInfoLabel.setText(LOADING);
-
- Job job = new Job("History: " + artifact.getName()) {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- final Collection<Change> changes = new ArrayList<Change>();
-
- try {
- if (loadHistory) {
- changes.addAll(ChangeManager.getChangesPerArtifact(artifact, monitor));
- }
-
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- if (loadHistory) {
- if (changes.isEmpty()) {
- extraInfoLabel.setText(NO_HISTORY);
- xHistoryViewer.setInput(changes);
- } else {
- String infoLabel =
- String.format("History: %s on branch: %s", artifact.getName(),
- artifact.getBranch().getShortName());
- extraInfoLabel.setText(infoLabel);
- xHistoryViewer.setInput(changes);
- }
- } else {
- extraInfoLabel.setText("Cleared on shut down - press refresh to reload");
- }
- }
- });
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return Status.OK_STATUS;
- }
- };
- Jobs.startJob(job);
- }
-
- @Override
- public String getReportData() {
- return null;
- }
-
- @Override
- public String getXmlData() {
- return null;
- }
-
- @Override
- public void setXmlData(String str) {
- }
- public class HistoryDragAndDrop extends SkynetDragAndDrop {
-
- public HistoryDragAndDrop(Tree tree, String viewId) {
- super(tree, viewId);
- }
-
- @Override
- public void performDragOver(DropTargetEvent event) {
- event.detail = DND.DROP_NONE;
- }
-
- @Override
- public Artifact[] getArtifacts() {
- IStructuredSelection selection = (IStructuredSelection) xHistoryViewer.getSelection();
- ArrayList<Artifact> artifacts = new ArrayList<Artifact>();
-
- if (selection != null && !selection.isEmpty()) {
- for (Object object : selection.toArray()) {
-
- if (object instanceof IAdaptable) {
- Artifact artifact = (Artifact) ((IAdaptable) object).getAdapter(Artifact.class);
-
- if (artifact != null) {
- artifacts.add(artifact);
- }
- }
- }
- }
- return artifacts.toArray(new Artifact[artifacts.size()]);
- }
- }
-
- @Override
- public String getActionDescription() {
- StringBuffer sb = new StringBuffer();
- if (artifact != null) {
- sb.append("\nHistory : " + artifact.getName());
- }
- return sb.toString();
- }
-
- public Artifact getArtifact() {
- return 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.framework.ui.skynet.widgets.xHistory;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import org.eclipse.core.runtime.IAdaptable;
+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.ActionContributionItem;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+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.plugin.core.IActionable;
+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.change.Change;
+import org.eclipse.osee.framework.skynet.core.revision.ChangeManager;
+import org.eclipse.osee.framework.ui.plugin.OseeUiActions;
+import org.eclipse.osee.framework.ui.plugin.PluginUiImage;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.util.SkynetDragAndDrop;
+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.ImageManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTargetEvent;
+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.Label;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.swt.widgets.Tree;
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class XHistoryWidget extends XWidget implements IActionable {
+
+ private HistoryXViewer xHistoryViewer;
+ public final static String normalColor = "#EEEEEE";
+ private static final String LOADING = "Loading ...";
+ private static final String NO_HISTORY = "No History changes were found";
+ protected Label extraInfoLabel;
+ private Artifact artifact;
+ private ToolBar toolBar;
+ private Composite rightComp;
+
+ public XHistoryWidget() {
+ super("History");
+ }
+
+ @Override
+ protected void createControls(Composite parent, int horizontalSpan) {
+ // Create Text Widgets
+ if (isDisplayLabel() && !getLabel().equals("")) {
+ labelWidget = new Label(parent, SWT.NONE);
+ labelWidget.setText(getLabel() + ":");
+ if (getToolTip() != null) {
+ labelWidget.setToolTipText(getToolTip());
+ }
+ }
+
+ Composite mainComp = new Composite(parent, SWT.BORDER);
+ mainComp.setLayoutData(new GridData(GridData.FILL_BOTH));
+ mainComp.setLayout(ALayout.getZeroMarginLayout());
+ if (toolkit != null) {
+ toolkit.paintBordersFor(mainComp);
+ }
+
+ createTaskActionBar(mainComp);
+
+ xHistoryViewer = new HistoryXViewer(mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, this);
+ xHistoryViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ xHistoryViewer.setContentProvider(new XHistoryContentProvider(xHistoryViewer));
+ xHistoryViewer.setLabelProvider(new XHistoryLabelProvider(xHistoryViewer));
+
+ createToolBar();
+
+ if (toolkit != null) {
+ toolkit.adapt(xHistoryViewer.getStatusLabel(), false, false);
+ }
+
+ Tree tree = xHistoryViewer.getTree();
+ GridData gridData = new GridData(GridData.FILL_BOTH);
+ gridData.heightHint = 100;
+ tree.setLayout(ALayout.getZeroMarginLayout());
+ tree.setLayoutData(gridData);
+ tree.setHeaderVisible(true);
+ tree.setLinesVisible(true);
+
+ new HistoryDragAndDrop(tree, HistoryXViewerFactory.NAMESPACE);
+ }
+
+ 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("\n");
+
+ rightComp = new Composite(bComp, SWT.NONE);
+ rightComp.setLayout(new GridLayout());
+ rightComp.setLayoutData(new GridData(GridData.END));
+ }
+
+ public void createToolBar() {
+
+ 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) {
+ setInputData(artifact, true);
+ }
+ });
+
+ OseeUiActions.addButtonToEditorToolBar(this, SkynetGuiPlugin.getInstance(), toolBar, HistoryView.VIEW_ID,
+ "Resource History");
+
+ new ActionContributionItem(xHistoryViewer.getCustomizeAction()).fill(toolBar, -1);
+
+ rightComp.layout();
+ rightComp.getParent().layout();
+ }
+
+ public void loadTable() {
+ refresh();
+ }
+
+ @SuppressWarnings("unchecked")
+ public ArrayList<Branch> getSelectedBranches() {
+ ArrayList<Branch> items = new ArrayList<Branch>();
+ if (xHistoryViewer == null) {
+ return items;
+ }
+ if (xHistoryViewer.getSelection().isEmpty()) {
+ return items;
+ }
+ Iterator i = ((IStructuredSelection) xHistoryViewer.getSelection()).iterator();
+ while (i.hasNext()) {
+ Object obj = i.next();
+ items.add((Branch) obj);
+ }
+ return items;
+ }
+
+ @Override
+ public Control getControl() {
+ return xHistoryViewer.getTree();
+ }
+
+ @Override
+ public void dispose() {
+ xHistoryViewer.dispose();
+ }
+
+ @Override
+ public void setFocus() {
+ xHistoryViewer.getTree().setFocus();
+ }
+
+ @Override
+ public void refresh() {
+ xHistoryViewer.refresh();
+ validate();
+ }
+
+ @Override
+ public IStatus isValid() {
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public String toHTML(String labelFont) {
+ return AHTML.simplePage("Unhandled");
+ }
+
+ /**
+ * @return Returns the xViewer.
+ */
+ public HistoryXViewer getXViewer() {
+ return xHistoryViewer;
+ }
+
+ @Override
+ public Object getData() {
+ return xHistoryViewer.getInput();
+ }
+
+ public void setInputData(final Artifact artifact, final boolean loadHistory) {
+ this.artifact = artifact;
+ extraInfoLabel.setText(LOADING);
+
+ Job job = new Job("History: " + artifact.getName()) {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ final Collection<Change> changes = new ArrayList<Change>();
+
+ try {
+ if (loadHistory) {
+ changes.addAll(ChangeManager.getChangesPerArtifact(artifact, monitor));
+ }
+
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ if (loadHistory) {
+ if (changes.isEmpty()) {
+ extraInfoLabel.setText(NO_HISTORY);
+ xHistoryViewer.setInput(changes);
+ } else {
+ String infoLabel =
+ String.format("History: %s on branch: %s", artifact.getName(),
+ artifact.getBranch().getShortName());
+ extraInfoLabel.setText(infoLabel);
+ xHistoryViewer.setInput(changes);
+ }
+ } else {
+ extraInfoLabel.setText("Cleared on shut down - press refresh to reload");
+ }
+ }
+ });
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ Jobs.startJob(job);
+ }
+
+ @Override
+ public String getReportData() {
+ return null;
+ }
+
+ @Override
+ public String getXmlData() {
+ return null;
+ }
+
+ @Override
+ public void setXmlData(String str) {
+ }
+ public class HistoryDragAndDrop extends SkynetDragAndDrop {
+
+ public HistoryDragAndDrop(Tree tree, String viewId) {
+ super(tree, viewId);
+ }
+
+ @Override
+ public void performDragOver(DropTargetEvent event) {
+ event.detail = DND.DROP_NONE;
+ }
+
+ @Override
+ public Artifact[] getArtifacts() {
+ IStructuredSelection selection = (IStructuredSelection) xHistoryViewer.getSelection();
+ ArrayList<Artifact> artifacts = new ArrayList<Artifact>();
+
+ if (selection != null && !selection.isEmpty()) {
+ for (Object object : selection.toArray()) {
+
+ if (object instanceof IAdaptable) {
+ Artifact artifact = (Artifact) ((IAdaptable) object).getAdapter(Artifact.class);
+
+ if (artifact != null) {
+ artifacts.add(artifact);
+ }
+ }
+ }
+ }
+ return artifacts.toArray(new Artifact[artifacts.size()]);
+ }
+ }
+
+ @Override
+ public String getActionDescription() {
+ StringBuffer sb = new StringBuffer();
+ if (artifact != null) {
+ sb.append("\nHistory : " + artifact.getName());
+ }
+ return sb.toString();
+ }
+
+ public Artifact getArtifact() {
+ return artifact;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xbargraph/XBarGraphLine.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xbargraph/XBarGraphLine.java
index 0ea01088605..50112b9e042 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xbargraph/XBarGraphLine.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xbargraph/XBarGraphLine.java
@@ -1,93 +1,93 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.xbargraph;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.swt.SWT;
-
-/**
- * @author Donald G. Dunne
- */
-public class XBarGraphLine {
- public static int DEFAULT_RED_FOREGROUND = SWT.COLOR_RED;
- public static int DEFAULT_RED_BACKGROUND = SWT.COLOR_YELLOW;
- public static int DEFAULT_GREEN_FOREGROUND = SWT.COLOR_GREEN;
- public static int DEFAULT_GREEN_BACKGROUND = SWT.COLOR_YELLOW;
- public static int DEFAULT_BLUE_FOREGROUND = SWT.COLOR_BLUE;
- public static int DEFAULT_BLUE_BACKGROUND = SWT.COLOR_YELLOW;
- public String name;
- List<XBarGraphLineSegment> segments = new ArrayList<XBarGraphLineSegment>();
-
- public XBarGraphLine(String name, int value) {
- this(name, DEFAULT_GREEN_FOREGROUND, DEFAULT_GREEN_BACKGROUND, value);
- }
-
- public XBarGraphLine(String name, int value, String valueStr) {
- this(name, DEFAULT_GREEN_FOREGROUND, DEFAULT_GREEN_BACKGROUND, value, valueStr);
- }
-
- public XBarGraphLine(String name, List<XBarGraphLineSegment> segments) {
- this.name = name;
- this.segments = segments;
- }
-
- public XBarGraphLine(String name, int foreground, int background, long value) {
- this(name, foreground, background, value, String.valueOf(value));
- }
-
- public XBarGraphLine(String name, int foreground, int background, long value, String valueStr) {
- this.name = name;
- segments.add(new XBarGraphLineSegment(valueStr, foreground, background, value));
- }
-
- public XBarGraphLine(String name, int foreground, int background, int remainingForeground, int remainingBackground, int value, String valueStr) {
- this(name, foreground, background, value, valueStr);
- segments.add(new XBarGraphLineSegment("", 100 - value));
- }
-
- public XBarGraphLine(String name, int foreground, int background, int remainingForeground, int remainingBackground, int value, String valueStr, String remainingValueStr) {
- this(name, foreground, background, value, valueStr);
- segments.add(new XBarGraphLineSegment(remainingValueStr, remainingForeground, remainingBackground, 100 - value));
- }
-
- /**
- * Shows as white until completed, then green
- *
- * @param name
- * @param value
- * @return XBarGraphLine
- */
- public static XBarGraphLine getPercentLine(String name, int value) {
- if (value == 100.0) {
- return new XBarGraphLine(name, DEFAULT_GREEN_FOREGROUND, DEFAULT_GREEN_BACKGROUND, value, value + "%");
- } else {
- return new XBarGraphLine(name, SWT.COLOR_WHITE, SWT.COLOR_WHITE, value, value + "%");
- }
- }
-
- public static XBarGraphLine getPercentLineBlueGreen(String name, int value) {
- if (value == 100.0) {
- return new XBarGraphLine(name, DEFAULT_GREEN_FOREGROUND, DEFAULT_GREEN_BACKGROUND, value, value + "%");
- } else {
- return new XBarGraphLine(name, SWT.COLOR_YELLOW, SWT.COLOR_GREEN, value, value + "%");
- }
- }
-
- public static XBarGraphLine getTextLine(String name, String value) {
- return new XBarGraphLine(name, SWT.COLOR_WHITE, SWT.COLOR_WHITE, 0, value);
- }
-
- public static XBarGraphLine getTextLineRedIfTrue(String name, String value, boolean isRed) {
- return new XBarGraphLine(name, isRed ? DEFAULT_RED_FOREGROUND : SWT.COLOR_WHITE,
- isRed ? DEFAULT_RED_BACKGROUND : SWT.COLOR_WHITE, isRed ? 100 : 0, 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.framework.ui.skynet.widgets.xbargraph;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.swt.SWT;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XBarGraphLine {
+ public static int DEFAULT_RED_FOREGROUND = SWT.COLOR_RED;
+ public static int DEFAULT_RED_BACKGROUND = SWT.COLOR_YELLOW;
+ public static int DEFAULT_GREEN_FOREGROUND = SWT.COLOR_GREEN;
+ public static int DEFAULT_GREEN_BACKGROUND = SWT.COLOR_YELLOW;
+ public static int DEFAULT_BLUE_FOREGROUND = SWT.COLOR_BLUE;
+ public static int DEFAULT_BLUE_BACKGROUND = SWT.COLOR_YELLOW;
+ public String name;
+ List<XBarGraphLineSegment> segments = new ArrayList<XBarGraphLineSegment>();
+
+ public XBarGraphLine(String name, int value) {
+ this(name, DEFAULT_GREEN_FOREGROUND, DEFAULT_GREEN_BACKGROUND, value);
+ }
+
+ public XBarGraphLine(String name, int value, String valueStr) {
+ this(name, DEFAULT_GREEN_FOREGROUND, DEFAULT_GREEN_BACKGROUND, value, valueStr);
+ }
+
+ public XBarGraphLine(String name, List<XBarGraphLineSegment> segments) {
+ this.name = name;
+ this.segments = segments;
+ }
+
+ public XBarGraphLine(String name, int foreground, int background, long value) {
+ this(name, foreground, background, value, String.valueOf(value));
+ }
+
+ public XBarGraphLine(String name, int foreground, int background, long value, String valueStr) {
+ this.name = name;
+ segments.add(new XBarGraphLineSegment(valueStr, foreground, background, value));
+ }
+
+ public XBarGraphLine(String name, int foreground, int background, int remainingForeground, int remainingBackground, int value, String valueStr) {
+ this(name, foreground, background, value, valueStr);
+ segments.add(new XBarGraphLineSegment("", 100 - value));
+ }
+
+ public XBarGraphLine(String name, int foreground, int background, int remainingForeground, int remainingBackground, int value, String valueStr, String remainingValueStr) {
+ this(name, foreground, background, value, valueStr);
+ segments.add(new XBarGraphLineSegment(remainingValueStr, remainingForeground, remainingBackground, 100 - value));
+ }
+
+ /**
+ * Shows as white until completed, then green
+ *
+ * @param name
+ * @param value
+ * @return XBarGraphLine
+ */
+ public static XBarGraphLine getPercentLine(String name, int value) {
+ if (value == 100.0) {
+ return new XBarGraphLine(name, DEFAULT_GREEN_FOREGROUND, DEFAULT_GREEN_BACKGROUND, value, value + "%");
+ } else {
+ return new XBarGraphLine(name, SWT.COLOR_WHITE, SWT.COLOR_WHITE, value, value + "%");
+ }
+ }
+
+ public static XBarGraphLine getPercentLineBlueGreen(String name, int value) {
+ if (value == 100.0) {
+ return new XBarGraphLine(name, DEFAULT_GREEN_FOREGROUND, DEFAULT_GREEN_BACKGROUND, value, value + "%");
+ } else {
+ return new XBarGraphLine(name, SWT.COLOR_YELLOW, SWT.COLOR_GREEN, value, value + "%");
+ }
+ }
+
+ public static XBarGraphLine getTextLine(String name, String value) {
+ return new XBarGraphLine(name, SWT.COLOR_WHITE, SWT.COLOR_WHITE, 0, value);
+ }
+
+ public static XBarGraphLine getTextLineRedIfTrue(String name, String value, boolean isRed) {
+ return new XBarGraphLine(name, isRed ? DEFAULT_RED_FOREGROUND : SWT.COLOR_WHITE,
+ isRed ? DEFAULT_RED_BACKGROUND : SWT.COLOR_WHITE, isRed ? 100 : 0, value);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xbargraph/XBarGraphLineSegment.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xbargraph/XBarGraphLineSegment.java
index 83dcddd4030..e74ec41c64d 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xbargraph/XBarGraphLineSegment.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xbargraph/XBarGraphLineSegment.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.framework.ui.skynet.widgets.xbargraph;
-
-import org.eclipse.swt.SWT;
-
-/**
- * @author Donald G. Dunne
- */
-public class XBarGraphLineSegment {
- public static int DEFAULT_RED_FOREGROUND = SWT.COLOR_RED;
- public static int DEFAULT_RED_BACKGROUND = SWT.COLOR_YELLOW;
- public static int DEFAULT_GREEN_FOREGROUND = SWT.COLOR_GREEN;
- public static int DEFAULT_GREEN_BACKGROUND = SWT.COLOR_YELLOW;
- String name;
- int foreground;
- int background;
- long value;
-
- public XBarGraphLineSegment(String name, long value) {
- this(name, DEFAULT_GREEN_FOREGROUND, DEFAULT_GREEN_BACKGROUND, value);
- }
-
- public XBarGraphLineSegment(String name, int color, long value) {
- this(name, color, color, value);
- }
-
- public XBarGraphLineSegment(String name, int foreground, int background, long value) {
- this.name = name;
- this.foreground = foreground;
- this.background = background;
- this.value = value;
- }
-
- public static XBarGraphLineSegment getPercentSegment(String name, long value) {
- return new XBarGraphLineSegment(value + "%", DEFAULT_GREEN_FOREGROUND, DEFAULT_GREEN_BACKGROUND, value);
- }
-
- public static XBarGraphLineSegment getPercentSegment(String name, int color, long value) {
- return new XBarGraphLineSegment(value + "%", color, color, 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.framework.ui.skynet.widgets.xbargraph;
+
+import org.eclipse.swt.SWT;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XBarGraphLineSegment {
+ public static int DEFAULT_RED_FOREGROUND = SWT.COLOR_RED;
+ public static int DEFAULT_RED_BACKGROUND = SWT.COLOR_YELLOW;
+ public static int DEFAULT_GREEN_FOREGROUND = SWT.COLOR_GREEN;
+ public static int DEFAULT_GREEN_BACKGROUND = SWT.COLOR_YELLOW;
+ String name;
+ int foreground;
+ int background;
+ long value;
+
+ public XBarGraphLineSegment(String name, long value) {
+ this(name, DEFAULT_GREEN_FOREGROUND, DEFAULT_GREEN_BACKGROUND, value);
+ }
+
+ public XBarGraphLineSegment(String name, int color, long value) {
+ this(name, color, color, value);
+ }
+
+ public XBarGraphLineSegment(String name, int foreground, int background, long value) {
+ this.name = name;
+ this.foreground = foreground;
+ this.background = background;
+ this.value = value;
+ }
+
+ public static XBarGraphLineSegment getPercentSegment(String name, long value) {
+ return new XBarGraphLineSegment(value + "%", DEFAULT_GREEN_FOREGROUND, DEFAULT_GREEN_BACKGROUND, value);
+ }
+
+ public static XBarGraphLineSegment getPercentSegment(String name, int color, long value) {
+ return new XBarGraphLineSegment(value + "%", color, color, value);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xbargraph/XBarGraphTable.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xbargraph/XBarGraphTable.java
index 13068f43b9c..18b37d0aebb 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xbargraph/XBarGraphTable.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xbargraph/XBarGraphTable.java
@@ -1,217 +1,217 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.xbargraph;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.GC;
-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.Display;
-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.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-
-/**
- * @author Donald G. Dunne
- */
-public class XBarGraphTable extends XWidget {
-
- private final String itemHeader;
- private final String percentHeader;
- private Table table;
- private final List<XBarGraphLine> lines;
- private boolean isHeaderVisible = true;
- private boolean isLinesVisible = true;
-
- public XBarGraphTable(String label, String itemHeader, String percentHeader, List<XBarGraphLine> lines) {
- super(label);
- this.itemHeader = itemHeader;
- this.percentHeader = percentHeader;
- this.lines = lines;
- }
-
- @Override
- protected void createControls(Composite parent, int horizontalSpan) {
- labelWidget = new Label(parent, SWT.NONE);
- labelWidget.setText(getLabel() + ": ");
-
- table = new Table(parent, SWT.BORDER);
- table.setHeaderVisible(isHeaderVisible);
- table.setLinesVisible(isLinesVisible);
- if (isFillHorizontally()) {
- table.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- }
- TableColumn column1 = new TableColumn(table, SWT.NONE);
- column1.setText(itemHeader);
- column1.setWidth(300);
- final TableColumn column2 = new TableColumn(table, SWT.NONE);
- column2.setText(percentHeader);
- column2.setWidth(500);
- for (XBarGraphLine line : lines) {
- TableItem item = new TableItem(table, SWT.NONE);
- item.setText(line.name);
- }
-
- /*
- * NOTE: MeasureItem, PaintItem and EraseItem are called repeatedly. Therefore, it is critical for performance
- * that these methods be as efficient as possible.
- */
- table.addListener(SWT.PaintItem, new Listener() {
- public void handleEvent(Event event) {
- if (event.index == 1) {
- GC gc = event.gc;
- TableItem item = (TableItem) event.item;
- int index = table.indexOf(item);
- XBarGraphLine line = lines.get(index);
- int cummulativeWidth = 0;
- for (XBarGraphLineSegment seg : line.segments) {
- Color foreground = gc.getForeground();
- Color background = gc.getBackground();
- gc.setForeground(Displays.getSystemColor(seg.foreground));
- gc.setBackground(Displays.getSystemColor(seg.background));
- int width = (column2.getWidth()) * (int) seg.value / 100;
- gc.fillGradientRectangle(event.x + cummulativeWidth, event.y, width, event.height, true);
- Rectangle rect2 = new Rectangle(event.x + cummulativeWidth, event.y, width - 1, event.height - 1);
- gc.drawRectangle(rect2);
- if (seg.name != null && !seg.name.equals("")) {
- gc.setForeground(Displays.getSystemColor(SWT.COLOR_LIST_FOREGROUND));
- Point size = event.gc.textExtent(seg.name);
- int offset = Math.max(0, (event.height - size.y) / 2);
- gc.drawText(seg.name, event.x + cummulativeWidth + 5, event.y + offset, true);
- gc.setForeground(background);
- gc.setBackground(foreground);
- }
- cummulativeWidth += width;
- }
- }
- }
- });
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public Control getControl() {
- return table;
- }
-
- @Override
- public Object getData() {
- return null;
- }
-
- @Override
- public String getReportData() {
- return null;
- }
-
- @Override
- public String getXmlData() {
- return null;
- }
-
- @Override
- public IStatus isValid() {
- return Status.OK_STATUS;
- }
-
- @Override
- public void refresh() {
- }
-
- @Override
- public void setFocus() {
- }
-
- @Override
- public void setXmlData(String str) {
- }
-
- @Override
- public String toHTML(String labelFont) {
- return null;
- }
-
- public static void main(String[] args) {
- final Display display = new Display();
- Shell shell = new Shell(display);
- shell.setLayout(new GridLayout(1, false));
- shell.setText("Show results as a bar chart in Table");
-
- List<XBarGraphLine> lines = new ArrayList<XBarGraphLine>();
- lines.add(XBarGraphLine.getPercentLine("Fix", 34));
- lines.add(XBarGraphLine.getPercentLine("Improvement", 100));
- lines.add(new XBarGraphLine("Support", SWT.COLOR_GREEN, SWT.COLOR_YELLOW, SWT.COLOR_RED, SWT.COLOR_YELLOW, 33,
- "33%", "67%"));
- List<XBarGraphLineSegment> segments = new ArrayList<XBarGraphLineSegment>();
- segments.add(XBarGraphLineSegment.getPercentSegment("23%", SWT.COLOR_GREEN, 23));
- segments.add(XBarGraphLineSegment.getPercentSegment("45%", SWT.COLOR_BLUE, 45));
- segments.add(XBarGraphLineSegment.getPercentSegment("20%", SWT.COLOR_YELLOW, 20));
- segments.add(XBarGraphLineSegment.getPercentSegment("12%", SWT.COLOR_MAGENTA, 12));
- lines.add(new XBarGraphLine("Other", segments));
- XBarGraphTable table = new XBarGraphTable("By Improvement", "", "Percent", lines);
- table.createWidgets(shell, 1);
-
- shell.pack();
- shell.open();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch()) {
- display.sleep();
- }
- }
- display.dispose();
- }
-
- /**
- * @return the isHeaderVisible
- */
- public boolean isHeaderVisible() {
- return isHeaderVisible;
- }
-
- /**
- * @param isHeaderVisible the isHeaderVisible to set
- */
- public void setHeaderVisible(boolean isHeaderVisible) {
- this.isHeaderVisible = isHeaderVisible;
- }
-
- /**
- * @return the isLinesVisible
- */
- public boolean isLinesVisible() {
- return isLinesVisible;
- }
-
- /**
- * @param isLinesVisible the isLinesVisible to set
- */
- public void setLinesVisible(boolean isLinesVisible) {
- this.isLinesVisible = isLinesVisible;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.xbargraph;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osee.framework.ui.skynet.widgets.XWidget;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+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.Display;
+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.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XBarGraphTable extends XWidget {
+
+ private final String itemHeader;
+ private final String percentHeader;
+ private Table table;
+ private final List<XBarGraphLine> lines;
+ private boolean isHeaderVisible = true;
+ private boolean isLinesVisible = true;
+
+ public XBarGraphTable(String label, String itemHeader, String percentHeader, List<XBarGraphLine> lines) {
+ super(label);
+ this.itemHeader = itemHeader;
+ this.percentHeader = percentHeader;
+ this.lines = lines;
+ }
+
+ @Override
+ protected void createControls(Composite parent, int horizontalSpan) {
+ labelWidget = new Label(parent, SWT.NONE);
+ labelWidget.setText(getLabel() + ": ");
+
+ table = new Table(parent, SWT.BORDER);
+ table.setHeaderVisible(isHeaderVisible);
+ table.setLinesVisible(isLinesVisible);
+ if (isFillHorizontally()) {
+ table.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ }
+ TableColumn column1 = new TableColumn(table, SWT.NONE);
+ column1.setText(itemHeader);
+ column1.setWidth(300);
+ final TableColumn column2 = new TableColumn(table, SWT.NONE);
+ column2.setText(percentHeader);
+ column2.setWidth(500);
+ for (XBarGraphLine line : lines) {
+ TableItem item = new TableItem(table, SWT.NONE);
+ item.setText(line.name);
+ }
+
+ /*
+ * NOTE: MeasureItem, PaintItem and EraseItem are called repeatedly. Therefore, it is critical for performance
+ * that these methods be as efficient as possible.
+ */
+ table.addListener(SWT.PaintItem, new Listener() {
+ public void handleEvent(Event event) {
+ if (event.index == 1) {
+ GC gc = event.gc;
+ TableItem item = (TableItem) event.item;
+ int index = table.indexOf(item);
+ XBarGraphLine line = lines.get(index);
+ int cummulativeWidth = 0;
+ for (XBarGraphLineSegment seg : line.segments) {
+ Color foreground = gc.getForeground();
+ Color background = gc.getBackground();
+ gc.setForeground(Displays.getSystemColor(seg.foreground));
+ gc.setBackground(Displays.getSystemColor(seg.background));
+ int width = (column2.getWidth()) * (int) seg.value / 100;
+ gc.fillGradientRectangle(event.x + cummulativeWidth, event.y, width, event.height, true);
+ Rectangle rect2 = new Rectangle(event.x + cummulativeWidth, event.y, width - 1, event.height - 1);
+ gc.drawRectangle(rect2);
+ if (seg.name != null && !seg.name.equals("")) {
+ gc.setForeground(Displays.getSystemColor(SWT.COLOR_LIST_FOREGROUND));
+ Point size = event.gc.textExtent(seg.name);
+ int offset = Math.max(0, (event.height - size.y) / 2);
+ gc.drawText(seg.name, event.x + cummulativeWidth + 5, event.y + offset, true);
+ gc.setForeground(background);
+ gc.setBackground(foreground);
+ }
+ cummulativeWidth += width;
+ }
+ }
+ }
+ });
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public Control getControl() {
+ return table;
+ }
+
+ @Override
+ public Object getData() {
+ return null;
+ }
+
+ @Override
+ public String getReportData() {
+ return null;
+ }
+
+ @Override
+ public String getXmlData() {
+ return null;
+ }
+
+ @Override
+ public IStatus isValid() {
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public void refresh() {
+ }
+
+ @Override
+ public void setFocus() {
+ }
+
+ @Override
+ public void setXmlData(String str) {
+ }
+
+ @Override
+ public String toHTML(String labelFont) {
+ return null;
+ }
+
+ public static void main(String[] args) {
+ final Display display = new Display();
+ Shell shell = new Shell(display);
+ shell.setLayout(new GridLayout(1, false));
+ shell.setText("Show results as a bar chart in Table");
+
+ List<XBarGraphLine> lines = new ArrayList<XBarGraphLine>();
+ lines.add(XBarGraphLine.getPercentLine("Fix", 34));
+ lines.add(XBarGraphLine.getPercentLine("Improvement", 100));
+ lines.add(new XBarGraphLine("Support", SWT.COLOR_GREEN, SWT.COLOR_YELLOW, SWT.COLOR_RED, SWT.COLOR_YELLOW, 33,
+ "33%", "67%"));
+ List<XBarGraphLineSegment> segments = new ArrayList<XBarGraphLineSegment>();
+ segments.add(XBarGraphLineSegment.getPercentSegment("23%", SWT.COLOR_GREEN, 23));
+ segments.add(XBarGraphLineSegment.getPercentSegment("45%", SWT.COLOR_BLUE, 45));
+ segments.add(XBarGraphLineSegment.getPercentSegment("20%", SWT.COLOR_YELLOW, 20));
+ segments.add(XBarGraphLineSegment.getPercentSegment("12%", SWT.COLOR_MAGENTA, 12));
+ lines.add(new XBarGraphLine("Other", segments));
+ XBarGraphTable table = new XBarGraphTable("By Improvement", "", "Percent", lines);
+ table.createWidgets(shell, 1);
+
+ shell.pack();
+ shell.open();
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
+ }
+ }
+ display.dispose();
+ }
+
+ /**
+ * @return the isHeaderVisible
+ */
+ public boolean isHeaderVisible() {
+ return isHeaderVisible;
+ }
+
+ /**
+ * @param isHeaderVisible the isHeaderVisible to set
+ */
+ public void setHeaderVisible(boolean isHeaderVisible) {
+ this.isHeaderVisible = isHeaderVisible;
+ }
+
+ /**
+ * @return the isLinesVisible
+ */
+ public boolean isLinesVisible() {
+ return isLinesVisible;
+ }
+
+ /**
+ * @param isLinesVisible the isLinesVisible to set
+ */
+ public void setLinesVisible(boolean isLinesVisible) {
+ this.isLinesVisible = isLinesVisible;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/ChangeXViewer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/ChangeXViewer.java
index 2655daa4e22..667ab151176 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/ChangeXViewer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/ChangeXViewer.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.framework.ui.skynet.widgets.xchange;
-
-import java.util.ArrayList;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.nebula.widgets.xviewer.IXViewerFactory;
-import org.eclipse.nebula.widgets.xviewer.XViewer;
-import org.eclipse.nebula.widgets.xviewer.XViewerTextFilter;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.change.Change;
-import org.eclipse.osee.framework.ui.skynet.commandHandlers.change.ViewWordChangeReportHandler;
-import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
-import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.TreeItem;
-
-/**
- * @author Donald G. Dunne
- * @author Jeff C. Phillips
- */
-public class ChangeXViewer extends XViewer {
-
- private XChangeTextFilter xChangeTextFilter;
-
- public ChangeXViewer(Composite parent, int style, IXViewerFactory factory) {
- super(parent, style, factory);
- getTree().addKeyListener(new KeySelectedListener());
- }
-
- @Override
- public void handleDoubleClick() {
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.xchange;
+
+import java.util.ArrayList;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.nebula.widgets.xviewer.IXViewerFactory;
+import org.eclipse.nebula.widgets.xviewer.XViewer;
+import org.eclipse.nebula.widgets.xviewer.XViewerTextFilter;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.change.Change;
+import org.eclipse.osee.framework.ui.skynet.commandHandlers.change.ViewWordChangeReportHandler;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
+import org.eclipse.osee.framework.ui.skynet.render.RendererManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * @author Donald G. Dunne
+ * @author Jeff C. Phillips
+ */
+public class ChangeXViewer extends XViewer {
+
+ private XChangeTextFilter xChangeTextFilter;
+
+ public ChangeXViewer(Composite parent, int style, IXViewerFactory factory) {
+ super(parent, style, factory);
+ getTree().addKeyListener(new KeySelectedListener());
+ }
+
+ @Override
+ public void handleDoubleClick() {
if (getSelectedChanges().isEmpty()) {
return;
}
-
+
Change change = getSelectedChanges().iterator().next();
Artifact artifact = (Artifact) ((IAdaptable) change).getAdapter(Artifact.class);
-
+
if (artifact != null) {
RendererManager.openInJob(artifact, PresentationType.DEFAULT_OPEN);
- }
- }
-
- private class KeySelectedListener implements KeyListener {
- public void keyPressed(KeyEvent e) {
- }
-
- public void keyReleased(KeyEvent e) {
- if (e.keyCode == SWT.F5) {
- System.out.println("pressed");
- ViewWordChangeReportHandler handler = (new ViewWordChangeReportHandler());
- if (handler.isEnabled()) {
- handler.execute(null);
- }
- }
- }
- }
-
- public ArrayList<Change> getSelectedChanges() {
- ArrayList<Change> arts = new ArrayList<Change>();
- TreeItem items[] = getTree().getSelection();
-
- if (items.length > 0) {
- for (TreeItem item : items) {
- arts.add((Change) item.getData());
- }
- }
- return arts;
- }
-
- @Override
- public void dispose() {
- getLabelProvider().dispose();
- }
-
- @Override
- public String getStatusString() {
- if (isShowDocumentOrderFilter()) {
- return "[Show Document Order]";
- }
- return "";
- }
-
- @Override
- public XViewerTextFilter getXViewerTextFilter() {
- if (xChangeTextFilter == null) {
- xChangeTextFilter = new XChangeTextFilter(this);
- }
- return xChangeTextFilter;
- }
-
- public boolean isShowDocumentOrderFilter() {
- if (xChangeTextFilter == null) {
- xChangeTextFilter = new XChangeTextFilter(this);
- }
- return xChangeTextFilter.isShowDocumentOrderFilter();
- }
-
- public void setShowDocumentOrderFilter(boolean showDocumentOrderFilter) {
- if (xChangeTextFilter == null) {
- xChangeTextFilter = new XChangeTextFilter(this);
- }
- xChangeTextFilter.setShowDocumentOrderFilter(showDocumentOrderFilter);
- }
-
+ }
+ }
+
+ private class KeySelectedListener implements KeyListener {
+ public void keyPressed(KeyEvent e) {
+ }
+
+ public void keyReleased(KeyEvent e) {
+ if (e.keyCode == SWT.F5) {
+ System.out.println("pressed");
+ ViewWordChangeReportHandler handler = (new ViewWordChangeReportHandler());
+ if (handler.isEnabled()) {
+ handler.execute(null);
+ }
+ }
+ }
+ }
+
+ public ArrayList<Change> getSelectedChanges() {
+ ArrayList<Change> arts = new ArrayList<Change>();
+ TreeItem items[] = getTree().getSelection();
+
+ if (items.length > 0) {
+ for (TreeItem item : items) {
+ arts.add((Change) item.getData());
+ }
+ }
+ return arts;
+ }
+
+ @Override
+ public void dispose() {
+ getLabelProvider().dispose();
+ }
+
+ @Override
+ public String getStatusString() {
+ if (isShowDocumentOrderFilter()) {
+ return "[Show Document Order]";
+ }
+ return "";
+ }
+
+ @Override
+ public XViewerTextFilter getXViewerTextFilter() {
+ if (xChangeTextFilter == null) {
+ xChangeTextFilter = new XChangeTextFilter(this);
+ }
+ return xChangeTextFilter;
+ }
+
+ public boolean isShowDocumentOrderFilter() {
+ if (xChangeTextFilter == null) {
+ xChangeTextFilter = new XChangeTextFilter(this);
+ }
+ return xChangeTextFilter.isShowDocumentOrderFilter();
+ }
+
+ public void setShowDocumentOrderFilter(boolean showDocumentOrderFilter) {
+ if (xChangeTextFilter == null) {
+ xChangeTextFilter = new XChangeTextFilter(this);
+ }
+ xChangeTextFilter.setShowDocumentOrderFilter(showDocumentOrderFilter);
+ }
+
@Override
- public boolean isRemoveItemsMenuOptionEnabled() {
- return false;
- }
-
-}
+ public boolean isRemoveItemsMenuOptionEnabled() {
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/ChangeXViewerFactory.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/ChangeXViewerFactory.java
index dca06dafb1a..c45f38d8058 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/ChangeXViewerFactory.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/ChangeXViewerFactory.java
@@ -1,71 +1,71 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.xchange;
-
-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.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.SkynetXViewerFactory;
-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 ChangeXViewerFactory extends SkynetXViewerFactory {
-
- public static XViewerColumn Name =
- new XViewerColumn("framework.change.artifactNames", "Artifact name(s)", 250, SWT.LEFT, true,
- SortDataType.String, false, null);
- public static XViewerColumn Item_Type =
- new XViewerColumn("framework.change.itemType", "Item Type", 100, SWT.LEFT, true, SortDataType.String, false,
- null);
- public static XViewerColumn Item_Kind =
- new XViewerColumn("framework.change.itemKind", "Item Kind", 70, SWT.LEFT, true, SortDataType.String, false,
- null);
- public static XViewerColumn Change_Type =
- new XViewerColumn("framework.change.changeType", "Change Type", 50, SWT.LEFT, true, SortDataType.String,
- false, null);
- public static XViewerColumn Is_Value =
- new XViewerColumn("framework.change.isValue", "Is Value", 150, SWT.LEFT, true, SortDataType.String, false,
- null);
- public static XViewerColumn Was_Value =
- new XViewerColumn("framework.change.wasValue", "Was Value", 150, SWT.LEFT, true, SortDataType.String, false,
- null);
- public static XViewerColumn paraNumber =
- new XViewerColumn("attribute.Imported Paragraph Number", CoreAttributeTypes.PARAGRAPH_NUMBER.getName(), 50,
- SWT.LEFT, false, SortDataType.Paragraph_Number, false, null);
-
- public static String NAMESPACE = "osee.skynet.gui.ChangeXViewer";
-
- public ChangeXViewerFactory() {
- super(NAMESPACE);
- registerColumns(Name, Item_Type, Item_Kind, Change_Type, Is_Value, Was_Value, paraNumber);
- registerColumns(new XViewerHridColumn());
- registerColumns(new XViewerGuidColumn(false));
- registerColumns(new XViewerArtifactTypeColumn("framework.change.artifactType", "Artifact Type", true));
- registerColumns(new XViewerLastModifiedDateColumn(false));
- registerColumns(new XViewerLastModifiedByColumn(false));
- registerAllAttributeColumns();
- }
-
- @Override
- public XViewerSorter createNewXSorter(XViewer xViewer) {
- return new XViewerSorter(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.framework.ui.skynet.widgets.xchange;
+
+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.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.SkynetXViewerFactory;
+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 ChangeXViewerFactory extends SkynetXViewerFactory {
+
+ public static XViewerColumn Name =
+ new XViewerColumn("framework.change.artifactNames", "Artifact name(s)", 250, SWT.LEFT, true,
+ SortDataType.String, false, null);
+ public static XViewerColumn Item_Type =
+ new XViewerColumn("framework.change.itemType", "Item Type", 100, SWT.LEFT, true, SortDataType.String, false,
+ null);
+ public static XViewerColumn Item_Kind =
+ new XViewerColumn("framework.change.itemKind", "Item Kind", 70, SWT.LEFT, true, SortDataType.String, false,
+ null);
+ public static XViewerColumn Change_Type =
+ new XViewerColumn("framework.change.changeType", "Change Type", 50, SWT.LEFT, true, SortDataType.String,
+ false, null);
+ public static XViewerColumn Is_Value =
+ new XViewerColumn("framework.change.isValue", "Is Value", 150, SWT.LEFT, true, SortDataType.String, false,
+ null);
+ public static XViewerColumn Was_Value =
+ new XViewerColumn("framework.change.wasValue", "Was Value", 150, SWT.LEFT, true, SortDataType.String, false,
+ null);
+ public static XViewerColumn paraNumber =
+ new XViewerColumn("attribute.Imported Paragraph Number", CoreAttributeTypes.PARAGRAPH_NUMBER.getName(), 50,
+ SWT.LEFT, false, SortDataType.Paragraph_Number, false, null);
+
+ public static String NAMESPACE = "osee.skynet.gui.ChangeXViewer";
+
+ public ChangeXViewerFactory() {
+ super(NAMESPACE);
+ registerColumns(Name, Item_Type, Item_Kind, Change_Type, Is_Value, Was_Value, paraNumber);
+ registerColumns(new XViewerHridColumn());
+ registerColumns(new XViewerGuidColumn(false));
+ registerColumns(new XViewerArtifactTypeColumn("framework.change.artifactType", "Artifact Type", true));
+ registerColumns(new XViewerLastModifiedDateColumn(false));
+ registerColumns(new XViewerLastModifiedByColumn(false));
+ registerAllAttributeColumns();
+ }
+
+ @Override
+ public XViewerSorter createNewXSorter(XViewer xViewer) {
+ return new XViewerSorter(xViewer);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/DefaultHierarchySorter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/DefaultHierarchySorter.java
index fc08e2daf8c..9c05a2e6138 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/DefaultHierarchySorter.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/DefaultHierarchySorter.java
@@ -8,8 +8,8 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.xchange;
-
+package org.eclipse.osee.framework.ui.skynet.widgets.xchange;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -20,93 +20,93 @@ import java.util.Set;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.OseeSystemArtifacts;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-
-/**
- * @author Jeff C. Phillips
- */
-public class DefaultHierarchySorter {
- private Map<Artifact, Set<Artifact>> childrenMap;
- private ArrayList<Artifact> orderedList;
- private Set<Artifact> orginalList;
-
- public List<Artifact> sort(Collection<Artifact> artifacts) throws OseeCoreException {
- childrenMap = new HashMap<Artifact, Set<Artifact>>();
- orderedList = new ArrayList<Artifact>();
- orginalList = new HashSet<Artifact>();
-
- if(artifacts.isEmpty()){
- return orderedList;
- }
-
- for (Artifact artifact : artifacts) {
- createAncestorTree(artifact);
- orginalList.add(artifact);
- }
-
- orderChildren(OseeSystemArtifacts.getDefaultHierarchyRootArtifact(artifacts.iterator().next().getBranch()));
- addDeletedArtifacts();
-
- if (artifacts.size() != orderedList.size()) {
- throw new OseeCoreException("Error in sorting artifacts");
- }
-
- return orderedList;
- }
-
- private void addDeletedArtifacts() {
- for (Artifact artifact : orderedList) {
- if (orginalList.contains(artifact)) {
- orginalList.remove(artifact);
- }
- }
-
- orderedList.addAll(orginalList);
- }
-
- private void orderChildren(Artifact parent) throws OseeCoreException {
- if (orginalList.contains(parent)) {
- orderedList.add(parent);
- }
-
- if (childrenMap.get(parent) == null) {
- return;
- }
-
- if (childrenMap.get(parent).size() > 1) {
- for (Artifact child : parent.getChildren(true)) {
- if (childrenMap.get(parent).contains(child)) {
- orderChildren(child);
- }
- }
- } else if ((childrenMap.get(parent).size() == 1)) {
- orderChildren(childrenMap.get(parent).iterator().next());
- }
- }
-
- private void createAncestorTree(Artifact child) throws OseeCoreException {
- Artifact parent = child.getParent();
-
- while (parent != null) {
- if (!insertChild(parent, child)) {
- return;
- }
-
- child = parent;
- parent = child.getParent();
-
- if (parent != null) {
- createAncestorTree(parent);
- }
- }
- }
-
- private boolean insertChild(Artifact parent, Artifact child) {
- Set<Artifact> children = childrenMap.get(parent);
- if (children == null) {
- children = new HashSet<Artifact>();
- childrenMap.put(parent, children);
- }
- return children.add(child);
- }
-
-}
+
+/**
+ * @author Jeff C. Phillips
+ */
+public class DefaultHierarchySorter {
+ private Map<Artifact, Set<Artifact>> childrenMap;
+ private ArrayList<Artifact> orderedList;
+ private Set<Artifact> orginalList;
+
+ public List<Artifact> sort(Collection<Artifact> artifacts) throws OseeCoreException {
+ childrenMap = new HashMap<Artifact, Set<Artifact>>();
+ orderedList = new ArrayList<Artifact>();
+ orginalList = new HashSet<Artifact>();
+
+ if(artifacts.isEmpty()){
+ return orderedList;
+ }
+
+ for (Artifact artifact : artifacts) {
+ createAncestorTree(artifact);
+ orginalList.add(artifact);
+ }
+
+ orderChildren(OseeSystemArtifacts.getDefaultHierarchyRootArtifact(artifacts.iterator().next().getBranch()));
+ addDeletedArtifacts();
+
+ if (artifacts.size() != orderedList.size()) {
+ throw new OseeCoreException("Error in sorting artifacts");
+ }
+
+ return orderedList;
+ }
+
+ private void addDeletedArtifacts() {
+ for (Artifact artifact : orderedList) {
+ if (orginalList.contains(artifact)) {
+ orginalList.remove(artifact);
+ }
+ }
+
+ orderedList.addAll(orginalList);
+ }
+
+ private void orderChildren(Artifact parent) throws OseeCoreException {
+ if (orginalList.contains(parent)) {
+ orderedList.add(parent);
+ }
+
+ if (childrenMap.get(parent) == null) {
+ return;
+ }
+
+ if (childrenMap.get(parent).size() > 1) {
+ for (Artifact child : parent.getChildren(true)) {
+ if (childrenMap.get(parent).contains(child)) {
+ orderChildren(child);
+ }
+ }
+ } else if ((childrenMap.get(parent).size() == 1)) {
+ orderChildren(childrenMap.get(parent).iterator().next());
+ }
+ }
+
+ private void createAncestorTree(Artifact child) throws OseeCoreException {
+ Artifact parent = child.getParent();
+
+ while (parent != null) {
+ if (!insertChild(parent, child)) {
+ return;
+ }
+
+ child = parent;
+ parent = child.getParent();
+
+ if (parent != null) {
+ createAncestorTree(parent);
+ }
+ }
+ }
+
+ private boolean insertChild(Artifact parent, Artifact child) {
+ Set<Artifact> children = childrenMap.get(parent);
+ if (children == null) {
+ children = new HashSet<Artifact>();
+ childrenMap.put(parent, children);
+ }
+ return children.add(child);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/XChangeTextFilter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/XChangeTextFilter.java
index abfbe93c0bc..986899e8bfb 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/XChangeTextFilter.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xchange/XChangeTextFilter.java
@@ -1,95 +1,95 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.xchange;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.nebula.widgets.xviewer.XViewerTextFilter;
-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.change.ArtifactChange;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-
-/**
- * @author Donald G. Dunne
- */
-public class XChangeTextFilter extends XViewerTextFilter {
-
- private final List<ArtifactChange> orderedChanges;
- private boolean showDocumentOrderFilter;
- private int lastSize;
-
- public XChangeTextFilter(ChangeXViewer changeXViewer) {
- super(changeXViewer);
- this.orderedChanges = new ArrayList<ArtifactChange>();
- lastSize = -1;
- }
-
- public boolean isShowDocumentOrderFilter() {
- return showDocumentOrderFilter;
- }
-
- public void setShowDocumentOrderFilter(boolean showDocumentOrderFilter) {
- this.showDocumentOrderFilter = showDocumentOrderFilter;
- lastSize = -1;
- }
-
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- boolean accept = false;
- if (isShowDocumentOrderFilter()) {
- if (parentElement instanceof Collection<?>) {
- Collection<?> data = (Collection<?>) parentElement;
- if (data.size() == 1 && data.iterator().next() instanceof String) {
- accept = super.select(viewer, parentElement, element);
- } else {
- if (lastSize != data.size()) {
- try {
- computeDocOrder(data);
- lastSize = data.size();
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- accept = orderedChanges.contains(element);
- }
- }
- } else {
- accept = super.select(viewer, parentElement, element);
- }
- return accept;
- }
-
- private void computeDocOrder(Collection<?> data) throws OseeCoreException {
- Map<Artifact, ArtifactChange> artChangeMap = new HashMap<Artifact, ArtifactChange>();
- for (Object object : data) {
- if (object instanceof ArtifactChange) {
- ArtifactChange artifactChanged = (ArtifactChange) object;
- Artifact artifact = artifactChanged.getChangeArtifact();
- if (artifact != null) {
- artChangeMap.put(artifact, artifactChanged);
- }
- }
- }
- orderedChanges.clear();
- DefaultHierarchySorter sorter = new DefaultHierarchySorter();
- List<Artifact> sortedArtifacts = sorter.sort(artChangeMap.keySet());
- for (Artifact artifact : sortedArtifacts) {
- orderedChanges.add(artChangeMap.get(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.framework.ui.skynet.widgets.xchange;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.nebula.widgets.xviewer.XViewerTextFilter;
+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.change.ArtifactChange;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XChangeTextFilter extends XViewerTextFilter {
+
+ private final List<ArtifactChange> orderedChanges;
+ private boolean showDocumentOrderFilter;
+ private int lastSize;
+
+ public XChangeTextFilter(ChangeXViewer changeXViewer) {
+ super(changeXViewer);
+ this.orderedChanges = new ArrayList<ArtifactChange>();
+ lastSize = -1;
+ }
+
+ public boolean isShowDocumentOrderFilter() {
+ return showDocumentOrderFilter;
+ }
+
+ public void setShowDocumentOrderFilter(boolean showDocumentOrderFilter) {
+ this.showDocumentOrderFilter = showDocumentOrderFilter;
+ lastSize = -1;
+ }
+
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ boolean accept = false;
+ if (isShowDocumentOrderFilter()) {
+ if (parentElement instanceof Collection<?>) {
+ Collection<?> data = (Collection<?>) parentElement;
+ if (data.size() == 1 && data.iterator().next() instanceof String) {
+ accept = super.select(viewer, parentElement, element);
+ } else {
+ if (lastSize != data.size()) {
+ try {
+ computeDocOrder(data);
+ lastSize = data.size();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ accept = orderedChanges.contains(element);
+ }
+ }
+ } else {
+ accept = super.select(viewer, parentElement, element);
+ }
+ return accept;
+ }
+
+ private void computeDocOrder(Collection<?> data) throws OseeCoreException {
+ Map<Artifact, ArtifactChange> artChangeMap = new HashMap<Artifact, ArtifactChange>();
+ for (Object object : data) {
+ if (object instanceof ArtifactChange) {
+ ArtifactChange artifactChanged = (ArtifactChange) object;
+ Artifact artifact = artifactChanged.getChangeArtifact();
+ if (artifact != null) {
+ artChangeMap.put(artifact, artifactChanged);
+ }
+ }
+ }
+ orderedChanges.clear();
+ DefaultHierarchySorter sorter = new DefaultHierarchySorter();
+ List<Artifact> sortedArtifacts = sorter.sort(artChangeMap.keySet());
+ for (Artifact artifact : sortedArtifacts) {
+ orderedChanges.add(artChangeMap.get(artifact));
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeUtility.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeUtility.java
index f49eaaf7894..dcc7cda3d49 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeUtility.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeUtility.java
@@ -1,77 +1,77 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.widgets.xmerge;
-
-import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.INCLUDE_DELETED;
-import java.io.File;
-import java.io.IOException;
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-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.dialogs.MessageDialog;
-import org.eclipse.osee.framework.core.enums.ConflictType;
-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.TransactionRecord;
-import org.eclipse.osee.framework.jdk.core.text.change.ChangeSet;
-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.plugin.core.util.AIFile;
-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.search.ArtifactQuery;
-import org.eclipse.osee.framework.skynet.core.attribute.WordAttribute;
-import org.eclipse.osee.framework.skynet.core.change.ArtifactDelta;
-import org.eclipse.osee.framework.skynet.core.conflict.ArtifactConflict;
-import org.eclipse.osee.framework.skynet.core.conflict.AttributeConflict;
-import org.eclipse.osee.framework.skynet.core.conflict.Conflict;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
-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.render.VbaWordDiffGenerator;
-import org.eclipse.osee.framework.ui.skynet.revert.RevertWizard;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.NonmodalWizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Theron Virgin
- */
-public class MergeUtility {
- /*
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.widgets.xmerge;
+
+import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.INCLUDE_DELETED;
+import java.io.File;
+import java.io.IOException;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+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.dialogs.MessageDialog;
+import org.eclipse.osee.framework.core.enums.ConflictType;
+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.TransactionRecord;
+import org.eclipse.osee.framework.jdk.core.text.change.ChangeSet;
+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.plugin.core.util.AIFile;
+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.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.attribute.WordAttribute;
+import org.eclipse.osee.framework.skynet.core.change.ArtifactDelta;
+import org.eclipse.osee.framework.skynet.core.conflict.ArtifactConflict;
+import org.eclipse.osee.framework.skynet.core.conflict.AttributeConflict;
+import org.eclipse.osee.framework.skynet.core.conflict.Conflict;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
+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.render.VbaWordDiffGenerator;
+import org.eclipse.osee.framework.ui.skynet.revert.RevertWizard;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.NonmodalWizardDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Theron Virgin
+ */
+public class MergeUtility {
+ /*
* This has all of the GUI prompts that help a user know what's going on when they set a merge.
- */
- public static final String CLEAR_PROMPT =
+ */
+ public static final String CLEAR_PROMPT =
"This attribute has had Merge changes made are you sure you want to overwrite them? All changes will be lost.";
- public static final String COMMITED_PROMPT =
+ public static final String COMMITED_PROMPT =
"You can not change the value for a conflict that has been marked resolved or has already been commited. Change the conflict status if the source branch has not been commited and you wish to modify the value.";
- public static final String ARTIFACT_DELETED_PROMPT =
+ public static final String ARTIFACT_DELETED_PROMPT =
"This Artifact has been changed on the source branch, but has been deleted on the destination branch. In order to commit this branch and resolve this conflict the Artifact will need to be reverted on the source branch. \n\nReverting the artifact is irreversible and you will need to restart OSEE after reverting to see changes.";
- public static final String ATTRIBUTE_DELETED_PROMPT =
+ public static final String ATTRIBUTE_DELETED_PROMPT =
"This Attribute has been changed on the source branch, but has been deleted on the destination branch. In order to commit this branch and resolve this conflict the Attribute will need to be reverted on the source branch. \n\nReverting the attribute is irreversible and you will need to restart OSEE after reverting to see changes.";
- public static final String INFORMATIONAL_CONFLICT =
+ public static final String INFORMATIONAL_CONFLICT =
"This Item has been deleted on the Source Branch, but has been changed on the destination branch. This conflict is informational only and will not prevent your from commiting, however when you commit it will delete the item on the destination branch.";
- public static final String OPEN_MERGE_DIALOG =
+ public static final String OPEN_MERGE_DIALOG =
"This will open a window that will allow in-document merging in Word. You will need to right click on every difference and either accept or reject the change. If you begin an in-document merge you will not be able to finalize the conflict until you resolve every change in the document.\n Computing a Merge will wipe out any merge changes you have made and start with a fresh diff of the two files. If you want to only view the changes use the difference options.\n Change that touch the entire file are better handled using copy and paste. \n\nWARNING: Word will occasionaly show incorrect changes especially when users have both modified the same block of text. Check your final version.";
private static final Pattern authorPattern = Pattern.compile("aml:author=\".*?\"",
@@ -92,302 +92,302 @@ public class MergeUtility {
private static final Pattern rsidPattern = Pattern.compile("wsp:rsid(RPr|P|R)=\"(.*?)\"",
Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE);
-
- public static void clearValue(Conflict conflict, Shell shell, boolean prompt) throws MultipleArtifactsExist, ArtifactDoesNotExist, Exception {
- if (conflict == null) {
- return;
- }
- if (okToOverwriteEditedValue(conflict, shell, prompt)) {
- conflict.clearValue();
- }
- }
-
- public static void setToDest(Conflict conflict, Shell shell, boolean prompt) throws MultipleArtifactsExist, ArtifactDoesNotExist, Exception {
- if (conflict == null) {
- return;
- }
- if (okToOverwriteEditedValue(conflict, shell, prompt)) {
- conflict.setToDest();
- }
- }
-
- public static void setToSource(Conflict conflict, Shell shell, boolean prompt) throws MultipleArtifactsExist, ArtifactDoesNotExist, Exception {
- if (conflict == null) {
- return;
- }
- if (okToOverwriteEditedValue(conflict, shell, prompt)) {
- conflict.setToSource();
- }
- }
-
- public static boolean okToOverwriteEditedValue(Conflict conflict, Shell shell, boolean prompt) throws MultipleArtifactsExist, ArtifactDoesNotExist, Exception {
- boolean proceed = true;
- if (!conflict.statusEditable()) {
- MessageDialog.openInformation(shell, "Attention", COMMITED_PROMPT);
- return false;
- }
- if (!(conflict.mergeEqualsDestination() || conflict.mergeEqualsSource() || conflict.statusUntouched()) && prompt) {
- proceed = MessageDialog.openConfirm(shell, "Confirm", CLEAR_PROMPT);
- }
- return proceed;
- }
-
- /*
+
+ public static void clearValue(Conflict conflict, Shell shell, boolean prompt) throws MultipleArtifactsExist, ArtifactDoesNotExist, Exception {
+ if (conflict == null) {
+ return;
+ }
+ if (okToOverwriteEditedValue(conflict, shell, prompt)) {
+ conflict.clearValue();
+ }
+ }
+
+ public static void setToDest(Conflict conflict, Shell shell, boolean prompt) throws MultipleArtifactsExist, ArtifactDoesNotExist, Exception {
+ if (conflict == null) {
+ return;
+ }
+ if (okToOverwriteEditedValue(conflict, shell, prompt)) {
+ conflict.setToDest();
+ }
+ }
+
+ public static void setToSource(Conflict conflict, Shell shell, boolean prompt) throws MultipleArtifactsExist, ArtifactDoesNotExist, Exception {
+ if (conflict == null) {
+ return;
+ }
+ if (okToOverwriteEditedValue(conflict, shell, prompt)) {
+ conflict.setToSource();
+ }
+ }
+
+ public static boolean okToOverwriteEditedValue(Conflict conflict, Shell shell, boolean prompt) throws MultipleArtifactsExist, ArtifactDoesNotExist, Exception {
+ boolean proceed = true;
+ if (!conflict.statusEditable()) {
+ MessageDialog.openInformation(shell, "Attention", COMMITED_PROMPT);
+ return false;
+ }
+ if (!(conflict.mergeEqualsDestination() || conflict.mergeEqualsSource() || conflict.statusUntouched()) && prompt) {
+ proceed = MessageDialog.openConfirm(shell, "Confirm", CLEAR_PROMPT);
+ }
+ return proceed;
+ }
+
+ /*
* This is not in the AttributeConflict because it relies on the renderer that is in not in the skynet core package.
- */
- public static String showCompareFile(Artifact art1, Artifact art2, String fileName) throws Exception {
- if (art1 == null || art2 == null) {
- return " ";
- }
- return RendererManager.diff(new ArtifactDelta(null, art1, art2), true, new VariableMap("fileName", fileName));
- }
-
- /*
+ */
+ public static String showCompareFile(Artifact art1, Artifact art2, String fileName) throws Exception {
+ if (art1 == null || art2 == null) {
+ return " ";
+ }
+ return RendererManager.diff(new ArtifactDelta(null, art1, art2), true, new VariableMap("fileName", fileName));
+ }
+
+ /*
* This is not in the AttributeConflict because it relies on the renderer that is in not in the skynet core package.
- */
- public static String CreateMergeDiffFile(Artifact art1, Artifact art2, String fileName) throws Exception {
- if (art1 == null || art2 == null) {
- return " ";
- }
- return RendererManager.merge(art1, art2, fileName, false);
- }
-
- /*
+ */
+ public static String CreateMergeDiffFile(Artifact art1, Artifact art2, String fileName) throws Exception {
+ if (art1 == null || art2 == null) {
+ return " ";
+ }
+ return RendererManager.merge(art1, art2, fileName, false);
+ }
+
+ /*
* This is not in the AttributeConflict because it relies on the renderer that is in not in the skynet core package.
- */
- public static void mergeEditableDiffFiles(Artifact art1, String art1FileName, String art2FileName, String fileName, boolean show, boolean editable) throws Exception {
- if (art1 == null) {
- return;
- }
- RendererManager.merge(art1, null, AIFile.constructIFile(art1FileName), AIFile.constructIFile(art2FileName),
+ */
+ public static void mergeEditableDiffFiles(Artifact art1, String art1FileName, String art2FileName, String fileName, boolean show, boolean editable) throws Exception {
+ if (art1 == null) {
+ return;
+ }
+ RendererManager.merge(art1, null, AIFile.constructIFile(art1FileName), AIFile.constructIFile(art2FileName),
fileName.substring(fileName.lastIndexOf('\\') + 1), show);
- }
-
- public static Artifact getStartArtifact(Conflict conflict) {
- try {
- if (conflict.getSourceBranch() == null) {
- return null;
- }
- TransactionRecord baseTransaction = conflict.getSourceBranch().getBaseTransaction();
+ }
+
+ public static Artifact getStartArtifact(Conflict conflict) {
+ try {
+ if (conflict.getSourceBranch() == null) {
+ return null;
+ }
+ TransactionRecord baseTransaction = conflict.getSourceBranch().getBaseTransaction();
return ArtifactQuery.getHistoricalArtifactFromId(conflict.getArtifact().getGuid(), baseTransaction,
INCLUDE_DELETED);
- } catch (OseeCoreException ex) {
- OseeLog.log(MergeUtility.class, Level.SEVERE, ex);
- }
- return null;
- }
-
- public static boolean showDeletedConflict(Conflict conflict, Shell shell) {
- if (conflict.getConflictType().equals(ConflictType.ARTIFACT)) {
- return showArtifactDeletedConflict(conflict, shell);
- } else if (conflict.getConflictType().equals(ConflictType.ATTRIBUTE)) {
- return showAttributeDeletedConflict(conflict, shell);
- }
- return false;
- }
-
- public static boolean showArtifactDeletedConflict(Conflict conflict, Shell shell) {
- if (conflict.getConflictType().equals(ConflictType.ARTIFACT)) {
- MessageDialog dialog =
+ } catch (OseeCoreException ex) {
+ OseeLog.log(MergeUtility.class, Level.SEVERE, ex);
+ }
+ return null;
+ }
+
+ public static boolean showDeletedConflict(Conflict conflict, Shell shell) {
+ if (conflict.getConflictType().equals(ConflictType.ARTIFACT)) {
+ return showArtifactDeletedConflict(conflict, shell);
+ } else if (conflict.getConflictType().equals(ConflictType.ATTRIBUTE)) {
+ return showAttributeDeletedConflict(conflict, shell);
+ }
+ return false;
+ }
+
+ public static boolean showArtifactDeletedConflict(Conflict conflict, Shell shell) {
+ if (conflict.getConflictType().equals(ConflictType.ARTIFACT)) {
+ MessageDialog dialog =
new MessageDialog(shell, "Unresovable Conflict", null, ARTIFACT_DELETED_PROMPT, 1, new String[] {
"Revert Source Artifact", "Handle Later"}, 1);
- if (dialog.open() == 0) {
- try {
- List<List<Artifact>> artifacts = new LinkedList<List<Artifact>>();
-
- List<Artifact> artifactList = new LinkedList<Artifact>();
- artifactList.add(((ArtifactConflict) conflict).getSourceArtifact());
- artifacts.add(artifactList);
- RevertWizard wizard = new RevertWizard(artifacts);
- NonmodalWizardDialog dialog2 = new NonmodalWizardDialog(Displays.getActiveShell(), wizard);
- dialog2.create();
- dialog2.open();
- return true;
- } catch (Exception ex) {
- OseeLog.log(MergeUtility.class, Level.SEVERE, ex);
- }
- }
- }
- return false;
- }
-
- /**
- * @param conflict
- */
- public static boolean showAttributeDeletedConflict(Conflict conflict, Shell shell) {
- if (conflict.getConflictType().equals(ConflictType.ATTRIBUTE)) {
- MessageDialog dialog =
+ if (dialog.open() == 0) {
+ try {
+ List<List<Artifact>> artifacts = new LinkedList<List<Artifact>>();
+
+ List<Artifact> artifactList = new LinkedList<Artifact>();
+ artifactList.add(((ArtifactConflict) conflict).getSourceArtifact());
+ artifacts.add(artifactList);
+ RevertWizard wizard = new RevertWizard(artifacts);
+ NonmodalWizardDialog dialog2 = new NonmodalWizardDialog(Displays.getActiveShell(), wizard);
+ dialog2.create();
+ dialog2.open();
+ return true;
+ } catch (Exception ex) {
+ OseeLog.log(MergeUtility.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @param conflict
+ */
+ public static boolean showAttributeDeletedConflict(Conflict conflict, Shell shell) {
+ if (conflict.getConflictType().equals(ConflictType.ATTRIBUTE)) {
+ MessageDialog dialog =
new MessageDialog(shell, "Unresovable Conflict", null, ATTRIBUTE_DELETED_PROMPT, 1, new String[] {
"Revert Source Attribute", "Handle Later"}, 1);
- if (dialog.open() == 0) {
- try {
- ((AttributeConflict) conflict).revertSourceAttribute();
- return true;
- } catch (Exception ex) {
- OseeLog.log(MergeUtility.class, Level.SEVERE, ex);
- }
- }
- }
- return false;
- }
-
- public static boolean showInformationalConflict(Shell shell) {
- MessageDialog dialog =
+ if (dialog.open() == 0) {
+ try {
+ ((AttributeConflict) conflict).revertSourceAttribute();
+ return true;
+ } catch (Exception ex) {
+ OseeLog.log(MergeUtility.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ return false;
+ }
+
+ public static boolean showInformationalConflict(Shell shell) {
+ MessageDialog dialog =
new MessageDialog(shell, "Informational Conflict", null, INFORMATIONAL_CONFLICT, 2, new String[] {"OK"}, 1);
- dialog.open();
- return false;
- }
-
- public static void launchMerge(final AttributeConflict attributeConflict, Shell shell) {
-
- try {
- if (attributeConflict.getAttribute() instanceof WordAttribute) {
- if (!attributeConflict.statusEditable()) {
- MessageDialog.openInformation(shell, "Attention", COMMITED_PROMPT);
- return;
- }
- String[] buttons;
- if (attributeConflict.mergeEqualsSource() || attributeConflict.mergeEqualsDestination() || attributeConflict.statusUntouched()) {
- buttons = new String[] {"Begin New Merge", "Show Help", "Cancel"};
- } else {
- buttons = new String[] {"Continue with last Merge", "Begin New Merge", "Show Help", "Cancel"};
- }
-
- MessageDialog dialog =
+ dialog.open();
+ return false;
+ }
+
+ public static void launchMerge(final AttributeConflict attributeConflict, Shell shell) {
+
+ try {
+ if (attributeConflict.getAttribute() instanceof WordAttribute) {
+ if (!attributeConflict.statusEditable()) {
+ MessageDialog.openInformation(shell, "Attention", COMMITED_PROMPT);
+ return;
+ }
+ String[] buttons;
+ if (attributeConflict.mergeEqualsSource() || attributeConflict.mergeEqualsDestination() || attributeConflict.statusUntouched()) {
+ buttons = new String[] {"Begin New Merge", "Show Help", "Cancel"};
+ } else {
+ buttons = new String[] {"Continue with last Merge", "Begin New Merge", "Show Help", "Cancel"};
+ }
+
+ MessageDialog dialog =
new MessageDialog(Displays.getActiveShell().getShell(), "Merge Word Artifacts", null,
OPEN_MERGE_DIALOG, 4, buttons, 2);
- int response = dialog.open();
- if (buttons.length == 3) {
- response++;
- }
- if (response == 2) {
- PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(
+ int response = dialog.open();
+ if (buttons.length == 3) {
+ response++;
+ }
+ if (response == 2) {
+ PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(
"/org.eclipse.osee.framework.ui.skynet/reference/Merge_Manager.html");
- } else if (response == 1) {
-
- Job job = new Job("Generate 3 Way Merge") {
-
- @Override
- protected IStatus run(final IProgressMonitor monitor) {
- try {
- int gamma = attributeConflict.getAttribute().getGammaId();
- monitor.beginTask("Generate 3 Way Merge", 100);
- VbaWordDiffGenerator generator = new VbaWordDiffGenerator();
- generator.initialize(false, false);
- monitor.worked(5);
- String sourceChangeFile =
+ } else if (response == 1) {
+
+ Job job = new Job("Generate 3 Way Merge") {
+
+ @Override
+ protected IStatus run(final IProgressMonitor monitor) {
+ try {
+ int gamma = attributeConflict.getAttribute().getGammaId();
+ monitor.beginTask("Generate 3 Way Merge", 100);
+ VbaWordDiffGenerator generator = new VbaWordDiffGenerator();
+ generator.initialize(false, false);
+ monitor.worked(5);
+ String sourceChangeFile =
MergeUtility.CreateMergeDiffFile(getStartArtifact(attributeConflict),
attributeConflict.getSourceArtifact(), null);
- monitor.worked(15);
- String destChangeFile =
+ monitor.worked(15);
+ String destChangeFile =
MergeUtility.CreateMergeDiffFile(getStartArtifact(attributeConflict),
attributeConflict.getDestArtifact(), null);
- monitor.worked(15);
- changeAuthorinWord("Source", sourceChangeFile, 2, "12345678", "55555555");
- changeAuthorinWord("Destination", destChangeFile, 2, "56781234", "55555555");
- monitor.worked(15);
- MergeUtility.mergeEditableDiffFiles(
+ monitor.worked(15);
+ changeAuthorinWord("Source", sourceChangeFile, 2, "12345678", "55555555");
+ changeAuthorinWord("Destination", destChangeFile, 2, "56781234", "55555555");
+ monitor.worked(15);
+ MergeUtility.mergeEditableDiffFiles(
attributeConflict.getArtifact(),
sourceChangeFile,
destChangeFile,
"Source_Dest_Merge_" + attributeConflict.getArtifact().getSafeName() + "(" + attributeConflict.getArtifact().getGuid() + ")" + new Date().toString().replaceAll(
":", ";") + ".xml", false, true);
-
- monitor.worked(40);
- attributeConflict.markStatusToReflectEdit();
-
- int maxCount = 5;
- int counter = 0;
- while (gamma == attributeConflict.getAttribute().getGammaId() && counter++ != maxCount) {
- Thread.sleep(500);
- }
- monitor.done();
+
+ monitor.worked(40);
+ attributeConflict.markStatusToReflectEdit();
+
+ int maxCount = 5;
+ int counter = 0;
+ while (gamma == attributeConflict.getAttribute().getGammaId() && counter++ != maxCount) {
+ Thread.sleep(500);
+ }
+ monitor.done();
RendererManager.openInJob(attributeConflict.getArtifact(), PresentationType.MERGE_EDIT);
-
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- monitor.done();
- return Status.OK_STATUS;
- }
- };
-
- Jobs.startJob(job);
-
- } else if (response == 0) {
- RendererManager.openInJob(attributeConflict.getArtifact(), PresentationType.SPECIALIZED_EDIT);
- attributeConflict.markStatusToReflectEdit();
- }
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- protected static void changeAuthorinWord(String newAuthor, String fileName, int revisionNumber, String rsidNumber, String baselineRsid) throws Exception {
- String fileValue = AFile.readFile(fileName);
-
- Matcher m = authorPattern.matcher(fileValue);
- while (m.find()) {
- String name = m.group();
- fileValue = fileValue.replace(name, "aml:author=\"" + newAuthor + "\"");
- }
-
- m = findSetRsids.matcher(fileValue);
- while (m.find()) {
- String rev = m.group();
- fileValue = fileValue.replace(rev, "wsp:rsidR=\"" + baselineRsid + "\"");
- }
- m = findSetRsidRPR.matcher(fileValue);
- while (m.find()) {
- String rev = m.group();
- fileValue = fileValue.replace(rev, "wsp:rsidRPr=\"" + baselineRsid + "\"");
- }
- m = findSetRsidP.matcher(fileValue);
- while (m.find()) {
- String rev = m.group();
- fileValue = fileValue.replace(rev, "wsp:rsidP=\"" + baselineRsid + "\"");
- }
- m = findSetRsidRDefault.matcher(fileValue);
- while (m.find()) {
- String rev = m.group();
- fileValue = fileValue.replace(rev, "wsp:rsidRDefault=\"" + baselineRsid + "\"");
- }
-
- resetRsidIds(fileValue, rsidNumber, baselineRsid, fileName);
- }
-
- private static void resetRsidIds(String fileValue, String rsidNumber, String baselineRsid, String fileName) throws IOException {
- ChangeSet changeSet = new ChangeSet(fileValue);
- Matcher matcher = annotationTag.matcher(fileValue);
-
- while (matcher.find()) {
- int startIndex = matcher.start();
- int level = 1;
-
- do {
- matcher.find();
-
- if (matcher.group().startsWith("<aml:annotation")) {
- level++;
- } else {
- level--;
- }
- } while (level != 0);
-
- Matcher rsidMatcher = rsidPattern.matcher(fileValue);
-
- while (rsidMatcher.find(startIndex) && rsidMatcher.end() <= matcher.end()) {
- changeSet.replace(rsidMatcher.start(2), rsidMatcher.end(2) - 1, rsidNumber);
- startIndex = rsidMatcher.end();
- }
- }
-
- Matcher m = rsidRootPattern.matcher(fileValue);
- while (m.find()) {
- changeSet.replace(m.start(), m.end() - 1, "<wsp:rsid wsp:val=\"" + baselineRsid + "\"/></wsp:rsids>");
- }
-
- changeSet.applyChanges(new File(fileName));
- }
-}
+
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ monitor.done();
+ return Status.OK_STATUS;
+ }
+ };
+
+ Jobs.startJob(job);
+
+ } else if (response == 0) {
+ RendererManager.openInJob(attributeConflict.getArtifact(), PresentationType.SPECIALIZED_EDIT);
+ attributeConflict.markStatusToReflectEdit();
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ protected static void changeAuthorinWord(String newAuthor, String fileName, int revisionNumber, String rsidNumber, String baselineRsid) throws Exception {
+ String fileValue = AFile.readFile(fileName);
+
+ Matcher m = authorPattern.matcher(fileValue);
+ while (m.find()) {
+ String name = m.group();
+ fileValue = fileValue.replace(name, "aml:author=\"" + newAuthor + "\"");
+ }
+
+ m = findSetRsids.matcher(fileValue);
+ while (m.find()) {
+ String rev = m.group();
+ fileValue = fileValue.replace(rev, "wsp:rsidR=\"" + baselineRsid + "\"");
+ }
+ m = findSetRsidRPR.matcher(fileValue);
+ while (m.find()) {
+ String rev = m.group();
+ fileValue = fileValue.replace(rev, "wsp:rsidRPr=\"" + baselineRsid + "\"");
+ }
+ m = findSetRsidP.matcher(fileValue);
+ while (m.find()) {
+ String rev = m.group();
+ fileValue = fileValue.replace(rev, "wsp:rsidP=\"" + baselineRsid + "\"");
+ }
+ m = findSetRsidRDefault.matcher(fileValue);
+ while (m.find()) {
+ String rev = m.group();
+ fileValue = fileValue.replace(rev, "wsp:rsidRDefault=\"" + baselineRsid + "\"");
+ }
+
+ resetRsidIds(fileValue, rsidNumber, baselineRsid, fileName);
+ }
+
+ private static void resetRsidIds(String fileValue, String rsidNumber, String baselineRsid, String fileName) throws IOException {
+ ChangeSet changeSet = new ChangeSet(fileValue);
+ Matcher matcher = annotationTag.matcher(fileValue);
+
+ while (matcher.find()) {
+ int startIndex = matcher.start();
+ int level = 1;
+
+ do {
+ matcher.find();
+
+ if (matcher.group().startsWith("<aml:annotation")) {
+ level++;
+ } else {
+ level--;
+ }
+ } while (level != 0);
+
+ Matcher rsidMatcher = rsidPattern.matcher(fileValue);
+
+ while (rsidMatcher.find(startIndex) && rsidMatcher.end() <= matcher.end()) {
+ changeSet.replace(rsidMatcher.start(2), rsidMatcher.end(2) - 1, rsidNumber);
+ startIndex = rsidMatcher.end();
+ }
+ }
+
+ Matcher m = rsidRootPattern.matcher(fileValue);
+ while (m.find()) {
+ changeSet.replace(m.start(), m.end() - 1, "<wsp:rsid wsp:val=\"" + baselineRsid + "\"/></wsp:rsids>");
+ }
+
+ changeSet.applyChanges(new File(fileName));
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeView.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeView.java
index b9dda9d3223..0169ffa6c03 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeView.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeView.java
@@ -1,984 +1,984 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.widgets.xmerge;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-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.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.access.AccessControlManager;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-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.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.plugin.core.IActionable;
-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.BranchManager;
-import org.eclipse.osee.framework.skynet.core.conflict.ArtifactConflict;
-import org.eclipse.osee.framework.skynet.core.conflict.AttributeConflict;
-import org.eclipse.osee.framework.skynet.core.conflict.Conflict;
-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.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.skynet.core.transaction.TransactionManager;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.plugin.util.AbstractSelectionEnabledHandler;
-import org.eclipse.osee.framework.ui.plugin.util.Commands;
-import org.eclipse.osee.framework.ui.skynet.ArtifactExplorer;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.OseeContributionItem;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-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.revert.RevertWizard;
-import org.eclipse.osee.framework.ui.skynet.util.SkynetViews;
-import org.eclipse.osee.framework.ui.skynet.widgets.xHistory.HistoryView;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.osee.framework.ui.swt.NonmodalWizardDialog;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.handlers.IHandlerService;
-import org.eclipse.ui.menus.CommandContributionItem;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * @see ViewPart
- * @author Donald G. Dunne
- */
-public class MergeView extends ViewPart implements IActionable, IBranchEventListener, IArtifactEventListener, IFrameworkTransactionEventListener {
- public static final String VIEW_ID = "org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeView";
- public static String HELP_CONTEXT_ID = "Merge_Manager_View";
- private MergeXWidget mergeXWidget;
- private Conflict[] conflicts;
- private IHandlerService handlerService;
- private Branch sourceBranch;
- private Branch destBranch;
- private TransactionRecord transactionId;
- private TransactionRecord commitTrans;
- private boolean showConflicts;
-
- public static void openView(final Branch sourceBranch, final Branch destBranch, final TransactionRecord tranId) {
- if (sourceBranch == null && destBranch == null && tranId == null) {
- throw new IllegalArgumentException("Branch's and Transaction ID can't be null");
- }
- openViewUpon(sourceBranch, destBranch, tranId, null, true);
- }
-
- public static void openView(final TransactionRecord commitTrans) {
- if (commitTrans == null) {
- throw new IllegalArgumentException("Commit Transaction ID can't be null");
- }
- openViewUpon(null, null, null, commitTrans, true);
- }
-
- private static void openViewUpon(final Branch sourceBranch, final Branch destBranch, final TransactionRecord tranId, final TransactionRecord commitTrans, final boolean showConflicts) {
- Job job = new Job("Open Merge View") {
-
- @Override
- protected IStatus run(final IProgressMonitor monitor) {
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- try {
- IWorkbenchPage page = AWorkbench.getActivePage();
- IViewPart viewPart =
- page.showView(
- MergeView.VIEW_ID,
- String.valueOf(sourceBranch != null ? sourceBranch.getId() * 100000 + destBranch.getId() : commitTrans.getId()),
- IWorkbenchPage.VIEW_ACTIVATE);
- if (viewPart instanceof MergeView) {
- MergeView mergeView = (MergeView) viewPart;
- mergeView.showConflicts = showConflicts;
- mergeView.explore(sourceBranch, destBranch, tranId, commitTrans, showConflicts);
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- });
-
- monitor.done();
- return Status.OK_STATUS;
- }
- };
-
- Jobs.startJob(job);
- }
-
- @Override
- public void dispose() {
- OseeEventManager.removeListener(this);
- OseeEventManager.removeListener(this);
- super.dispose();
- }
-
- @Override
- public void setFocus() {
- if (mergeXWidget != null) {
- mergeXWidget.setFocus();
- }
- }
-
- @Override
- public void createPartControl(Composite parent) {
- /*
- * Create a grid layout object so the text and treeviewer are laid out the way I want.
- */
-
- PlatformUI.getWorkbench().getService(IHandlerService.class);
- handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
-
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- layout.verticalSpacing = 0;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- parent.setLayout(layout);
- parent.setLayoutData(new GridData(GridData.FILL_BOTH));
- mergeXWidget = new MergeXWidget();
- mergeXWidget.setDisplayLabel(false);
- mergeXWidget.createWidgets(parent, 1);
-
- if (conflicts != null) {
- mergeXWidget.setConflicts(conflicts);
- }
- MenuManager menuManager = new MenuManager();
- menuManager.setRemoveAllWhenShown(true);
- menuManager.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- MenuManager menuManager = (MenuManager) manager;
- fillPopupMenu(menuManager);
- }
-
- private void fillPopupMenu(MenuManager menuManager) {
- addEditArtifactMenuItem(menuManager);
- addMergeMenuItem(menuManager);
- menuManager.add(new Separator());
- addPreviewMenuItem(menuManager);
- addDiffMenuItem(menuManager);
- menuManager.add(new Separator());
- addSourceResourceHistoryMenuItem(menuManager);
- addSourceRevealMenuItem(menuManager);
- menuManager.add(new Separator());
- addDestResourceHistoryMenuItem(menuManager);
- addDestRevealMenuItem(menuManager);
- menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- addRevertUnresolvableConflictsMenuItem(menuManager);
- }
- });
-
- mergeXWidget.getXViewer().getTree().setMenu(menuManager.createContextMenu(mergeXWidget.getXViewer().getTree()));
-
- createEditArtifactMenuItem(menuManager);
- createMergeMenuItem(menuManager);
- menuManager.add(new Separator());
- createPreviewMenuItem(menuManager);
- createDiffMenuItem(menuManager);
- menuManager.add(new Separator());
- createSourceResourceHistoryMenuItem(menuManager);
- createSourceRevealMenuItem(menuManager);
- menuManager.add(new Separator());
- createDestinationResourceHistoryMenuItem(menuManager);
- createDestinationRevealMenuItem(menuManager);
- menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- createRevertUnresolvableConflictsMenuItem(menuManager);
-
- OseeContributionItem.addTo(this, true);
- getSite().registerContextMenu("org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeView", menuManager,
- mergeXWidget.getXViewer());
-
- getSite().setSelectionProvider(mergeXWidget.getXViewer());
- SkynetGuiPlugin.getInstance().setHelp(parent, HELP_CONTEXT_ID, "org.eclipse.osee.framework.help.ui");
-
- OseeEventManager.addListener(this);
- OseeEventManager.addListener(this);
- }
-
- private void addPreviewMenuItem(MenuManager menuManager) {
- MenuManager subMenuManager = new MenuManager("Preview", "previewTransaction");
- menuManager.add(subMenuManager);
- addPreviewItems(subMenuManager, "Preview Source Artifact");
- addPreviewItems(subMenuManager, "Preview Destination Artifact");
- addPreviewItems(subMenuManager, "Preview Merge Artifact");
- }
-
- private void createPreviewMenuItem(MenuManager menuManager) {
- MenuManager subMenuManager = new MenuManager("Preview", "previewTransaction");
- menuManager.add(subMenuManager);
- createPreviewItems(subMenuManager, new PreviewHandler(menuManager, 1), "Preview Source Artifact");
- createPreviewItems(subMenuManager, new PreviewHandler(menuManager, 2), "Preview Destination Artifact");
- createPreviewItems(subMenuManager, new PreviewHandler(menuManager, 3), "Preview Merge Artifact");
- }
-
- private String addPreviewItems(MenuManager subMenuManager, String command) {
- CommandContributionItem previewCommand =
- Commands.getLocalCommandContribution(getSite(), subMenuManager.getId() + command, command, null, null,
- ImageManager.getImageDescriptor(FrameworkImage.PREVIEW_ARTIFACT), null, null, null);
- subMenuManager.add(previewCommand);
- return previewCommand.getId();
- }
-
- private void createPreviewItems(MenuManager subMenuManager, PreviewHandler handler, String command) {
- handlerService.activateHandler(addPreviewItems(subMenuManager, command), handler);
- }
-
- private void addDiffMenuItem(MenuManager menuManager) {
- MenuManager subMenuManager = new MenuManager("Differences", "diffTransaction");
- menuManager.add(subMenuManager);
- addDiffItems(subMenuManager, "Show Source Branch Differences");
- addDiffItems(subMenuManager, "Show Destination Branch Differences");
- addDiffItems(subMenuManager, "Show Source/Destination Differences");
- addDiffItems(subMenuManager, "Show Source/Merge Differences");
- addDiffItems(subMenuManager, "Show Destination/Merge Differences");
- }
-
- private void createDiffMenuItem(MenuManager menuManager) {
- MenuManager subMenuManager = new MenuManager("Differences", "diffTransaction");
- menuManager.add(subMenuManager);
- createDiffItems(subMenuManager, new DiffHandler(menuManager, 1, mergeXWidget), "Show Source Branch Differences");
- createDiffItems(subMenuManager, new DiffHandler(menuManager, 2, mergeXWidget),
- "Show Destination Branch Differences");
- createDiffItems(subMenuManager, new DiffHandler(menuManager, 3, mergeXWidget),
- "Show Source/Destination Differences");
- createDiffItems(subMenuManager, new DiffHandler(menuManager, 4, mergeXWidget), "Show Source/Merge Differences");
- createDiffItems(subMenuManager, new DiffHandler(menuManager, 5, mergeXWidget),
- "Show Destination/Merge Differences");
- }
-
- private String addDiffItems(MenuManager subMenuManager, String command) {
- CommandContributionItem diffCommand =
- Commands.getLocalCommandContribution(getSite(), subMenuManager.getId() + command, command, null, null,
- null, null, null, null);
- subMenuManager.add(diffCommand);
- return diffCommand.getId();
- }
-
- private void createDiffItems(MenuManager subMenuManager, DiffHandler handler, String command) {
- handlerService.activateHandler(addDiffItems(subMenuManager, command), handler);
- }
-
- private String addEditArtifactMenuItem(MenuManager menuManager) {
- CommandContributionItem editArtifactCommand;
- //RendererManager.getBestFileRenderer(PresentationType.SPECIALIZED_EDIT, attributeConflict.getArtifact()).getImage(attributeConflict.getArtifact());
- editArtifactCommand =
- Commands.getLocalCommandContribution(getSite(), "editArtifactCommand", "Edit Merge Artifact", null, null,
- null, "E", null, "edit_Merge_Artifact");
- menuManager.add(editArtifactCommand);
- return editArtifactCommand.getId();
- }
-
- private String addSourceResourceHistoryMenuItem(MenuManager menuManager) {
- CommandContributionItem sourecResourceCommand;
- sourecResourceCommand =
- Commands.getLocalCommandContribution(getSite(), "sourceResourceHistory",
- "Show Source Artifact Resource History", null, null,
- ImageManager.getImageDescriptor(FrameworkImage.DB_ICON_BLUE_EDIT), null, null,
- "source_Resource_History");
- menuManager.add(sourecResourceCommand);
- return sourecResourceCommand.getId();
- }
-
- private String addDestResourceHistoryMenuItem(MenuManager menuManager) {
- CommandContributionItem sourecResourceCommand;
- sourecResourceCommand =
- Commands.getLocalCommandContribution(getSite(), "destResourceHistory",
- "Show Dest Artifact Resource History", null, null,
- ImageManager.getImageDescriptor(FrameworkImage.DB_ICON_BLUE_EDIT), null, null,
- "dest_Resource_History");
- menuManager.add(sourecResourceCommand);
- return sourecResourceCommand.getId();
- }
-
- private String addSourceRevealMenuItem(MenuManager menuManager) {
- CommandContributionItem sourceReveal;
- sourceReveal =
- Commands.getLocalCommandContribution(getSite(), "sourceRevealArtifactExplorer",
- "Reveal Source Artifact in Artifact Explorer", null, null,
- ImageManager.getImageDescriptor(FrameworkImage.MAGNIFY), null, null, "source_Reveal");
- menuManager.add(sourceReveal);
- return sourceReveal.getId();
- }
-
- private String addDestRevealMenuItem(MenuManager menuManager) {
- CommandContributionItem destReveal;
- destReveal =
- Commands.getLocalCommandContribution(getSite(), "destRevealArtifactExplorer",
- "Reveal Dest Artifact in Artifact Explorer", null, null,
- ImageManager.getImageDescriptor(FrameworkImage.MAGNIFY), null, null, "dest_Reveal");
- menuManager.add(destReveal);
- return destReveal.getId();
- }
-
- private String addRevertUnresolvableConflictsMenuItem(MenuManager menuManager) {
- CommandContributionItem revertSelected;
- revertSelected =
- Commands.getLocalCommandContribution(getSite(), "revertSelected",
- "Revert Source Artifacts for Unresolvable Conflicts", null, null, null, null, null, null);
- menuManager.add(revertSelected);
- return revertSelected.getId();
- }
-
- private void createEditArtifactMenuItem(MenuManager menuManager) {
-
- handlerService.activateHandler(addEditArtifactMenuItem(menuManager),
-
- new AbstractSelectionEnabledHandler(menuManager) {
- private AttributeConflict attributeConflict;
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- if (attributeConflict != null) {
- try {
- if (MergeUtility.okToOverwriteEditedValue(attributeConflict,
- Displays.getActiveShell().getShell(), false)) {
- RendererManager.openInJob(attributeConflict.getArtifact(), PresentationType.MERGE_EDIT);
-
- attributeConflict.markStatusToReflectEdit();
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- return null;
- }
-
- @Override
- public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- List<Conflict> conflicts = mergeXWidget.getSelectedConflicts();
- attributeConflict = null;
- if (conflicts == null || conflicts.size() != 1 || !(conflicts.get(0) instanceof AttributeConflict) || !conflicts.get(
- 0).statusEditable()) {
- return false;
- }
- attributeConflict = (AttributeConflict) conflicts.get(0);
- return true;
- }
- });
- }
-
- private void createSourceResourceHistoryMenuItem(MenuManager menuManager) {
-
- handlerService.activateHandler(addSourceResourceHistoryMenuItem(menuManager),
-
- new AbstractSelectionEnabledHandler(menuManager) {
- private AttributeConflict attributeConflict;
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- if (attributeConflict != null) {
- try {
- HistoryView.open(attributeConflict.getSourceArtifact());
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- return null;
- }
-
- @Override
- public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- List<Conflict> conflicts = mergeXWidget.getSelectedConflicts();
- attributeConflict = null;
- if (conflicts == null || conflicts.size() != 1) {
- return false;
- }
- attributeConflict = (AttributeConflict) conflicts.get(0);
- return true;
- }
- });
- }
-
- private void createDestinationResourceHistoryMenuItem(MenuManager menuManager) {
-
- handlerService.activateHandler(addDestResourceHistoryMenuItem(menuManager),
-
- new AbstractSelectionEnabledHandler(menuManager) {
- private AttributeConflict attributeConflict;
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- if (attributeConflict != null) {
- try {
- HistoryView.open(attributeConflict.getDestArtifact());
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- return null;
- }
-
- @Override
- public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- List<Conflict> conflicts = mergeXWidget.getSelectedConflicts();
- attributeConflict = null;
- if (conflicts == null || conflicts.size() != 1) {
- return false;
- }
- attributeConflict = (AttributeConflict) conflicts.get(0);
- return true;
- }
- });
- }
-
- private void createSourceRevealMenuItem(MenuManager menuManager) {
-
- handlerService.activateHandler(addSourceRevealMenuItem(menuManager),
-
- new AbstractSelectionEnabledHandler(menuManager) {
- private AttributeConflict attributeConflict;
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- if (attributeConflict != null) {
- try {
- ArtifactExplorer.revealArtifact(attributeConflict.getSourceArtifact());
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- return null;
- }
-
- @Override
- public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- List<Conflict> conflicts = mergeXWidget.getSelectedConflicts();
- attributeConflict = null;
- if (conflicts == null || conflicts.size() != 1) {
- return false;
- }
- attributeConflict = (AttributeConflict) conflicts.get(0);
- return true;
- }
- });
- }
-
- private void createDestinationRevealMenuItem(MenuManager menuManager) {
-
- handlerService.activateHandler(addDestRevealMenuItem(menuManager),
-
- new AbstractSelectionEnabledHandler(menuManager) {
- private AttributeConflict attributeConflict;
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- if (attributeConflict != null) {
- try {
- ArtifactExplorer.revealArtifact(attributeConflict.getDestArtifact());
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- return null;
- }
-
- @Override
- public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- List<Conflict> conflicts = mergeXWidget.getSelectedConflicts();
- attributeConflict = null;
- if (conflicts == null || conflicts.size() != 1) {
- return false;
- }
- attributeConflict = (AttributeConflict) conflicts.get(0);
- return true;
- }
- });
- }
-
- private void createRevertUnresolvableConflictsMenuItem(MenuManager menuManager) {
- handlerService.activateHandler(addRevertUnresolvableConflictsMenuItem(menuManager),
- new AbstractSelectionEnabledHandler(menuManager) {
- List<List<Artifact>> revertList;
- List<Conflict> selectedConflicts;
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- RevertWizard wizard = new RevertWizard(revertList);
- NonmodalWizardDialog wizardDialog =
- new NonmodalWizardDialog(Displays.getActiveShell(), wizard);
- wizardDialog.create();
- wizardDialog.open();
- return null;
- }
-
- @Override
- public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- selectedConflicts = mergeXWidget.getSelectedConflicts();
- revertList = new ArrayList<List<Artifact>>();
- populateRevertList();
- return !revertList.isEmpty();
- }
-
- private void populateRevertList() {
- for (Conflict conflict : selectedConflicts) {
- ArtifactConflict artifactConflict = (ArtifactConflict) conflict;
- if (conflict.statusNotResolvable()) {
- addArtifactToRevertList(artifactConflict);
- }
- }
- }
-
- private void addArtifactToRevertList(ArtifactConflict artifactConflict) {
- Artifact art;
- try {
- art = artifactConflict.getSourceArtifact();
- } catch (OseeCoreException ex) {
- return;
- }
- List<Artifact> ins = new ArrayList<Artifact>();
- ins.add(art);
- revertList.add(ins);
- }
- });
- }
-
- private String addMergeMenuItem(MenuManager menuManager) {
- CommandContributionItem mergeArtifactCommand;
- mergeArtifactCommand =
- Commands.getLocalCommandContribution(getSite(), "mergeArtifactCommand",
- "Generate Three Way Merge (Developmental)", null, null, null, "E", null,
- "Merge_Source_Destination_Artifact");
- menuManager.add(mergeArtifactCommand);
- return mergeArtifactCommand.getId();
- }
-
- private void createMergeMenuItem(MenuManager menuManager) {
-
- handlerService.activateHandler(addMergeMenuItem(menuManager),
-
- new AbstractSelectionEnabledHandler(menuManager) {
- private AttributeConflict attributeConflict;
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- if (attributeConflict != null) {
- MergeUtility.launchMerge(attributeConflict, Displays.getActiveShell().getShell());
- }
- return null;
- }
-
- @Override
- public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- List<Conflict> conflicts = mergeXWidget.getSelectedConflicts();
- attributeConflict = null;
- if (conflicts == null || conflicts.size() != 1 || !(conflicts.get(0) instanceof AttributeConflict) || !conflicts.get(
- 0).statusEditable()) {
- return false;
- }
- attributeConflict = (AttributeConflict) conflicts.get(0);
- return attributeConflict.isWordAttribute();
- }
- });
- }
-
- public void explore(final Branch sourceBranch, final Branch destBranch, final TransactionRecord transactionId, final TransactionRecord commitTrans, boolean showConflicts) {
- this.sourceBranch = sourceBranch;
- this.destBranch = destBranch;
- this.transactionId = transactionId;
- this.commitTrans = commitTrans;
- try {
- mergeXWidget.setInputData(sourceBranch, destBranch, transactionId, this, commitTrans, showConflicts);
- if (sourceBranch != null) {
- setPartName("Merge Manager: " + sourceBranch.getShortName() + " <=> " + destBranch.getShortName());
- } else if (commitTrans != null) {
- setPartName("Merge Manager: " + commitTrans.getId());
- } else {
- setPartName("Merge Manager");
- }
-
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- public void setConflicts(Conflict[] conflicts) {
- this.conflicts = conflicts;
- }
-
- public String getActionDescription() {
- return "";
- }
-
- @Override
- public void init(IViewSite site, IMemento memento) throws PartInitException {
- super.init(site, memento);
- try {
- Integer sourceBranchId = null;
- Integer destBranchId = null;
-
- if (memento != null) {
- memento = memento.getChild(INPUT);
- if (memento != null) {
- if (SkynetViews.isSourceValid(memento)) {
-
- Integer commitTransaction = memento.getInteger(COMMIT_NUMBER);
- if (commitTransaction != null) {
- openViewUpon(null, null, null, TransactionManager.getTransactionId(commitTransaction), false);
- return;
- }
- sourceBranchId = memento.getInteger(SOURCE_BRANCH_ID);
- final Branch sourceBranch = BranchManager.getBranch(sourceBranchId);
- if (sourceBranch == null) {
- OseeLog.log(SkynetGuiPlugin.class, Level.WARNING,
- "Merge View can't init due to invalid source branch id " + sourceBranchId);
- mergeXWidget.setLabel("Could not restore this Merge View");
- return;
- }
- destBranchId = memento.getInteger(DEST_BRANCH_ID);
- final Branch destBranch = BranchManager.getBranch(destBranchId);
- if (destBranch == null) {
- OseeLog.log(SkynetGuiPlugin.class, Level.WARNING,
- "Merge View can't init due to invalid destination branch id " + sourceBranchId);
- mergeXWidget.setLabel("Could not restore this Merge View");
- return;
- }
- try {
- TransactionRecord transactionId =
- TransactionManager.getTransactionId(memento.getInteger(TRANSACTION_NUMBER));
- openViewUpon(sourceBranch, destBranch, transactionId, null, false);
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.WARNING,
- "Merge View can't init due to invalid transaction id " + transactionId);
- mergeXWidget.setLabel("Could not restore this Merge View due to invalid transaction id " + transactionId);
- return;
- }
- } else {
- SkynetViews.closeView(VIEW_ID, getViewSite().getSecondaryId());
- }
- }
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.WARNING, "Merge View error on init", ex);
- }
- }
-
- private static final String INPUT = "input";
- private static final String SOURCE_BRANCH_ID = "sourceBranchId";
- private static final String DEST_BRANCH_ID = "destBranchId";
- private static final String TRANSACTION_NUMBER = "transactionNumber";
- private static final String COMMIT_NUMBER = "commitTransactionNumber";
-
- @Override
- public void saveState(IMemento memento) {
- super.saveState(memento);
- memento = memento.createChild(INPUT);
- if (sourceBranch != null) {
- memento.putInteger(SOURCE_BRANCH_ID, sourceBranch.getId());
- memento.putInteger(DEST_BRANCH_ID, destBranch.getId());
- memento.putInteger(TRANSACTION_NUMBER, transactionId.getId());
- } else if (commitTrans != null) {
- memento.putInteger(COMMIT_NUMBER, commitTrans.getId());
- }
-
- if (sourceBranch != null || commitTrans != null) {
- SkynetViews.addDatabaseSourceId(memento);
- }
- }
-
- private class PreviewHandler extends AbstractSelectionEnabledHandler {
- private final int partToPreview;
- private List<Artifact> artifacts;
-
- public PreviewHandler(MenuManager menuManager, int partToPreview) {
- super(menuManager);
- this.partToPreview = partToPreview;
- }
-
- @Override
- public Object execute(ExecutionEvent event) {
- RendererManager.openInJob(artifacts, PresentationType.PREVIEW);
- return null;
- }
-
- @Override
- public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
- artifacts = new LinkedList<Artifact>();
- List<Conflict> conflicts = mergeXWidget.getSelectedConflicts();
- for (Conflict conflict : conflicts) {
- try {
- switch (partToPreview) {
- case 1:
- if (conflict.getSourceArtifact() != null) {
- artifacts.add(conflict.getSourceArtifact());
- }
- break;
- case 2:
- if (conflict.getDestArtifact() != null) {
- artifacts.add(conflict.getDestArtifact());
- }
- break;
- case 3:
- if (conflict.statusNotResolvable() || conflict.statusInformational()) {
- return false;
- }
- if (conflict.getArtifact() != null) {
- artifacts.add(conflict.getArtifact());
- }
- break;
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- return AccessControlManager.checkObjectListPermission(artifacts, PermissionEnum.READ);
- }
- }
-
- @Override
- public void handleBranchEventREM1(Sender sender, BranchEventType branchModType, int branchId) {
- if (sourceBranch != null && destBranch != null && (sourceBranch.getId() == branchId || destBranch.getId() == branchId)) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (mergeXWidget != null && mergeXWidget.getXViewer().getTree().isDisposed() != true) {
- mergeXWidget.refresh();
- }
- }
- });
- }
- }
-
- @Override
- public void handleFrameworkTransactionEvent(final Sender sender, final FrameworkTransactionData transData) throws OseeCoreException {
- try {
- if (sourceBranch == null || destBranch == null) {
- return;
- }
- if (sourceBranch.getId() != transData.getBranchId() && destBranch.getId() != transData.getBranchId()) {
- Branch mergeBranch = BranchManager.getMergeBranch(sourceBranch, destBranch);
- if (mergeBranch == null || mergeBranch.getId() != transData.getBranchId()) {
- return;
- }
- }
- } catch (OseeCoreException ex) {
- //ignore the exception for an event don't want them popping up on people for no reason
- }
- final MergeView mergeView = this;
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (mergeXWidget.getXViewer() == null || mergeXWidget.getXViewer().getTree() == null || mergeXWidget.getXViewer().getTree().isDisposed()) {
- return;
- }
- for (Artifact artifact : transData.cacheChangedArtifacts) {
- try {
- Branch branch = artifact.getBranch();
- if (showConflicts) {
- for (Conflict conflict : conflicts) {
- if (artifact.equals(conflict.getSourceArtifact()) && branch.equals(conflict.getSourceBranch()) || artifact.equals(conflict.getDestArtifact()) && branch.equals(conflict.getDestBranch())) {
- mergeXWidget.setInputData(sourceBranch, destBranch, transactionId, mergeView, commitTrans,
- "Source Artifact Changed", showConflicts);
- if (artifact.equals(conflict.getSourceArtifact()) && sender.isLocal()) {
- new MessageDialog(
- Displays.getActiveShell().getShell(),
- "Modifying Source artifact while merging",
- null,
- "Typically changes done while merging should be done on the merge branch. You should not normally merge on the source branch.",
- 2, new String[] {"OK"}, 1).open();
- }
- return;
- } else if (artifact.equals(conflict.getArtifact())) {
- conflict.computeEqualsValues();
- mergeXWidget.refresh();
- }
- }
- if (conflicts.length > 0 && (branch.equals(conflicts[0].getSourceBranch()) || branch.equals(conflicts[0].getDestBranch()))) {
- mergeXWidget.setInputData(
- sourceBranch,
- destBranch,
- transactionId,
- mergeView,
- commitTrans,
- branch.equals(conflicts[0].getSourceBranch()) ? "Source Branch Changed" : "Destination Branch Changed",
- showConflicts);
- }
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- if (!transData.cacheDeletedArtifacts.isEmpty()) {
- Branch branch = transData.cacheDeletedArtifacts.iterator().next().getBranch();
- if (conflicts.length > 0 && (branch.equals(conflicts[0].getSourceBranch()) || branch.equals(conflicts[0].getDestBranch()))) {
- mergeXWidget.setInputData(
- sourceBranch,
- destBranch,
- transactionId,
- mergeView,
- commitTrans,
- branch.equals(conflicts[0].getSourceBranch()) ? "Source Branch Changed" : "Destination Branch Changed",
- showConflicts);
- }
- }
- }
- });
-
- }
-
- protected void showConflicts(boolean show) {
- showConflicts = show;
- }
-
- private boolean isApplicableEvent(String branchGuid) {
- return (sourceBranch != null && destBranch != null &&
- //
- (sourceBranch.getGuid().equals(branchGuid) ||
- //
- destBranch.getGuid().equals(branchGuid)));
- }
-
- @Override
- public void handleBranchEvent(Sender sender, BranchEvent branchEvent) {
- if (!isApplicableEvent(branchEvent.getBranchGuid())) {
- return;
- }
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (mergeXWidget != null && mergeXWidget.getXViewer().getTree().isDisposed() != true) {
- mergeXWidget.refresh();
- }
- }
- });
- }
-
- @Override
- public void handleLocalBranchToArtifactCacheUpdateEvent(Sender sender) {
- }
-
- @Override
- public List<? extends IEventFilter> getEventFilters() {
- return null;
- }
-
- @Override
- public void handleArtifactEvent(ArtifactEvent artifactEvent, final Sender sender) {
- if (mergeXWidget.getXViewer() == null || mergeXWidget.getXViewer().getTree() == null || mergeXWidget.getXViewer().getTree().isDisposed()) {
- OseeEventManager.removeListener(this);
- return;
- }
- if (!isApplicableEvent(artifactEvent.getBranchGuid())) {
- return;
- }
- try {
- Branch mergeBranch = BranchManager.getMergeBranch(sourceBranch, destBranch);
- if (mergeBranch == null || !mergeBranch.getGuid().equals(artifactEvent.getBranchGuid())) {
- return;
- }
- } catch (OseeCoreException ex) {
- // ignore the exception for an event don't want them popping up on people for no reason
- }
- final Collection<Artifact> modifiedArts =
- artifactEvent.getCacheArtifacts(EventModType.Modified, EventModType.Reloaded);
- final Collection<EventBasicGuidArtifact> deletedPurgedArts = artifactEvent.get(EventModType.Deleted);
- if (modifiedArts.isEmpty() && deletedPurgedArts.isEmpty()) {
- return;
- }
- final MergeView mergeView = this;
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (mergeXWidget.getXViewer() == null || mergeXWidget.getXViewer().getTree() == null || mergeXWidget.getXViewer().getTree().isDisposed()) {
- return;
- }
- for (Artifact artifact : modifiedArts) {
- try {
- Branch branch = artifact.getBranch();
- if (showConflicts) {
- for (Conflict conflict : conflicts) {
- if (artifact.equals(conflict.getSourceArtifact()) && branch.equals(conflict.getSourceBranch()) || artifact.equals(conflict.getDestArtifact()) && branch.equals(conflict.getDestBranch())) {
- mergeXWidget.setInputData(sourceBranch, destBranch, transactionId, mergeView, commitTrans,
- "Source Artifact Changed", showConflicts);
- if (artifact.equals(conflict.getSourceArtifact()) && sender.isLocal()) {
- new MessageDialog(
- Displays.getActiveShell().getShell(),
- "Modifying Source artifact while merging",
- null,
- "Typically changes done while merging should be done on the merge branch. You should not normally merge on the source branch.",
- 2, new String[] {"OK"}, 1).open();
- }
- return;
- } else if (artifact.equals(conflict.getArtifact())) {
- conflict.computeEqualsValues();
- mergeXWidget.refresh();
- }
- }
- if (conflicts.length > 0 && (branch.equals(conflicts[0].getSourceBranch()) || branch.equals(conflicts[0].getDestBranch()))) {
- mergeXWidget.setInputData(
- sourceBranch,
- destBranch,
- transactionId,
- mergeView,
- commitTrans,
- branch.equals(conflicts[0].getSourceBranch()) ? "Source Branch Changed" : "Destination Branch Changed",
- showConflicts);
- }
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
- if (!deletedPurgedArts.isEmpty()) {
- try {
- Branch branch = BranchManager.getBranch(deletedPurgedArts.iterator().next());
- if (conflicts.length > 0 && (branch.equals(conflicts[0].getSourceBranch()) || branch.equals(conflicts[0].getDestBranch()))) {
- mergeXWidget.setInputData(
- sourceBranch,
- destBranch,
- transactionId,
- mergeView,
- commitTrans,
- branch.equals(conflicts[0].getSourceBranch()) ? "Source Branch Changed" : "Destination Branch Changed",
- showConflicts);
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.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.framework.ui.skynet.widgets.xmerge;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+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.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osee.framework.access.AccessControlManager;
+import org.eclipse.osee.framework.core.enums.PermissionEnum;
+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.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.plugin.core.IActionable;
+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.BranchManager;
+import org.eclipse.osee.framework.skynet.core.conflict.ArtifactConflict;
+import org.eclipse.osee.framework.skynet.core.conflict.AttributeConflict;
+import org.eclipse.osee.framework.skynet.core.conflict.Conflict;
+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.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.skynet.core.transaction.TransactionManager;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.util.AbstractSelectionEnabledHandler;
+import org.eclipse.osee.framework.ui.plugin.util.Commands;
+import org.eclipse.osee.framework.ui.skynet.ArtifactExplorer;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.OseeContributionItem;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+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.revert.RevertWizard;
+import org.eclipse.osee.framework.ui.skynet.util.SkynetViews;
+import org.eclipse.osee.framework.ui.skynet.widgets.xHistory.HistoryView;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.osee.framework.ui.swt.NonmodalWizardDialog;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.IHandlerService;
+import org.eclipse.ui.menus.CommandContributionItem;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * @see ViewPart
+ * @author Donald G. Dunne
+ */
+public class MergeView extends ViewPart implements IActionable, IBranchEventListener, IArtifactEventListener, IFrameworkTransactionEventListener {
+ public static final String VIEW_ID = "org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeView";
+ public static String HELP_CONTEXT_ID = "Merge_Manager_View";
+ private MergeXWidget mergeXWidget;
+ private Conflict[] conflicts;
+ private IHandlerService handlerService;
+ private Branch sourceBranch;
+ private Branch destBranch;
+ private TransactionRecord transactionId;
+ private TransactionRecord commitTrans;
+ private boolean showConflicts;
+
+ public static void openView(final Branch sourceBranch, final Branch destBranch, final TransactionRecord tranId) {
+ if (sourceBranch == null && destBranch == null && tranId == null) {
+ throw new IllegalArgumentException("Branch's and Transaction ID can't be null");
+ }
+ openViewUpon(sourceBranch, destBranch, tranId, null, true);
+ }
+
+ public static void openView(final TransactionRecord commitTrans) {
+ if (commitTrans == null) {
+ throw new IllegalArgumentException("Commit Transaction ID can't be null");
+ }
+ openViewUpon(null, null, null, commitTrans, true);
+ }
+
+ private static void openViewUpon(final Branch sourceBranch, final Branch destBranch, final TransactionRecord tranId, final TransactionRecord commitTrans, final boolean showConflicts) {
+ Job job = new Job("Open Merge View") {
+
+ @Override
+ protected IStatus run(final IProgressMonitor monitor) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ try {
+ IWorkbenchPage page = AWorkbench.getActivePage();
+ IViewPart viewPart =
+ page.showView(
+ MergeView.VIEW_ID,
+ String.valueOf(sourceBranch != null ? sourceBranch.getId() * 100000 + destBranch.getId() : commitTrans.getId()),
+ IWorkbenchPage.VIEW_ACTIVATE);
+ if (viewPart instanceof MergeView) {
+ MergeView mergeView = (MergeView) viewPart;
+ mergeView.showConflicts = showConflicts;
+ mergeView.explore(sourceBranch, destBranch, tranId, commitTrans, showConflicts);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ });
+
+ monitor.done();
+ return Status.OK_STATUS;
+ }
+ };
+
+ Jobs.startJob(job);
+ }
+
+ @Override
+ public void dispose() {
+ OseeEventManager.removeListener(this);
+ OseeEventManager.removeListener(this);
+ super.dispose();
+ }
+
+ @Override
+ public void setFocus() {
+ if (mergeXWidget != null) {
+ mergeXWidget.setFocus();
+ }
+ }
+
+ @Override
+ public void createPartControl(Composite parent) {
+ /*
+ * Create a grid layout object so the text and treeviewer are laid out the way I want.
+ */
+
+ PlatformUI.getWorkbench().getService(IHandlerService.class);
+ handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
+
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.verticalSpacing = 0;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ parent.setLayout(layout);
+ parent.setLayoutData(new GridData(GridData.FILL_BOTH));
+ mergeXWidget = new MergeXWidget();
+ mergeXWidget.setDisplayLabel(false);
+ mergeXWidget.createWidgets(parent, 1);
+
+ if (conflicts != null) {
+ mergeXWidget.setConflicts(conflicts);
+ }
+ MenuManager menuManager = new MenuManager();
+ menuManager.setRemoveAllWhenShown(true);
+ menuManager.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager manager) {
+ MenuManager menuManager = (MenuManager) manager;
+ fillPopupMenu(menuManager);
+ }
+
+ private void fillPopupMenu(MenuManager menuManager) {
+ addEditArtifactMenuItem(menuManager);
+ addMergeMenuItem(menuManager);
+ menuManager.add(new Separator());
+ addPreviewMenuItem(menuManager);
+ addDiffMenuItem(menuManager);
+ menuManager.add(new Separator());
+ addSourceResourceHistoryMenuItem(menuManager);
+ addSourceRevealMenuItem(menuManager);
+ menuManager.add(new Separator());
+ addDestResourceHistoryMenuItem(menuManager);
+ addDestRevealMenuItem(menuManager);
+ menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ addRevertUnresolvableConflictsMenuItem(menuManager);
+ }
+ });
+
+ mergeXWidget.getXViewer().getTree().setMenu(menuManager.createContextMenu(mergeXWidget.getXViewer().getTree()));
+
+ createEditArtifactMenuItem(menuManager);
+ createMergeMenuItem(menuManager);
+ menuManager.add(new Separator());
+ createPreviewMenuItem(menuManager);
+ createDiffMenuItem(menuManager);
+ menuManager.add(new Separator());
+ createSourceResourceHistoryMenuItem(menuManager);
+ createSourceRevealMenuItem(menuManager);
+ menuManager.add(new Separator());
+ createDestinationResourceHistoryMenuItem(menuManager);
+ createDestinationRevealMenuItem(menuManager);
+ menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ createRevertUnresolvableConflictsMenuItem(menuManager);
+
+ OseeContributionItem.addTo(this, true);
+ getSite().registerContextMenu("org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeView", menuManager,
+ mergeXWidget.getXViewer());
+
+ getSite().setSelectionProvider(mergeXWidget.getXViewer());
+ SkynetGuiPlugin.getInstance().setHelp(parent, HELP_CONTEXT_ID, "org.eclipse.osee.framework.help.ui");
+
+ OseeEventManager.addListener(this);
+ OseeEventManager.addListener(this);
+ }
+
+ private void addPreviewMenuItem(MenuManager menuManager) {
+ MenuManager subMenuManager = new MenuManager("Preview", "previewTransaction");
+ menuManager.add(subMenuManager);
+ addPreviewItems(subMenuManager, "Preview Source Artifact");
+ addPreviewItems(subMenuManager, "Preview Destination Artifact");
+ addPreviewItems(subMenuManager, "Preview Merge Artifact");
+ }
+
+ private void createPreviewMenuItem(MenuManager menuManager) {
+ MenuManager subMenuManager = new MenuManager("Preview", "previewTransaction");
+ menuManager.add(subMenuManager);
+ createPreviewItems(subMenuManager, new PreviewHandler(menuManager, 1), "Preview Source Artifact");
+ createPreviewItems(subMenuManager, new PreviewHandler(menuManager, 2), "Preview Destination Artifact");
+ createPreviewItems(subMenuManager, new PreviewHandler(menuManager, 3), "Preview Merge Artifact");
+ }
+
+ private String addPreviewItems(MenuManager subMenuManager, String command) {
+ CommandContributionItem previewCommand =
+ Commands.getLocalCommandContribution(getSite(), subMenuManager.getId() + command, command, null, null,
+ ImageManager.getImageDescriptor(FrameworkImage.PREVIEW_ARTIFACT), null, null, null);
+ subMenuManager.add(previewCommand);
+ return previewCommand.getId();
+ }
+
+ private void createPreviewItems(MenuManager subMenuManager, PreviewHandler handler, String command) {
+ handlerService.activateHandler(addPreviewItems(subMenuManager, command), handler);
+ }
+
+ private void addDiffMenuItem(MenuManager menuManager) {
+ MenuManager subMenuManager = new MenuManager("Differences", "diffTransaction");
+ menuManager.add(subMenuManager);
+ addDiffItems(subMenuManager, "Show Source Branch Differences");
+ addDiffItems(subMenuManager, "Show Destination Branch Differences");
+ addDiffItems(subMenuManager, "Show Source/Destination Differences");
+ addDiffItems(subMenuManager, "Show Source/Merge Differences");
+ addDiffItems(subMenuManager, "Show Destination/Merge Differences");
+ }
+
+ private void createDiffMenuItem(MenuManager menuManager) {
+ MenuManager subMenuManager = new MenuManager("Differences", "diffTransaction");
+ menuManager.add(subMenuManager);
+ createDiffItems(subMenuManager, new DiffHandler(menuManager, 1, mergeXWidget), "Show Source Branch Differences");
+ createDiffItems(subMenuManager, new DiffHandler(menuManager, 2, mergeXWidget),
+ "Show Destination Branch Differences");
+ createDiffItems(subMenuManager, new DiffHandler(menuManager, 3, mergeXWidget),
+ "Show Source/Destination Differences");
+ createDiffItems(subMenuManager, new DiffHandler(menuManager, 4, mergeXWidget), "Show Source/Merge Differences");
+ createDiffItems(subMenuManager, new DiffHandler(menuManager, 5, mergeXWidget),
+ "Show Destination/Merge Differences");
+ }
+
+ private String addDiffItems(MenuManager subMenuManager, String command) {
+ CommandContributionItem diffCommand =
+ Commands.getLocalCommandContribution(getSite(), subMenuManager.getId() + command, command, null, null,
+ null, null, null, null);
+ subMenuManager.add(diffCommand);
+ return diffCommand.getId();
+ }
+
+ private void createDiffItems(MenuManager subMenuManager, DiffHandler handler, String command) {
+ handlerService.activateHandler(addDiffItems(subMenuManager, command), handler);
+ }
+
+ private String addEditArtifactMenuItem(MenuManager menuManager) {
+ CommandContributionItem editArtifactCommand;
+ //RendererManager.getBestFileRenderer(PresentationType.SPECIALIZED_EDIT, attributeConflict.getArtifact()).getImage(attributeConflict.getArtifact());
+ editArtifactCommand =
+ Commands.getLocalCommandContribution(getSite(), "editArtifactCommand", "Edit Merge Artifact", null, null,
+ null, "E", null, "edit_Merge_Artifact");
+ menuManager.add(editArtifactCommand);
+ return editArtifactCommand.getId();
+ }
+
+ private String addSourceResourceHistoryMenuItem(MenuManager menuManager) {
+ CommandContributionItem sourecResourceCommand;
+ sourecResourceCommand =
+ Commands.getLocalCommandContribution(getSite(), "sourceResourceHistory",
+ "Show Source Artifact Resource History", null, null,
+ ImageManager.getImageDescriptor(FrameworkImage.DB_ICON_BLUE_EDIT), null, null,
+ "source_Resource_History");
+ menuManager.add(sourecResourceCommand);
+ return sourecResourceCommand.getId();
+ }
+
+ private String addDestResourceHistoryMenuItem(MenuManager menuManager) {
+ CommandContributionItem sourecResourceCommand;
+ sourecResourceCommand =
+ Commands.getLocalCommandContribution(getSite(), "destResourceHistory",
+ "Show Dest Artifact Resource History", null, null,
+ ImageManager.getImageDescriptor(FrameworkImage.DB_ICON_BLUE_EDIT), null, null,
+ "dest_Resource_History");
+ menuManager.add(sourecResourceCommand);
+ return sourecResourceCommand.getId();
+ }
+
+ private String addSourceRevealMenuItem(MenuManager menuManager) {
+ CommandContributionItem sourceReveal;
+ sourceReveal =
+ Commands.getLocalCommandContribution(getSite(), "sourceRevealArtifactExplorer",
+ "Reveal Source Artifact in Artifact Explorer", null, null,
+ ImageManager.getImageDescriptor(FrameworkImage.MAGNIFY), null, null, "source_Reveal");
+ menuManager.add(sourceReveal);
+ return sourceReveal.getId();
+ }
+
+ private String addDestRevealMenuItem(MenuManager menuManager) {
+ CommandContributionItem destReveal;
+ destReveal =
+ Commands.getLocalCommandContribution(getSite(), "destRevealArtifactExplorer",
+ "Reveal Dest Artifact in Artifact Explorer", null, null,
+ ImageManager.getImageDescriptor(FrameworkImage.MAGNIFY), null, null, "dest_Reveal");
+ menuManager.add(destReveal);
+ return destReveal.getId();
+ }
+
+ private String addRevertUnresolvableConflictsMenuItem(MenuManager menuManager) {
+ CommandContributionItem revertSelected;
+ revertSelected =
+ Commands.getLocalCommandContribution(getSite(), "revertSelected",
+ "Revert Source Artifacts for Unresolvable Conflicts", null, null, null, null, null, null);
+ menuManager.add(revertSelected);
+ return revertSelected.getId();
+ }
+
+ private void createEditArtifactMenuItem(MenuManager menuManager) {
+
+ handlerService.activateHandler(addEditArtifactMenuItem(menuManager),
+
+ new AbstractSelectionEnabledHandler(menuManager) {
+ private AttributeConflict attributeConflict;
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ if (attributeConflict != null) {
+ try {
+ if (MergeUtility.okToOverwriteEditedValue(attributeConflict,
+ Displays.getActiveShell().getShell(), false)) {
+ RendererManager.openInJob(attributeConflict.getArtifact(), PresentationType.MERGE_EDIT);
+
+ attributeConflict.markStatusToReflectEdit();
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
+ List<Conflict> conflicts = mergeXWidget.getSelectedConflicts();
+ attributeConflict = null;
+ if (conflicts == null || conflicts.size() != 1 || !(conflicts.get(0) instanceof AttributeConflict) || !conflicts.get(
+ 0).statusEditable()) {
+ return false;
+ }
+ attributeConflict = (AttributeConflict) conflicts.get(0);
+ return true;
+ }
+ });
+ }
+
+ private void createSourceResourceHistoryMenuItem(MenuManager menuManager) {
+
+ handlerService.activateHandler(addSourceResourceHistoryMenuItem(menuManager),
+
+ new AbstractSelectionEnabledHandler(menuManager) {
+ private AttributeConflict attributeConflict;
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ if (attributeConflict != null) {
+ try {
+ HistoryView.open(attributeConflict.getSourceArtifact());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
+ List<Conflict> conflicts = mergeXWidget.getSelectedConflicts();
+ attributeConflict = null;
+ if (conflicts == null || conflicts.size() != 1) {
+ return false;
+ }
+ attributeConflict = (AttributeConflict) conflicts.get(0);
+ return true;
+ }
+ });
+ }
+
+ private void createDestinationResourceHistoryMenuItem(MenuManager menuManager) {
+
+ handlerService.activateHandler(addDestResourceHistoryMenuItem(menuManager),
+
+ new AbstractSelectionEnabledHandler(menuManager) {
+ private AttributeConflict attributeConflict;
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ if (attributeConflict != null) {
+ try {
+ HistoryView.open(attributeConflict.getDestArtifact());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
+ List<Conflict> conflicts = mergeXWidget.getSelectedConflicts();
+ attributeConflict = null;
+ if (conflicts == null || conflicts.size() != 1) {
+ return false;
+ }
+ attributeConflict = (AttributeConflict) conflicts.get(0);
+ return true;
+ }
+ });
+ }
+
+ private void createSourceRevealMenuItem(MenuManager menuManager) {
+
+ handlerService.activateHandler(addSourceRevealMenuItem(menuManager),
+
+ new AbstractSelectionEnabledHandler(menuManager) {
+ private AttributeConflict attributeConflict;
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ if (attributeConflict != null) {
+ try {
+ ArtifactExplorer.revealArtifact(attributeConflict.getSourceArtifact());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
+ List<Conflict> conflicts = mergeXWidget.getSelectedConflicts();
+ attributeConflict = null;
+ if (conflicts == null || conflicts.size() != 1) {
+ return false;
+ }
+ attributeConflict = (AttributeConflict) conflicts.get(0);
+ return true;
+ }
+ });
+ }
+
+ private void createDestinationRevealMenuItem(MenuManager menuManager) {
+
+ handlerService.activateHandler(addDestRevealMenuItem(menuManager),
+
+ new AbstractSelectionEnabledHandler(menuManager) {
+ private AttributeConflict attributeConflict;
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ if (attributeConflict != null) {
+ try {
+ ArtifactExplorer.revealArtifact(attributeConflict.getDestArtifact());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
+ List<Conflict> conflicts = mergeXWidget.getSelectedConflicts();
+ attributeConflict = null;
+ if (conflicts == null || conflicts.size() != 1) {
+ return false;
+ }
+ attributeConflict = (AttributeConflict) conflicts.get(0);
+ return true;
+ }
+ });
+ }
+
+ private void createRevertUnresolvableConflictsMenuItem(MenuManager menuManager) {
+ handlerService.activateHandler(addRevertUnresolvableConflictsMenuItem(menuManager),
+ new AbstractSelectionEnabledHandler(menuManager) {
+ List<List<Artifact>> revertList;
+ List<Conflict> selectedConflicts;
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ RevertWizard wizard = new RevertWizard(revertList);
+ NonmodalWizardDialog wizardDialog =
+ new NonmodalWizardDialog(Displays.getActiveShell(), wizard);
+ wizardDialog.create();
+ wizardDialog.open();
+ return null;
+ }
+
+ @Override
+ public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
+ selectedConflicts = mergeXWidget.getSelectedConflicts();
+ revertList = new ArrayList<List<Artifact>>();
+ populateRevertList();
+ return !revertList.isEmpty();
+ }
+
+ private void populateRevertList() {
+ for (Conflict conflict : selectedConflicts) {
+ ArtifactConflict artifactConflict = (ArtifactConflict) conflict;
+ if (conflict.statusNotResolvable()) {
+ addArtifactToRevertList(artifactConflict);
+ }
+ }
+ }
+
+ private void addArtifactToRevertList(ArtifactConflict artifactConflict) {
+ Artifact art;
+ try {
+ art = artifactConflict.getSourceArtifact();
+ } catch (OseeCoreException ex) {
+ return;
+ }
+ List<Artifact> ins = new ArrayList<Artifact>();
+ ins.add(art);
+ revertList.add(ins);
+ }
+ });
+ }
+
+ private String addMergeMenuItem(MenuManager menuManager) {
+ CommandContributionItem mergeArtifactCommand;
+ mergeArtifactCommand =
+ Commands.getLocalCommandContribution(getSite(), "mergeArtifactCommand",
+ "Generate Three Way Merge (Developmental)", null, null, null, "E", null,
+ "Merge_Source_Destination_Artifact");
+ menuManager.add(mergeArtifactCommand);
+ return mergeArtifactCommand.getId();
+ }
+
+ private void createMergeMenuItem(MenuManager menuManager) {
+
+ handlerService.activateHandler(addMergeMenuItem(menuManager),
+
+ new AbstractSelectionEnabledHandler(menuManager) {
+ private AttributeConflict attributeConflict;
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ if (attributeConflict != null) {
+ MergeUtility.launchMerge(attributeConflict, Displays.getActiveShell().getShell());
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
+ List<Conflict> conflicts = mergeXWidget.getSelectedConflicts();
+ attributeConflict = null;
+ if (conflicts == null || conflicts.size() != 1 || !(conflicts.get(0) instanceof AttributeConflict) || !conflicts.get(
+ 0).statusEditable()) {
+ return false;
+ }
+ attributeConflict = (AttributeConflict) conflicts.get(0);
+ return attributeConflict.isWordAttribute();
+ }
+ });
+ }
+
+ public void explore(final Branch sourceBranch, final Branch destBranch, final TransactionRecord transactionId, final TransactionRecord commitTrans, boolean showConflicts) {
+ this.sourceBranch = sourceBranch;
+ this.destBranch = destBranch;
+ this.transactionId = transactionId;
+ this.commitTrans = commitTrans;
+ try {
+ mergeXWidget.setInputData(sourceBranch, destBranch, transactionId, this, commitTrans, showConflicts);
+ if (sourceBranch != null) {
+ setPartName("Merge Manager: " + sourceBranch.getShortName() + " <=> " + destBranch.getShortName());
+ } else if (commitTrans != null) {
+ setPartName("Merge Manager: " + commitTrans.getId());
+ } else {
+ setPartName("Merge Manager");
+ }
+
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ public void setConflicts(Conflict[] conflicts) {
+ this.conflicts = conflicts;
+ }
+
+ public String getActionDescription() {
+ return "";
+ }
+
+ @Override
+ public void init(IViewSite site, IMemento memento) throws PartInitException {
+ super.init(site, memento);
+ try {
+ Integer sourceBranchId = null;
+ Integer destBranchId = null;
+
+ if (memento != null) {
+ memento = memento.getChild(INPUT);
+ if (memento != null) {
+ if (SkynetViews.isSourceValid(memento)) {
+
+ Integer commitTransaction = memento.getInteger(COMMIT_NUMBER);
+ if (commitTransaction != null) {
+ openViewUpon(null, null, null, TransactionManager.getTransactionId(commitTransaction), false);
+ return;
+ }
+ sourceBranchId = memento.getInteger(SOURCE_BRANCH_ID);
+ final Branch sourceBranch = BranchManager.getBranch(sourceBranchId);
+ if (sourceBranch == null) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.WARNING,
+ "Merge View can't init due to invalid source branch id " + sourceBranchId);
+ mergeXWidget.setLabel("Could not restore this Merge View");
+ return;
+ }
+ destBranchId = memento.getInteger(DEST_BRANCH_ID);
+ final Branch destBranch = BranchManager.getBranch(destBranchId);
+ if (destBranch == null) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.WARNING,
+ "Merge View can't init due to invalid destination branch id " + sourceBranchId);
+ mergeXWidget.setLabel("Could not restore this Merge View");
+ return;
+ }
+ try {
+ TransactionRecord transactionId =
+ TransactionManager.getTransactionId(memento.getInteger(TRANSACTION_NUMBER));
+ openViewUpon(sourceBranch, destBranch, transactionId, null, false);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.WARNING,
+ "Merge View can't init due to invalid transaction id " + transactionId);
+ mergeXWidget.setLabel("Could not restore this Merge View due to invalid transaction id " + transactionId);
+ return;
+ }
+ } else {
+ SkynetViews.closeView(VIEW_ID, getViewSite().getSecondaryId());
+ }
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.WARNING, "Merge View error on init", ex);
+ }
+ }
+
+ private static final String INPUT = "input";
+ private static final String SOURCE_BRANCH_ID = "sourceBranchId";
+ private static final String DEST_BRANCH_ID = "destBranchId";
+ private static final String TRANSACTION_NUMBER = "transactionNumber";
+ private static final String COMMIT_NUMBER = "commitTransactionNumber";
+
+ @Override
+ public void saveState(IMemento memento) {
+ super.saveState(memento);
+ memento = memento.createChild(INPUT);
+ if (sourceBranch != null) {
+ memento.putInteger(SOURCE_BRANCH_ID, sourceBranch.getId());
+ memento.putInteger(DEST_BRANCH_ID, destBranch.getId());
+ memento.putInteger(TRANSACTION_NUMBER, transactionId.getId());
+ } else if (commitTrans != null) {
+ memento.putInteger(COMMIT_NUMBER, commitTrans.getId());
+ }
+
+ if (sourceBranch != null || commitTrans != null) {
+ SkynetViews.addDatabaseSourceId(memento);
+ }
+ }
+
+ private class PreviewHandler extends AbstractSelectionEnabledHandler {
+ private final int partToPreview;
+ private List<Artifact> artifacts;
+
+ public PreviewHandler(MenuManager menuManager, int partToPreview) {
+ super(menuManager);
+ this.partToPreview = partToPreview;
+ }
+
+ @Override
+ public Object execute(ExecutionEvent event) {
+ RendererManager.openInJob(artifacts, PresentationType.PREVIEW);
+ return null;
+ }
+
+ @Override
+ public boolean isEnabledWithException(IStructuredSelection structuredSelection) throws OseeCoreException {
+ artifacts = new LinkedList<Artifact>();
+ List<Conflict> conflicts = mergeXWidget.getSelectedConflicts();
+ for (Conflict conflict : conflicts) {
+ try {
+ switch (partToPreview) {
+ case 1:
+ if (conflict.getSourceArtifact() != null) {
+ artifacts.add(conflict.getSourceArtifact());
+ }
+ break;
+ case 2:
+ if (conflict.getDestArtifact() != null) {
+ artifacts.add(conflict.getDestArtifact());
+ }
+ break;
+ case 3:
+ if (conflict.statusNotResolvable() || conflict.statusInformational()) {
+ return false;
+ }
+ if (conflict.getArtifact() != null) {
+ artifacts.add(conflict.getArtifact());
+ }
+ break;
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ return AccessControlManager.checkObjectListPermission(artifacts, PermissionEnum.READ);
+ }
+ }
+
+ @Override
+ public void handleBranchEventREM1(Sender sender, BranchEventType branchModType, int branchId) {
+ if (sourceBranch != null && destBranch != null && (sourceBranch.getId() == branchId || destBranch.getId() == branchId)) {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (mergeXWidget != null && mergeXWidget.getXViewer().getTree().isDisposed() != true) {
+ mergeXWidget.refresh();
+ }
+ }
+ });
+ }
+ }
+
+ @Override
+ public void handleFrameworkTransactionEvent(final Sender sender, final FrameworkTransactionData transData) throws OseeCoreException {
+ try {
+ if (sourceBranch == null || destBranch == null) {
+ return;
+ }
+ if (sourceBranch.getId() != transData.getBranchId() && destBranch.getId() != transData.getBranchId()) {
+ Branch mergeBranch = BranchManager.getMergeBranch(sourceBranch, destBranch);
+ if (mergeBranch == null || mergeBranch.getId() != transData.getBranchId()) {
+ return;
+ }
+ }
+ } catch (OseeCoreException ex) {
+ //ignore the exception for an event don't want them popping up on people for no reason
+ }
+ final MergeView mergeView = this;
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (mergeXWidget.getXViewer() == null || mergeXWidget.getXViewer().getTree() == null || mergeXWidget.getXViewer().getTree().isDisposed()) {
+ return;
+ }
+ for (Artifact artifact : transData.cacheChangedArtifacts) {
+ try {
+ Branch branch = artifact.getBranch();
+ if (showConflicts) {
+ for (Conflict conflict : conflicts) {
+ if (artifact.equals(conflict.getSourceArtifact()) && branch.equals(conflict.getSourceBranch()) || artifact.equals(conflict.getDestArtifact()) && branch.equals(conflict.getDestBranch())) {
+ mergeXWidget.setInputData(sourceBranch, destBranch, transactionId, mergeView, commitTrans,
+ "Source Artifact Changed", showConflicts);
+ if (artifact.equals(conflict.getSourceArtifact()) && sender.isLocal()) {
+ new MessageDialog(
+ Displays.getActiveShell().getShell(),
+ "Modifying Source artifact while merging",
+ null,
+ "Typically changes done while merging should be done on the merge branch. You should not normally merge on the source branch.",
+ 2, new String[] {"OK"}, 1).open();
+ }
+ return;
+ } else if (artifact.equals(conflict.getArtifact())) {
+ conflict.computeEqualsValues();
+ mergeXWidget.refresh();
+ }
+ }
+ if (conflicts.length > 0 && (branch.equals(conflicts[0].getSourceBranch()) || branch.equals(conflicts[0].getDestBranch()))) {
+ mergeXWidget.setInputData(
+ sourceBranch,
+ destBranch,
+ transactionId,
+ mergeView,
+ commitTrans,
+ branch.equals(conflicts[0].getSourceBranch()) ? "Source Branch Changed" : "Destination Branch Changed",
+ showConflicts);
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ if (!transData.cacheDeletedArtifacts.isEmpty()) {
+ Branch branch = transData.cacheDeletedArtifacts.iterator().next().getBranch();
+ if (conflicts.length > 0 && (branch.equals(conflicts[0].getSourceBranch()) || branch.equals(conflicts[0].getDestBranch()))) {
+ mergeXWidget.setInputData(
+ sourceBranch,
+ destBranch,
+ transactionId,
+ mergeView,
+ commitTrans,
+ branch.equals(conflicts[0].getSourceBranch()) ? "Source Branch Changed" : "Destination Branch Changed",
+ showConflicts);
+ }
+ }
+ }
+ });
+
+ }
+
+ protected void showConflicts(boolean show) {
+ showConflicts = show;
+ }
+
+ private boolean isApplicableEvent(String branchGuid) {
+ return (sourceBranch != null && destBranch != null &&
+ //
+ (sourceBranch.getGuid().equals(branchGuid) ||
+ //
+ destBranch.getGuid().equals(branchGuid)));
+ }
+
+ @Override
+ public void handleBranchEvent(Sender sender, BranchEvent branchEvent) {
+ if (!isApplicableEvent(branchEvent.getBranchGuid())) {
+ return;
+ }
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (mergeXWidget != null && mergeXWidget.getXViewer().getTree().isDisposed() != true) {
+ mergeXWidget.refresh();
+ }
+ }
+ });
+ }
+
+ @Override
+ public void handleLocalBranchToArtifactCacheUpdateEvent(Sender sender) {
+ }
+
+ @Override
+ public List<? extends IEventFilter> getEventFilters() {
+ return null;
+ }
+
+ @Override
+ public void handleArtifactEvent(ArtifactEvent artifactEvent, final Sender sender) {
+ if (mergeXWidget.getXViewer() == null || mergeXWidget.getXViewer().getTree() == null || mergeXWidget.getXViewer().getTree().isDisposed()) {
+ OseeEventManager.removeListener(this);
+ return;
+ }
+ if (!isApplicableEvent(artifactEvent.getBranchGuid())) {
+ return;
+ }
+ try {
+ Branch mergeBranch = BranchManager.getMergeBranch(sourceBranch, destBranch);
+ if (mergeBranch == null || !mergeBranch.getGuid().equals(artifactEvent.getBranchGuid())) {
+ return;
+ }
+ } catch (OseeCoreException ex) {
+ // ignore the exception for an event don't want them popping up on people for no reason
+ }
+ final Collection<Artifact> modifiedArts =
+ artifactEvent.getCacheArtifacts(EventModType.Modified, EventModType.Reloaded);
+ final Collection<EventBasicGuidArtifact> deletedPurgedArts = artifactEvent.get(EventModType.Deleted);
+ if (modifiedArts.isEmpty() && deletedPurgedArts.isEmpty()) {
+ return;
+ }
+ final MergeView mergeView = this;
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (mergeXWidget.getXViewer() == null || mergeXWidget.getXViewer().getTree() == null || mergeXWidget.getXViewer().getTree().isDisposed()) {
+ return;
+ }
+ for (Artifact artifact : modifiedArts) {
+ try {
+ Branch branch = artifact.getBranch();
+ if (showConflicts) {
+ for (Conflict conflict : conflicts) {
+ if (artifact.equals(conflict.getSourceArtifact()) && branch.equals(conflict.getSourceBranch()) || artifact.equals(conflict.getDestArtifact()) && branch.equals(conflict.getDestBranch())) {
+ mergeXWidget.setInputData(sourceBranch, destBranch, transactionId, mergeView, commitTrans,
+ "Source Artifact Changed", showConflicts);
+ if (artifact.equals(conflict.getSourceArtifact()) && sender.isLocal()) {
+ new MessageDialog(
+ Displays.getActiveShell().getShell(),
+ "Modifying Source artifact while merging",
+ null,
+ "Typically changes done while merging should be done on the merge branch. You should not normally merge on the source branch.",
+ 2, new String[] {"OK"}, 1).open();
+ }
+ return;
+ } else if (artifact.equals(conflict.getArtifact())) {
+ conflict.computeEqualsValues();
+ mergeXWidget.refresh();
+ }
+ }
+ if (conflicts.length > 0 && (branch.equals(conflicts[0].getSourceBranch()) || branch.equals(conflicts[0].getDestBranch()))) {
+ mergeXWidget.setInputData(
+ sourceBranch,
+ destBranch,
+ transactionId,
+ mergeView,
+ commitTrans,
+ branch.equals(conflicts[0].getSourceBranch()) ? "Source Branch Changed" : "Destination Branch Changed",
+ showConflicts);
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ if (!deletedPurgedArts.isEmpty()) {
+ try {
+ Branch branch = BranchManager.getBranch(deletedPurgedArts.iterator().next());
+ if (conflicts.length > 0 && (branch.equals(conflicts[0].getSourceBranch()) || branch.equals(conflicts[0].getDestBranch()))) {
+ mergeXWidget.setInputData(
+ sourceBranch,
+ destBranch,
+ transactionId,
+ mergeView,
+ commitTrans,
+ branch.equals(conflicts[0].getSourceBranch()) ? "Source Branch Changed" : "Destination Branch Changed",
+ showConflicts);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ }
+ });
+
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXViewer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXViewer.java
index fd6878ba810..980e3f61c1d 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXViewer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXViewer.java
@@ -1,266 +1,266 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.xmerge;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.nebula.widgets.xviewer.XViewer;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.osee.framework.core.enums.ConflictType;
-import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
-import org.eclipse.osee.framework.core.exception.MergeChangesInArtifactException;
-import org.eclipse.osee.framework.core.exception.MultipleArtifactsExist;
-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.HttpBranchCreation;
-import org.eclipse.osee.framework.skynet.core.conflict.AttributeConflict;
-import org.eclipse.osee.framework.skynet.core.conflict.Conflict;
-import org.eclipse.osee.framework.skynet.core.event.BranchEventType;
-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.event2.BranchEvent;
-import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.compare.AttributeCompareItem;
-import org.eclipse.osee.framework.ui.skynet.compare.CompareHandler;
-import org.eclipse.osee.framework.ui.skynet.mergeWizard.ConflictResolutionWizard;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.Widgets;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- * @author Donald G. Dunne
- * @author Theron Virgin
- */
-public class MergeXViewer extends XViewer {
-
- private final MergeXWidget mergeXWidget;
- private Conflict[] conflicts;
- private ConflictResolutionWizard conWizard;
- private XMergeLabelProvider labelProvider;
- private Action openMergeViewAction;
-
- /**
- * @param parent
- * @param style
- */
- public MergeXViewer(Composite parent, int style, MergeXWidget xMergeViewer) {
- super(parent, style, new MergeXViewerFactory());
- this.mergeXWidget = xMergeViewer;
- }
-
- @Override
- protected void createSupportWidgets(Composite parent) {
- super.createSupportWidgets(parent);
- createMenuActions();
- }
-
- public void createMenuActions() {
- MenuManager mm = getMenuManager();
- mm.createContextMenu(getControl());
- mm.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- updateMenuActionsForTable();
- }
- });
-
- openMergeViewAction = new Action("Open Merge View", Action.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- AWorkbench.popup("ERROR", "Not implemented yet");
- }
- };
- }
-
- public void updateEditMenuActions() {
- MenuManager mm = getMenuManager();
-
- // EDIT MENU BLOCK
- mm.insertBefore(MENU_GROUP_PRE, openMergeViewAction);
- openMergeViewAction.setEnabled(true);
-
- }
-
- @Override
- public boolean isColumnMultiEditEnabled() {
- return true;
- }
-
- @Override
- public void updateMenuActionsForTable() {
- MenuManager mm = getMenuManager();
-
- updateEditMenuActions();
-
- mm.insertBefore(MENU_GROUP_PRE, new Separator());
- }
-
- public void setConflicts(final Conflict[] conflicts) {
- this.conflicts = conflicts;
-
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- setInput(conflicts);
- }
- });
- }
-
- /**
- * Release resources
- */
- @Override
- public void dispose() {
- getLabelProvider().dispose();
- }
-
- /**
- * @return the xUserRoleViewer
- */
- public MergeXWidget getXUserRoleViewer() {
- return mergeXWidget;
- }
-
- @Override
- public void resetDefaultSorter() {
- setSorter(new MergeXViewerSorter(this, labelProvider));
- }
-
- public Conflict[] getTransactionArtifactChanges() {
- return conflicts;
- }
-
- private boolean hasInteractiveIcon(TreeColumn treeColumn) {
- return isXViewerColumn(treeColumn, MergeXViewerFactory.Source) //
- || isXViewerColumn(treeColumn, MergeXViewerFactory.Destination) //
- || isXViewerColumn(treeColumn, MergeXViewerFactory.Conflict_Resolved) //
- || isXViewerColumn(treeColumn, MergeXViewerFactory.Merged);
- }
-
- private boolean isXViewerColumn(TreeColumn treeColumn, XViewerColumn expected) {
- return Widgets.isAccessible(treeColumn) && treeColumn.getText().equals(expected.getName());
- }
-
- @Override
- public boolean handleLeftClickInIconArea(TreeColumn treeColumn, TreeItem treeItem) {
- Conflict conflict = (Conflict) treeItem.getData();
- if (!conflict.statusCommitted() && hasInteractiveIcon(treeColumn)) {
- respondToIconClick(conflict, treeColumn);
- }
-
- return super.handleLeftClickInIconArea(treeColumn, treeItem);
- }
-
- private void respondToIconClick(Conflict conflict, TreeColumn treeColumn) {
- Shell shell = Displays.getActiveShell().getShell();
-
- try {
- if (conflict.statusNotResolvable()) {
- if (MergeUtility.showDeletedConflict(conflict, shell)) {
- mergeXWidget.refreshTable();
- }
- } else if (conflict.statusInformational()) {
- MergeUtility.showInformationalConflict(shell);
- } else {
- handleResolvableConflictClick(treeColumn, conflict, shell);
- }
- } catch (MergeChangesInArtifactException ex) {
- MessageDialog.openError(shell, "Error", ex.getMessage());
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
-
- private void handleResolvableConflictClick(TreeColumn treeColumn, Conflict conflict, Shell shell) throws MultipleArtifactsExist, ArtifactDoesNotExist, Exception {
- if (isXViewerColumn(treeColumn, MergeXViewerFactory.Source)) {
- MergeUtility.setToSource(conflict, shell, true);
- } else if (isXViewerColumn(treeColumn, MergeXViewerFactory.Destination)) {
- MergeUtility.setToDest(conflict, shell, true);
- } else if (isXViewerColumn(treeColumn, MergeXViewerFactory.Conflict_Resolved)) {
- conflict.handleResolvedSelection();
- // old events
- OseeEventManager.kickMergeBranchEvent(HttpBranchCreation.class, MergeBranchEventType.ConflictResolved,
- conflict.getMergeBranchID());
- // new events
- OseeEventManager.kickBranchEvent(HttpBranchCreation.class, new BranchEvent(
- BranchEventType.MergeConflictResolved, conflict.getMergeBranch().getGuid()), conflict.getMergeBranchID());
- } else if (isXViewerColumn(treeColumn, MergeXViewerFactory.Merged)) {
- if (!conflict.getConflictType().equals(ConflictType.ARTIFACT)) {
- AttributeConflict attributeConflict = (AttributeConflict) conflict;
- if (attributeConflict.isSimpleStringAttribute()) {
- getCompareHandler(attributeConflict).compare();
- } else if (attributeConflict.involvesNativeContent()) {
- nativeContentAlert(shell);
- } else {
- conWizard = new ConflictResolutionWizard(conflict);
- WizardDialog dialog = new WizardDialog(shell, conWizard);
- dialog.create();
- dialog.open();
- }
- }
- }
- mergeXWidget.loadTable();
- }
-
- private CompareHandler getCompareHandler(AttributeConflict attributeConflict) throws OseeCoreException {
- AttributeCompareItem leftContributionItem =
- new AttributeCompareItem(attributeConflict,
- attributeConflict.getArtifactName() + " on Branch: " + attributeConflict.getSourceBranch().getName(),
- attributeConflict.getAttribute().getDisplayableString(), true,
- ArtifactImageManager.getImage(attributeConflict.getArtifact()));
- AttributeCompareItem rightContributionItem =
- new AttributeCompareItem(attributeConflict,
- attributeConflict.getArtifactName() + " on Branch: " + attributeConflict.getDestBranch().getName(),
- attributeConflict.getDestDisplayData(), false,
- ArtifactImageManager.getImage(attributeConflict.getArtifact()));
-
- return new CompareHandler(leftContributionItem, rightContributionItem, null);
- }
-
- private static void nativeContentAlert(Shell shell) {
- MessageDialog dialog =
- new MessageDialog(
- shell,
- "Artifact type not supported",
- null,
- "Native artifact types are not currently supported for the merge wizard.\n" + "You will need to populate the merge value with the source or destination values" + " and then merge by hand by right-clicking \"Edit Merge Artifact.\"",
- 2, new String[] {"OK"}, 1);
- dialog.open();
- }
-
- @Override
- protected void doUpdateItem(Widget widget, Object element, boolean fullMap) {
- super.doUpdateItem(widget, element, fullMap);
- if (conWizard != null) {
- try {
- conWizard.setResolution();
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
-
- public void addLabelProvider(XMergeLabelProvider labelProvider) {
- this.labelProvider = labelProvider;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.xmerge;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.nebula.widgets.xviewer.XViewer;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.osee.framework.core.enums.ConflictType;
+import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
+import org.eclipse.osee.framework.core.exception.MergeChangesInArtifactException;
+import org.eclipse.osee.framework.core.exception.MultipleArtifactsExist;
+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.HttpBranchCreation;
+import org.eclipse.osee.framework.skynet.core.conflict.AttributeConflict;
+import org.eclipse.osee.framework.skynet.core.conflict.Conflict;
+import org.eclipse.osee.framework.skynet.core.event.BranchEventType;
+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.event2.BranchEvent;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.compare.AttributeCompareItem;
+import org.eclipse.osee.framework.ui.skynet.compare.CompareHandler;
+import org.eclipse.osee.framework.ui.skynet.mergeWizard.ConflictResolutionWizard;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.Widgets;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.swt.widgets.Widget;
+
+/**
+ * @author Donald G. Dunne
+ * @author Theron Virgin
+ */
+public class MergeXViewer extends XViewer {
+
+ private final MergeXWidget mergeXWidget;
+ private Conflict[] conflicts;
+ private ConflictResolutionWizard conWizard;
+ private XMergeLabelProvider labelProvider;
+ private Action openMergeViewAction;
+
+ /**
+ * @param parent
+ * @param style
+ */
+ public MergeXViewer(Composite parent, int style, MergeXWidget xMergeViewer) {
+ super(parent, style, new MergeXViewerFactory());
+ this.mergeXWidget = xMergeViewer;
+ }
+
+ @Override
+ protected void createSupportWidgets(Composite parent) {
+ super.createSupportWidgets(parent);
+ createMenuActions();
+ }
+
+ public void createMenuActions() {
+ MenuManager mm = getMenuManager();
+ mm.createContextMenu(getControl());
+ mm.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager manager) {
+ updateMenuActionsForTable();
+ }
+ });
+
+ openMergeViewAction = new Action("Open Merge View", Action.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ AWorkbench.popup("ERROR", "Not implemented yet");
+ }
+ };
+ }
+
+ public void updateEditMenuActions() {
+ MenuManager mm = getMenuManager();
+
+ // EDIT MENU BLOCK
+ mm.insertBefore(MENU_GROUP_PRE, openMergeViewAction);
+ openMergeViewAction.setEnabled(true);
+
+ }
+
+ @Override
+ public boolean isColumnMultiEditEnabled() {
+ return true;
+ }
+
+ @Override
+ public void updateMenuActionsForTable() {
+ MenuManager mm = getMenuManager();
+
+ updateEditMenuActions();
+
+ mm.insertBefore(MENU_GROUP_PRE, new Separator());
+ }
+
+ public void setConflicts(final Conflict[] conflicts) {
+ this.conflicts = conflicts;
+
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ setInput(conflicts);
+ }
+ });
+ }
+
+ /**
+ * Release resources
+ */
+ @Override
+ public void dispose() {
+ getLabelProvider().dispose();
+ }
+
+ /**
+ * @return the xUserRoleViewer
+ */
+ public MergeXWidget getXUserRoleViewer() {
+ return mergeXWidget;
+ }
+
+ @Override
+ public void resetDefaultSorter() {
+ setSorter(new MergeXViewerSorter(this, labelProvider));
+ }
+
+ public Conflict[] getTransactionArtifactChanges() {
+ return conflicts;
+ }
+
+ private boolean hasInteractiveIcon(TreeColumn treeColumn) {
+ return isXViewerColumn(treeColumn, MergeXViewerFactory.Source) //
+ || isXViewerColumn(treeColumn, MergeXViewerFactory.Destination) //
+ || isXViewerColumn(treeColumn, MergeXViewerFactory.Conflict_Resolved) //
+ || isXViewerColumn(treeColumn, MergeXViewerFactory.Merged);
+ }
+
+ private boolean isXViewerColumn(TreeColumn treeColumn, XViewerColumn expected) {
+ return Widgets.isAccessible(treeColumn) && treeColumn.getText().equals(expected.getName());
+ }
+
+ @Override
+ public boolean handleLeftClickInIconArea(TreeColumn treeColumn, TreeItem treeItem) {
+ Conflict conflict = (Conflict) treeItem.getData();
+ if (!conflict.statusCommitted() && hasInteractiveIcon(treeColumn)) {
+ respondToIconClick(conflict, treeColumn);
+ }
+
+ return super.handleLeftClickInIconArea(treeColumn, treeItem);
+ }
+
+ private void respondToIconClick(Conflict conflict, TreeColumn treeColumn) {
+ Shell shell = Displays.getActiveShell().getShell();
+
+ try {
+ if (conflict.statusNotResolvable()) {
+ if (MergeUtility.showDeletedConflict(conflict, shell)) {
+ mergeXWidget.refreshTable();
+ }
+ } else if (conflict.statusInformational()) {
+ MergeUtility.showInformationalConflict(shell);
+ } else {
+ handleResolvableConflictClick(treeColumn, conflict, shell);
+ }
+ } catch (MergeChangesInArtifactException ex) {
+ MessageDialog.openError(shell, "Error", ex.getMessage());
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ private void handleResolvableConflictClick(TreeColumn treeColumn, Conflict conflict, Shell shell) throws MultipleArtifactsExist, ArtifactDoesNotExist, Exception {
+ if (isXViewerColumn(treeColumn, MergeXViewerFactory.Source)) {
+ MergeUtility.setToSource(conflict, shell, true);
+ } else if (isXViewerColumn(treeColumn, MergeXViewerFactory.Destination)) {
+ MergeUtility.setToDest(conflict, shell, true);
+ } else if (isXViewerColumn(treeColumn, MergeXViewerFactory.Conflict_Resolved)) {
+ conflict.handleResolvedSelection();
+ // old events
+ OseeEventManager.kickMergeBranchEvent(HttpBranchCreation.class, MergeBranchEventType.ConflictResolved,
+ conflict.getMergeBranchID());
+ // new events
+ OseeEventManager.kickBranchEvent(HttpBranchCreation.class, new BranchEvent(
+ BranchEventType.MergeConflictResolved, conflict.getMergeBranch().getGuid()), conflict.getMergeBranchID());
+ } else if (isXViewerColumn(treeColumn, MergeXViewerFactory.Merged)) {
+ if (!conflict.getConflictType().equals(ConflictType.ARTIFACT)) {
+ AttributeConflict attributeConflict = (AttributeConflict) conflict;
+ if (attributeConflict.isSimpleStringAttribute()) {
+ getCompareHandler(attributeConflict).compare();
+ } else if (attributeConflict.involvesNativeContent()) {
+ nativeContentAlert(shell);
+ } else {
+ conWizard = new ConflictResolutionWizard(conflict);
+ WizardDialog dialog = new WizardDialog(shell, conWizard);
+ dialog.create();
+ dialog.open();
+ }
+ }
+ }
+ mergeXWidget.loadTable();
+ }
+
+ private CompareHandler getCompareHandler(AttributeConflict attributeConflict) throws OseeCoreException {
+ AttributeCompareItem leftContributionItem =
+ new AttributeCompareItem(attributeConflict,
+ attributeConflict.getArtifactName() + " on Branch: " + attributeConflict.getSourceBranch().getName(),
+ attributeConflict.getAttribute().getDisplayableString(), true,
+ ArtifactImageManager.getImage(attributeConflict.getArtifact()));
+ AttributeCompareItem rightContributionItem =
+ new AttributeCompareItem(attributeConflict,
+ attributeConflict.getArtifactName() + " on Branch: " + attributeConflict.getDestBranch().getName(),
+ attributeConflict.getDestDisplayData(), false,
+ ArtifactImageManager.getImage(attributeConflict.getArtifact()));
+
+ return new CompareHandler(leftContributionItem, rightContributionItem, null);
+ }
+
+ private static void nativeContentAlert(Shell shell) {
+ MessageDialog dialog =
+ new MessageDialog(
+ shell,
+ "Artifact type not supported",
+ null,
+ "Native artifact types are not currently supported for the merge wizard.\n" + "You will need to populate the merge value with the source or destination values" + " and then merge by hand by right-clicking \"Edit Merge Artifact.\"",
+ 2, new String[] {"OK"}, 1);
+ dialog.open();
+ }
+
+ @Override
+ protected void doUpdateItem(Widget widget, Object element, boolean fullMap) {
+ super.doUpdateItem(widget, element, fullMap);
+ if (conWizard != null) {
+ try {
+ conWizard.setResolution();
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+
+ public void addLabelProvider(XMergeLabelProvider labelProvider) {
+ this.labelProvider = labelProvider;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXViewerFactory.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXViewerFactory.java
index dbe66f5328f..b3b459225f4 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXViewerFactory.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXViewerFactory.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.xmerge;
-
-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 MergeXViewerFactory extends SkynetXViewerFactory {
-
- public static XViewerColumn Conflict_Resolved =
- new XViewerColumn("framework.merge.conflictResolved", "Conflict Resolution", 43, SWT.LEFT, true,
- SortDataType.String, false, null);
- public static XViewerColumn Artifact_Name =
- new XViewerColumn("framework.merge.artifactName", "Artifact Name", 200, SWT.LEFT, true, SortDataType.String,
- false, null);
- public static XViewerColumn Type =
- new XViewerColumn("framework.merge.artifactType", "Artifact Type", 150, SWT.LEFT, true, SortDataType.String,
- false, null);
- public static XViewerColumn Change_Item =
- new XViewerColumn("framework.merge.conflictingItem", "Conflicting Item", 150, SWT.LEFT, true,
- SortDataType.String, false, null);
- public static XViewerColumn Source =
- new XViewerColumn("framework.merge.sourceValue", "Source Value", 100, SWT.LEFT, true, SortDataType.String,
- false, null);
- public static XViewerColumn Destination =
- new XViewerColumn("framework.merge.destinationValue", "Destination Value", 100, SWT.LEFT, true,
- SortDataType.String, false, null);
- public static XViewerColumn Merged =
- new XViewerColumn("framework.merge.mergedValue", "Merged Value", 100, SWT.LEFT, true, SortDataType.String,
- false, null);
- public static XViewerColumn Art_Id =
- new XViewerColumn("framework.merge.artId", "Artifact Id", 75, SWT.LEFT, true, SortDataType.String, false, null);
-
- public MergeXViewerFactory() {
- super("osee.skynet.gui.MergeXViewer");
- registerColumns(Conflict_Resolved, Artifact_Name, Type, Change_Item, Source, Destination, Merged, Art_Id);
- registerAllAttributeColumns();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.xmerge;
+
+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 MergeXViewerFactory extends SkynetXViewerFactory {
+
+ public static XViewerColumn Conflict_Resolved =
+ new XViewerColumn("framework.merge.conflictResolved", "Conflict Resolution", 43, SWT.LEFT, true,
+ SortDataType.String, false, null);
+ public static XViewerColumn Artifact_Name =
+ new XViewerColumn("framework.merge.artifactName", "Artifact Name", 200, SWT.LEFT, true, SortDataType.String,
+ false, null);
+ public static XViewerColumn Type =
+ new XViewerColumn("framework.merge.artifactType", "Artifact Type", 150, SWT.LEFT, true, SortDataType.String,
+ false, null);
+ public static XViewerColumn Change_Item =
+ new XViewerColumn("framework.merge.conflictingItem", "Conflicting Item", 150, SWT.LEFT, true,
+ SortDataType.String, false, null);
+ public static XViewerColumn Source =
+ new XViewerColumn("framework.merge.sourceValue", "Source Value", 100, SWT.LEFT, true, SortDataType.String,
+ false, null);
+ public static XViewerColumn Destination =
+ new XViewerColumn("framework.merge.destinationValue", "Destination Value", 100, SWT.LEFT, true,
+ SortDataType.String, false, null);
+ public static XViewerColumn Merged =
+ new XViewerColumn("framework.merge.mergedValue", "Merged Value", 100, SWT.LEFT, true, SortDataType.String,
+ false, null);
+ public static XViewerColumn Art_Id =
+ new XViewerColumn("framework.merge.artId", "Artifact Id", 75, SWT.LEFT, true, SortDataType.String, false, null);
+
+ public MergeXViewerFactory() {
+ super("osee.skynet.gui.MergeXViewer");
+ registerColumns(Conflict_Resolved, Artifact_Name, Type, Change_Item, Source, Destination, Merged, Art_Id);
+ registerAllAttributeColumns();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXViewerSorter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXViewerSorter.java
index 32f53ffc1e7..fd5cc46406a 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXViewerSorter.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXViewerSorter.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.framework.ui.skynet.widgets.xmerge;
-
-import org.eclipse.jface.viewers.Viewer;
-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.framework.skynet.core.conflict.Conflict;
-import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.XMergeLabelProvider.ConflictState;
-
-/**
- * @author Theron Virgin
- */
-public class MergeXViewerSorter extends XViewerSorter {
-
- protected final XViewer xViewer;
- protected final XMergeLabelProvider labelProvider;
-
- /**
- * @param xViewer
- */
- public MergeXViewerSorter(XViewer xViewer, XMergeLabelProvider labelProvider) {
- super(xViewer);
- this.xViewer = xViewer;
- this.labelProvider = labelProvider;
- }
-
- @Override
- public int compare(Viewer viewer, Object o1, Object o2, int sortXColIndex) {
- try {
- if (xViewer == null || !xViewer.getCustomizeMgr().isSorting()) return 0;
- XViewerColumn sortXCol = xViewer.getCustomizeMgr().getSortXCols().get(sortXColIndex);
- String value1 = labelProvider.getColumnText(o1, sortXCol, sortXColIndex);
- String value2 = labelProvider.getColumnText(o2, sortXCol, sortXColIndex);
-
- if (o1 instanceof Conflict && o2 instanceof Conflict) {
- if (sortXCol.equals(MergeXViewerFactory.Conflict_Resolved)) {
- int compareInt =
- new Integer(ConflictState.getValue(value1)).compareTo(new Integer(ConflictState.getValue(value2)));
- return getCompareBasedOnDirection(sortXCol, compareInt, viewer, o1, o2, sortXColIndex);
- }
- }
-
- return super.compare(viewer, o1, o2, sortXColIndex);
- } catch (Exception ex) {
- // do nothing
- }
- return 1;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.xmerge;
+
+import org.eclipse.jface.viewers.Viewer;
+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.framework.skynet.core.conflict.Conflict;
+import org.eclipse.osee.framework.ui.skynet.widgets.xmerge.XMergeLabelProvider.ConflictState;
+
+/**
+ * @author Theron Virgin
+ */
+public class MergeXViewerSorter extends XViewerSorter {
+
+ protected final XViewer xViewer;
+ protected final XMergeLabelProvider labelProvider;
+
+ /**
+ * @param xViewer
+ */
+ public MergeXViewerSorter(XViewer xViewer, XMergeLabelProvider labelProvider) {
+ super(xViewer);
+ this.xViewer = xViewer;
+ this.labelProvider = labelProvider;
+ }
+
+ @Override
+ public int compare(Viewer viewer, Object o1, Object o2, int sortXColIndex) {
+ try {
+ if (xViewer == null || !xViewer.getCustomizeMgr().isSorting()) return 0;
+ XViewerColumn sortXCol = xViewer.getCustomizeMgr().getSortXCols().get(sortXColIndex);
+ String value1 = labelProvider.getColumnText(o1, sortXCol, sortXColIndex);
+ String value2 = labelProvider.getColumnText(o2, sortXCol, sortXColIndex);
+
+ if (o1 instanceof Conflict && o2 instanceof Conflict) {
+ if (sortXCol.equals(MergeXViewerFactory.Conflict_Resolved)) {
+ int compareInt =
+ new Integer(ConflictState.getValue(value1)).compareTo(new Integer(ConflictState.getValue(value2)));
+ return getCompareBasedOnDirection(sortXCol, compareInt, viewer, o1, o2, sortXColIndex);
+ }
+ }
+
+ return super.compare(viewer, o1, o2, sortXColIndex);
+ } catch (Exception ex) {
+ // do nothing
+ }
+ return 1;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXWidget.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXWidget.java
index 7842f457c8b..be115e56f75 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXWidget.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeXWidget.java
@@ -1,702 +1,702 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.ui.skynet.widgets.xmerge;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.action.ToolBarManager;
-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.framework.core.data.SystemUser;
-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.jdk.core.util.AHTML;
-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.plugin.core.util.Jobs;
-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.BranchManager;
-import org.eclipse.osee.framework.skynet.core.artifact.IATSArtifact;
-import org.eclipse.osee.framework.skynet.core.conflict.Conflict;
-import org.eclipse.osee.framework.skynet.core.conflict.ConflictManagerExternal;
-import org.eclipse.osee.framework.skynet.core.revision.ConflictManagerInternal;
-import org.eclipse.osee.framework.skynet.core.types.IArtifact;
-import org.eclipse.osee.framework.ui.plugin.OseeUiActions;
-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.ListSelectionDialogNoSave;
-import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.ats.OseeAts;
-import org.eclipse.osee.framework.ui.skynet.change.ChangeUiUtil;
-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.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.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Tree;
-
-/**
- * @author Donald G. Dunne
- * @author Theron Virgin
- */
-public class MergeXWidget extends XWidget implements IAdaptable {
- private static final String COMPLETE_COMMIT_ACTION_ID = "complete.commit.action.id";
- private static final String REFRESH_ACTION_ID = "refresh.action.id";
- private MergeXViewer mergeXViewer;
- private IDirtiableEditor editor;
- public final static String normalColor = "#EEEEEE";
- private static final String LOADING = "Loading ...";
- private static final String NO_CONFLICTS = "No conflicts were found";
- private static final String CONFLICTS_NOT_LOADED = "Cleared on shutdown. Refresh to Reload.";
- private Label extraInfoLabel;
- private Conflict[] conflicts;
- private String displayLabelText;
- private Action openAssociatedArtifactAction;
- private Action completeCommitAction;
- private Branch sourceBranch;
- private Branch destBranch;
- private TransactionRecord commitTrans;
- private TransactionRecord tranId;
- private MergeView mergeView;
- private IToolBarManager toolBarManager;
- private final static String CONFLICTS_RESOLVED = "\nAll Conflicts Are Resolved";
-
- public MergeXWidget() {
- super("Merge Manager");
- }
-
- @Override
- protected void createControls(Composite parent, int horizontalSpan) {
- Composite mainComp = new Composite(parent, SWT.BORDER);
- Composite taskComp = new Composite(mainComp, SWT.NONE);
- taskComp.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
- taskComp.setLayout(ALayout.getZeroMarginLayout());
- createTextWidgets(parent);
- createMainComposite(mainComp);
- mergeXViewer = new MergeXViewer(mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, this);
- createMergeXViewer();
- createTaskActionBar(taskComp);
- if (toolkit != null) {
- toolkit.adapt(mergeXViewer.getStatusLabel(), false, false);
- }
- Tree tree = mergeXViewer.getTree();
- createTree(tree);
- }
-
- private void createTextWidgets(Composite parent) {
- if (isDisplayLabel() && !getLabel().equals("")) {
- labelWidget = new Label(parent, SWT.NONE);
- labelWidget.setText(getLabel() + ":");
- if (getToolTip() != null) {
- labelWidget.setToolTipText(getToolTip());
- }
- }
- }
-
- private void createMainComposite(Composite mainComp) {
- mainComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- mainComp.setLayout(ALayout.getZeroMarginLayout());
- if (toolkit != null) {
- toolkit.paintBordersFor(mainComp);
- }
-
- }
-
- private void createMergeXViewer() {
- mergeXViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
- XMergeLabelProvider labelProvider = new XMergeLabelProvider(mergeXViewer);
- mergeXViewer.addLabelProvider(labelProvider);
- mergeXViewer.setSorter(new MergeXViewerSorter(mergeXViewer, labelProvider));
- mergeXViewer.setContentProvider(new XMergeContentProvider());
- mergeXViewer.setLabelProvider(new XMergeLabelProvider(mergeXViewer));
- mergeXViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- refreshActionEnablement();
- }
- });
- }
-
- private void createTree(Tree tree) {
- GridData gridData = new GridData(GridData.FILL_BOTH);
- gridData.heightHint = 100;
- tree.setLayout(ALayout.getZeroMarginLayout());
- tree.setLayoutData(gridData);
- tree.setHeaderVisible(true);
- tree.setLinesVisible(true);
- }
-
- public void createTaskActionBar(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = ALayout.getZeroMarginLayout(2, false);
- layout.marginLeft = 5;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- extraInfoLabel = new Label(composite, SWT.NONE);
- extraInfoLabel.setAlignment(SWT.LEFT);
- extraInfoLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- extraInfoLabel.setText("\n");
-
- IToolBarManager manager = getToolBarManager();
- ((ToolBarManager) manager).createControl(composite);
- manager.add(new RefreshAction());
- manager.add(new Separator());
- openAssociatedArtifactAction = new OpenAssociatedArtifactAction();
- manager.add(openAssociatedArtifactAction);
- manager.add(new Separator());
- manager.add(new ApplyPriorMergeResultsAction());
- manager.add(new Separator());
- manager.add(new ShowSourceBranchChangeReportAction());
- manager.add(new ShowDestinationBranchChangeReportAction());
- manager.add(new Separator());
- manager.add(mergeXViewer.getCustomizeAction());
- manager.add(OseeUiActions.createBugAction(SkynetGuiPlugin.getInstance(), this, MergeView.VIEW_ID, "Merge Manager"));
- manager.update(true);
- }
-
- private IToolBarManager getToolBarManager() {
- if (toolBarManager == null) {
- toolBarManager = new ToolBarManager(SWT.FLAT);
- }
- return toolBarManager;
- }
-
- private void applyPreviousMerge(final int destBranchId) {
- Job job = new Job("Apply Previous Merge") {
-
- @Override
- protected IStatus run(final IProgressMonitor monitor) {
- monitor.beginTask("ApplyingPreviousMerge", conflicts.length);
- for (Conflict conflict : conflicts) {
- try {
- Branch destinationBranch = BranchManager.getBranch(destBranchId);
- Branch mergeBranch = BranchManager.getMergeBranch(conflict.getSourceBranch(), destinationBranch);
- conflict.applyPreviousMerge(mergeBranch.getId(), destBranchId);
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- } finally {
- monitor.worked(1);
- }
- }
- monitor.done();
- return Status.OK_STATUS;
- }
- };
-
- Jobs.startJob(job, new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- loadTable();
- }
- });
- }
-
- public void refreshTable() {
- Job job = new Job("Loading Merge Manager") {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- if (!(conflicts.length == 0)) {
- Conflict[] artifactChanges = new Conflict[0];
- if (conflicts[0].getToTransactionId() != null) {
- setConflicts(ConflictManagerInternal.getConflictsPerBranch(conflicts[0].getSourceBranch(),
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.widgets.xmerge;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.logging.Level;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.action.ToolBarManager;
+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.framework.core.data.SystemUser;
+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.jdk.core.util.AHTML;
+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.plugin.core.util.Jobs;
+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.BranchManager;
+import org.eclipse.osee.framework.skynet.core.artifact.IATSArtifact;
+import org.eclipse.osee.framework.skynet.core.conflict.Conflict;
+import org.eclipse.osee.framework.skynet.core.conflict.ConflictManagerExternal;
+import org.eclipse.osee.framework.skynet.core.revision.ConflictManagerInternal;
+import org.eclipse.osee.framework.skynet.core.types.IArtifact;
+import org.eclipse.osee.framework.ui.plugin.OseeUiActions;
+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.ListSelectionDialogNoSave;
+import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.ats.OseeAts;
+import org.eclipse.osee.framework.ui.skynet.change.ChangeUiUtil;
+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.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.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Tree;
+
+/**
+ * @author Donald G. Dunne
+ * @author Theron Virgin
+ */
+public class MergeXWidget extends XWidget implements IAdaptable {
+ private static final String COMPLETE_COMMIT_ACTION_ID = "complete.commit.action.id";
+ private static final String REFRESH_ACTION_ID = "refresh.action.id";
+ private MergeXViewer mergeXViewer;
+ private IDirtiableEditor editor;
+ public final static String normalColor = "#EEEEEE";
+ private static final String LOADING = "Loading ...";
+ private static final String NO_CONFLICTS = "No conflicts were found";
+ private static final String CONFLICTS_NOT_LOADED = "Cleared on shutdown. Refresh to Reload.";
+ private Label extraInfoLabel;
+ private Conflict[] conflicts;
+ private String displayLabelText;
+ private Action openAssociatedArtifactAction;
+ private Action completeCommitAction;
+ private Branch sourceBranch;
+ private Branch destBranch;
+ private TransactionRecord commitTrans;
+ private TransactionRecord tranId;
+ private MergeView mergeView;
+ private IToolBarManager toolBarManager;
+ private final static String CONFLICTS_RESOLVED = "\nAll Conflicts Are Resolved";
+
+ public MergeXWidget() {
+ super("Merge Manager");
+ }
+
+ @Override
+ protected void createControls(Composite parent, int horizontalSpan) {
+ Composite mainComp = new Composite(parent, SWT.BORDER);
+ Composite taskComp = new Composite(mainComp, SWT.NONE);
+ taskComp.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
+ taskComp.setLayout(ALayout.getZeroMarginLayout());
+ createTextWidgets(parent);
+ createMainComposite(mainComp);
+ mergeXViewer = new MergeXViewer(mainComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, this);
+ createMergeXViewer();
+ createTaskActionBar(taskComp);
+ if (toolkit != null) {
+ toolkit.adapt(mergeXViewer.getStatusLabel(), false, false);
+ }
+ Tree tree = mergeXViewer.getTree();
+ createTree(tree);
+ }
+
+ private void createTextWidgets(Composite parent) {
+ if (isDisplayLabel() && !getLabel().equals("")) {
+ labelWidget = new Label(parent, SWT.NONE);
+ labelWidget.setText(getLabel() + ":");
+ if (getToolTip() != null) {
+ labelWidget.setToolTipText(getToolTip());
+ }
+ }
+ }
+
+ private void createMainComposite(Composite mainComp) {
+ mainComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ mainComp.setLayout(ALayout.getZeroMarginLayout());
+ if (toolkit != null) {
+ toolkit.paintBordersFor(mainComp);
+ }
+
+ }
+
+ private void createMergeXViewer() {
+ mergeXViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
+ XMergeLabelProvider labelProvider = new XMergeLabelProvider(mergeXViewer);
+ mergeXViewer.addLabelProvider(labelProvider);
+ mergeXViewer.setSorter(new MergeXViewerSorter(mergeXViewer, labelProvider));
+ mergeXViewer.setContentProvider(new XMergeContentProvider());
+ mergeXViewer.setLabelProvider(new XMergeLabelProvider(mergeXViewer));
+ mergeXViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ refreshActionEnablement();
+ }
+ });
+ }
+
+ private void createTree(Tree tree) {
+ GridData gridData = new GridData(GridData.FILL_BOTH);
+ gridData.heightHint = 100;
+ tree.setLayout(ALayout.getZeroMarginLayout());
+ tree.setLayoutData(gridData);
+ tree.setHeaderVisible(true);
+ tree.setLinesVisible(true);
+ }
+
+ public void createTaskActionBar(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = ALayout.getZeroMarginLayout(2, false);
+ layout.marginLeft = 5;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ extraInfoLabel = new Label(composite, SWT.NONE);
+ extraInfoLabel.setAlignment(SWT.LEFT);
+ extraInfoLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ extraInfoLabel.setText("\n");
+
+ IToolBarManager manager = getToolBarManager();
+ ((ToolBarManager) manager).createControl(composite);
+ manager.add(new RefreshAction());
+ manager.add(new Separator());
+ openAssociatedArtifactAction = new OpenAssociatedArtifactAction();
+ manager.add(openAssociatedArtifactAction);
+ manager.add(new Separator());
+ manager.add(new ApplyPriorMergeResultsAction());
+ manager.add(new Separator());
+ manager.add(new ShowSourceBranchChangeReportAction());
+ manager.add(new ShowDestinationBranchChangeReportAction());
+ manager.add(new Separator());
+ manager.add(mergeXViewer.getCustomizeAction());
+ manager.add(OseeUiActions.createBugAction(SkynetGuiPlugin.getInstance(), this, MergeView.VIEW_ID, "Merge Manager"));
+ manager.update(true);
+ }
+
+ private IToolBarManager getToolBarManager() {
+ if (toolBarManager == null) {
+ toolBarManager = new ToolBarManager(SWT.FLAT);
+ }
+ return toolBarManager;
+ }
+
+ private void applyPreviousMerge(final int destBranchId) {
+ Job job = new Job("Apply Previous Merge") {
+
+ @Override
+ protected IStatus run(final IProgressMonitor monitor) {
+ monitor.beginTask("ApplyingPreviousMerge", conflicts.length);
+ for (Conflict conflict : conflicts) {
+ try {
+ Branch destinationBranch = BranchManager.getBranch(destBranchId);
+ Branch mergeBranch = BranchManager.getMergeBranch(conflict.getSourceBranch(), destinationBranch);
+ conflict.applyPreviousMerge(mergeBranch.getId(), destBranchId);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ } finally {
+ monitor.worked(1);
+ }
+ }
+ monitor.done();
+ return Status.OK_STATUS;
+ }
+ };
+
+ Jobs.startJob(job, new JobChangeAdapter() {
+ @Override
+ public void done(IJobChangeEvent event) {
+ loadTable();
+ }
+ });
+ }
+
+ public void refreshTable() {
+ Job job = new Job("Loading Merge Manager") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ if (!(conflicts.length == 0)) {
+ Conflict[] artifactChanges = new Conflict[0];
+ if (conflicts[0].getToTransactionId() != null) {
+ setConflicts(ConflictManagerInternal.getConflictsPerBranch(conflicts[0].getSourceBranch(),
conflicts[0].getDestBranch(), conflicts[0].getToTransactionId(), monitor).toArray(
artifactChanges));
- } else {
- setConflicts(ConflictManagerInternal.getConflictsPerBranch(conflicts[0].getCommitTransactionId(),
+ } else {
+ setConflicts(ConflictManagerInternal.getConflictsPerBranch(conflicts[0].getCommitTransactionId(),
monitor).toArray(artifactChanges));
- }
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
-
- return Status.OK_STATUS;
- }
- };
- Jobs.startJob(job, new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- loadTable();
- }
- });
- }
-
- public void refreshActionEnablement() {
-
- }
-
- public void loadTable() {
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- refresh();
- }
- });
- }
-
- public ArrayList<Conflict> getSelectedConflicts() {
- ArrayList<Conflict> items = new ArrayList<Conflict>();
- if (mergeXViewer == null) {
- return items;
- }
- if (mergeXViewer.getSelection().isEmpty()) {
- return items;
- }
- Iterator<?> i = ((IStructuredSelection) mergeXViewer.getSelection()).iterator();
- while (i.hasNext()) {
- Object obj = i.next();
- items.add((Conflict) obj);
- }
- return items;
- }
-
- @Override
- public Control getControl() {
- return mergeXViewer.getTree();
- }
-
- @Override
- public void dispose() {
- mergeXViewer.dispose();
- }
-
- @Override
- public void setFocus() {
- mergeXViewer.getTree().setFocus();
- }
-
- @Override
- public void refresh() {
- mergeXViewer.refresh();
- validate();
- refreshActionEnablement();
- mergeView.showConflicts(true);
- int resolved = 0;
- int informational = 0;
- if (conflicts != null && conflicts.length != 0) {
- for (Conflict conflict : conflicts) {
- if (conflict.statusResolved() || conflict.statusCommitted()) {
- resolved++;
- }
- if (conflict.statusInformational()) {
- informational++;
- }
- }
- if (resolved == conflicts.length) {
- extraInfoLabel.setText(displayLabelText + CONFLICTS_RESOLVED);
- } else {
- extraInfoLabel.setText(displayLabelText + "\nConflicts : " + (conflicts.length - informational) + " <=> Resolved : " + resolved + (informational == 0 ? " " : "\nInformational Conflicts : " + informational));
- }
- }
- checkForCompleteCommit();
- }
-
- private boolean areAllConflictsResolved() {
- int resolved = 0;
- for (Conflict conflict : conflicts) {
- if (conflict.statusResolved() || conflict.statusCommitted() || conflict.statusInformational()) {
- resolved++;
- }
- }
- return resolved == conflicts.length;
- }
-
- @Override
- public IStatus isValid() {
- return Status.OK_STATUS;
- }
-
- @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 MergeXViewer getXViewer() {
- return mergeXViewer;
- }
-
- @Override
- public Object getData() {
- return mergeXViewer.getInput();
- }
-
- public IDirtiableEditor getEditor() {
- return editor;
- }
-
- public void setEditor(IDirtiableEditor editor) {
- this.editor = editor;
- }
-
- public void setInputData(final Branch sourceBranch, final Branch destBranch, final TransactionRecord tranId, final MergeView mergeView, final TransactionRecord commitTrans, boolean showConflicts) {
- setInputData(sourceBranch, destBranch, tranId, mergeView, commitTrans, "", showConflicts);
- }
-
- public void setInputData(final Branch sourceBranch, final Branch destBranch, final TransactionRecord tranId, final MergeView mergeView, final TransactionRecord commitTrans, String loadingText, final boolean showConflicts) {
- this.sourceBranch = sourceBranch;
- this.destBranch = destBranch;
- this.tranId = tranId;
- this.mergeView = mergeView;
- this.commitTrans = commitTrans;
- extraInfoLabel.setText(LOADING + loadingText);
- Job job = new Job("Loading Merge Manager") {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- if (showConflicts) {
- if (commitTrans == null) {
- conflicts =
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+
+ return Status.OK_STATUS;
+ }
+ };
+ Jobs.startJob(job, new JobChangeAdapter() {
+ @Override
+ public void done(IJobChangeEvent event) {
+ loadTable();
+ }
+ });
+ }
+
+ public void refreshActionEnablement() {
+
+ }
+
+ public void loadTable() {
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ refresh();
+ }
+ });
+ }
+
+ public ArrayList<Conflict> getSelectedConflicts() {
+ ArrayList<Conflict> items = new ArrayList<Conflict>();
+ if (mergeXViewer == null) {
+ return items;
+ }
+ if (mergeXViewer.getSelection().isEmpty()) {
+ return items;
+ }
+ Iterator<?> i = ((IStructuredSelection) mergeXViewer.getSelection()).iterator();
+ while (i.hasNext()) {
+ Object obj = i.next();
+ items.add((Conflict) obj);
+ }
+ return items;
+ }
+
+ @Override
+ public Control getControl() {
+ return mergeXViewer.getTree();
+ }
+
+ @Override
+ public void dispose() {
+ mergeXViewer.dispose();
+ }
+
+ @Override
+ public void setFocus() {
+ mergeXViewer.getTree().setFocus();
+ }
+
+ @Override
+ public void refresh() {
+ mergeXViewer.refresh();
+ validate();
+ refreshActionEnablement();
+ mergeView.showConflicts(true);
+ int resolved = 0;
+ int informational = 0;
+ if (conflicts != null && conflicts.length != 0) {
+ for (Conflict conflict : conflicts) {
+ if (conflict.statusResolved() || conflict.statusCommitted()) {
+ resolved++;
+ }
+ if (conflict.statusInformational()) {
+ informational++;
+ }
+ }
+ if (resolved == conflicts.length) {
+ extraInfoLabel.setText(displayLabelText + CONFLICTS_RESOLVED);
+ } else {
+ extraInfoLabel.setText(displayLabelText + "\nConflicts : " + (conflicts.length - informational) + " <=> Resolved : " + resolved + (informational == 0 ? " " : "\nInformational Conflicts : " + informational));
+ }
+ }
+ checkForCompleteCommit();
+ }
+
+ private boolean areAllConflictsResolved() {
+ int resolved = 0;
+ for (Conflict conflict : conflicts) {
+ if (conflict.statusResolved() || conflict.statusCommitted() || conflict.statusInformational()) {
+ resolved++;
+ }
+ }
+ return resolved == conflicts.length;
+ }
+
+ @Override
+ public IStatus isValid() {
+ return Status.OK_STATUS;
+ }
+
+ @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 MergeXViewer getXViewer() {
+ return mergeXViewer;
+ }
+
+ @Override
+ public Object getData() {
+ return mergeXViewer.getInput();
+ }
+
+ public IDirtiableEditor getEditor() {
+ return editor;
+ }
+
+ public void setEditor(IDirtiableEditor editor) {
+ this.editor = editor;
+ }
+
+ public void setInputData(final Branch sourceBranch, final Branch destBranch, final TransactionRecord tranId, final MergeView mergeView, final TransactionRecord commitTrans, boolean showConflicts) {
+ setInputData(sourceBranch, destBranch, tranId, mergeView, commitTrans, "", showConflicts);
+ }
+
+ public void setInputData(final Branch sourceBranch, final Branch destBranch, final TransactionRecord tranId, final MergeView mergeView, final TransactionRecord commitTrans, String loadingText, final boolean showConflicts) {
+ this.sourceBranch = sourceBranch;
+ this.destBranch = destBranch;
+ this.tranId = tranId;
+ this.mergeView = mergeView;
+ this.commitTrans = commitTrans;
+ extraInfoLabel.setText(LOADING + loadingText);
+ Job job = new Job("Loading Merge Manager") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ if (showConflicts) {
+ if (commitTrans == null) {
+ conflicts =
ConflictManagerInternal.getConflictsPerBranch(sourceBranch, destBranch, tranId, monitor).toArray(
new Conflict[0]);
- } else {
- conflicts =
+ } else {
+ conflicts =
ConflictManagerInternal.getConflictsPerBranch(commitTrans, monitor).toArray(new Conflict[0]);
- }
- }
-
- Displays.ensureInDisplayThread(new Runnable() {
- public void run() {
- if (showConflicts) {
- if (conflicts.length == 0) {
- extraInfoLabel.setText(NO_CONFLICTS);
- } else {
- setConflicts(conflicts);
- mergeView.setConflicts(conflicts);
- refresh();
- }
- } else {
- extraInfoLabel.setText(CONFLICTS_NOT_LOADED);
- }
- checkForCompleteCommit();
- }
- });
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- return Status.OK_STATUS;
- }
- };
- Jobs.startJob(job);
- if (sourceBranch != null) {
- refreshAssociatedArtifactItem(sourceBranch);
- }
- }
-
- private void refreshAssociatedArtifactItem(Branch sourceBranch) {
- try {
- IArtifact branchAssociatedArtifact = BranchManager.getAssociatedArtifact(sourceBranch);
- if (branchAssociatedArtifact != null) {
- openAssociatedArtifactAction.setImageDescriptor(ArtifactImageManager.getImageDescriptor(branchAssociatedArtifact));
- openAssociatedArtifactAction.setEnabled(true);
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
-
- public void setConflicts(Conflict[] conflicts) throws IllegalStateException {
- this.conflicts = conflicts;
- loadTable();
- int resolved = 0;
- int informational = 0;
- for (Conflict conflict : conflicts) {
- if (conflict.statusResolved() || conflict.statusCommitted()) {
- resolved++;
- }
- if (conflict.statusInformational()) {
- informational++;
- }
- }
- mergeXViewer.setConflicts(conflicts);
- if (conflicts != null && conflicts.length != 0) {
- if (sourceBranch != null) {
- displayLabelText =
+ }
+ }
+
+ Displays.ensureInDisplayThread(new Runnable() {
+ public void run() {
+ if (showConflicts) {
+ if (conflicts.length == 0) {
+ extraInfoLabel.setText(NO_CONFLICTS);
+ } else {
+ setConflicts(conflicts);
+ mergeView.setConflicts(conflicts);
+ refresh();
+ }
+ } else {
+ extraInfoLabel.setText(CONFLICTS_NOT_LOADED);
+ }
+ checkForCompleteCommit();
+ }
+ });
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ Jobs.startJob(job);
+ if (sourceBranch != null) {
+ refreshAssociatedArtifactItem(sourceBranch);
+ }
+ }
+
+ private void refreshAssociatedArtifactItem(Branch sourceBranch) {
+ try {
+ IArtifact branchAssociatedArtifact = BranchManager.getAssociatedArtifact(sourceBranch);
+ if (branchAssociatedArtifact != null) {
+ openAssociatedArtifactAction.setImageDescriptor(ArtifactImageManager.getImageDescriptor(branchAssociatedArtifact));
+ openAssociatedArtifactAction.setEnabled(true);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ public void setConflicts(Conflict[] conflicts) throws IllegalStateException {
+ this.conflicts = conflicts;
+ loadTable();
+ int resolved = 0;
+ int informational = 0;
+ for (Conflict conflict : conflicts) {
+ if (conflict.statusResolved() || conflict.statusCommitted()) {
+ resolved++;
+ }
+ if (conflict.statusInformational()) {
+ informational++;
+ }
+ }
+ mergeXViewer.setConflicts(conflicts);
+ if (conflicts != null && conflicts.length != 0) {
+ if (sourceBranch != null) {
+ displayLabelText =
"Source Branch : " + sourceBranch.getName() + "\nDestination Branch : " + destBranch.getName();
- } else {
- displayLabelText = "Commit Transaction ID : " + commitTrans + " " + commitTrans.getComment();
- }
- if (resolved == conflicts.length - informational) {
- extraInfoLabel.setText(displayLabelText + CONFLICTS_RESOLVED);
- } else {
- extraInfoLabel.setText(displayLabelText + "\nConflicts : " + (conflicts.length - informational) + " <=> Resolved : " + resolved + (informational == 0 ? " " : "\nInformational Conflicts : " + informational));
- }
- }
-
- }
-
- @SuppressWarnings("rawtypes")
- @Override
- public Object getAdapter(Class adapter) {
- if (IActionable.class.equals(adapter)) {
- return new MergeViewerActionable();
- }
- return null;
- }
-
- private Action getCompleteCommitAction() {
- if (completeCommitAction == null) {
- completeCommitAction = new CompleteCommitAction();
- }
- return completeCommitAction;
- }
-
- private Branch getMergeBranch() {
- if (conflicts != null && conflicts.length != 0) {
- return conflicts[0].getMergeBranch();
- }
- return null;
- }
-
- private boolean hasMergeBranchBeenCommitted() {
- final Branch mergeBranch = getMergeBranch();
- return mergeBranch != null && !mergeBranch.isEditable();
- }
-
- private void checkForCompleteCommit() {
- boolean isVisible = false;
- if (conflicts != null && conflicts.length != 0) {
- isVisible = !hasMergeBranchBeenCommitted() && areAllConflictsResolved();
- isVisible &= sourceBranch != null && sourceBranch.getBranchState().isRebaselineInProgress();
- }
- setCompleteCommitItemVisible(isVisible);
- }
-
- private void setCompleteCommitItemVisible(boolean isVisible) {
- IToolBarManager manager = getToolBarManager();
- boolean wasFound = manager.find(COMPLETE_COMMIT_ACTION_ID) != null;
- if (isVisible) {
- if (!wasFound) {
- manager.insertBefore(REFRESH_ACTION_ID, getCompleteCommitAction());
- }
- } else if (wasFound) {
- manager.remove(COMPLETE_COMMIT_ACTION_ID);
- }
- manager.update(true);
- }
-
- private final class MergeViewerActionable implements IActionable {
- @Override
- public String getActionDescription() {
- StringBuilder sb = new StringBuilder();
- if (sourceBranch != null) {
- sb.append("\nSource Branch: " + sourceBranch);
- }
- if (destBranch != null) {
- sb.append("\nDestination Branch: " + destBranch);
- }
- if (tranId != null) {
- sb.append("\nTransactionId: " + tranId);
- }
- if (commitTrans != null) {
- sb.append("\nCommit TransactionId: " + commitTrans);
- }
- return sb.toString();
- }
- }
-
- private final class CompleteCommitAction extends Action {
- public CompleteCommitAction() {
- super();
- setImageDescriptor(FrameworkImage.BRANCH_COMMIT.createImageDescriptor());
- setToolTipText("Commit changes into destination branch");
- setId(COMPLETE_COMMIT_ACTION_ID);
- }
-
- @Override
- public void run() {
- if (sourceBranch.getBranchState().isRebaselineInProgress()) {
- ConflictManagerExternal conflictManager = new ConflictManagerExternal(destBranch, sourceBranch);
- BranchManager.completeUpdateBranch(conflictManager, true, false);
- }
- }
- }
-
- private final class OpenAssociatedArtifactAction extends Action {
-
- public OpenAssociatedArtifactAction() {
- super();
- setToolTipText("Open Associated Artifact");
- setEnabled(false);
- }
-
- @Override
- public void run() {
- try {
- Branch sourceBranch = conflicts[0].getSourceBranch();
- Artifact branchAssociatedArtifact = BranchManager.getAssociatedArtifact(sourceBranch);
- if (branchAssociatedArtifact instanceof IATSArtifact) {
- OseeAts.getInstance().openArtifact(branchAssociatedArtifact);
- } else if (!branchAssociatedArtifact.equals(UserManager.getUser(SystemUser.OseeSystem))) {
+ } else {
+ displayLabelText = "Commit Transaction ID : " + commitTrans + " " + commitTrans.getComment();
+ }
+ if (resolved == conflicts.length - informational) {
+ extraInfoLabel.setText(displayLabelText + CONFLICTS_RESOLVED);
+ } else {
+ extraInfoLabel.setText(displayLabelText + "\nConflicts : " + (conflicts.length - informational) + " <=> Resolved : " + resolved + (informational == 0 ? " " : "\nInformational Conflicts : " + informational));
+ }
+ }
+
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class adapter) {
+ if (IActionable.class.equals(adapter)) {
+ return new MergeViewerActionable();
+ }
+ return null;
+ }
+
+ private Action getCompleteCommitAction() {
+ if (completeCommitAction == null) {
+ completeCommitAction = new CompleteCommitAction();
+ }
+ return completeCommitAction;
+ }
+
+ private Branch getMergeBranch() {
+ if (conflicts != null && conflicts.length != 0) {
+ return conflicts[0].getMergeBranch();
+ }
+ return null;
+ }
+
+ private boolean hasMergeBranchBeenCommitted() {
+ final Branch mergeBranch = getMergeBranch();
+ return mergeBranch != null && !mergeBranch.isEditable();
+ }
+
+ private void checkForCompleteCommit() {
+ boolean isVisible = false;
+ if (conflicts != null && conflicts.length != 0) {
+ isVisible = !hasMergeBranchBeenCommitted() && areAllConflictsResolved();
+ isVisible &= sourceBranch != null && sourceBranch.getBranchState().isRebaselineInProgress();
+ }
+ setCompleteCommitItemVisible(isVisible);
+ }
+
+ private void setCompleteCommitItemVisible(boolean isVisible) {
+ IToolBarManager manager = getToolBarManager();
+ boolean wasFound = manager.find(COMPLETE_COMMIT_ACTION_ID) != null;
+ if (isVisible) {
+ if (!wasFound) {
+ manager.insertBefore(REFRESH_ACTION_ID, getCompleteCommitAction());
+ }
+ } else if (wasFound) {
+ manager.remove(COMPLETE_COMMIT_ACTION_ID);
+ }
+ manager.update(true);
+ }
+
+ private final class MergeViewerActionable implements IActionable {
+ @Override
+ public String getActionDescription() {
+ StringBuilder sb = new StringBuilder();
+ if (sourceBranch != null) {
+ sb.append("\nSource Branch: " + sourceBranch);
+ }
+ if (destBranch != null) {
+ sb.append("\nDestination Branch: " + destBranch);
+ }
+ if (tranId != null) {
+ sb.append("\nTransactionId: " + tranId);
+ }
+ if (commitTrans != null) {
+ sb.append("\nCommit TransactionId: " + commitTrans);
+ }
+ return sb.toString();
+ }
+ }
+
+ private final class CompleteCommitAction extends Action {
+ public CompleteCommitAction() {
+ super();
+ setImageDescriptor(FrameworkImage.BRANCH_COMMIT.createImageDescriptor());
+ setToolTipText("Commit changes into destination branch");
+ setId(COMPLETE_COMMIT_ACTION_ID);
+ }
+
+ @Override
+ public void run() {
+ if (sourceBranch.getBranchState().isRebaselineInProgress()) {
+ ConflictManagerExternal conflictManager = new ConflictManagerExternal(destBranch, sourceBranch);
+ BranchManager.completeUpdateBranch(conflictManager, true, false);
+ }
+ }
+ }
+
+ private final class OpenAssociatedArtifactAction extends Action {
+
+ public OpenAssociatedArtifactAction() {
+ super();
+ setToolTipText("Open Associated Artifact");
+ setEnabled(false);
+ }
+
+ @Override
+ public void run() {
+ try {
+ Branch sourceBranch = conflicts[0].getSourceBranch();
+ Artifact branchAssociatedArtifact = BranchManager.getAssociatedArtifact(sourceBranch);
+ if (branchAssociatedArtifact instanceof IATSArtifact) {
+ OseeAts.getInstance().openArtifact(branchAssociatedArtifact);
+ } else if (!branchAssociatedArtifact.equals(UserManager.getUser(SystemUser.OseeSystem))) {
RendererManager.open(branchAssociatedArtifact, PresentationType.GENERALIZED_EDIT);
- } else {
- AWorkbench.popup("ERROR", "Unknown branch association");
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
-
- private final class ShowSourceBranchChangeReportAction extends Action {
-
- public ShowSourceBranchChangeReportAction() {
- super();
- // setImageDescriptor(SkynetGuiPlugin.getInstance().getImageDescriptor("branch_change_source.gif"));
- setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.BRANCH_CHANGE_SOURCE));
- setToolTipText("Show Source Branch Change Report");
- }
-
- @Override
- public void run() {
- if (conflicts.length != 0) {
- if (conflicts[0].getSourceBranch() != null) {
- try {
- ChangeUiUtil.open(conflicts[0].getSourceBranch());
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- } else {
- try {
- ChangeUiUtil.open(conflicts[0].getCommitTransactionId());
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
- }
- }
-
- private final class ShowDestinationBranchChangeReportAction extends Action {
-
- public ShowDestinationBranchChangeReportAction() {
- super();
- setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.BRANCH_CHANGE_DEST));
- setToolTipText("Show Destination Branch Change Report");
- }
-
- @Override
- public void run() {
- if (conflicts.length != 0) {
- try {
- ChangeUiUtil.open(conflicts[0].getDestBranch());
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
- }
-
- private final class RefreshAction extends Action {
-
- public RefreshAction() {
- super();
- setImageDescriptor(ImageManager.getImageDescriptor(PluginUiImage.REFRESH));
- setToolTipText("Refresh");
- setId(REFRESH_ACTION_ID);
- }
-
- @Override
- public void run() {
- setInputData(sourceBranch, destBranch, tranId, mergeView, commitTrans, true);
- }
- }
-
- private final class ApplyPriorMergeResultsAction extends Action {
- public ApplyPriorMergeResultsAction() {
- super();
- setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.OUTGOING_MERGED));
- setToolTipText("Apply Merge Results From Prior Merge");
- }
-
- @Override
- public void run() {
- if (conflicts.length != 0) {
- if (conflicts[0].getSourceBranch() != null) {
- ArrayList<String> selections = new ArrayList<String>();
- ArrayList<Integer> branchIds = new ArrayList<Integer>();
- try {
- Collection<Integer> destBranches =
+ } else {
+ AWorkbench.popup("ERROR", "Unknown branch association");
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+
+ private final class ShowSourceBranchChangeReportAction extends Action {
+
+ public ShowSourceBranchChangeReportAction() {
+ super();
+ // setImageDescriptor(SkynetGuiPlugin.getInstance().getImageDescriptor("branch_change_source.gif"));
+ setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.BRANCH_CHANGE_SOURCE));
+ setToolTipText("Show Source Branch Change Report");
+ }
+
+ @Override
+ public void run() {
+ if (conflicts.length != 0) {
+ if (conflicts[0].getSourceBranch() != null) {
+ try {
+ ChangeUiUtil.open(conflicts[0].getSourceBranch());
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ } else {
+ try {
+ ChangeUiUtil.open(conflicts[0].getCommitTransactionId());
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+ }
+ }
+
+ private final class ShowDestinationBranchChangeReportAction extends Action {
+
+ public ShowDestinationBranchChangeReportAction() {
+ super();
+ setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.BRANCH_CHANGE_DEST));
+ setToolTipText("Show Destination Branch Change Report");
+ }
+
+ @Override
+ public void run() {
+ if (conflicts.length != 0) {
+ try {
+ ChangeUiUtil.open(conflicts[0].getDestBranch());
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+ }
+
+ private final class RefreshAction extends Action {
+
+ public RefreshAction() {
+ super();
+ setImageDescriptor(ImageManager.getImageDescriptor(PluginUiImage.REFRESH));
+ setToolTipText("Refresh");
+ setId(REFRESH_ACTION_ID);
+ }
+
+ @Override
+ public void run() {
+ setInputData(sourceBranch, destBranch, tranId, mergeView, commitTrans, true);
+ }
+ }
+
+ private final class ApplyPriorMergeResultsAction extends Action {
+ public ApplyPriorMergeResultsAction() {
+ super();
+ setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.OUTGOING_MERGED));
+ setToolTipText("Apply Merge Results From Prior Merge");
+ }
+
+ @Override
+ public void run() {
+ if (conflicts.length != 0) {
+ if (conflicts[0].getSourceBranch() != null) {
+ ArrayList<String> selections = new ArrayList<String>();
+ ArrayList<Integer> branchIds = new ArrayList<Integer>();
+ try {
+ Collection<Integer> destBranches =
ConflictManagerInternal.getDestinationBranchesMerged(sourceBranch.getId());
- for (Integer integer : destBranches) {
- if (integer.intValue() != destBranch.getId()) {
- selections.add(BranchManager.getBranch(integer).getName());
- branchIds.add(integer);
- }
- }
- if (selections.size() > 0) {
- ListSelectionDialogNoSave dialog =
+ for (Integer integer : destBranches) {
+ if (integer.intValue() != destBranch.getId()) {
+ selections.add(BranchManager.getBranch(integer).getName());
+ branchIds.add(integer);
+ }
+ }
+ if (selections.size() > 0) {
+ ListSelectionDialogNoSave dialog =
new ListSelectionDialogNoSave(selections.toArray(),
Displays.getActiveShell().getShell(), "Apply Prior Merge Resolution", null,
"Select the destination branch that the previous commit was appplied to", 2, new String[] {
"Apply", "Cancel"}, 1);
- if (dialog.open() == 0) {
- System.out.print("Applying the merge found for Branch " + branchIds.toArray()[dialog.getSelection()]);
- applyPreviousMerge(branchIds.get(dialog.getSelection()));
- }
- }
- if (selections.isEmpty()) {
- new MessageDialog(Displays.getActiveShell().getShell(),
+ if (dialog.open() == 0) {
+ System.out.print("Applying the merge found for Branch " + branchIds.toArray()[dialog.getSelection()]);
+ applyPreviousMerge(branchIds.get(dialog.getSelection()));
+ }
+ }
+ if (selections.isEmpty()) {
+ new MessageDialog(Displays.getActiveShell().getShell(),
"Apply Prior Merge Resolution", null, "This Source Branch has had No Prior Merges", 2,
new String[] {"OK"}, 1).open();
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- }
- }
- }
-}
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/XMergeLabelProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/XMergeLabelProvider.java
index e86d8c08b52..8652b7c754e 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/XMergeLabelProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/XMergeLabelProvider.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.framework.ui.skynet.widgets.xmerge;
-
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.nebula.widgets.xviewer.XViewerLabelProvider;
-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.conflict.Conflict;
-import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
-import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-
-public class XMergeLabelProvider extends XViewerLabelProvider {
- public static enum ConflictState {
- UNTOUCHED(2, " "),
- REVERT(1, "Must Be Reverted"),
- MODIFIED(3, "Modified"),
- CHANGED(4, "Artifact Changed After Resolution"),
- RESOLVED(5, "Resolved"),
- INFORMATIONAL(6, "Informational"),
- COMMITTED(7, "Committed"),
- CHANGED_EDIT(8, "Artifact Changed"),
- MERGE_SUCCESS(9, "Previous Merge Applied Successfully"),
- MERGE_CAUTION(10, "Previous Merge applied with destination differences");
-
- private final int value;
- private final String text;
-
- ConflictState(int value, String text) {
- this.value = value;
- this.text = text;
- }
-
- public static final int getValue(String text) {
- for (ConflictState state : values()) {
- if (state.text.equals(text)) {
- return state.value;
- }
- }
- return 0;
- }
-
- public final String getText() {
- return text;
- }
-
- };
- Font font = null;
-
- private final MergeXViewer mergeXViewer;
-
- public XMergeLabelProvider(MergeXViewer mergeXViewer) {
- super(mergeXViewer);
- this.mergeXViewer = mergeXViewer;
- }
-
- @Override
- public String getColumnText(Object element, XViewerColumn aCol, int columnIndex) throws OseeCoreException {
- if (element instanceof Conflict) {
- Conflict conflict = (Conflict) element;
- if (aCol.equals(MergeXViewerFactory.Conflict_Resolved)) {
- if (conflict.statusResolved()) {
- return ConflictState.RESOLVED.getText();
- }
- if (conflict.statusEdited()) {
- return ConflictState.MODIFIED.getText();
- }
- if (conflict.statusOutOfDate()) {
- return ConflictState.CHANGED_EDIT.getText();
- }
- if (conflict.statusOutOfDateCommitted()) {
- return ConflictState.CHANGED.getText();
- }
- if (conflict.statusUntouched()) {
- return ConflictState.UNTOUCHED.getText();
- }
- if (conflict.statusNotResolvable()) {
- return ConflictState.REVERT.getText();
- }
- if (conflict.statusInformational()) {
- return ConflictState.INFORMATIONAL.getText();
- }
- if (conflict.statusCommitted()) {
- return ConflictState.COMMITTED.getText();
- }
- if (conflict.statusPreviousMergeAppliedSuccess()) {
- return ConflictState.MERGE_SUCCESS.getText();
- }
- if (conflict.statusPreviousMergeAppliedCaution()) {
- return ConflictState.MERGE_CAUTION.getText();
- }
- } else if (aCol.equals(MergeXViewerFactory.Artifact_Name)) {
- return conflict.getArtifactName();
- } else if (aCol.equals(MergeXViewerFactory.Change_Item)) {
- return conflict.getChangeItem();
- } else if (aCol.equals(MergeXViewerFactory.Source)) {
- return conflict.getSourceDisplayData();
- } else if (aCol.equals(MergeXViewerFactory.Destination)) {
- return conflict.getDestDisplayData();
- } else if (aCol.equals(MergeXViewerFactory.Merged)) {
- return conflict.getMergeDisplayData();
- } else if (aCol.equals(MergeXViewerFactory.Type)) {
- return conflict.getArtifact().getArtifactTypeName();
- } else if (aCol.equals(MergeXViewerFactory.Art_Id)) {
- return String.valueOf(conflict.getArtifact().getArtId());
- }
- }
- return "unhandled column";
- }
-
- 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 MergeXViewer getTreeViewer() {
- return mergeXViewer;
- }
-
- @Override
- public Image getColumnImage(Object element, XViewerColumn dCol, int columnIndex) throws OseeCoreException {
- if (element instanceof Conflict) {
- try {
- Conflict conflict = (Conflict) element;
- if (dCol.equals(MergeXViewerFactory.Artifact_Name)) {
- return ArtifactImageManager.getImage(conflict.getArtifact());
- } else if (dCol.equals(MergeXViewerFactory.Type)) {
- return ArtifactImageManager.getImage(conflict.getArtifact());
- } else if (dCol.equals(MergeXViewerFactory.Change_Item)) {
- return ArtifactImageManager.getConflictImage(conflict);
- } else if (dCol.equals(MergeXViewerFactory.Source)) {
- return ImageManager.getImage(FrameworkImage.MERGE_SOURCE);
- } else if (dCol.equals(MergeXViewerFactory.Destination)) {
- return ImageManager.getImage(FrameworkImage.MERGE_DEST);
- } else if (dCol.equals(MergeXViewerFactory.Merged)) {
- return getMergeImage(conflict);
- } else if (dCol.equals(MergeXViewerFactory.Conflict_Resolved)) {
- if (conflict.statusUntouched()) {
- return null;
- }
- if (conflict.statusEdited()) {
- return ImageManager.getImage(FrameworkImage.MERGE_EDITED);
- }
- if (conflict.statusResolved() || conflict.statusCommitted()) {
- return ImageManager.getImage(FrameworkImage.MERGE_MARKED);
- }
- if (conflict.statusOutOfDate()) {
- return ImageManager.getImage(FrameworkImage.MERGE_OUT_OF_DATE);
- }
- if (conflict.statusOutOfDateCommitted()) {
- return ImageManager.getImage(FrameworkImage.MERGE_OUT_OF_DATE_COMMITTED);
- }
- if (conflict.statusPreviousMergeAppliedSuccess()) {
- return ImageManager.getImage(FrameworkImage.MERGE_SUCCESS);
- }
- if (conflict.statusPreviousMergeAppliedCaution()) {
- return ImageManager.getImage(FrameworkImage.MERGE_CAUTION);
- }
- if (conflict.statusNotResolvable()) {
- return ImageManager.getImage(FrameworkImage.MERGE_NOT_RESOLVEABLE);
- }
- if (conflict.statusInformational()) {
- return ImageManager.getImage(FrameworkImage.MERGE_INFO);
- }
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- return null;
- }
-
- public static Image getMergeImage(Conflict conflict) throws OseeCoreException {
- if (conflict.statusInformational()) {
- return null;
- }
- if (conflict.statusNotResolvable()) {
- return ImageManager.getImage(FrameworkImage.MERGE_START);
- }
- if (conflict.sourceEqualsDestination() && conflict.mergeEqualsSource()) {
- return ImageManager.getImage(FrameworkImage.MERGE_NO_CONFLICT);
- }
- if (conflict.statusUntouched()) {
- return ImageManager.getImage(FrameworkImage.MERGE_START);
- }
- if (conflict.mergeEqualsDestination()) {
- return ImageManager.getImage(FrameworkImage.MERGE_DEST);
- }
- if (conflict.mergeEqualsSource()) {
- return ImageManager.getImage(FrameworkImage.MERGE_SOURCE);
- } else {
- return ImageManager.getImage(FrameworkImage.MERGE_YELLOW_M);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.xmerge;
+
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.XViewerLabelProvider;
+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.conflict.Conflict;
+import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+
+public class XMergeLabelProvider extends XViewerLabelProvider {
+ public static enum ConflictState {
+ UNTOUCHED(2, " "),
+ REVERT(1, "Must Be Reverted"),
+ MODIFIED(3, "Modified"),
+ CHANGED(4, "Artifact Changed After Resolution"),
+ RESOLVED(5, "Resolved"),
+ INFORMATIONAL(6, "Informational"),
+ COMMITTED(7, "Committed"),
+ CHANGED_EDIT(8, "Artifact Changed"),
+ MERGE_SUCCESS(9, "Previous Merge Applied Successfully"),
+ MERGE_CAUTION(10, "Previous Merge applied with destination differences");
+
+ private final int value;
+ private final String text;
+
+ ConflictState(int value, String text) {
+ this.value = value;
+ this.text = text;
+ }
+
+ public static final int getValue(String text) {
+ for (ConflictState state : values()) {
+ if (state.text.equals(text)) {
+ return state.value;
+ }
+ }
+ return 0;
+ }
+
+ public final String getText() {
+ return text;
+ }
+
+ };
+ Font font = null;
+
+ private final MergeXViewer mergeXViewer;
+
+ public XMergeLabelProvider(MergeXViewer mergeXViewer) {
+ super(mergeXViewer);
+ this.mergeXViewer = mergeXViewer;
+ }
+
+ @Override
+ public String getColumnText(Object element, XViewerColumn aCol, int columnIndex) throws OseeCoreException {
+ if (element instanceof Conflict) {
+ Conflict conflict = (Conflict) element;
+ if (aCol.equals(MergeXViewerFactory.Conflict_Resolved)) {
+ if (conflict.statusResolved()) {
+ return ConflictState.RESOLVED.getText();
+ }
+ if (conflict.statusEdited()) {
+ return ConflictState.MODIFIED.getText();
+ }
+ if (conflict.statusOutOfDate()) {
+ return ConflictState.CHANGED_EDIT.getText();
+ }
+ if (conflict.statusOutOfDateCommitted()) {
+ return ConflictState.CHANGED.getText();
+ }
+ if (conflict.statusUntouched()) {
+ return ConflictState.UNTOUCHED.getText();
+ }
+ if (conflict.statusNotResolvable()) {
+ return ConflictState.REVERT.getText();
+ }
+ if (conflict.statusInformational()) {
+ return ConflictState.INFORMATIONAL.getText();
+ }
+ if (conflict.statusCommitted()) {
+ return ConflictState.COMMITTED.getText();
+ }
+ if (conflict.statusPreviousMergeAppliedSuccess()) {
+ return ConflictState.MERGE_SUCCESS.getText();
+ }
+ if (conflict.statusPreviousMergeAppliedCaution()) {
+ return ConflictState.MERGE_CAUTION.getText();
+ }
+ } else if (aCol.equals(MergeXViewerFactory.Artifact_Name)) {
+ return conflict.getArtifactName();
+ } else if (aCol.equals(MergeXViewerFactory.Change_Item)) {
+ return conflict.getChangeItem();
+ } else if (aCol.equals(MergeXViewerFactory.Source)) {
+ return conflict.getSourceDisplayData();
+ } else if (aCol.equals(MergeXViewerFactory.Destination)) {
+ return conflict.getDestDisplayData();
+ } else if (aCol.equals(MergeXViewerFactory.Merged)) {
+ return conflict.getMergeDisplayData();
+ } else if (aCol.equals(MergeXViewerFactory.Type)) {
+ return conflict.getArtifact().getArtifactTypeName();
+ } else if (aCol.equals(MergeXViewerFactory.Art_Id)) {
+ return String.valueOf(conflict.getArtifact().getArtId());
+ }
+ }
+ return "unhandled column";
+ }
+
+ 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 MergeXViewer getTreeViewer() {
+ return mergeXViewer;
+ }
+
+ @Override
+ public Image getColumnImage(Object element, XViewerColumn dCol, int columnIndex) throws OseeCoreException {
+ if (element instanceof Conflict) {
+ try {
+ Conflict conflict = (Conflict) element;
+ if (dCol.equals(MergeXViewerFactory.Artifact_Name)) {
+ return ArtifactImageManager.getImage(conflict.getArtifact());
+ } else if (dCol.equals(MergeXViewerFactory.Type)) {
+ return ArtifactImageManager.getImage(conflict.getArtifact());
+ } else if (dCol.equals(MergeXViewerFactory.Change_Item)) {
+ return ArtifactImageManager.getConflictImage(conflict);
+ } else if (dCol.equals(MergeXViewerFactory.Source)) {
+ return ImageManager.getImage(FrameworkImage.MERGE_SOURCE);
+ } else if (dCol.equals(MergeXViewerFactory.Destination)) {
+ return ImageManager.getImage(FrameworkImage.MERGE_DEST);
+ } else if (dCol.equals(MergeXViewerFactory.Merged)) {
+ return getMergeImage(conflict);
+ } else if (dCol.equals(MergeXViewerFactory.Conflict_Resolved)) {
+ if (conflict.statusUntouched()) {
+ return null;
+ }
+ if (conflict.statusEdited()) {
+ return ImageManager.getImage(FrameworkImage.MERGE_EDITED);
+ }
+ if (conflict.statusResolved() || conflict.statusCommitted()) {
+ return ImageManager.getImage(FrameworkImage.MERGE_MARKED);
+ }
+ if (conflict.statusOutOfDate()) {
+ return ImageManager.getImage(FrameworkImage.MERGE_OUT_OF_DATE);
+ }
+ if (conflict.statusOutOfDateCommitted()) {
+ return ImageManager.getImage(FrameworkImage.MERGE_OUT_OF_DATE_COMMITTED);
+ }
+ if (conflict.statusPreviousMergeAppliedSuccess()) {
+ return ImageManager.getImage(FrameworkImage.MERGE_SUCCESS);
+ }
+ if (conflict.statusPreviousMergeAppliedCaution()) {
+ return ImageManager.getImage(FrameworkImage.MERGE_CAUTION);
+ }
+ if (conflict.statusNotResolvable()) {
+ return ImageManager.getImage(FrameworkImage.MERGE_NOT_RESOLVEABLE);
+ }
+ if (conflict.statusInformational()) {
+ return ImageManager.getImage(FrameworkImage.MERGE_INFO);
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ return null;
+ }
+
+ public static Image getMergeImage(Conflict conflict) throws OseeCoreException {
+ if (conflict.statusInformational()) {
+ return null;
+ }
+ if (conflict.statusNotResolvable()) {
+ return ImageManager.getImage(FrameworkImage.MERGE_START);
+ }
+ if (conflict.sourceEqualsDestination() && conflict.mergeEqualsSource()) {
+ return ImageManager.getImage(FrameworkImage.MERGE_NO_CONFLICT);
+ }
+ if (conflict.statusUntouched()) {
+ return ImageManager.getImage(FrameworkImage.MERGE_START);
+ }
+ if (conflict.mergeEqualsDestination()) {
+ return ImageManager.getImage(FrameworkImage.MERGE_DEST);
+ }
+ if (conflict.mergeEqualsSource()) {
+ return ImageManager.getImage(FrameworkImage.MERGE_SOURCE);
+ } else {
+ return ImageManager.getImage(FrameworkImage.MERGE_YELLOW_M);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xnavigate/XNavigateItemBlam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xnavigate/XNavigateItemBlam.java
index 9ff11e094b0..ce987f6d6b4 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xnavigate/XNavigateItemBlam.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xnavigate/XNavigateItemBlam.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.framework.ui.skynet.widgets.xnavigate;
-
-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.skynet.FrameworkImage;
-import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam;
-import org.eclipse.osee.framework.ui.skynet.blam.BlamEditor;
-
-/**
- * @author Donald G. Dunne
- */
-public class XNavigateItemBlam extends XNavigateItem {
- private final AbstractBlam blamOperation;
-
- /**
- * @param parent
- * @param name
- */
- public XNavigateItemBlam(XNavigateItem parent, AbstractBlam blamOperation) {
- super(parent, blamOperation.getName(), FrameworkImage.BLAM);
- this.blamOperation = blamOperation;
- }
-
- @Override
- public void run(TableLoadOption... tableLoadOptions) throws Exception {
- // Need a new copy of the BLAM operation so widgets don't collide
- BlamEditor.edit(blamOperation);
- }
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.ui.skynet.widgets.xnavigate;
+
+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.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam;
+import org.eclipse.osee.framework.ui.skynet.blam.BlamEditor;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XNavigateItemBlam extends XNavigateItem {
+ private final AbstractBlam blamOperation;
+
+ /**
+ * @param parent
+ * @param name
+ */
+ public XNavigateItemBlam(XNavigateItem parent, AbstractBlam blamOperation) {
+ super(parent, blamOperation.getName(), FrameworkImage.BLAM);
+ this.blamOperation = blamOperation;
+ }
+
+ @Override
+ public void run(TableLoadOption... tableLoadOptions) throws Exception {
+ // Need a new copy of the BLAM operation so widgets don't collide
+ BlamEditor.edit(blamOperation);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/SkynetCustomizations.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/SkynetCustomizations.java
index 8a2fb241d38..f9c182aa1c0 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/SkynetCustomizations.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/SkynetCustomizations.java
@@ -1,255 +1,255 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
-import org.eclipse.nebula.widgets.xviewer.customize.IXViewerCustomizations;
-import org.eclipse.nebula.widgets.xviewer.util.XViewerException;
-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.GlobalXViewerSettings;
-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.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.ui.skynet.SkynetGuiPlugin;
-
-/**
- * @author Donald G. Dunne
- */
-public class SkynetCustomizations implements IXViewerCustomizations, IArtifactEventListener, IFrameworkTransactionEventListener {
-
- // Artifact that stores shared/global customizations
- private static Artifact globalCustomizationsArtifact;
- // Collection of all customizations both from local and global storage
- private static List<CustomizeData> custDatas;
- // Storage mechanism (user's User Artifact) for storage of selected default customizations guids for each XViewer namespace
- private final SkynetUserArtifactCustomizeDefaults userArtifactDefaults;
- // Attribute name for storing customizations both locally and globally
- private static String CUSTOMIZATION_ATTRIBUTE_NAME = "XViewer Customization";
- private final SkynetXViewerFactory skynetXViewerFactory;
- private static SkynetCustomizations instance = new SkynetCustomizations();
-
- /**
- * Constructor for events only
- */
- private SkynetCustomizations() {
- OseeEventManager.addListener(this);
- userArtifactDefaults = null;
- skynetXViewerFactory = null;
- }
-
- public SkynetCustomizations(SkynetXViewerFactory skynetXViewerFactory) throws OseeCoreException {
- this.skynetXViewerFactory = skynetXViewerFactory;
- this.userArtifactDefaults = new SkynetUserArtifactCustomizeDefaults(UserManager.getUser());
- globalCustomizationsArtifact = GlobalXViewerSettings.getCustomArtifact();
- }
-
- public List<CustomizeData> getSavedCustDatas() throws OseeCoreException {
- ensurePopulated(false);
- List<CustomizeData> thisCustDatas = new ArrayList<CustomizeData>();
- for (CustomizeData custData : custDatas) {
- if (custData.getNameSpace().equals(this.skynetXViewerFactory.getNamespace())) {
- thisCustDatas.add(custData);
- }
- }
- return thisCustDatas;
- }
-
- private static void saveCustomization(CustomizeData custData, Artifact saveArt) throws OseeCoreException {
- boolean found = false;
- Collection<Attribute<String>> attributes = saveArt.getAttributes(CUSTOMIZATION_ATTRIBUTE_NAME);
- for (Attribute<String> attribute : attributes) {
- if (attribute.getDisplayableString().contains("namespace=\"" + custData.getNameSpace() + "\"") && attribute.getDisplayableString().contains(
- "name=\"" + custData.getName() + "\"")) {
- attribute.setValue(custData.getXml(true));
- found = true;
- break;
- }
- }
- if (!found) {
- saveArt.addAttribute(CUSTOMIZATION_ATTRIBUTE_NAME, custData.getXml(true));
- }
- saveArt.persist();
- }
-
- public void saveCustomization(CustomizeData custData) throws OseeCoreException {
- if (custData.isPersonal())
- saveCustomization(custData, UserManager.getUser());
- else
- saveCustomization(custData, globalCustomizationsArtifact);
- ensurePopulated(true);
- }
-
- /**
- * Load and cache all customizations
- */
- public static synchronized void ensurePopulated(boolean force) throws OseeCoreException {
- if (custDatas == null || force) {
- if (custDatas == null) custDatas = Collections.synchronizedList(new ArrayList<CustomizeData>());
- if (force) custDatas.clear();
- User user = UserManager.getUser();
- if (user != null) {
- for (CustomizeData custData : getArtifactCustomizations(user)) {
- custData.setPersonal(true);
- custDatas.add(custData);
- }
- }
- custDatas.addAll(getArtifactCustomizations(getGlobalCustomizationsArtifact()));
- }
- }
-
- public static Artifact getGlobalCustomizationsArtifact() {
- return globalCustomizationsArtifact;
- }
-
- /**
- * Artifact that holds default customizations for this XTreeViewer. These will be selectable to everyone, but only
- * writable to Developer/AtsAdmin. Users will be able to save their own customizations separately. If no defaults are
- * necessary, don't set this artifact upon creation.
- *
- * @param defaultCustomizationsArtifact The defaultCustomizationsArtifact to set.
- */
- public void setGlobalCustomizationsArtifact(Artifact defaultCustomizationsArtifact) {
- SkynetCustomizations.globalCustomizationsArtifact = defaultCustomizationsArtifact;
- }
-
- public void deleteCustomization(CustomizeData custData) throws OseeCoreException {
- Artifact deleteArt = null;
- if (custData.isPersonal())
- deleteArt = UserManager.getUser();
- else
- deleteArt = getGlobalCustomizationsArtifact();
- deleteCustomization(custData, deleteArt);
- // Remove item as default if set
- if (userArtifactDefaults.isDefaultCustomization(custData)) {
- userArtifactDefaults.removeDefaultCustomization(custData);
- userArtifactDefaults.save();
- }
-
- }
-
- public void deleteCustomization(CustomizeData custData, Artifact deleteArt) throws OseeCoreException {
- Pattern pattern = Pattern.compile("name=\"(.*?)\".*?namespace=\"" + custData.getNameSpace() + "\"");
- for (Attribute<?> attribute : deleteArt.getAttributes(CUSTOMIZATION_ATTRIBUTE_NAME)) {
- String str = attribute.getDisplayableString();
- Matcher m = pattern.matcher(str);
- if (m.find() && m.group(1).equals(custData.getName())) {
- attribute.delete();
- deleteArt.persist();
- break;
- }
- }
- }
-
- public CustomizeData getUserDefaultCustData() throws XViewerException {
- try {
- for (CustomizeData custData : getSavedCustDatas()) {
- if (userArtifactDefaults.isDefaultCustomization(custData)) {
- return custData;
- }
- }
- return null;
- } catch (OseeCoreException ex) {
- throw new XViewerException(ex);
- }
- }
-
- public boolean isCustomizationUserDefault(CustomizeData custData) {
- try {
- return (getUserDefaultCustData() != null && getUserDefaultCustData().getGuid().equals(custData.getGuid()));
- } catch (Exception ex) {
- return false;
- }
- }
-
- public void setUserDefaultCustData(CustomizeData newCustData, boolean set) throws Exception {
- // Remove old defaults
- for (CustomizeData custData : getSavedCustDatas()) {
- if (userArtifactDefaults.isDefaultCustomization(custData)) {
- userArtifactDefaults.removeDefaultCustomization(custData);
- }
- }
- // Add new default
- if (set) userArtifactDefaults.setDefaultCustomization(newCustData);
- // persist
- userArtifactDefaults.save();
- }
-
- private static List<CustomizeData> getArtifactCustomizations(Artifact customizationArtifact) throws OseeCoreException {
- // ElapsedTime time = new ElapsedTime("getArtifactCustomizations");
- List<CustomizeData> custDatas = new ArrayList<CustomizeData>();
- if (customizationArtifact != null) {
-
- Collection<Attribute<String>> attributes = customizationArtifact.getAttributes(CUSTOMIZATION_ATTRIBUTE_NAME);
- for (Attribute<String> attr : attributes) {
- CustomizeData custData = new CustomizeData(attr.getValue());
- custDatas.add(custData);
- }
- }
- // time.end();
- return custDatas;
- }
-
- public boolean isCustomizationPersistAvailable() {
- return true;
- }
-
- @Override
- public void handleFrameworkTransactionEvent(Sender sender, FrameworkTransactionData transData) throws OseeCoreException {
- // If global customization artifact or user artifact change, clear cache so it can be loaded again
- if (transData.cacheChangedArtifacts.size() > 0) {
- if (transData.cacheChangedArtifacts.contains(getGlobalCustomizationsArtifact()) || transData.cacheChangedArtifacts.contains(UserManager.getUser())) {
- ensurePopulated(true);
- }
- }
- }
-
- public static SkynetCustomizations getInstance() {
- return instance;
- }
-
- @Override
- public List<? extends IEventFilter> getEventFilters() {
- return OseeEventManager.getCommonBranchEventFilters();
- }
-
- @Override
- public void handleArtifactEvent(ArtifactEvent artifactEvent, Sender sender) {
- final Collection<Artifact> modifiedArts =
- artifactEvent.getCacheArtifacts(EventModType.Modified, EventModType.Reloaded);
- try {
- if (!modifiedArts.isEmpty()) {
- if (modifiedArts.contains(getGlobalCustomizationsArtifact()) || modifiedArts.contains(UserManager.getUser())) {
- ensurePopulated(true);
- }
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.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.framework.ui.skynet.widgets.xviewer.skynet;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.nebula.widgets.xviewer.customize.CustomizeData;
+import org.eclipse.nebula.widgets.xviewer.customize.IXViewerCustomizations;
+import org.eclipse.nebula.widgets.xviewer.util.XViewerException;
+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.GlobalXViewerSettings;
+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.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.ui.skynet.SkynetGuiPlugin;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class SkynetCustomizations implements IXViewerCustomizations, IArtifactEventListener, IFrameworkTransactionEventListener {
+
+ // Artifact that stores shared/global customizations
+ private static Artifact globalCustomizationsArtifact;
+ // Collection of all customizations both from local and global storage
+ private static List<CustomizeData> custDatas;
+ // Storage mechanism (user's User Artifact) for storage of selected default customizations guids for each XViewer namespace
+ private final SkynetUserArtifactCustomizeDefaults userArtifactDefaults;
+ // Attribute name for storing customizations both locally and globally
+ private static String CUSTOMIZATION_ATTRIBUTE_NAME = "XViewer Customization";
+ private final SkynetXViewerFactory skynetXViewerFactory;
+ private static SkynetCustomizations instance = new SkynetCustomizations();
+
+ /**
+ * Constructor for events only
+ */
+ private SkynetCustomizations() {
+ OseeEventManager.addListener(this);
+ userArtifactDefaults = null;
+ skynetXViewerFactory = null;
+ }
+
+ public SkynetCustomizations(SkynetXViewerFactory skynetXViewerFactory) throws OseeCoreException {
+ this.skynetXViewerFactory = skynetXViewerFactory;
+ this.userArtifactDefaults = new SkynetUserArtifactCustomizeDefaults(UserManager.getUser());
+ globalCustomizationsArtifact = GlobalXViewerSettings.getCustomArtifact();
+ }
+
+ public List<CustomizeData> getSavedCustDatas() throws OseeCoreException {
+ ensurePopulated(false);
+ List<CustomizeData> thisCustDatas = new ArrayList<CustomizeData>();
+ for (CustomizeData custData : custDatas) {
+ if (custData.getNameSpace().equals(this.skynetXViewerFactory.getNamespace())) {
+ thisCustDatas.add(custData);
+ }
+ }
+ return thisCustDatas;
+ }
+
+ private static void saveCustomization(CustomizeData custData, Artifact saveArt) throws OseeCoreException {
+ boolean found = false;
+ Collection<Attribute<String>> attributes = saveArt.getAttributes(CUSTOMIZATION_ATTRIBUTE_NAME);
+ for (Attribute<String> attribute : attributes) {
+ if (attribute.getDisplayableString().contains("namespace=\"" + custData.getNameSpace() + "\"") && attribute.getDisplayableString().contains(
+ "name=\"" + custData.getName() + "\"")) {
+ attribute.setValue(custData.getXml(true));
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ saveArt.addAttribute(CUSTOMIZATION_ATTRIBUTE_NAME, custData.getXml(true));
+ }
+ saveArt.persist();
+ }
+
+ public void saveCustomization(CustomizeData custData) throws OseeCoreException {
+ if (custData.isPersonal())
+ saveCustomization(custData, UserManager.getUser());
+ else
+ saveCustomization(custData, globalCustomizationsArtifact);
+ ensurePopulated(true);
+ }
+
+ /**
+ * Load and cache all customizations
+ */
+ public static synchronized void ensurePopulated(boolean force) throws OseeCoreException {
+ if (custDatas == null || force) {
+ if (custDatas == null) custDatas = Collections.synchronizedList(new ArrayList<CustomizeData>());
+ if (force) custDatas.clear();
+ User user = UserManager.getUser();
+ if (user != null) {
+ for (CustomizeData custData : getArtifactCustomizations(user)) {
+ custData.setPersonal(true);
+ custDatas.add(custData);
+ }
+ }
+ custDatas.addAll(getArtifactCustomizations(getGlobalCustomizationsArtifact()));
+ }
+ }
+
+ public static Artifact getGlobalCustomizationsArtifact() {
+ return globalCustomizationsArtifact;
+ }
+
+ /**
+ * Artifact that holds default customizations for this XTreeViewer. These will be selectable to everyone, but only
+ * writable to Developer/AtsAdmin. Users will be able to save their own customizations separately. If no defaults are
+ * necessary, don't set this artifact upon creation.
+ *
+ * @param defaultCustomizationsArtifact The defaultCustomizationsArtifact to set.
+ */
+ public void setGlobalCustomizationsArtifact(Artifact defaultCustomizationsArtifact) {
+ SkynetCustomizations.globalCustomizationsArtifact = defaultCustomizationsArtifact;
+ }
+
+ public void deleteCustomization(CustomizeData custData) throws OseeCoreException {
+ Artifact deleteArt = null;
+ if (custData.isPersonal())
+ deleteArt = UserManager.getUser();
+ else
+ deleteArt = getGlobalCustomizationsArtifact();
+ deleteCustomization(custData, deleteArt);
+ // Remove item as default if set
+ if (userArtifactDefaults.isDefaultCustomization(custData)) {
+ userArtifactDefaults.removeDefaultCustomization(custData);
+ userArtifactDefaults.save();
+ }
+
+ }
+
+ public void deleteCustomization(CustomizeData custData, Artifact deleteArt) throws OseeCoreException {
+ Pattern pattern = Pattern.compile("name=\"(.*?)\".*?namespace=\"" + custData.getNameSpace() + "\"");
+ for (Attribute<?> attribute : deleteArt.getAttributes(CUSTOMIZATION_ATTRIBUTE_NAME)) {
+ String str = attribute.getDisplayableString();
+ Matcher m = pattern.matcher(str);
+ if (m.find() && m.group(1).equals(custData.getName())) {
+ attribute.delete();
+ deleteArt.persist();
+ break;
+ }
+ }
+ }
+
+ public CustomizeData getUserDefaultCustData() throws XViewerException {
+ try {
+ for (CustomizeData custData : getSavedCustDatas()) {
+ if (userArtifactDefaults.isDefaultCustomization(custData)) {
+ return custData;
+ }
+ }
+ return null;
+ } catch (OseeCoreException ex) {
+ throw new XViewerException(ex);
+ }
+ }
+
+ public boolean isCustomizationUserDefault(CustomizeData custData) {
+ try {
+ return (getUserDefaultCustData() != null && getUserDefaultCustData().getGuid().equals(custData.getGuid()));
+ } catch (Exception ex) {
+ return false;
+ }
+ }
+
+ public void setUserDefaultCustData(CustomizeData newCustData, boolean set) throws Exception {
+ // Remove old defaults
+ for (CustomizeData custData : getSavedCustDatas()) {
+ if (userArtifactDefaults.isDefaultCustomization(custData)) {
+ userArtifactDefaults.removeDefaultCustomization(custData);
+ }
+ }
+ // Add new default
+ if (set) userArtifactDefaults.setDefaultCustomization(newCustData);
+ // persist
+ userArtifactDefaults.save();
+ }
+
+ private static List<CustomizeData> getArtifactCustomizations(Artifact customizationArtifact) throws OseeCoreException {
+ // ElapsedTime time = new ElapsedTime("getArtifactCustomizations");
+ List<CustomizeData> custDatas = new ArrayList<CustomizeData>();
+ if (customizationArtifact != null) {
+
+ Collection<Attribute<String>> attributes = customizationArtifact.getAttributes(CUSTOMIZATION_ATTRIBUTE_NAME);
+ for (Attribute<String> attr : attributes) {
+ CustomizeData custData = new CustomizeData(attr.getValue());
+ custDatas.add(custData);
+ }
+ }
+ // time.end();
+ return custDatas;
+ }
+
+ public boolean isCustomizationPersistAvailable() {
+ return true;
+ }
+
+ @Override
+ public void handleFrameworkTransactionEvent(Sender sender, FrameworkTransactionData transData) throws OseeCoreException {
+ // If global customization artifact or user artifact change, clear cache so it can be loaded again
+ if (transData.cacheChangedArtifacts.size() > 0) {
+ if (transData.cacheChangedArtifacts.contains(getGlobalCustomizationsArtifact()) || transData.cacheChangedArtifacts.contains(UserManager.getUser())) {
+ ensurePopulated(true);
+ }
+ }
+ }
+
+ public static SkynetCustomizations getInstance() {
+ return instance;
+ }
+
+ @Override
+ public List<? extends IEventFilter> getEventFilters() {
+ return OseeEventManager.getCommonBranchEventFilters();
+ }
+
+ @Override
+ public void handleArtifactEvent(ArtifactEvent artifactEvent, Sender sender) {
+ final Collection<Artifact> modifiedArts =
+ artifactEvent.getCacheArtifacts(EventModType.Modified, EventModType.Reloaded);
+ try {
+ if (!modifiedArts.isEmpty()) {
+ if (modifiedArts.contains(getGlobalCustomizationsArtifact()) || modifiedArts.contains(UserManager.getUser())) {
+ ensurePopulated(true);
+ }
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE, ex);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/SkynetXViewerFactory.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/SkynetXViewerFactory.java
index 3732330c980..a34f998b7e3 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/SkynetXViewerFactory.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/SkynetXViewerFactory.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.framework.ui.skynet.widgets.xviewer.skynet;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-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.XViewerFactory;
-import org.eclipse.nebula.widgets.xviewer.XViewerTreeReport;
-import org.eclipse.nebula.widgets.xviewer.customize.IXViewerCustomizations;
-import org.eclipse.nebula.widgets.xviewer.customize.XViewerCustomizations;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-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.attribute.AttributeTypeManager;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.OseeXViewerTreeReport;
-import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column.XViewerArtifactNameColumn;
-import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column.XViewerAttributeColumn;
-import org.eclipse.swt.SWT;
-
-/**
- * @author Donald G. Dunne
- */
-public class SkynetXViewerFactory extends XViewerFactory {
-
- /**
- * @param namespace
- */
- public SkynetXViewerFactory(String namespace) {
- super(namespace);
- }
-
- private IXViewerCustomizations xViewerCustomizations;
-
- @Override
- public IXViewerCustomizations getXViewerCustomizations() {
- try {
- if (SkynetGuiPlugin.areOSEEServicesAvailable().isTrue()) {
- if (xViewerCustomizations == null) {
- xViewerCustomizations = new SkynetCustomizations(this);
- }
- return xViewerCustomizations;
- }
- } catch (Throwable ex) {
- OseeLog.log(SkynetXViewerFactory.class, Level.SEVERE,
- "Failed to retrieve XViewer customizations from the persistence layer.", ex);
- }
- return new XViewerCustomizations();
- }
-
- public void registerAllAttributeColumns() {
- try {
- registerColumns(getAllAttributeColumns().toArray(new XViewerColumn[AttributeTypeManager.getAllTypes().size()]));
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
-
- public void registerAllAttributeColumnsForArtifacts(Collection<? extends Artifact> artifacts, boolean show) {
- registerAllAttributeColumnsForArtifacts(artifacts, show, false);
- }
-
- public void registerAllAttributeColumnsForArtifacts(Collection<? extends Artifact> artifacts, boolean show, boolean multiColumnEditable) {
- try {
- for (XViewerColumn xCol : SkynetXViewerFactory.getAllAttributeColumnsForArtifacts(artifacts)) {
- xCol.setShow(show);
- xCol.setMultiColumnEditable(multiColumnEditable);
- registerColumns(xCol);
- }
- } catch (Exception ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
-
- public static List<XViewerColumn> getAllAttributeColumns() throws OseeCoreException {
- List<XViewerColumn> columns = new ArrayList<XViewerColumn>();
- for (AttributeType attributeType : AttributeTypeManager.getAllTypes()) {
- columns.add(getAttributeColumn(attributeType));
- }
- return columns;
- }
-
- public static XViewerColumn getAttributeColumn(AttributeType attributeType) throws OseeCoreException {
- return new XViewerAttributeColumn("attribute." + attributeType.getName(), attributeType.getName(),
- attributeType.getName(), 75, SWT.LEFT, false, XViewerAttributeSortDataType.get(attributeType), false, null);
- }
-
- /**
- * @param artifacts
- * @return columns for attributes valid for at least on of the given artifacts
- * @throws OseeCoreException
- */
- public static List<XViewerColumn> getAllAttributeColumnsForArtifacts(Collection<? extends Artifact> artifacts) throws OseeCoreException {
- List<XViewerColumn> columns = new ArrayList<XViewerColumn>();
- Set<AttributeType> attributeTypes = new HashSet<AttributeType>();
- try {
- for (Artifact art : artifacts) {
- attributeTypes.addAll(art.getAttributeTypes());
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
- }
- Set<String> attrNames = new HashSet<String>();
- // Add Name first
- columns.add(new XViewerArtifactNameColumn(true));
- attrNames.add("Name");
- for (AttributeType attributeType : attributeTypes) {
- if (!attrNames.contains(attributeType.getName())) {
- columns.add(getAttributeColumn(attributeType));
- attrNames.add(attributeType.getName());
- }
- }
- return columns;
- }
-
- @Override
- public boolean isAdmin() {
- return true;
- }
-
- @Override
- public XViewerTreeReport getXViewerTreeReport(XViewer viewer) {
- return new OseeXViewerTreeReport(viewer);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+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.XViewerFactory;
+import org.eclipse.nebula.widgets.xviewer.XViewerTreeReport;
+import org.eclipse.nebula.widgets.xviewer.customize.IXViewerCustomizations;
+import org.eclipse.nebula.widgets.xviewer.customize.XViewerCustomizations;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+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.attribute.AttributeTypeManager;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.OseeXViewerTreeReport;
+import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column.XViewerArtifactNameColumn;
+import org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column.XViewerAttributeColumn;
+import org.eclipse.swt.SWT;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class SkynetXViewerFactory extends XViewerFactory {
+
+ /**
+ * @param namespace
+ */
+ public SkynetXViewerFactory(String namespace) {
+ super(namespace);
+ }
+
+ private IXViewerCustomizations xViewerCustomizations;
+
+ @Override
+ public IXViewerCustomizations getXViewerCustomizations() {
+ try {
+ if (SkynetGuiPlugin.areOSEEServicesAvailable().isTrue()) {
+ if (xViewerCustomizations == null) {
+ xViewerCustomizations = new SkynetCustomizations(this);
+ }
+ return xViewerCustomizations;
+ }
+ } catch (Throwable ex) {
+ OseeLog.log(SkynetXViewerFactory.class, Level.SEVERE,
+ "Failed to retrieve XViewer customizations from the persistence layer.", ex);
+ }
+ return new XViewerCustomizations();
+ }
+
+ public void registerAllAttributeColumns() {
+ try {
+ registerColumns(getAllAttributeColumns().toArray(new XViewerColumn[AttributeTypeManager.getAllTypes().size()]));
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ public void registerAllAttributeColumnsForArtifacts(Collection<? extends Artifact> artifacts, boolean show) {
+ registerAllAttributeColumnsForArtifacts(artifacts, show, false);
+ }
+
+ public void registerAllAttributeColumnsForArtifacts(Collection<? extends Artifact> artifacts, boolean show, boolean multiColumnEditable) {
+ try {
+ for (XViewerColumn xCol : SkynetXViewerFactory.getAllAttributeColumnsForArtifacts(artifacts)) {
+ xCol.setShow(show);
+ xCol.setMultiColumnEditable(multiColumnEditable);
+ registerColumns(xCol);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ public static List<XViewerColumn> getAllAttributeColumns() throws OseeCoreException {
+ List<XViewerColumn> columns = new ArrayList<XViewerColumn>();
+ for (AttributeType attributeType : AttributeTypeManager.getAllTypes()) {
+ columns.add(getAttributeColumn(attributeType));
+ }
+ return columns;
+ }
+
+ public static XViewerColumn getAttributeColumn(AttributeType attributeType) throws OseeCoreException {
+ return new XViewerAttributeColumn("attribute." + attributeType.getName(), attributeType.getName(),
+ attributeType.getName(), 75, SWT.LEFT, false, XViewerAttributeSortDataType.get(attributeType), false, null);
+ }
+
+ /**
+ * @param artifacts
+ * @return columns for attributes valid for at least on of the given artifacts
+ * @throws OseeCoreException
+ */
+ public static List<XViewerColumn> getAllAttributeColumnsForArtifacts(Collection<? extends Artifact> artifacts) throws OseeCoreException {
+ List<XViewerColumn> columns = new ArrayList<XViewerColumn>();
+ Set<AttributeType> attributeTypes = new HashSet<AttributeType>();
+ try {
+ for (Artifact art : artifacts) {
+ attributeTypes.addAll(art.getAttributeTypes());
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ Set<String> attrNames = new HashSet<String>();
+ // Add Name first
+ columns.add(new XViewerArtifactNameColumn(true));
+ attrNames.add("Name");
+ for (AttributeType attributeType : attributeTypes) {
+ if (!attrNames.contains(attributeType.getName())) {
+ columns.add(getAttributeColumn(attributeType));
+ attrNames.add(attributeType.getName());
+ }
+ }
+ return columns;
+ }
+
+ @Override
+ public boolean isAdmin() {
+ return true;
+ }
+
+ @Override
+ public XViewerTreeReport getXViewerTreeReport(XViewer viewer) {
+ return new OseeXViewerTreeReport(viewer);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/XViewerAttributeSortDataType.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/XViewerAttributeSortDataType.java
index ece81fb19e6..3035347dd24 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/XViewerAttributeSortDataType.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/XViewerAttributeSortDataType.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.framework.ui.skynet.widgets.xviewer.skynet;
-
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn.SortDataType;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
-import org.eclipse.osee.framework.skynet.core.attribute.BooleanAttribute;
-import org.eclipse.osee.framework.skynet.core.attribute.DateAttribute;
-import org.eclipse.osee.framework.skynet.core.attribute.FloatingPointAttribute;
-import org.eclipse.osee.framework.skynet.core.attribute.IntegerAttribute;
-
-/**
- * @author Donald G. Dunne
- */
-public class XViewerAttributeSortDataType {
-
- public static SortDataType get(AttributeType attributeType) throws OseeCoreException {
- SortDataType sortType = SortDataType.String;
- if (AttributeTypeManager.isBaseTypeCompatible(DateAttribute.class, attributeType)) {
- sortType = SortDataType.Date;
- } else if (AttributeTypeManager.isBaseTypeCompatible(FloatingPointAttribute.class, attributeType)) {
- sortType = SortDataType.Float;
- } else if (AttributeTypeManager.isBaseTypeCompatible(IntegerAttribute.class, attributeType)) {
- sortType = SortDataType.Integer;
- } else if (AttributeTypeManager.isBaseTypeCompatible(BooleanAttribute.class, attributeType)) {
- sortType = SortDataType.Boolean;
- }
- return sortType;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet;
+
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn.SortDataType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
+import org.eclipse.osee.framework.skynet.core.attribute.BooleanAttribute;
+import org.eclipse.osee.framework.skynet.core.attribute.DateAttribute;
+import org.eclipse.osee.framework.skynet.core.attribute.FloatingPointAttribute;
+import org.eclipse.osee.framework.skynet.core.attribute.IntegerAttribute;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XViewerAttributeSortDataType {
+
+ public static SortDataType get(AttributeType attributeType) throws OseeCoreException {
+ SortDataType sortType = SortDataType.String;
+ if (AttributeTypeManager.isBaseTypeCompatible(DateAttribute.class, attributeType)) {
+ sortType = SortDataType.Date;
+ } else if (AttributeTypeManager.isBaseTypeCompatible(FloatingPointAttribute.class, attributeType)) {
+ sortType = SortDataType.Float;
+ } else if (AttributeTypeManager.isBaseTypeCompatible(IntegerAttribute.class, attributeType)) {
+ sortType = SortDataType.Integer;
+ } else if (AttributeTypeManager.isBaseTypeCompatible(BooleanAttribute.class, attributeType)) {
+ sortType = SortDataType.Boolean;
+ }
+ return sortType;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerArtifactNameColumn.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerArtifactNameColumn.java
index 71abb0cf940..493bf2d9731 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerArtifactNameColumn.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerArtifactNameColumn.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.framework.ui.skynet.widgets.xviewer.skynet.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.framework.skynet.core.artifact.Artifact;
-import org.eclipse.swt.SWT;
-
-/**
- * @author Donald G. Dunne
- */
-public class XViewerArtifactNameColumn extends XViewerValueColumn {
-
- public XViewerArtifactNameColumn(boolean show) {
- this("framework.artifact.name", "Name", 150, SWT.LEFT, show, SortDataType.String, false, null);
- }
-
- public XViewerArtifactNameColumn(String name) {
- this("framework.artifact.name." + name, name, 150, SWT.LEFT, true, SortDataType.String, false, null);
- }
-
- public XViewerArtifactNameColumn(String name, boolean multiColumnEditable) {
- this("framework.artifact.name." + name, name, 150, SWT.LEFT, true, SortDataType.String, multiColumnEditable, null);
- }
-
- public XViewerArtifactNameColumn(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 MUST extend this constructor so the correct sub-class is created
- *
- * @param col
- */
- @Override
- public XViewerArtifactNameColumn copy() {
- return new XViewerArtifactNameColumn(getId(), getName(), getWidth(), getAlign(), isShow(), getSortDataType(),
- isMultiColumnEditable(), getDescription());
- }
-
- @Override
- public String getColumnText(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
- if (element instanceof Artifact) {
- return ((Artifact) element).getName();
- } else if (element instanceof String) {
- return "";
- }
- return super.getColumnText(element, column, columnIndex);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.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.framework.skynet.core.artifact.Artifact;
+import org.eclipse.swt.SWT;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XViewerArtifactNameColumn extends XViewerValueColumn {
+
+ public XViewerArtifactNameColumn(boolean show) {
+ this("framework.artifact.name", "Name", 150, SWT.LEFT, show, SortDataType.String, false, null);
+ }
+
+ public XViewerArtifactNameColumn(String name) {
+ this("framework.artifact.name." + name, name, 150, SWT.LEFT, true, SortDataType.String, false, null);
+ }
+
+ public XViewerArtifactNameColumn(String name, boolean multiColumnEditable) {
+ this("framework.artifact.name." + name, name, 150, SWT.LEFT, true, SortDataType.String, multiColumnEditable, null);
+ }
+
+ public XViewerArtifactNameColumn(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 MUST extend this constructor so the correct sub-class is created
+ *
+ * @param col
+ */
+ @Override
+ public XViewerArtifactNameColumn copy() {
+ return new XViewerArtifactNameColumn(getId(), getName(), getWidth(), getAlign(), isShow(), getSortDataType(),
+ isMultiColumnEditable(), getDescription());
+ }
+
+ @Override
+ public String getColumnText(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
+ if (element instanceof Artifact) {
+ return ((Artifact) element).getName();
+ } else if (element instanceof String) {
+ return "";
+ }
+ return super.getColumnText(element, column, columnIndex);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerArtifactTypeColumn.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerArtifactTypeColumn.java
index 7bafda0926f..2e2658be989 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerArtifactTypeColumn.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerArtifactTypeColumn.java
@@ -1,75 +1,75 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.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.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.change.Change;
-import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Donald G. Dunne
- */
-public class XViewerArtifactTypeColumn extends XViewerValueColumn {
-
- public XViewerArtifactTypeColumn(boolean show) {
- this("framework.artifact.type." + "Artifact Type", "Artifact Type", 150, SWT.LEFT, show, SortDataType.String,
- false, "Artifact Type");
- }
-
- public XViewerArtifactTypeColumn(String name) {
- this("framework.artifact.type." + name, name, 150, SWT.LEFT, true, SortDataType.String, false, "Artifact Type");
- }
-
- public XViewerArtifactTypeColumn(String id, String name, boolean show) {
- this(id, name, 150, SWT.LEFT, show, SortDataType.String, false, name);
- }
-
- public XViewerArtifactTypeColumn(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 MUST extend this constructor so the correct sub-class is created
- *
- * @param col
- */
- @Override
- public XViewerArtifactTypeColumn copy() {
- return new XViewerArtifactTypeColumn(getId(), getName(), getWidth(), getAlign(), isShow(), getSortDataType(),
- isMultiColumnEditable(), getDescription());
- }
-
- @Override
- public String getColumnText(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
- if (element instanceof Artifact) {
- return ((Artifact) element).getArtifactTypeName();
- } else if (element instanceof Change) {
- return ((Change) element).getArtifactType().getName();
- } else if (element instanceof String) {
- return "";
- }
- return super.getColumnText(element, column, columnIndex);
- }
-
- @Override
- public Image getColumnImage(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
- if (element instanceof Artifact) {
- return ArtifactImageManager.getImage((Artifact) element);
- }
- return super.getColumnImage(element, column, columnIndex);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.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.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.change.Change;
+import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XViewerArtifactTypeColumn extends XViewerValueColumn {
+
+ public XViewerArtifactTypeColumn(boolean show) {
+ this("framework.artifact.type." + "Artifact Type", "Artifact Type", 150, SWT.LEFT, show, SortDataType.String,
+ false, "Artifact Type");
+ }
+
+ public XViewerArtifactTypeColumn(String name) {
+ this("framework.artifact.type." + name, name, 150, SWT.LEFT, true, SortDataType.String, false, "Artifact Type");
+ }
+
+ public XViewerArtifactTypeColumn(String id, String name, boolean show) {
+ this(id, name, 150, SWT.LEFT, show, SortDataType.String, false, name);
+ }
+
+ public XViewerArtifactTypeColumn(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 MUST extend this constructor so the correct sub-class is created
+ *
+ * @param col
+ */
+ @Override
+ public XViewerArtifactTypeColumn copy() {
+ return new XViewerArtifactTypeColumn(getId(), getName(), getWidth(), getAlign(), isShow(), getSortDataType(),
+ isMultiColumnEditable(), getDescription());
+ }
+
+ @Override
+ public String getColumnText(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
+ if (element instanceof Artifact) {
+ return ((Artifact) element).getArtifactTypeName();
+ } else if (element instanceof Change) {
+ return ((Change) element).getArtifactType().getName();
+ } else if (element instanceof String) {
+ return "";
+ }
+ return super.getColumnText(element, column, columnIndex);
+ }
+
+ @Override
+ public Image getColumnImage(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
+ if (element instanceof Artifact) {
+ return ArtifactImageManager.getImage((Artifact) element);
+ }
+ return super.getColumnImage(element, column, columnIndex);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerAttributeColumn.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerAttributeColumn.java
index 5b20b9aac8e..328c14664d4 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerAttributeColumn.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerAttributeColumn.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.framework.ui.skynet.widgets.xviewer.skynet.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.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.change.Change;
-import org.eclipse.osee.framework.skynet.core.conflict.Conflict;
-
-/**
- * @author Donald G. Dunne
- */
-public class XViewerAttributeColumn extends XViewerValueColumn {
-
- 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 XViewerAttributeColumn copy() {
- return new XViewerAttributeColumn(getId(), getName(), getAttributeTypeName(), getWidth(), getAlign(), isShow(),
- getSortDataType(), isMultiColumnEditable(), getDescription());
- }
-
- public XViewerAttributeColumn(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;
- }
-
- @Override
- public String getColumnText(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
- try {
- if (element instanceof Artifact) {
- return ((Artifact) element).getAttributesToString(attributeTypeName);
- }
- if (element instanceof Change) {
- return ((Change) element).getChangeArtifact().getAttributesToString(attributeTypeName);
- }
- if (element instanceof Conflict) {
- return ((Conflict) element).getArtifact().getAttributesToString(attributeTypeName);
- }
- return "";
- } catch (OseeCoreException ex) {
- throw new XViewerException(ex);
- }
- }
-
- 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.framework.ui.skynet.widgets.xviewer.skynet.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.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.change.Change;
+import org.eclipse.osee.framework.skynet.core.conflict.Conflict;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XViewerAttributeColumn extends XViewerValueColumn {
+
+ 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 XViewerAttributeColumn copy() {
+ return new XViewerAttributeColumn(getId(), getName(), getAttributeTypeName(), getWidth(), getAlign(), isShow(),
+ getSortDataType(), isMultiColumnEditable(), getDescription());
+ }
+
+ public XViewerAttributeColumn(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;
+ }
+
+ @Override
+ public String getColumnText(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
+ try {
+ if (element instanceof Artifact) {
+ return ((Artifact) element).getAttributesToString(attributeTypeName);
+ }
+ if (element instanceof Change) {
+ return ((Change) element).getChangeArtifact().getAttributesToString(attributeTypeName);
+ }
+ if (element instanceof Conflict) {
+ return ((Conflict) element).getArtifact().getAttributesToString(attributeTypeName);
+ }
+ return "";
+ } catch (OseeCoreException ex) {
+ throw new XViewerException(ex);
+ }
+ }
+
+ public String getAttributeTypeName() {
+ return attributeTypeName;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerGuidColumn.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerGuidColumn.java
index 94530f8b450..7ac0fcb89ea 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerGuidColumn.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerGuidColumn.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.framework.ui.skynet.widgets.xviewer.skynet.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.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.change.Change;
-import org.eclipse.swt.SWT;
-
-/**
- * @author Donald G. Dunne
- */
-public class XViewerGuidColumn extends XViewerValueColumn {
-
- public XViewerGuidColumn(boolean show) {
- this("framework.guid", "Guid", 75, SWT.LEFT, show, SortDataType.String, false, "Globally Unique Identifier");
- }
-
- public XViewerGuidColumn(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 MUST extend this constructor so the correct sub-class is created
- *
- * @param col
- */
- @Override
- public XViewerGuidColumn copy() {
- return new XViewerGuidColumn(getId(), getName(), getWidth(), getAlign(), isShow(), getSortDataType(),
- isMultiColumnEditable(), getDescription());
- }
-
- @Override
- public String getColumnText(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
- if (element instanceof Artifact) {
- return ((Artifact) element).getGuid();
- } else if (element instanceof Change) {
- return ((Change) element).getChangeArtifact().getGuid();
- }
- return "";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.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.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.change.Change;
+import org.eclipse.swt.SWT;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XViewerGuidColumn extends XViewerValueColumn {
+
+ public XViewerGuidColumn(boolean show) {
+ this("framework.guid", "Guid", 75, SWT.LEFT, show, SortDataType.String, false, "Globally Unique Identifier");
+ }
+
+ public XViewerGuidColumn(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 MUST extend this constructor so the correct sub-class is created
+ *
+ * @param col
+ */
+ @Override
+ public XViewerGuidColumn copy() {
+ return new XViewerGuidColumn(getId(), getName(), getWidth(), getAlign(), isShow(), getSortDataType(),
+ isMultiColumnEditable(), getDescription());
+ }
+
+ @Override
+ public String getColumnText(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
+ if (element instanceof Artifact) {
+ return ((Artifact) element).getGuid();
+ } else if (element instanceof Change) {
+ return ((Change) element).getChangeArtifact().getGuid();
+ }
+ return "";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerHridColumn.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerHridColumn.java
index 6b0d5e3a8db..caaed574b65 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerHridColumn.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerHridColumn.java
@@ -1,64 +1,64 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column;
-
-import org.eclipse.nebula.widgets.xviewer.XViewerCells;
-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.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.change.Change;
-import org.eclipse.swt.SWT;
-
-/**
- * @author Donald G. Dunne
- */
-public class XViewerHridColumn extends XViewerValueColumn {
-
- public XViewerHridColumn() {
- this(false);
- }
-
- public XViewerHridColumn(boolean show) {
- this("framework.hrid", "HRID", 75, SWT.LEFT, show, SortDataType.String, false, "Human Readable ID");
- }
-
- public XViewerHridColumn(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 MUST extend this constructor so the correct sub-class is created
- *
- * @param col
- */
- @Override
- public XViewerHridColumn copy() {
- return new XViewerHridColumn(getId(), getName(), getWidth(), getAlign(), isShow(), getSortDataType(),
- isMultiColumnEditable(), getDescription());
- }
-
- @Override
- public String getColumnText(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
- try {
- if (element instanceof Artifact) {
- return ((Artifact) element).getHumanReadableId();
- } else if (element instanceof Change) {
- return ((Change) element).getChangeArtifact().getHumanReadableId();
- }
- } catch (Exception ex) {
- return XViewerCells.getCellExceptionString(ex);
- }
- return "";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column;
+
+import org.eclipse.nebula.widgets.xviewer.XViewerCells;
+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.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.change.Change;
+import org.eclipse.swt.SWT;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XViewerHridColumn extends XViewerValueColumn {
+
+ public XViewerHridColumn() {
+ this(false);
+ }
+
+ public XViewerHridColumn(boolean show) {
+ this("framework.hrid", "HRID", 75, SWT.LEFT, show, SortDataType.String, false, "Human Readable ID");
+ }
+
+ public XViewerHridColumn(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 MUST extend this constructor so the correct sub-class is created
+ *
+ * @param col
+ */
+ @Override
+ public XViewerHridColumn copy() {
+ return new XViewerHridColumn(getId(), getName(), getWidth(), getAlign(), isShow(), getSortDataType(),
+ isMultiColumnEditable(), getDescription());
+ }
+
+ @Override
+ public String getColumnText(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
+ try {
+ if (element instanceof Artifact) {
+ return ((Artifact) element).getHumanReadableId();
+ } else if (element instanceof Change) {
+ return ((Change) element).getChangeArtifact().getHumanReadableId();
+ }
+ } catch (Exception ex) {
+ return XViewerCells.getCellExceptionString(ex);
+ }
+ return "";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerLastModifiedByColumn.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerLastModifiedByColumn.java
index d03bc7862c1..33fae20bfa5 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerLastModifiedByColumn.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerLastModifiedByColumn.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.framework.ui.skynet.widgets.xviewer.skynet.column;
-
-import org.eclipse.nebula.widgets.xviewer.XViewerCells;
-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.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.change.Change;
-import org.eclipse.swt.SWT;
-
-/**
- * @author Donald G. Dunne
- */
-public class XViewerLastModifiedByColumn extends XViewerValueColumn {
-
- public XViewerLastModifiedByColumn(boolean show) {
- this("framework.lastModBy", "Last Modified By", 50, SWT.LEFT, show, SortDataType.String, false, null);
- }
-
- public XViewerLastModifiedByColumn(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 MUST extend this constructor so the correct sub-class is created
- *
- * @param col
- */
- @Override
- public XViewerLastModifiedByColumn copy() {
- return new XViewerLastModifiedByColumn(getId(), getName(), getWidth(), getAlign(), isShow(), getSortDataType(),
- isMultiColumnEditable(), getDescription());
- }
-
- @Override
- public String getColumnText(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
- try {
- if (element instanceof Artifact) {
- return ((Artifact) element).getLastModifiedBy().toString();
- } else if (element instanceof Change) {
- User user = ((Change) element).getChangeArtifact().getLastModifiedBy();
- return user.toString();
- }
- } catch (OseeCoreException ex) {
- return XViewerCells.getCellExceptionString(ex);
- }
- return "";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column;
+
+import org.eclipse.nebula.widgets.xviewer.XViewerCells;
+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.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.change.Change;
+import org.eclipse.swt.SWT;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XViewerLastModifiedByColumn extends XViewerValueColumn {
+
+ public XViewerLastModifiedByColumn(boolean show) {
+ this("framework.lastModBy", "Last Modified By", 50, SWT.LEFT, show, SortDataType.String, false, null);
+ }
+
+ public XViewerLastModifiedByColumn(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 MUST extend this constructor so the correct sub-class is created
+ *
+ * @param col
+ */
+ @Override
+ public XViewerLastModifiedByColumn copy() {
+ return new XViewerLastModifiedByColumn(getId(), getName(), getWidth(), getAlign(), isShow(), getSortDataType(),
+ isMultiColumnEditable(), getDescription());
+ }
+
+ @Override
+ public String getColumnText(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
+ try {
+ if (element instanceof Artifact) {
+ return ((Artifact) element).getLastModifiedBy().toString();
+ } else if (element instanceof Change) {
+ User user = ((Change) element).getChangeArtifact().getLastModifiedBy();
+ return user.toString();
+ }
+ } catch (OseeCoreException ex) {
+ return XViewerCells.getCellExceptionString(ex);
+ }
+ return "";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerLastModifiedDateColumn.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerLastModifiedDateColumn.java
index 35597cf2b65..4b9bab719c8 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerLastModifiedDateColumn.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xviewer/skynet/column/XViewerLastModifiedDateColumn.java
@@ -1,64 +1,64 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column;
-
-import java.util.Date;
-import org.eclipse.nebula.widgets.xviewer.XViewerCells;
-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.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.change.Change;
-import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
-import org.eclipse.swt.SWT;
-
-/**
- * @author Donald G. Dunne
- */
-public class XViewerLastModifiedDateColumn extends XViewerValueColumn {
-
- public XViewerLastModifiedDateColumn(boolean show) {
- this("framework.lastModDate", "Last Modified Date", 50, SWT.LEFT, show, SortDataType.Date, false, null);
- }
-
- public XViewerLastModifiedDateColumn(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 MUST extend this constructor so the correct sub-class is created
- *
- * @param col
- */
- @Override
- public XViewerLastModifiedDateColumn copy() {
- return new XViewerLastModifiedDateColumn(getId(), getName(), getWidth(), getAlign(), isShow(), getSortDataType(),
- isMultiColumnEditable(), getDescription());
- }
-
- @Override
- public String getColumnText(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
- try {
- if (element instanceof Artifact) {
- return XDate.getDateStr(((Artifact) element).getLastModified(), XDate.MMDDYYHHMM);
- } else if (element instanceof Change) {
- Date date = ((Change) element).getChangeArtifact().getLastModified();
- return XDate.getDateStr(date, XDate.MMDDYYHHMM);
- }
- } catch (OseeCoreException ex) {
- return XViewerCells.getCellExceptionString(ex);
- }
- return "";
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column;
+
+import java.util.Date;
+import org.eclipse.nebula.widgets.xviewer.XViewerCells;
+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.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.change.Change;
+import org.eclipse.osee.framework.ui.skynet.widgets.XDate;
+import org.eclipse.swt.SWT;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XViewerLastModifiedDateColumn extends XViewerValueColumn {
+
+ public XViewerLastModifiedDateColumn(boolean show) {
+ this("framework.lastModDate", "Last Modified Date", 50, SWT.LEFT, show, SortDataType.Date, false, null);
+ }
+
+ public XViewerLastModifiedDateColumn(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 MUST extend this constructor so the correct sub-class is created
+ *
+ * @param col
+ */
+ @Override
+ public XViewerLastModifiedDateColumn copy() {
+ return new XViewerLastModifiedDateColumn(getId(), getName(), getWidth(), getAlign(), isShow(), getSortDataType(),
+ isMultiColumnEditable(), getDescription());
+ }
+
+ @Override
+ public String getColumnText(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
+ try {
+ if (element instanceof Artifact) {
+ return XDate.getDateStr(((Artifact) element).getLastModified(), XDate.MMDDYYHHMM);
+ } else if (element instanceof Change) {
+ Date date = ((Change) element).getChangeArtifact().getLastModified();
+ return XDate.getDateStr(date, XDate.MMDDYYHHMM);
+ }
+ } catch (OseeCoreException ex) {
+ return XViewerCells.getCellExceptionString(ex);
+ }
+ return "";
+ }
+
+}

Back to the top