Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui/src/org')
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableHierarchicalResourceList.java102
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableResourceList.java62
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AddToVersionControlDialog.java218
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AlternateUserValidationDialog.java235
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AnnotateView.java396
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AvoidableMessageDialog.java63
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java457
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java453
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java427
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorConfiguration.java142
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorPreferencesPage.java619
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFieldEditorPreferencePage.java92
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFilePropertiesPage.java144
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFolderPropertiesPage.java179
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java452
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPerspective.java64
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java477
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java473
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectSetSerializer.java219
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPropertiesPage.java44
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java756
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommitCommentArea.java235
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ComparePreferencePage.java75
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java263
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/EditorsDialog.java67
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/EditorsView.java207
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java283
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/FileModificationValidator.java168
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryDropAdapter.java66
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryFilter.java74
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryFilterAction.java55
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryFilterDialog.java265
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryTableProvider.java428
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java880
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java170
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java150
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IRepositoryListener.java20
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IgnoreResourcesDialog.java248
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/KeyboardInteractiveDialog.java177
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ListSelectionArea.java191
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/OverlayIconCache.java50
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/PasswordManagementPreferencePage.java206
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Policy.java129
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ReleaseCommentDialog.java151
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteAnnotationEditorInput.java42
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteAnnotationStorage.java79
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteFileEditorInput.java224
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteRevisionQuickDiffProvider.java351
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResizableWizardDialog.java27
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java186
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourcePropertiesPage.java111
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/SimpleContentProvider.java47
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagetLocationSelectionDialog.java438
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TextViewerAction.java41
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TimeoutProgressMonitorDialog.java88
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/UserValidationDialog.java286
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/VersionCollator.java64
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WatchEditPreferencePage.java110
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkInProgressPreferencePage.java147
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkbenchUserAuthenticator.java244
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkingSetSelectionArea.java304
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/XMLWriter.java116
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java92
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java31
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java483
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAction.java51
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAsAction.java50
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutWizardAction.java54
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java67
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteResourcesAction.java65
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteWithTagAction.java65
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java49
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java149
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java64
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ConfigureTagsFromRepoViewOnFolder.java102
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditAction.java70
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditorsAction.java104
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java58
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java136
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java34
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MoveRemoteTagAction.java60
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/NewRepositoryAction.java56
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenLogEntryAction.java109
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenRemoteFileAction.java109
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java108
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRevisionAction.java92
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java104
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java198
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SetKeywordSubstitutionAction.java39
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java130
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowCVSPerspectiveAction.java37
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowEditorsAction.java69
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowHistoryAction.java86
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowResourceInHistoryAction.java76
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java110
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java161
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagInRepositoryAction.java50
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java70
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UneditAction.java78
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java147
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java50
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateSilentAction.java27
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java616
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsoleFactory.java58
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsolePageParticipant.java55
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSOutputConsole.java424
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/ConsoleDocument.java93
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/ConsolePreferencesPage.java133
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/ConsoleRemoveAction.java32
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties1327
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/AllRootsElement.java42
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/BranchCategory.java59
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java96
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSModelElement.java133
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFilePropertySource.java159
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFolderPropertySource.java101
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRepositoryLocationPropertySource.java124
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRepositoryRootElement.java74
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSResourceElement.java39
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSTagElement.java157
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/DateTagCategory.java60
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/GroupedByVersionCategory.java118
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/ModulesCategory.java93
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteContentProvider.java130
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteFileElement.java48
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteFolderElement.java95
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteModule.java147
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteProjectsElement.java87
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteResourceElement.java32
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteVersionModule.java103
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RepositoryLocationSchedulingRule.java33
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/TagCategory.java72
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/VersionCategory.java154
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/AddOperation.java205
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java320
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSOperation.java366
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutIntoOperation.java442
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutMultipleProjectsOperation.java53
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutOperation.java86
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java481
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutSingleProjectOperation.java63
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutToRemoteFolderOperation.java213
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitOperation.java179
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DisconnectOperation.java81
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FetchMembersOperation.java147
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/HasProjectMetaFileOperation.java96
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ITagOperation.java27
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/OverrideAndUpdateOperation.java52
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReconcileProjectOperation.java175
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteCompareOperation.java381
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteLogOperation.java282
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteOperation.java42
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReplaceOperation.java135
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryLocationOperation.java72
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryProviderOperation.java211
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShareProjectOperation.java208
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java232
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SingleCommandOperation.java81
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/TagInRepositoryOperation.java125
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/TagOperation.java167
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOnlyMergableOperation.java77
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOperation.java132
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/AddToBranchAction.java93
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepoViewAction.java48
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepositoryPropertiesPage.java595
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CommentHistoryContentHandler.java85
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CopyRepositoryNameAction.java61
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/NewCVSRepositoryAction.java39
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/NewDateTagAction.java57
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectSelectionPage.java174
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectWizard.java182
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshTagsAction.java37
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteProjectsView.java79
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteTagsView.java66
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteViewPart.java429
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoveDateTagAction.java86
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoveRootAction.java152
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesView.java327
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesViewContentHandler.java248
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryEncodingPropertyPage.java419
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java813
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java633
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositorySorter.java116
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSActionDelegateWrapper.java43
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetActionGroup.java40
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCapability.java54
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCollector.java441
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipant.java177
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipantAction.java63
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipantLabelDecorator.java128
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberOperation.java334
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeWizard.java70
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CommitSetDialog.java228
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipant.java218
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertAction.java33
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertOperation.java108
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ConfirmMergedAction.java39
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ConfirmMergedOperation.java92
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/LogEntryCacheUpdateHandler.java666
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java280
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java56
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateOperation.java170
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OpenChangeSetAction.java215
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndCommitAction.java40
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateAction.java41
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateSubscriberOperation.java73
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateAction.java49
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateOperation.java78
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateOperation.java434
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SyncInfoSetDetailsDialog.java194
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/UpdateDialog.java72
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitAction.java44
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitOperation.java354
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java259
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateAction.java50
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateOperation.java101
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ToolTipMessageDialog.java40
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/BranchPromptDialog.java231
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/CVSFileElement.java75
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/CVSFolderElement.java82
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/FilteredTagList.java108
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/LocalProjectTagSource.java136
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/MultiFolderTagSource.java53
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/SingleFileTagSource.java98
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/SingleFolderTagSource.java142
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagAsVersionDialog.java182
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagConfigurationDialog.java763
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagContentAssistProcessor.java160
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagElement.java89
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRefreshButtonArea.java175
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRootElement.java75
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionArea.java612
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionDialog.java247
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionWizardPage.java181
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSource.java234
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceResourceAdapter.java88
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceWorkbenchAdapter.java157
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSWizardPage.java382
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsLocationSelectionPage.java316
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsMainPage.java233
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsProjectSelectionPage.java272
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsWizard.java265
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutWizard.java287
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardAutoconnectPage.java141
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java616
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileOperation.java142
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileWizard.java775
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ICVSWizard.java37
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizard.java428
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardCommitCommentPage.java75
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardDirtyFilesPage.java95
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardSelectionPage.java157
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardSharedFilesPage.java95
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardSummaryPage.java291
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java95
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizardPage.java254
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModuleSelectionPage.java325
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/NewLocationWizard.java137
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RepositorySelectionPage.java141
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryFileSelectionPage.java558
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryWizard.java57
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java548
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardPageActionGroup.java82
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardSyncPage.java279
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizard.java90
265 files changed, 0 insertions, 48336 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableHierarchicalResourceList.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableHierarchicalResourceList.java
deleted file mode 100644
index 537a367c7..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableHierarchicalResourceList.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-
-/**
- * This class acts as an adaptable list that will return the resources in the
- * hierarchy indicated by their paths
- */
-public class AdaptableHierarchicalResourceList extends AdaptableResourceList {
- private IContainer root;
-
- /**
- * Constructor for AdaptableHierarchicalResourceList.
- * @param resources
- */
- public AdaptableHierarchicalResourceList(IContainer root, IResource[] resources) {
- super(resources);
- this.root = root;
- }
-
- /**
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
- */
- public Object[] getChildren(Object o) {
- return getChildenFor(root);
- }
-
- private IResource[] getChildenFor(IContainer parent) {
- Set children = new HashSet();
- IPath parentPath = parent.getFullPath();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- IPath resourcePath = resource.getFullPath();
- if (parent instanceof IWorkspaceRoot) {
- children.add(((IWorkspaceRoot)parent).getProject(resourcePath.segment(0)));
- } else if (parentPath.isPrefixOf(resourcePath)) {
- IPath parentRelativePath = resourcePath.removeFirstSegments(parentPath.segmentCount());
- if (parentRelativePath.segmentCount() == 1) {
- children.add(resource);
- } else if (parentRelativePath.segmentCount() > 1) {
- children.add(parent.getFolder(new Path(null, parentRelativePath.segment(0))));
- }
- }
- }
- return (IResource[]) children.toArray(new IResource[children.size()]);
- }
-
- /**
- * Returns a content provider for <code>IResource</code>s that returns
- * only children of the given resource type.
- */
- public ITreeContentProvider getTreeContentProvider() {
- return new WorkbenchContentProvider() {
- public Object[] getChildren(Object o) {
- if (o instanceof IContainer) {
- return getChildenFor((IContainer) o);
- } else {
- return super.getChildren(o);
- }
- }
- };
- }
-
- public void setResources(IResource[] resources) {
- this.resources = resources;
- }
- /**
- * Returns the root.
- * @return IContainer
- */
- public IContainer getRoot() {
- return root;
- }
-
- /**
- * Sets the root.
- * @param root The root to set
- */
- public void setRoot(IContainer root) {
- this.root = root;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableResourceList.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableResourceList.java
deleted file mode 100644
index d8179f457..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AdaptableResourceList.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * This class acts as a resource list that can be used in table widgets.
- */
-public class AdaptableResourceList implements IAdaptable, IWorkbenchAdapter {
-
- IResource[] resources;
-
- public AdaptableResourceList(IResource[] resources) {
- this.resources = resources;
- }
-
- /**
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class)
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
- }
-
- /**
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(Object)
- */
- public Object[] getChildren(Object o) {
- return resources;
- }
- /**
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return null;
- }
- /**
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
- */
- public String getLabel(Object o) {
- return o == null ? "" : o.toString();//$NON-NLS-1$
- }
- /**
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
- */
- public Object getParent(Object o) {
- return null;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AddToVersionControlDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AddToVersionControlDialog.java
deleted file mode 100644
index a6d7d48d3..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AddToVersionControlDialog.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ui.dialogs.DetailsDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-/**
- * This dialog allows the user to add a set of resources to version control.
- * They can either all be added or the user can choose which to add from a
- * details list.
- */
-public class AddToVersionControlDialog extends DetailsDialog {
-
- private static final int WIDTH_HINT = 350;
- private final static int SELECTION_HEIGHT_HINT = 100;
-
- private IResource[] unaddedResources;
- private Object[] resourcesToAdd;
-
- private CheckboxTableViewer listViewer;
- /**
- * Constructor for AddToVersionControlDialog.
- * @param parentShell
- */
- public AddToVersionControlDialog(Shell parentShell, IResource[] unaddedResources) {
- super(parentShell, Policy.bind("AddToVersionControlDialog.title")); //$NON-NLS-1$
- this.unaddedResources = unaddedResources;
- }
-
- /**
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected void createMainDialogArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- // set F1 help
- WorkbenchHelp.setHelp(composite, IHelpContextIds.ADD_TO_VERSION_CONTROL_DIALOG);
-
- // add a description label
- if (unaddedResources.length==1) {
- createWrappingLabel(composite, Policy.bind("AddToVersionControlDialog.thereIsAnUnaddedResource", new Integer(unaddedResources.length).toString())); //$NON-NLS-1$
- } else {
- createWrappingLabel(composite, Policy.bind("AddToVersionControlDialog.thereAreUnaddedResources", new Integer(unaddedResources.length).toString())); //$NON-NLS-1$
- }
- }
-
- /**
- * @see org.eclipse.team.internal.ui.DetailsDialog#createDropDownDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected Composite createDropDownDialogArea(Composite parent) {
- // create a composite with standard margins and spacing
- 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));
-
- addUnaddedResourcesArea(composite);
-
- // set F1 help
- WorkbenchHelp.setHelp(composite, IHelpContextIds.ADD_TO_VERSION_CONTROL_DIALOG);
-
- return composite;
- }
-
- private void addUnaddedResourcesArea(Composite composite) {
-
- // add a description label
- createWrappingLabel(composite, Policy.bind("ReleaseCommentDialog.unaddedResources")); //$NON-NLS-1$
-
- // add the selectable checkbox list
- listViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = SELECTION_HEIGHT_HINT;
- data.widthHint = WIDTH_HINT;
- listViewer.getTable().setLayoutData(data);
-
- // set the contents of the list
- listViewer.setLabelProvider(new WorkbenchLabelProvider() {
- protected String decorateText(String input, Object element) {
- if (element instanceof IResource)
- return ((IResource)element).getFullPath().toString();
- else
- return input;
- }
- });
- listViewer.setContentProvider(new WorkbenchContentProvider());
- listViewer.setInput(new AdaptableResourceList(unaddedResources));
- if (resourcesToAdd == null) {
- listViewer.setAllChecked(true);
- } else {
- listViewer.setCheckedElements(resourcesToAdd);
- }
- listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- resourcesToAdd = listViewer.getCheckedElements();
- }
- });
-
- addSelectionButtons(composite);
- }
-
- /**
- * Add the selection and deselection buttons to the dialog.
- * @param composite org.eclipse.swt.widgets.Composite
- */
- private void addSelectionButtons(Composite composite) {
-
- Composite buttonComposite = new Composite(composite, SWT.RIGHT);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- buttonComposite.setLayout(layout);
- GridData data =
- new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL);
- data.grabExcessHorizontalSpace = true;
- composite.setData(data);
-
- Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, Policy.bind("ReleaseCommentDialog.selectAll"), false); //$NON-NLS-1$
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- listViewer.setAllChecked(true);
- resourcesToAdd = null;
- }
- };
- selectButton.addSelectionListener(listener);
-
- Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, Policy.bind("ReleaseCommentDialog.deselectAll"), false); //$NON-NLS-1$
- listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- listViewer.setAllChecked(false);
- resourcesToAdd = new Object[0];
-
- }
- };
- deselectButton.addSelectionListener(listener);
- }
-
- /**
- * @see org.eclipse.team.internal.ui.DetailsDialog#updateEnablements()
- */
- protected void updateEnablements() {
- }
-
- /**
- * Returns the resourcesToAdd.
- * @return IResource[]
- */
- public IResource[] getResourcesToAdd() {
- if (resourcesToAdd == null) {
- return unaddedResources;
- } else {
- List result = Arrays.asList(resourcesToAdd);
- return (IResource[]) result.toArray(new IResource[result.size()]);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
- */
- protected void createButtonsForButtonBar(Composite parent) {
- createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true);
- createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, true);
- super.createButtonsForButtonBar(parent);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.DetailsDialog#includeOkButton()
- */
- protected boolean includeOkButton() {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
- */
- protected void buttonPressed(int id) {
- // hijack yes and no buttons to set the correct return
- // codes.
- if(id == IDialogConstants.YES_ID || id == IDialogConstants.NO_ID) {
- setReturnCode(id);
- close();
- } else {
- super.buttonPressed(id);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AlternateUserValidationDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AlternateUserValidationDialog.java
deleted file mode 100644
index 3aa447ee1..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AlternateUserValidationDialog.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
-import org.eclipse.swt.graphics.FontData;
-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;
-import org.eclipse.swt.widgets.Text;
-
-public class AlternateUserValidationDialog extends Dialog {
- String user;
- String password = ""; //$NON-NLS-1$
- List numXs = new ArrayList();
- Label icon1;
- Label icon2;
- Label icon3;
- Label icon4;
- Text passwordText;
- boolean inUpdate = false;
-
- Image[] images;
-
- public AlternateUserValidationDialog(Shell parentShell, String user) {
- super(parentShell);
- this.user = user;
- initializeImages();
- }
-
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(Policy.bind("AlternateUserValidationDialog.Enter_Password_2")); //$NON-NLS-1$
- }
-
- protected Control createContents(Composite parent) {
- Composite main = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- main.setLayout(layout);
- main.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Composite iconComposite = new Composite(main, SWT.NONE);
- layout = new GridLayout();
- layout.numColumns = 2;
- iconComposite.setLayout(layout);
- iconComposite.setLayoutData(new GridData());
-
- icon1 = createLabel(iconComposite);
- icon2 = createLabel(iconComposite);
- icon3 = createLabel(iconComposite);
- icon4 = createLabel(iconComposite);
-
- Composite middleComposite = new Composite(main, SWT.NONE);
- middleComposite.setLayout(new GridLayout());
- middleComposite.setLayoutData(new GridData());
-
- Label l = new Label(middleComposite, SWT.NULL);
- l.setText(Policy.bind("AlternateUserValidationDialog.message", user)); //$NON-NLS-1$
- l.setLayoutData(new GridData());
- l = new Label(middleComposite, SWT.NULL);
- l.setText(""); //$NON-NLS-1$
- l.setLayoutData(new GridData());
- passwordText = new Text(middleComposite, SWT.SINGLE | SWT.BORDER);
- GridData data = new GridData();
- data.widthHint = 250;
- passwordText.setLayoutData(data);
-
- passwordText.addVerifyListener(new VerifyListener() {
- public void verifyText(VerifyEvent e) {
- if (inUpdate) return;
- e.doit = false;
- inUpdate = true;
- switch (e.character) {
- case 8: {
- // backspace pressed
- if (password.length() > 0) {
- password = password.substring(0, password.length() - 1);
- }
- // get rid of bogus Xs
- int numX = ((Integer)numXs.get(numXs.size() - 1)).intValue();
- numXs.remove(numXs.size() - 1);
- String oldText = passwordText.getText();
- String newText = oldText.substring(0, oldText.length() - numX);
- passwordText.setText(newText);
- passwordText.setSelection(newText.length());
- break;
- }
- default: {
- String oldText = passwordText.getText();
- String x = getXs();
- numXs.add(numXs.size(), new Integer(x.length()));
- String newText = oldText + x;
- passwordText.setText(newText);
- passwordText.setSelection(newText.length());
- password += e.character;
- }
- }
- inUpdate = false;
- updateImages();
- }
- });
- /*passwordText.addTraverseListener(new TraverseListener() {
- public void keyTraversed(TraverseEvent e) {
- switch (e.detail) {
- case SWT.TRAVERSE_ARROW_NEXT:
- case SWT.TRAVERSE_ARROW_PREVIOUS:
- e.detail = SWT.TRAVERSE_NONE;
- e.doit = false;
- break;
- }
- }
- });*/
- Composite buttonComposite = new Composite(main, SWT.NONE);
- buttonComposite.setLayout(new GridLayout());
- buttonComposite.setLayoutData(new GridData());
- Button b = new Button(buttonComposite, SWT.PUSH);
- b.setText(Policy.bind("AlternateUserValidationDialog.OK_6")); //$NON-NLS-1$
- data = new GridData();
- data.widthHint = 70;
- b.setLayoutData(data);
- b.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- okPressed();
- }
- });
- buttonComposite.getShell().setDefaultButton(b);
- b = new Button(buttonComposite, SWT.PUSH);
- b.setText(Policy.bind("AlternateUserValidationDialog.Cancel_7")); //$NON-NLS-1$
- data = new GridData();
- data.widthHint = 70;
- b.setLayoutData(data);
- b.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- cancelPressed();
- }
- });
- Dialog.applyDialogFont(parent);
- return main;
- }
-
- public boolean close() {
- boolean result = super.close();
- if (images != null) {
- for (int i = 0; i < images.length; i++) {
- images[i].dispose();
- images[i] = null;
- }
- images = null;
- }
- return result;
- }
- public String getPassword() {
- return password;
- }
-
- Label createLabel(Composite parent) {
- Label result = new Label(parent, SWT.NULL);
- GridData data = new GridData();
- data.widthHint = 22;
- data.heightHint = 22;
- result.setLayoutData(data);
- result.setImage(getImage());
- return result;
- }
- Image getImage() {
- double random = Math.random();
- random *= 7; // Random number between 0.0 and 7.0
- long num = Math.round(random);
- return images[(int)num];
- }
- void initializeImages() {
- images = new Image[8];
- for (int i = 0; i < images.length; i++) {
- images[i] = CVSUIPlugin.getPlugin().getImageDescriptor("glyphs/glyph" + (i+1) + ".gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
- }
- FontData fd = new FontData();
- fd.setStyle(SWT.BOLD);
- fd.setHeight(10);
- // On Windows, set the font to Sans Serif for an authentic look
- if (System.getProperty("os.name").indexOf("Windows") != -1) { //$NON-NLS-1$ //$NON-NLS-2$
- fd.setName("Microsoft Sans Serif"); //$NON-NLS-1$
- }
- }
- void updateImages() {
- icon1.setImage(getImage());
- icon2.setImage(getImage());
- icon3.setImage(getImage());
- icon4.setImage(getImage());
- }
- public void setUsername(String user) {
- this.user = user;
- }
- String getXs() {
- double random = Math.random();
- random *= 2;
- random += 2;
- long num = Math.round(random);
- // Random number between 2 and 4
- switch ((int)num) {
- case 2:
- return "XX"; //$NON-NLS-1$
- case 3:
- return "XXX"; //$NON-NLS-1$
- case 4:
- return "XXXX"; //$NON-NLS-1$
- }
- return "X"; //$NON-NLS-1$
- }
- protected void cancelPressed() {
- password = null;
- super.cancelPressed();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AnnotateView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AnnotateView.java
deleted file mode 100644
index bbc7c2280..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AnnotateView.java
+++ /dev/null
@@ -1,396 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.IPostSelectionProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.team.internal.ccvs.core.CVSAnnotateBlock;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorRegistry;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IReusableEditor;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
-import org.eclipse.ui.internal.registry.EditorDescriptor;
-import org.eclipse.ui.part.ViewPart;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-/**
- * A view showing the results of the CVS Annotate Command. A linked
- * combination of a View of annotations, a source editor and the
- * Resource History View
- */
-public class AnnotateView extends ViewPart implements ISelectionChangedListener {
-
- ITextEditor editor;
- HistoryView historyView;
- IWorkbenchPage page;
-
- ListViewer viewer;
- IDocument document;
- Collection cvsAnnotateBlocks;
- ICVSResource cvsResource;
- InputStream contents;
-
- IStructuredSelection previousListSelection;
- ITextSelection previousTextSelection;
- boolean lastSelectionWasText = false;
-
-
- public static final String VIEW_ID = "org.eclipse.team.ccvs.ui.AnnotateView"; //$NON-NLS-1$
- private Composite top;
-
- private IPartListener partListener = new IPartListener() {
- public void partActivated(IWorkbenchPart part) {
- }
- public void partBroughtToTop(IWorkbenchPart part) {
- }
- public void partClosed(IWorkbenchPart part) {
- if (editor != null && part == editor) {
- disconnect();
- }
- }
- public void partDeactivated(IWorkbenchPart part) {
- }
- public void partOpened(IWorkbenchPart part) {
- }
- };
-
- public AnnotateView() {
- super();
- }
-
- public void createPartControl(Composite parent) {
-
- this.top = parent;
-
- // Create default contents
- Label label = new Label(top, SWT.WRAP);
- label.setText(Policy.bind("CVSAnnotateView.viewInstructions")); //$NON-NLS-1$
- label.setLayoutData(new GridData(GridData.FILL_BOTH));
- top.layout();
- }
-
- /**
- * Show the annotation view.
- * @param cvsResource
- * @param cvsAnnotateBlocks
- * @param contents
- * @throws PartInitException, CVSException
- */
- public void showAnnotations(ICVSResource cvsResource, Collection cvsAnnotateBlocks, InputStream contents) throws PartInitException, CVSException {
- showAnnotations(cvsResource, cvsAnnotateBlocks, contents, true);
- }
-
- /**
- * Show the annotation view.
- * @param cvsResource
- * @param cvsAnnotateBlocks
- * @param contents
- * @param useHistoryView
- * @throws PartInitException, CVSException
- */
- public void showAnnotations(ICVSResource cvsResource, Collection cvsAnnotateBlocks, InputStream contents, boolean useHistoryView) throws PartInitException, CVSException {
-
- // Disconnect from old annotation editor
- disconnect();
-
- // Remove old viewer
- Control[] oldChildren = top.getChildren();
- if (oldChildren != null) {
- for (int i = 0; i < oldChildren.length; i++) {
- oldChildren[i].dispose();
- }
- }
-
- viewer = new ListViewer(top, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
- viewer.setContentProvider(new ArrayContentProvider());
- viewer.setLabelProvider(new LabelProvider());
- viewer.addSelectionChangedListener(this);
- viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
-
- WorkbenchHelp.setHelp(viewer.getControl(), IHelpContextIds.ANNOTATE_VIEW);
-
- top.layout();
-
- this.cvsResource = cvsResource;
- this.contents = contents;
- this.cvsAnnotateBlocks = cvsAnnotateBlocks;
- page = CVSUIPlugin.getActivePage();
- viewer.setInput(cvsAnnotateBlocks);
- editor = (ITextEditor) openEditor();
- IDocumentProvider provider = editor.getDocumentProvider();
- document = provider.getDocument(editor.getEditorInput());
-
- setPartName(Policy.bind("CVSAnnotateView.showFileAnnotation", new Object[] {cvsResource.getName()})); //$NON-NLS-1$
- try {
- IResource localResource = cvsResource.getIResource();
- if (localResource != null) {
- setTitleToolTip(localResource.getFullPath().toString());
- } else {
- setTitleToolTip(cvsResource.getName());
- }
- } catch (CVSException e) {
- setTitleToolTip(cvsResource.getName());
- }
-
- if (!useHistoryView) {
- return;
- }
-
- // Get hook to the HistoryView
-
- historyView = (HistoryView) page.showView(HistoryView.VIEW_ID);
- historyView.showHistory((ICVSRemoteFile) CVSWorkspaceRoot.getRemoteResourceFor(cvsResource), false /* don't refetch */);
- }
-
- protected void disconnect() {
- if(editor != null) {
- if (editor.getSelectionProvider() instanceof IPostSelectionProvider) {
- ((IPostSelectionProvider) editor.getSelectionProvider()).removePostSelectionChangedListener(this);
- }
- editor.getSite().getPage().removePartListener(partListener);
- editor = null;
- document = null;
- }
- }
-
- /**
- * Makes the view visible in the active perspective. If there
- * isn't a view registered <code>null</code> is returned.
- * Otherwise the opened view part is returned.
- */
- public static AnnotateView openInActivePerspective() throws PartInitException {
- return (AnnotateView) CVSUIPlugin.getActivePage().showView(VIEW_ID);
- }
-
- /**
- * Selection changed in either the Annotate List View or the
- * Source editor.
- */
- public void selectionChanged(SelectionChangedEvent event) {
-
- if (event.getSelection() instanceof IStructuredSelection) {
- listSelectionChanged((IStructuredSelection) event.getSelection());
- } else if (event.getSelection() instanceof ITextSelection) {
- textSelectionChanged((ITextSelection) event.getSelection());
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
- public void dispose() {
- disconnect();
- }
-
- /**
- * A selection event in the Annotate Source Editor
- * @param event
- */
- private void textSelectionChanged(ITextSelection selection) {
-
- // Track where the last selection event came from to avoid
- // a selection event loop.
- lastSelectionWasText = true;
-
- // Locate the annotate block containing the selected line number.
- CVSAnnotateBlock match = null;
- for (Iterator iterator = cvsAnnotateBlocks.iterator(); iterator.hasNext();) {
- CVSAnnotateBlock block = (CVSAnnotateBlock) iterator.next();
- if (block.contains(selection.getStartLine())) {
- match = block;
- break;
- }
- }
-
- // Select the annotate block in the List View.
- if (match == null) {
- return;
- }
-
- StructuredSelection listSelection = new StructuredSelection(match);
- viewer.setSelection(listSelection, true);
- }
-
- /**
- * A selection event in the Annotate List View
- * @param selection
- */
- private void listSelectionChanged(IStructuredSelection selection) {
-
- // If the editor was closed, reopen it.
- if (editor == null || editor.getSelectionProvider() == null) {
- try {
- contents.reset();
- showAnnotations(cvsResource, cvsAnnotateBlocks, contents, false);
- } catch (CVSException e) {
- return;
- } catch (PartInitException e) {
- return;
- } catch (IOException e) {
- return;
- }
- }
-
- ISelectionProvider selectionProvider = editor.getSelectionProvider();
- if (selectionProvider == null) {
- // Failed to open the editor but what else can we do.
- return;
- }
-
- ITextSelection textSelection = (ITextSelection) selectionProvider.getSelection();
- CVSAnnotateBlock listSelection = (CVSAnnotateBlock) selection.getFirstElement();
-
- /**
- * Ignore event if the current text selection is already equal to the corresponding
- * list selection. Nothing to do. This prevents infinite event looping.
- *
- * Extra check to handle single line deltas
- */
-
- if (textSelection.getStartLine() == listSelection.getStartLine() && textSelection.getEndLine() == listSelection.getEndLine() && selection.equals(previousListSelection)) {
- return;
- }
-
- // If the last selection was a text selection then bale to prevent a selection loop.
- if (!lastSelectionWasText) {
- try {
- int start = document.getLineOffset(listSelection.getStartLine());
- int end = document.getLineOffset(listSelection.getEndLine() + 1);
- editor.selectAndReveal(start, end - start);
- if (editor != null && !page.isPartVisible(editor)) {
- page.activate(editor);
- }
-
- } catch (BadLocationException e) {
- // Ignore - nothing we can do.
- }
- }
-
-
- // Select the revision in the history view.
- if(historyView != null) {
- historyView.selectRevision(listSelection.getRevision());
- }
- lastSelectionWasText = false;
- }
-
- /**
- * Try and open the correct registered editor type for the file.
- * @throws CVSException, PartInitException
- */
- private IEditorPart openEditor() throws CVSException, PartInitException {
- ICVSRemoteFile file = (ICVSRemoteFile) CVSWorkspaceRoot.getRemoteResourceFor(cvsResource);
-
- // Determine if the registered editor is an ITextEditor.
- // There is currently no support from UI to determine this information. This
- // problem has been logged in: https://bugs.eclipse.org/bugs/show_bug.cgi?id=47362
- // For now, use internal classes.
- String id = getEditorId(file);
- ITextEditor editor = getEditor(id, file);
-
- // Hook Editor post selection listener.
- if (editor.getSelectionProvider() instanceof IPostSelectionProvider) {
- ((IPostSelectionProvider) editor.getSelectionProvider()).addPostSelectionChangedListener(this);
- }
- editor.getSite().getPage().addPartListener(partListener);
- return editor;
- }
-
- private ITextEditor getEditor(String id, ICVSRemoteFile file) throws PartInitException {
- // Either reuse an existing editor or open a new editor of the correct type.
- if (editor != null && editor instanceof IReusableEditor && page.isPartVisible(editor) && editor.getSite().getId().equals(id)) {
- // We can reuse the editor
- ((IReusableEditor) editor).setInput(new RemoteAnnotationEditorInput(file, contents));
- return editor;
- } else {
- // We can not reuse the editor so close the existing one and open a new one.
- if (editor != null) {
- page.closeEditor(editor, false);
- editor = null;
- }
- IEditorPart part = page.openEditor(new RemoteAnnotationEditorInput(file, contents), id);
- if (part instanceof ITextEditor) {
- return (ITextEditor)part;
- } else {
- // We asked for a text editor but didn't get one
- // so open a vanilla text editor
- page.closeEditor(part, false);
- part = page.openEditor(new RemoteAnnotationEditorInput(file, contents), IDEWorkbenchPlugin.DEFAULT_TEXT_EDITOR_ID);
- if (part instanceof ITextEditor) {
- return (ITextEditor)part;
- } else {
- // There is something really wrong so just bail
- throw new PartInitException(Policy.bind("AnnotateView.0")); //$NON-NLS-1$
- }
- }
- }
- }
-
- private String getEditorId(ICVSRemoteFile file) {
- String id;
- IEditorRegistry registry = CVSUIPlugin.getPlugin().getWorkbench().getEditorRegistry();
- IEditorDescriptor descriptor = registry.getDefaultEditor(file.getName());
- if (descriptor == null || !(descriptor instanceof EditorDescriptor) || !(((EditorDescriptor)descriptor).isInternal())) {
- id = IDEWorkbenchPlugin.DEFAULT_TEXT_EDITOR_ID; //$NON-NLS-1$
- } else {
- try {
- Object obj = IDEWorkbenchPlugin.createExtension(((EditorDescriptor) descriptor).getConfigurationElement(), "class"); //$NON-NLS-1$
- if (obj instanceof ITextEditor) {
- id = descriptor.getId();
- } else {
- id = IDEWorkbenchPlugin.DEFAULT_TEXT_EDITOR_ID;
- }
- } catch (CoreException e) {
- id = IDEWorkbenchPlugin.DEFAULT_TEXT_EDITOR_ID;
- }
- }
- return id;
- }
-
- // This method implemented to be an ISelectionChangeListener but we
- // don't really care when the List or Editor get focus.
- public void setFocus() {
- return;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AvoidableMessageDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AvoidableMessageDialog.java
deleted file mode 100644
index 3259f7911..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AvoidableMessageDialog.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-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.Control;
-import org.eclipse.swt.widgets.Shell;
-
-public class AvoidableMessageDialog extends MessageDialog {
- Button dontShowAgain;
- boolean dontShow;
- boolean showOption;
-
- public AvoidableMessageDialog(Shell shell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex) {
- this(shell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex, true);
- }
-
- public AvoidableMessageDialog(Shell shell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex, boolean showOption) {
- super(shell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex);
- this.showOption = showOption;
- }
-
- protected Control createCustomArea(Composite composite) {
- if ( ! showOption) return null;
- dontShow = false;
- dontShowAgain = new Button(composite, SWT.CHECK);
- GridData data = new GridData();
- data.horizontalIndent = 50;
- dontShowAgain.setLayoutData(data);
- dontShowAgain.setText(Policy.bind("AvoidableMessageDialog.dontShowAgain")); //$NON-NLS-1$
- dontShowAgain.setSelection(dontShow);
- dontShowAgain.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- dontShow = dontShowAgain.getSelection();
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- });
- return dontShowAgain;
- }
-
- public boolean isDontShowAgain() {
- return dontShow;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java
deleted file mode 100644
index f1a012da7..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java
+++ /dev/null
@@ -1,457 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.compare.structuremergeviewer.DiffNode;
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.compare.structuremergeviewer.IStructureComparator;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-
-/**
- * A compare input for comparing remote resources. Use <code>CVSLocalCompareInput</code>
- * when comparing resources in the workspace to remote resources.
- */
-public class CVSCompareEditorInput extends CompareEditorInput {
- private ITypedElement left;
- private ITypedElement right;
- private ITypedElement ancestor;
- private Image leftImage;
- private Image rightImage;
- private Image ancestorImage;
-
- // comparison constants
- private static final int NODE_EQUAL = 0;
- private static final int NODE_NOT_EQUAL = 1;
- private static final int NODE_UNKNOWN = 2;
-
- String toolTipText;
- private String title;
-
- /**
- * Creates a new CVSCompareEditorInput.
- */
- public CVSCompareEditorInput(ResourceEditionNode left, ResourceEditionNode right) {
- this(left, right, null);
- }
-
- public CVSCompareEditorInput(String title, String toolTip, ResourceEditionNode left, ResourceEditionNode right) {
- this(left, right, null);
- this.title = title;
- this.toolTipText = toolTip;
- }
-
- /**
- * Creates a new CVSCompareEditorInput.
- */
- public CVSCompareEditorInput(ResourceEditionNode left, ResourceEditionNode right, ResourceEditionNode ancestor) {
- super(new CompareConfiguration());
- // TODO: Invokers of this method should ensure that trees and contents are prefetched
- this.left = left;
- this.right = right;
- this.ancestor = ancestor;
- if (left != null) {
- this.leftImage = left.getImage();
- }
- if (right != null) {
- this.rightImage = right.getImage();
- }
- if (ancestor != null) {
- this.ancestorImage = ancestor.getImage();
- }
- }
-
- /**
- * Returns the label for the given input element.
- */
- private String getLabel(ITypedElement element) {
- if (element instanceof ResourceEditionNode) {
- ICVSRemoteResource edition = ((ResourceEditionNode)element).getRemoteResource();
- ICVSResource resource = edition;
- if (edition instanceof ICVSRemoteFile) {
- try {
- return Policy.bind("nameAndRevision", resource.getName(), ((ICVSRemoteFile)edition).getRevision()); //$NON-NLS-1$
- } catch (TeamException e) {
- // fall through
- }
- }
- try {
- if (edition.isContainer()) {
- CVSTag tag = ((ICVSRemoteFolder)edition).getTag();
- if (tag == null) {
- return Policy.bind("CVSCompareEditorInput.inHead", edition.getName()); //$NON-NLS-1$
- } else if (tag.getType() == CVSTag.BRANCH) {
- return Policy.bind("CVSCompareEditorInput.inBranch", new Object[] {edition.getName(), tag.getName()}); //$NON-NLS-1$
- } else {
- return Policy.bind("CVSCompareEditorInput.repository", new Object[] {edition.getName(), tag.getName()}); //$NON-NLS-1$
- }
- } else {
- return Policy.bind("CVSCompareEditorInput.repository", new Object[] {edition.getName(), resource.getSyncInfo().getRevision()}); //$NON-NLS-1$
- }
- } catch (TeamException e) {
- handle(e);
- // Fall through and get the default label
- }
- }
- return element.getName();
- }
-
- /**
- * Returns the label for the given input element.
- */
- private String getVersionLabel(ITypedElement element) {
- if (element instanceof ResourceEditionNode) {
- ICVSRemoteResource edition = ((ResourceEditionNode)element).getRemoteResource();
- ICVSResource resource = edition;
- try {
- if (edition.isContainer()) {
- CVSTag tag = ((ICVSRemoteFolder)resource).getTag();
- if (tag == null) {
- return Policy.bind("CVSCompareEditorInput.headLabel"); //$NON-NLS-1$
- } else if (tag.getType() == CVSTag.BRANCH) {
- return Policy.bind("CVSCompareEditorInput.branchLabel", tag.getName()); //$NON-NLS-1$
- } else {
- return tag.getName();
- }
- } else {
- return resource.getSyncInfo().getRevision();
- }
- } catch (TeamException e) {
- handle(e);
- // Fall through and get the default label
- }
- }
- return element.getName();
- }
-
- /*
- * Returns a guess of the resource name being compared, for display
- * in the title.
- */
- private String guessResourceName() {
- if (left != null) {
- return left.getName();
- }
- if (right != null) {
- return right.getName();
- }
- if (ancestor != null) {
- return ancestor.getName();
- }
- return ""; //$NON-NLS-1$
- }
-
- /*
- * Returns a guess of the resource path being compared, for display
- * in the tooltip.
- */
- private Object guessResourcePath() {
- if (left != null && left instanceof ResourceEditionNode) {
- return ((ResourceEditionNode)left).getRemoteResource().getRepositoryRelativePath();
- }
- if (right != null && right instanceof ResourceEditionNode) {
- return ((ResourceEditionNode)right).getRemoteResource().getRepositoryRelativePath();
- }
- if (ancestor != null && ancestor instanceof ResourceEditionNode) {
- return ((ResourceEditionNode)ancestor).getRemoteResource().getRepositoryRelativePath();
- }
- return guessResourceName();
- }
-
- /**
- * Handles a random exception and sanitizes it into a reasonable
- * error message.
- */
- private void handle(Exception e) {
- // create a status
- Throwable t = e;
- // unwrap the invocation target exception
- if (t instanceof InvocationTargetException) {
- t = ((InvocationTargetException)t).getTargetException();
- }
- IStatus error;
- if (t instanceof CoreException) {
- error = ((CoreException)t).getStatus();
- } else if (t instanceof TeamException) {
- error = ((TeamException)t).getStatus();
- } else {
- error = new Status(IStatus.ERROR, CVSUIPlugin.ID, 1, Policy.bind("internal"), t); //$NON-NLS-1$
- }
- setMessage(error.getMessage());
- if (!(t instanceof TeamException)) {
- CVSUIPlugin.log(error.getSeverity(), error.getMessage(), t);
- }
- }
-
- /**
- * Sets up the title and pane labels for the comparison view.
- */
- private void initLabels() {
- CompareConfiguration cc = getCompareConfiguration();
- setLabels(cc, new StructuredSelection());
-
- if (title == null) {
- if (ancestor != null) {
- title = Policy.bind("CVSCompareEditorInput.titleAncestor", new Object[] {guessResourceName(), getVersionLabel(ancestor), getVersionLabel(left), getVersionLabel(right)} ); //$NON-NLS-1$
- toolTipText = Policy.bind("CVSCompareEditorInput.titleAncestor", new Object[] {guessResourcePath(), getVersionLabel(ancestor), getVersionLabel(left), getVersionLabel(right)} ); //$NON-NLS-1$
- } else {
- String leftName = null;
- if (left != null) leftName = left.getName();
- String rightName = null;
- if (right != null) rightName = right.getName();
- if (leftName != null && !leftName.equals(rightName)) {
- title = Policy.bind("CVSCompareEditorInput.titleNoAncestorDifferent", new Object[] {leftName, getVersionLabel(left), rightName, getVersionLabel(right)} ); //$NON-NLS-1$
- } else {
- title = Policy.bind("CVSCompareEditorInput.titleNoAncestor", new Object[] {guessResourceName(), getVersionLabel(left), getVersionLabel(right)} ); //$NON-NLS-1$
- title = Policy.bind("CVSCompareEditorInput.titleNoAncestor", new Object[] {guessResourcePath(), getVersionLabel(left), getVersionLabel(right)} ); //$NON-NLS-1$
- }
- }
- }
- setTitle(title);
- }
-
- private void setLabels(CompareConfiguration cc, IStructuredSelection selection) {
- ITypedElement left = this.left;
- ITypedElement right = this.right;
- ITypedElement ancestor = this.ancestor;
-
- if (left != null) {
- cc.setLeftLabel(getLabel(left));
- cc.setLeftImage(leftImage);
- }
-
- if (right != null) {
- cc.setRightLabel(getLabel(right));
- cc.setRightImage(rightImage);
- }
-
- if (ancestor != null) {
- cc.setAncestorLabel(getLabel(ancestor));
- cc.setAncestorImage(ancestorImage);
- }
- }
-
- /* (Non-javadoc)
- * Method declared on CompareEditorInput
- */
- public boolean isSaveNeeded() {
- return false;
- }
-
- /* (non-Javadoc)
- * Method declared on CompareEditorInput
- */
- protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- final boolean threeWay = ancestor != null;
- if (right == null || left == null) {
- setMessage(Policy.bind("CVSCompareEditorInput.different")); //$NON-NLS-1$
- return null;
- }
-
- initLabels();
-
- final Differencer d = new Differencer() {
- protected boolean contentsEqual(Object input1, Object input2) {
- int compare = teamEqual(input1, input2);
- if (compare == NODE_EQUAL) {
- return true;
- }
- if (compare == NODE_NOT_EQUAL) {
- return false;
- }
- //revert to slow content comparison
- return super.contentsEqual(input1, input2);
- }
- protected void updateProgress(IProgressMonitor progressMonitor, Object node) {
- if (node instanceof ITypedElement) {
- ITypedElement element = (ITypedElement)node;
- progressMonitor.subTask(Policy.bind("CompareEditorInput.fileProgress", new String[] {element.getName()})); //$NON-NLS-1$
- progressMonitor.worked(1);
- }
- }
- protected Object[] getChildren(Object input) {
- if (input instanceof IStructureComparator) {
- Object[] children= ((IStructureComparator)input).getChildren();
- if (children != null)
- return children;
- }
- return null;
- }
- protected Object visit(Object data, int result, Object ancestor, Object left, Object right) {
- return new DiffNode((IDiffContainer) data, result, (ITypedElement)ancestor, (ITypedElement)left, (ITypedElement)right);
- }
- };
-
- try {
- // do the diff
- Object result = null;
- monitor.beginTask(Policy.bind("CVSCompareEditorInput.comparing"), 30); //$NON-NLS-1$
- IProgressMonitor sub = new SubProgressMonitor(monitor, 30);
- sub.beginTask(Policy.bind("CVSCompareEditorInput.comparing"), 100); //$NON-NLS-1$
- try {
- result = d.findDifferences(threeWay, sub, null, ancestor, left, right);
- } finally {
- sub.done();
- }
- return result;
- } catch (OperationCanceledException e) {
- throw new InterruptedException(e.getMessage());
- } catch (RuntimeException e) {
- handle(e);
- return null;
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Compares two nodes to determine if they are equal. Returns NODE_EQUAL
- * of they are the same, NODE_NOT_EQUAL if they are different, and
- * NODE_UNKNOWN if comparison was not possible.
- */
- protected int teamEqual(Object left, Object right) {
- // calculate the type for the left contribution
- ICVSRemoteResource leftEdition = null;
- if (left instanceof ResourceEditionNode) {
- leftEdition = ((ResourceEditionNode)left).getRemoteResource();
- }
-
- // calculate the type for the right contribution
- ICVSRemoteResource rightEdition = null;
- if (right instanceof ResourceEditionNode)
- rightEdition = ((ResourceEditionNode)right).getRemoteResource();
-
-
- // compare them
-
- if (leftEdition == null || rightEdition == null) {
- return NODE_UNKNOWN;
- }
- // if they're both non-files, they're the same
- if (leftEdition.isContainer() && rightEdition.isContainer()) {
- return NODE_EQUAL;
- }
- // if they have different types, they're different
- if (leftEdition.isContainer() != rightEdition.isContainer()) {
- return NODE_NOT_EQUAL;
- }
-
- String leftLocation = leftEdition.getRepository().getLocation();
- String rightLocation = rightEdition.getRepository().getLocation();
- if (!leftLocation.equals(rightLocation)) {
- return NODE_UNKNOWN;
- }
- try {
- ResourceSyncInfo leftInfo = ((ICVSResource)leftEdition).getSyncInfo();
- ResourceSyncInfo rightInfo = ((ICVSResource)rightEdition).getSyncInfo();
-
- if (leftEdition.getRepositoryRelativePath().equals(rightEdition.getRepositoryRelativePath()) &&
- leftInfo.getRevision().equals(rightInfo.getRevision())) {
- return NODE_EQUAL;
- } else {
- if(considerContentIfRevisionOrPathDiffers()) {
- return NODE_UNKNOWN;
- } else {
- return NODE_NOT_EQUAL;
- }
- }
- } catch (TeamException e) {
- handle(e);
- return NODE_UNKNOWN;
- }
- }
-
- private boolean considerContentIfRevisionOrPathDiffers() {
- return CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_CONSIDER_CONTENTS);
- }
-
- public Viewer createDiffViewer(Composite parent) {
- Viewer viewer = super.createDiffViewer(parent);
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- CompareConfiguration cc = getCompareConfiguration();
- setLabels(cc, (IStructuredSelection)event.getSelection());
- }
- });
- ((StructuredViewer)viewer).addOpenListener(new IOpenListener() {
- public void open(OpenEvent event) {
- ISelection selection = event.getSelection();
- if (! selection.isEmpty() && selection instanceof IStructuredSelection) {
- Object o = ((IStructuredSelection)selection).getFirstElement();
- if (o instanceof DiffNode) {
- updateLabelsFor((DiffNode)o);
- }
- }
- }
- });
- return viewer;
- }
-
- /*
- * Update the labels for the given DiffNode
- */
- protected void updateLabelsFor(DiffNode node) {
- CompareConfiguration cc = getCompareConfiguration();
- ITypedElement l = node.getLeft();
- if (l == null) {
- cc.setLeftLabel(Policy.bind("CVSCompareEditorInput.0")); //$NON-NLS-1$
- cc.setLeftImage(null);
- } else {
- cc.setLeftLabel(getLabel(l));
- cc.setLeftImage(l.getImage());
- }
- ITypedElement r = node.getRight();
- if (r == null) {
- cc.setRightLabel(Policy.bind("CVSCompareEditorInput.1")); //$NON-NLS-1$
- cc.setRightImage(null);
- } else {
- cc.setRightLabel(getLabel(r));
- cc.setRightImage(r.getImage());
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#getToolTipText()
- */
- public String getToolTipText() {
- if (toolTipText != null) {
- return toolTipText;
- }
- return super.getToolTipText();
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java
deleted file mode 100644
index fe20f0053..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java
+++ /dev/null
@@ -1,453 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.CompareUI;
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.compare.ResourceNode;
-import org.eclipse.compare.structuremergeviewer.DiffContainer;
-import org.eclipse.compare.structuremergeviewer.DiffNode;
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-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.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.core.ILogEntry;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Update;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
-import org.eclipse.team.internal.ccvs.ui.operations.UpdateOperation;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.ISaveableWorkbenchPart;
-import org.eclipse.ui.IPropertyListener;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-public class CVSCompareRevisionsInput extends CompareEditorInput implements ISaveableWorkbenchPart {
- IFile resource;
- ILogEntry[] editions;
- TableViewer viewer;
- Action getRevisionAction;
- Action getContentsAction;
- Shell shell;
-
- // Provide the widget for the history table
- private HistoryTableProvider historyTableProvider;
-
- /**
- * Provide a wrapper for a resource node that doesn't buffer. Changes are saved directly to the
- * underlying file.
- */
- class TypedBufferedContent extends ResourceNode {
- public TypedBufferedContent(IFile resource) {
- super(resource);
- }
- protected InputStream createStream() throws CoreException {
- return ((IFile)getResource()).getContents();
- }
- public void setContent(byte[] contents) {
- if (contents == null) contents = new byte[0];
- final InputStream is = new ByteArrayInputStream(contents);
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- IFile file = resource;
- if (is != null) {
- if (!file.exists()) {
- file.create(is, false, monitor);
- } else {
- file.setContents(is, false, true, monitor);
- }
- } else {
- file.delete(false, true, monitor);
- }
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- };
- try {
- new ProgressMonitorDialog(shell).run(false, false, runnable);
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(CVSUIPlugin.getPlugin().getWorkbench().getActiveWorkbenchWindow().getShell(), Policy.bind("TeamFile.saveChanges", resource.getName()), null, e); //$NON-NLS-1$
- } catch (InterruptedException e) {
- // Ignore
- }
- fireContentChanged();
- }
- public ITypedElement replace(ITypedElement child, ITypedElement other) {
- return null;
- }
- public void fireChange() {
- fireContentChanged();
- }
- }
-
- /**
- * This class is an edition node which knows the log entry it came from.
- */
- class ResourceRevisionNode extends ResourceEditionNode {
- ILogEntry entry;
- public ResourceRevisionNode(ILogEntry entry) {
- super(entry.getRemoteFile());
- this.entry = entry;
- }
- public ILogEntry getLogEntry() {
- return entry;
- }
- public String getName() {
- String revisionName = entry.getRevision();
- if (revisionName != null) {
- IResource resource = CVSCompareRevisionsInput.this.resource;
- try {
- ICVSRemoteFile currentEdition = (ICVSRemoteFile) CVSWorkspaceRoot.getRemoteResourceFor(resource);
- if (currentEdition != null && currentEdition.getRevision().equals(revisionName)) {
- Policy.bind("currentRevision", revisionName); //$NON-NLS-1$
- } else {
- return revisionName;
- }
- } catch (TeamException e) {
- handle(e);
- }
- }
- return super.getName();
- }
- }
-
- /**
- * A compare node that gets its label from the right element
- */
- class VersionCompareDiffNode extends DiffNode implements IAdaptable {
- public VersionCompareDiffNode(ITypedElement left, ITypedElement right) {
- super(left, right);
- }
- public String getName() {
- return getRight().getName();
- }
- public Object getAdapter(Class adapter) {
- if (adapter == ILogEntry.class) {
- return ((ResourceRevisionNode)getRight()).getLogEntry();
- }
- return null;
- }
- public void fireContentChanges() {
- fireChange();
- }
- }
- /**
- * A content provider which knows how to get the children of the diff container
- */
- class VersionCompareContentProvider implements IStructuredContentProvider {
- public void dispose() {
- }
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- public Object[] getElements(Object inputElement) {
- if (inputElement instanceof DiffContainer) {
- return ((DiffContainer)inputElement).getChildren();
- }
- return null;
- }
- }
-
- public CVSCompareRevisionsInput(IFile resource, ILogEntry[] editions) {
- super(new CompareConfiguration());
- this.resource = resource;
- this.editions = editions;
- updateCurrentEdition();
- initializeActions();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#createContents(org.eclipse.swt.widgets.Composite)
- */
- public Control createContents(Composite parent) {
- Control c = super.createContents(parent);
- c.setLayoutData(new GridData(GridData.FILL_BOTH));
- return c;
- }
-
- public Viewer createDiffViewer(Composite parent) {
- this.shell = parent.getShell();
- viewer = getHistoryTableProvider().createTable(parent);
- Table table = viewer.getTable();
- table.setData(CompareUI.COMPARE_VIEWER_TITLE, getTitle()); //$NON-NLS-1$
-
- viewer.setContentProvider(new VersionCompareContentProvider());
-
- MenuManager mm = new MenuManager();
- mm.setRemoveAllWhenShown(true);
- mm.addMenuListener(
- new IMenuListener() {
- public void menuAboutToShow(IMenuManager mm) {
- mm.add(getContentsAction);
- mm.add(getRevisionAction);
- }
- }
- );
- table.setMenu(mm.createContextMenu(table));
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- if (!(selection instanceof IStructuredSelection)) {
- getRevisionAction.setEnabled(false);
- getContentsAction.setEnabled(false);
- return;
- }
- IStructuredSelection ss = (IStructuredSelection)selection;
- getRevisionAction.setEnabled(ss.size() == 1);
- getContentsAction.setEnabled(ss.size() == 1);
- }
- });
-
- // Add F1 help.
- WorkbenchHelp.setHelp(table, IHelpContextIds.COMPARE_REVISIONS_VIEW);
- return viewer;
- }
-
- private void initLabels() {
- CompareConfiguration cc = getCompareConfiguration();
- cc.setLeftEditable(true);
- cc.setRightEditable(false);
- String resourceName = resource.getName();
- String leftLabel = Policy.bind("CVSCompareRevisionsInput.workspace", new Object[] {resourceName}); //$NON-NLS-1$
- cc.setLeftLabel(leftLabel);
- String rightLabel = Policy.bind("CVSCompareRevisionsInput.repository", new Object[] {resourceName}); //$NON-NLS-1$
- cc.setRightLabel(rightLabel);
- }
- private void initializeActions() {
- getRevisionAction = new Action(Policy.bind("HistoryView.getRevisionAction"), null) { //$NON-NLS-1$
- public void run() {
- try {
- new ProgressMonitorDialog(shell).run(false, true, new WorkspaceModifyOperation(null) {
- protected void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
- if (selection.size() != 1) return;
- VersionCompareDiffNode node = (VersionCompareDiffNode)selection.getFirstElement();
- ResourceEditionNode right = (ResourceEditionNode)node.getRight();
- ICVSRemoteResource edition = right.getRemoteResource();
- // Do the load. This just consists of setting the local contents. We don't
- // actually want to change the base.
- try {
- CVSTag revisionTag = new CVSTag(((ICVSRemoteFile)edition).getRevision(), CVSTag.VERSION);
- if(CVSAction.checkForMixingTags(shell, new IResource[] {resource}, revisionTag)) {
- new UpdateOperation(
- null,
- new IResource[] {resource},
- new Command.LocalOption[] {Update.IGNORE_LOCAL_CHANGES},
- revisionTag)
- .run(monitor);
- getHistoryTableProvider().setFile((ICVSFile)edition);
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InterruptedException e) {
- // Do nothing
- return;
- } catch (InvocationTargetException e) {
- handle(e);
- }
- // fire change
- IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
- if (selection.size() != 1) return;
- VersionCompareDiffNode node = (VersionCompareDiffNode)selection.getFirstElement();
- TypedBufferedContent left = (TypedBufferedContent)node.getLeft();
- left.fireChange();
- // recompute the labels on the viewer
- viewer.refresh();
- }
- };
- getContentsAction = new Action(Policy.bind("HistoryView.getContentsAction")) { //$NON-NLS-1$
- public void run() {
- try {
- replaceLocalWithCurrentlySelectedRevision();
- } catch (CoreException e) {
- Utils.handle(e);
- }
- }
- };
- }
- protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- initLabels();
- DiffNode diffRoot = new DiffNode(Differencer.NO_CHANGE);
- ITypedElement left = new TypedBufferedContent(resource);
- for (int i = 0; i < editions.length; i++) {
- ITypedElement right = new ResourceRevisionNode(editions[i]);
- diffRoot.add(new VersionCompareDiffNode(left, right));
- }
- return diffRoot;
- }
- private void updateCurrentEdition() {
- try {
- getHistoryTableProvider().setFile((ICVSFile) CVSWorkspaceRoot.getRemoteResourceFor(resource));
- } catch (TeamException e) {
- handle(e);
- }
- }
- private void handle(Exception e) {
- setMessage(CVSUIPlugin.openError(shell, null, null, e, CVSUIPlugin.LOG_NONTEAM_EXCEPTIONS).getMessage());
- }
- /**
- * Returns the historyTableProvider.
- * @return HistoryTableProvider
- */
- public HistoryTableProvider getHistoryTableProvider() {
- if (historyTableProvider == null) {
- historyTableProvider = new HistoryTableProvider();
- }
- return historyTableProvider;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#saveChanges(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void saveChanges(IProgressMonitor pm) throws CoreException {
- super.saveChanges(pm);
- }
-
- public void replaceLocalWithCurrentlySelectedRevision() throws CoreException {
- IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
- if (selection.size() != 1) return;
- VersionCompareDiffNode node = (VersionCompareDiffNode)selection.getFirstElement();
- ResourceRevisionNode right = (ResourceRevisionNode)node.getRight();
- TypedBufferedContent left = (TypedBufferedContent)node.getLeft();
- left.setContent(Utils.readBytes(right.getContents()));
- }
-
- public Viewer getViewer() {
- return viewer;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#getTitle()
- */
- public String getTitle() {
- return Policy.bind("CVSCompareRevisionsInput.compareResourceAndVersions", new Object[] {resource.getFullPath().toString()}); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#doSave(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void doSave(IProgressMonitor monitor) {
- try {
- saveChanges(monitor);
- } catch (CoreException e) {
- Utils.handle(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#doSaveAs()
- */
- public void doSaveAs() {
- // noop
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#isDirty()
- */
- public boolean isDirty() {
- return isSaveNeeded();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#isSaveAsAllowed()
- */
- public boolean isSaveAsAllowed() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#isSaveOnCloseNeeded()
- */
- public boolean isSaveOnCloseNeeded() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#addPropertyListener(org.eclipse.ui.IPropertyListener)
- */
- public void addPropertyListener(IPropertyListener listener) {
- // noop
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- public void createPartControl(Composite parent) {
- createContents(parent);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
- public void dispose() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#getSite()
- */
- public IWorkbenchPartSite getSite() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#getTitleToolTip()
- */
- public String getTitleToolTip() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#removePropertyListener(org.eclipse.ui.IPropertyListener)
- */
- public void removePropertyListener(IPropertyListener listener) {
- // noop
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java
deleted file mode 100644
index 0e8caf800..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java
+++ /dev/null
@@ -1,427 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IDecoration;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.util.Assert;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.themes.ITheme;
-
-/**
- * A decoration describes the annotations to a user interface element. The
- * annotations can apply to text (e.g. prefix, suffix, color, font) and to an
- * image (e.g. overlays).
- * <p>
- * This class is derived from an internal workbench class
- * <code>IDecoration</code> and is often used in conjunction with the label
- * decoration APIs. As such a client can convert between them using helpers
- * defined in this class.
- * </p>
- * TODO:
- * profile
- * add colors and fonts to preferences instead of being hard coded
- * what to do with CVSDecorationConfiguration class?
- * preference page externalizations
- * preference page preview should update when theme changes
- *
- * @since 3.1
- */
-public class CVSDecoration {
-
- // Decorations
- private String prefix;
- private String suffix;
- private ImageDescriptor overlay;
- private Color bkgColor;
- private Color fgColor;
- private Font font;
-
- // Properties
- private int resourceType = IResource.FILE;
- private boolean watchEditEnabled = false;
- private boolean isDirty = false;
- private boolean isIgnored = false;
- private boolean isAdded = false;
- private boolean isNewResource = false;
- private boolean hasRemote = false;
- private boolean readOnly = false;
- private boolean needsMerge = false;
- private boolean virtualFolder = false;
- private String tag;
- private String revision;
- private String repository;
- private ICVSRepositoryLocation location;
- private String keywordSubstitution;
-
- // Text formatters
- private String fileFormatter;
- private String folderFormatter;
- private String projectFormatter;
- private String dirtyTextIndicator;
- private String addedTextIndicator;
- private String resourceName;
-
- // Images cached for better performance
- private static ImageDescriptor dirty;
- private static ImageDescriptor checkedIn;
- private static ImageDescriptor noRemoteDir;
- private static ImageDescriptor added;
- private static ImageDescriptor merged;
- private static ImageDescriptor newResource;
- private static ImageDescriptor edited;
-
- // List of preferences used to configure the decorations that
- // are applied.
- private Preferences preferences;
-
- /*
- * Define a cached image descriptor which only creates the image data once
- */
- public static class CachedImageDescriptor extends ImageDescriptor {
-
- ImageDescriptor descriptor;
- ImageData data;
-
- public CachedImageDescriptor(ImageDescriptor descriptor) {
- Assert.isNotNull(descriptor);
- this.descriptor = descriptor;
- }
-
- public ImageData getImageData() {
- if (data == null) {
- data = descriptor.getImageData();
- }
- return data;
- }
- }
-
- static {
- dirty = new CachedImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DIRTY_OVR));
- checkedIn = new CachedImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_CHECKEDIN_OVR));
- added = new CachedImageDescriptor(TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_CHECKEDIN_OVR));
- merged = new CachedImageDescriptor(CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_MERGED));
- newResource = new CachedImageDescriptor(CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_QUESTIONABLE));
- edited = new CachedImageDescriptor(CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_EDITED));
- noRemoteDir = new CachedImageDescriptor(CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_NO_REMOTEDIR));
- }
-
- /**
- * Default constructor uses the plug-in's preferences to determine text decoration
- * formatters and preferences.
- */
- public CVSDecoration(String resourceName) {
- // TODO: for efficiency don't look up a pref until its needed
- IPreferenceStore store = getStore();
- Preferences prefs = new Preferences();
-
- prefs.setValue(ICVSUIConstants.PREF_SHOW_DIRTY_DECORATION, store.getBoolean(ICVSUIConstants.PREF_SHOW_DIRTY_DECORATION));
- prefs.setValue(ICVSUIConstants.PREF_SHOW_ADDED_DECORATION, store.getBoolean(ICVSUIConstants.PREF_SHOW_ADDED_DECORATION));
- prefs.setValue(ICVSUIConstants.PREF_SHOW_HASREMOTE_DECORATION, store.getBoolean(ICVSUIConstants.PREF_SHOW_HASREMOTE_DECORATION));
- prefs.setValue(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION, store.getBoolean(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION));
- prefs.setValue(ICVSUIConstants.PREF_CALCULATE_DIRTY, store.getBoolean(ICVSUIConstants.PREF_CALCULATE_DIRTY));
- prefs.setValue(ICVSUIConstants.PREF_DIRTY_FLAG, store.getString(ICVSUIConstants.PREF_DIRTY_FLAG));
- prefs.setValue(ICVSUIConstants.PREF_ADDED_FLAG, store.getString(ICVSUIConstants.PREF_ADDED_FLAG));
-
- initialize(resourceName, prefs, store.getString(ICVSUIConstants.PREF_FILETEXT_DECORATION), store.getString(ICVSUIConstants.PREF_FOLDERTEXT_DECORATION), store.getString(ICVSUIConstants.PREF_PROJECTTEXT_DECORATION));
- }
-
- public CVSDecoration(String resourceName, Preferences preferences, String fileFormater, String folderFormatter, String projectFormatter) {
- initialize(resourceName, preferences, fileFormater, folderFormatter, projectFormatter);
- }
-
- private IPreferenceStore getStore() {
- return CVSUIPlugin.getPlugin().getPreferenceStore();
- }
-
- private void initialize(String resourceName, Preferences preferences, String fileFormater, String folderFormatter, String projectFormatter) {
- this.resourceName = resourceName;
- this.preferences = preferences;
- this.fileFormatter = fileFormater;
- this.folderFormatter = folderFormatter;
- this.projectFormatter = projectFormatter;
- }
-
- public void addPrefix(String prefix) {
- this.prefix = prefix;
- }
-
- public void addSuffix(String suffix) {
- this.suffix = suffix;
- }
-
- public void addOverlay(ImageDescriptor overlay) {
- this.overlay = overlay;
- }
-
- public void setForegroundColor(Color fgColor) {
- this.fgColor = fgColor;
- }
-
- public void setBackgroundColor(Color bkgColor) {
- this.bkgColor = bkgColor;
- }
-
- public void setFont(Font font) {
- this.font = font;
- }
-
- public Color getBackgroundColor() {
- return bkgColor;
- }
-
- public Color getForegroundColor() {
- return fgColor;
- }
-
- public Font getFont() {
- return font;
- }
-
- public ImageDescriptor getOverlay() {
- return overlay;
- }
-
- public String getPrefix() {
- return prefix;
- }
-
- public String getSuffix() {
- return suffix;
- }
-
- public void setResourceType(int type) {
- this.resourceType = type;
- }
-
- public void apply(IDecoration decoration) {
- compute();
- // apply changes
- String suffix = getSuffix();
- if(suffix != null)
- decoration.addSuffix(suffix);
- String prefix = getPrefix();
- if(prefix != null)
- decoration.addPrefix(prefix);
- ImageDescriptor overlay = getOverlay();
- if(overlay != null)
- decoration.addOverlay(getOverlay());
- Color bc = getBackgroundColor();
- if(bc != null)
- decoration.setBackgroundColor(bc);
- Color fc = getForegroundColor();
- if(fc != null)
- decoration.setForegroundColor(fc);
- Font f = getFont();
- if(f != null)
- decoration.setFont(f);
- }
-
- public void compute() {
- computeText();
- overlay = computeImage();
- computeColorsAndFonts();
- }
-
- private void computeText() {
- Map bindings = new HashMap();
- IPreferenceStore store = getStore();
- if (isDirty()) {
- bindings.put(CVSDecoratorConfiguration.DIRTY_FLAG, preferences.getString(ICVSUIConstants.PREF_DIRTY_FLAG));
- }
- if (isAdded()) {
- bindings.put(CVSDecoratorConfiguration.ADDED_FLAG, preferences.getString(ICVSUIConstants.PREF_ADDED_FLAG));
- } else if(isHasRemote()){
- bindings.put(CVSDecoratorConfiguration.FILE_REVISION, getRevision());
- bindings.put(CVSDecoratorConfiguration.RESOURCE_TAG, getTag());
- }
- bindings.put(CVSDecoratorConfiguration.RESOURCE_NAME, getResourceName());
- bindings.put(CVSDecoratorConfiguration.FILE_KEYWORD, getKeywordSubstitution());
- if (resourceType != IResource.FILE && location != null) {
- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_HOST, location.getHost());
- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_METHOD, location.getMethod().getName());
- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_USER, location.getUsername());
- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_ROOT, location.getRootDirectory());
- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_REPOSITORY, repository);
- }
- CVSDecoratorConfiguration.decorate(this, getTextFormatter(), bindings);
- }
-
- private ImageDescriptor computeImage() {
- // show newResource icon
- if (preferences.getBoolean(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION) && isNewResource()) {
- return newResource;
- }
- // show dirty icon
- if (preferences.getBoolean(ICVSUIConstants.PREF_SHOW_DIRTY_DECORATION) && isDirty()) {
- return dirty;
- }
- // show added
- if (preferences.getBoolean(ICVSUIConstants.PREF_SHOW_ADDED_DECORATION) && isAdded()) {
- return added;
- }
- // show watch edit
- if (isWatchEditEnabled() && resourceType == IResource.FILE && !isReadOnly() && isHasRemote()) {
- return edited;
- }
- // show checked in
- if (preferences.getBoolean(ICVSUIConstants.PREF_SHOW_HASREMOTE_DECORATION) && isHasRemote()) {
- if (resourceType != IResource.FILE && isVirtualFolder()) {
- return noRemoteDir;
- }
- return checkedIn;
- }
- //nothing matched
- return null;
- }
-
- private void computeColorsAndFonts() {
- ITheme current = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
- if(isIgnored()) {
- setBackgroundColor(current.getColorRegistry().get(CVSDecoratorConfiguration.IGNORED_BACKGROUND_COLOR));
- setForegroundColor(current.getColorRegistry().get(CVSDecoratorConfiguration.IGNORED_FOREGROUND_COLOR));
- setFont(current.getFontRegistry().get(CVSDecoratorConfiguration.IGNORED_FONT));
- } else if(isDirty()) {
- setBackgroundColor(current.getColorRegistry().get(CVSDecoratorConfiguration.OUTGOING_CHANGE_BACKGROUND_COLOR));
- setForegroundColor(current.getColorRegistry().get(CVSDecoratorConfiguration.OUTGOING_CHANGE_FOREGROUND_COLOR));
- setFont(current.getFontRegistry().get(CVSDecoratorConfiguration.OUTGOING_CHANGE_FONT));
- }
- }
-
- private String getResourceName() {
- return resourceName;
- }
-
- private String getTextFormatter() {
- switch (resourceType) {
- case IResource.FILE :
- return fileFormatter;
- case IResource.FOLDER :
- return folderFormatter;
- case IResource.PROJECT :
- return projectFormatter;
- }
- return "no format specified"; //$NON-NLS-1$
- }
-
- public boolean isAdded() {
- return isAdded;
- }
-
- public void setAdded(boolean isAdded) {
- this.isAdded = isAdded;
- }
-
- public boolean isDirty() {
- return isDirty;
- }
-
- public void setDirty(boolean isDirty) {
- this.isDirty = isDirty;
- }
-
- public boolean isIgnored() {
- return isIgnored;
- }
-
- public void setIgnored(boolean isIgnored) {
- this.isIgnored = isIgnored;
- }
-
- public String getTag() {
- return tag;
- }
-
- public void setTag(String tag) {
- this.tag = tag;
- }
-
- public boolean isWatchEditEnabled() {
- return watchEditEnabled;
- }
-
- public void setWatchEditEnabled(boolean watchEditEnabled) {
- this.watchEditEnabled = watchEditEnabled;
- }
-
- public boolean isNewResource() {
- return isNewResource;
- }
-
- public void setNewResource(boolean isNewResource) {
- this.isNewResource = isNewResource;
- }
-
- public ICVSRepositoryLocation getLocation() {
- return location;
- }
-
- public void setLocation(ICVSRepositoryLocation location) {
- this.location = location;
- }
-
- public String getRevision() {
- return revision;
- }
-
- public void setRevision(String revision) {
- this.revision = revision;
- }
-
- public String getKeywordSubstitution() {
- return keywordSubstitution;
- }
-
- public void setKeywordSubstitution(String keywordSubstitution) {
- this.keywordSubstitution = keywordSubstitution;
- }
-
- public void setNeedsMerge(boolean needsMerge) {
- this.needsMerge = needsMerge;
- }
-
- public boolean isHasRemote() {
- return hasRemote;
- }
-
- public void setHasRemote(boolean hasRemote) {
- this.hasRemote = hasRemote;
- }
-
- public void setRepository(String repository) {
- this.repository = repository;
- }
-
- public boolean isReadOnly() {
- return readOnly;
- }
-
- public void setReadOnly(boolean readOnly) {
- this.readOnly = readOnly;
- }
-
- public boolean isVirtualFolder() {
- return virtualFolder;
- }
-
- public void setVirtualFolder(boolean virtualFolder) {
- this.virtualFolder = virtualFolder;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorConfiguration.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorConfiguration.java
deleted file mode 100644
index 647424147..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorConfiguration.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import java.util.Map;
-
-public class CVSDecoratorConfiguration {
-
- // bindings for
- public static final String RESOURCE_NAME = "name"; //$NON-NLS-1$
- public static final String RESOURCE_TAG = "tag"; //$NON-NLS-1$
- public static final String FILE_REVISION = "revision"; //$NON-NLS-1$
- public static final String FILE_KEYWORD = "keyword"; //$NON-NLS-1$
-
- // bindings for repository location
- public static final String REMOTELOCATION_METHOD = "method"; //$NON-NLS-1$
- public static final String REMOTELOCATION_USER = "user"; //$NON-NLS-1$
- public static final String REMOTELOCATION_HOST = "host"; //$NON-NLS-1$
- public static final String REMOTELOCATION_ROOT = "root"; //$NON-NLS-1$
- public static final String REMOTELOCATION_REPOSITORY = "repository"; //$NON-NLS-1$
-
- // bindings for resource states
- public static final String DIRTY_FLAG = "dirty_flag"; //$NON-NLS-1$
- public static final String ADDED_FLAG = "added_flag"; //$NON-NLS-1$
- public static final String DEFAULT_DIRTY_FLAG = ">"; //$NON-NLS-1$
- public static final String DEFAULT_ADDED_FLAG = "*"; //$NON-NLS-1$
-
- // default text decoration formats
- public static final String DEFAULT_FILETEXTFORMAT = "{dirty_flag}{name} {revision} {tag} ({keyword})"; //$NON-NLS-1$
- public static final String DEFAULT_FOLDERTEXTFORMAT = "{dirty_flag}{name} {tag}"; //$NON-NLS-1$
- public static final String DEFAULT_PROJECTTEXTFORMAT = "{dirty_flag}{name} {tag} [{host}]"; //$NON-NLS-1$
-
- // prefix characters that can be removed if the following binding is not found
- private static final char KEYWORD_SEPCOLON = ':';
- private static final char KEYWORD_SEPAT = '@';
-
- // font and color definition ids
- public static final String OUTGOING_CHANGE_FOREGROUND_COLOR = "org.eclipse.team.cvs.ui.fontsandcolors.outgoing_change_foreground_color"; //$NON-NLS-1$
- public static final String OUTGOING_CHANGE_BACKGROUND_COLOR = "org.eclipse.team.cvs.ui.fontsandcolors.outgoing_change_background_color"; //$NON-NLS-1$
- public static final String OUTGOING_CHANGE_FONT = "org.eclipse.team.cvs.ui.fontsandcolors.outgoing_change_font"; //$NON-NLS-1$
- public static final String IGNORED_FOREGROUND_COLOR = "org.eclipse.team.cvs.ui.fontsandcolors.ignored_resource_foreground_color"; //$NON-NLS-1$
- public static final String IGNORED_BACKGROUND_COLOR = "org.eclipse.team.cvs.ui.fontsandcolors.ignored_resource_background_color"; //$NON-NLS-1$
- public static final String IGNORED_FONT = "org.eclipse.team.cvs.ui.fontsandcolors.ignored_resource_font"; //$NON-NLS-1$
-
- public static void decorate(CVSDecoration decoration, String format, Map bindings) {
- StringBuffer prefix = new StringBuffer(80);
- StringBuffer suffix = new StringBuffer(80);
- StringBuffer output = prefix;
-
- int length = format.length();
- int start = -1;
- int end = length;
- while (true) {
- if ((end = format.indexOf('{', start)) > -1) {
- output.append(format.substring(start + 1, end));
- if ((start = format.indexOf('}', end)) > -1) {
- String key = format.substring(end + 1, start);
- String s;
-
- //We use the RESOURCE_NAME key to determine if we are doing the prefix or suffix. The name isn't actually part of either.
- if(key.equals(RESOURCE_NAME)) {
- output = suffix;
- s = null;
- } else {
- s = (String) bindings.get(key);
- }
-
- if(s!=null) {
- output.append(s);
- } else {
- // support for removing prefix character if binding is null
- int curLength = output.length();
- if(curLength>0) {
- char c = output.charAt(curLength - 1);
- if(c == KEYWORD_SEPCOLON || c == KEYWORD_SEPAT) {
- output.deleteCharAt(curLength - 1);
- }
- }
- }
- } else {
- output.append(format.substring(end, length));
- break;
- }
- } else {
- output.append(format.substring(start + 1, length));
- break;
- }
- }
-
- if (prefix.length() != 0) {
- decoration.addPrefix(prefix.toString());
- }
- if (suffix.length() != 0) {
- decoration.addSuffix(suffix.toString());
- }
- }
-
-//todo: leaving the old bind method in until senders can be fixed
-
- public static String bind(String format, Map bindings) {
- StringBuffer output = new StringBuffer(80);
- int length = format.length();
- int start = -1;
- int end = length;
- while (true) {
- if ((end = format.indexOf('{', start)) > -1) {
- output.append(format.substring(start + 1, end));
- if ((start = format.indexOf('}', end)) > -1) {
- String s = (String)bindings.get(format.substring(end + 1, start));
- if(s!=null) {
- output.append(s);
- } else {
- // support for removing prefix character if binding is null
- int curLength = output.length();
- if(curLength>0) {
- char c = output.charAt(curLength - 1);
- if(c == KEYWORD_SEPCOLON || c == KEYWORD_SEPAT) {
- output.deleteCharAt(curLength - 1);
- }
- }
- }
- } else {
- output.append(format.substring(end, length));
- break;
- }
- } else {
- output.append(format.substring(start + 1, length));
- break;
- }
- }
- return output.toString();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorPreferencesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorPreferencesPage.java
deleted file mode 100644
index 414ca7bb6..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorPreferencesPage.java
+++ /dev/null
@@ -1,619 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import java.util.*;
-import java.util.List;
-
-import org.eclipse.compare.internal.TabFolderLayout;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.team.internal.ui.OverlayIcon;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.ListSelectionDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.ide.IDE.SharedImages;
-
-public class CVSDecoratorPreferencesPage extends PreferencePage implements IWorkbenchPreferencePage {
-
- private Button imageShowDirty;
- private Button imageShowHasRemote;
- private Button imageShowAdded;
- private Button imageShowNewResource;
-
- private Text fileTextFormat;
- private Text folderTextFormat;
- private Text projectTextFormat;
-
- private Text dirtyFlag;
- private Text addedFlag;
-
- private Button showDirty;
-
- // Cache for folder images that have been overlayed with sample CVS icons
- private Map fgImageCache;
-
- // Tree that provides a preview of the decorations
- private TreeViewer previewTree;
-
- /**
- * Update the preview tree when a theme changes.
- */
- private IPropertyChangeListener themeListener = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- previewTree.refresh(true /* update labels */);
- }
- };
-
- /**
- * Label provider creates a dummy CVSDecoration using the preferences set
- * in this page. The decoration properties are assigned to the different named
- * resources in the preview tree so that most of the decoration options
- * are shown
- */
- private class PreviewLabelProvider extends LabelProvider implements IFontProvider, IColorProvider {
-
- public Color getBackground(Object element) {
- CVSDecoration decoration = getDecoration(element);
- return decoration.getBackgroundColor();
- }
-
- public Color getForeground(Object element) {
- CVSDecoration decoration = getDecoration(element);
- return decoration.getForegroundColor();
- }
-
- public Font getFont(Object element) {
- CVSDecoration decoration = getDecoration(element);
- return decoration.getFont();
- }
-
- public String getText(Object element) {
- CVSDecoration decoration = getDecoration(element);
- StringBuffer buffer = new StringBuffer();
- String prefix = decoration.getPrefix();
- if(prefix != null)
- buffer.append(prefix);
- buffer.append((String)element);
- String suffix = decoration.getSuffix();
- if(suffix != null)
- buffer.append(suffix);
- return buffer.toString();
- }
-
- public CVSDecoration getDecoration(Object element) {
- CVSDecoration decoration = buildDecoration((String)element);
- if(element.equals("ignored.txt")) { //$NON-NLS-1$
- decoration.setResourceType(IResource.FILE);
- decoration.setIgnored(true);
- } else if(element.equals("Project")) { //$NON-NLS-1$
- decoration.setResourceType(IResource.PROJECT);
- decoration.setHasRemote(true);
- decoration.setTag("v1_0"); //$NON-NLS-1$
- } else if(element.equals("Folder")) { //$NON-NLS-1$
- decoration.setHasRemote(true);
- decoration.setResourceType(IResource.FOLDER);
- decoration.setHasRemote(true);
- } else if(element.equals("dirty.cpp")){ //$NON-NLS-1$
- decoration.setResourceType(IResource.FILE);
- decoration.setDirty(true);
- decoration.setHasRemote(true);
- } else if(element.equals("added.java")){ //$NON-NLS-1$
- decoration.setResourceType(IResource.FILE);
- decoration.setAdded(true);
- decoration.setDirty(true);
- decoration.setHasRemote(false);
- } else if(element.equals("todo.txt")){ //$NON-NLS-1$
- decoration.setResourceType(IResource.FILE);
- decoration.setNewResource(true);
- decoration.setDirty(true);
- } else if(element.equals("bugs.txt")){ //$NON-NLS-1$
- decoration.setResourceType(IResource.FILE);
- decoration.setDirty(false);
- decoration.setHasRemote(true);
- } else if(element.equals("archive.zip")){ //$NON-NLS-1$
- decoration.setResourceType(IResource.FILE);
- decoration.setDirty(false);
- decoration.setHasRemote(true);
- decoration.setKeywordSubstitution(Command.KSUBST_BINARY.getShortDisplayText());
- }
- decoration.compute();
- return decoration;
- }
-
- public Image getImage(Object element) {
- Image baseImage;
- if(element.equals("Project")) { //$NON-NLS-1$
- baseImage= PlatformUI.getWorkbench().
- getSharedImages().getImage(SharedImages.IMG_OBJ_PROJECT);
- } else if(element.equals("Folder")) { //$NON-NLS-1$
- baseImage= PlatformUI.getWorkbench().
- getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
- } else {
- baseImage= PlatformUI.getWorkbench().
- getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
- }
- CVSDecoration decoration = getDecoration(element);
- ImageDescriptor overlay = decoration.getOverlay();
- if(overlay == null)
- return baseImage;
-
- // Otherwise
- ImageDescriptor resultImageDescriptor = new OverlayIcon(baseImage, new ImageDescriptor[] {overlay}, new int[] {OverlayIcon.BOTTOM_RIGHT}, new Point(baseImage.getBounds().width, baseImage.getBounds().height));
- if (fgImageCache == null) {
- fgImageCache = new HashMap(10);
- }
- Image image = (Image) fgImageCache.get(overlay);
- if (image == null) {
- image = resultImageDescriptor.createImage();
- fgImageCache.put(resultImageDescriptor, image);
- }
- return image;
- }
- };
-
- /**
- * Provides a fixed mock resource tree for showing the preview.
- */
- private IContentProvider previewContentProvider = new ITreeContentProvider() {
- public Object[] getChildren(Object parentElement) {
- if(parentElement == ResourcesPlugin.getWorkspace().getRoot()) {
- return new String[] {
- "Project"}; //$NON-NLS-1$
- } else if(parentElement.equals("Project")) { //$NON-NLS-1$
- return new String[] {
- "ignored.txt", //$NON-NLS-1$
- "dirty.cpp", //$NON-NLS-1$
- "added.java", //$NON-NLS-1$
- "todo.txt", //$NON-NLS-1$
- "bugs.txt", //$NON-NLS-1$
- "archive.zip", //$NON-NLS-1$
- "Folder" //$NON-NLS-1$
- };
- } else {
- return new Object[0];
- }
- }
-
- public Object getParent(Object element) {
- return null;
- }
-
- public boolean hasChildren(Object element) {
- if(element.equals("Project") || element == ResourcesPlugin.getWorkspace().getRoot()) //$NON-NLS-1$
- return true;
- else
- return false;
- }
-
- public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- };
-
- class StringPair {
- String s1;
- String s2;
- }
-
- class TextPair {
- TextPair(Text t1, Text t2) {
- this.t1 = t1;
- this.t2 = t2;
- }
- Text t1;
- Text t2;
- }
-
- /**
- * Constructor for CVSDecoratorPreferencesPage.
- */
- public CVSDecoratorPreferencesPage() {
- setDescription(Policy.bind("CVSDecoratorPreferencesPage.description")); //$NON-NLS-1$;
- }
-
- protected TextPair createFormatEditorControl(Composite composite, String title, String buttonText, final Map supportedBindings) {
- createLabel(composite, title, 1);
- Text format = new Text(composite, SWT.BORDER);
- format.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- format.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- previewTree.refresh(true);
- }
- });
- Button b = new Button(composite, SWT.NONE);
- b.setText(buttonText);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- b.setLayoutData(data);
- final Text formatToInsert = format;
- b.addListener(SWT.Selection, new Listener() {
- public void handleEvent (Event event) {
- addVariables(formatToInsert, supportedBindings);
- }
- });
- return new TextPair(format, null);
- }
-
- /**
- * @see PreferencePage#createContents(Composite)
- */
- protected Control createContents(Composite parent) {
-
- // create a tab folder for the page
- TabFolder tabFolder = new TabFolder(parent, SWT.NONE);
- tabFolder.setLayout(new TabFolderLayout());
- tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- // text decoration options
- TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
- tabItem.setText(Policy.bind("Text_Labels_12"));//$NON-NLS-1$
- tabItem.setControl(createTextDecoratorPage(tabFolder));
-
- // image decoration options
- //tabItem = new TabItem(tabFolder, SWT.NONE);
- //tabItem.setText(Policy.bind("Icon_Overlays_24"));//$NON-NLS-1$
- //tabItem.setControl(createIconDecoratorPage(tabFolder));
-
- // general decoration options
- tabItem = new TabItem(tabFolder, SWT.NONE);
- tabItem.setText(Policy.bind("CVSDecoratorPreferencesPage.generalTabFolder"));//$NON-NLS-1$
- tabItem.setControl(createGeneralDecoratorPage(tabFolder));
-
- initializeValues();
- WorkbenchHelp.setHelp(tabFolder, IHelpContextIds.DECORATORS_PREFERENCE_PAGE);
- Dialog.applyDialogFont(parent);
-
- previewTree.setInput(ResourcesPlugin.getWorkspace().getRoot());
- previewTree.expandAll();
-
- PlatformUI.getWorkbench().getThemeManager().addPropertyChangeListener(themeListener);
-
- return tabFolder;
- }
-
- public void dispose() {
- PlatformUI.getWorkbench().getThemeManager().removePropertyChangeListener(themeListener);
- }
-
- private Control createTextDecoratorPage(Composite parent) {
- Composite top = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- top.setLayout(layout);
- GridData data = new GridData(GridData.FILL, GridData.FILL, true, true);
- top.setLayoutData(data);
-
- Group fileTextGroup = new Group(top, SWT.SHADOW_IN);
- fileTextGroup.setText(Policy.bind("CVSDecoratorPreferencePage.1")); //$NON-NLS-1$
- layout = new GridLayout();
- layout.numColumns = 3;
- fileTextGroup.setLayout(layout);
- data = new GridData(GridData.FILL, GridData.BEGINNING, true, false);
- fileTextGroup.setLayoutData(data);
-
- TextPair format = createFormatEditorControl(fileTextGroup, Policy.bind("&File_Format__14"), Policy.bind("Add_&Variables_15"), getFileBindingDescriptions()); //$NON-NLS-1$ //$NON-NLS-2$
- fileTextFormat = format.t1;
- format = createFormatEditorControl(fileTextGroup, Policy.bind("F&older_Format__16"), Policy.bind("Add_Varia&bles_17"), getFolderBindingDescriptions()); //$NON-NLS-1$ //$NON-NLS-2$
- folderTextFormat = format.t1;
- format = createFormatEditorControl(fileTextGroup, Policy.bind("&Project_Format__18"), Policy.bind("Add_Variable&s_19"), getFolderBindingDescriptions()); //$NON-NLS-1$ //$NON-NLS-2$
- projectTextFormat = format.t1;
-
- createLabel(fileTextGroup, Policy.bind("&Label_decoration_for_outgoing__20"), 1); //$NON-NLS-1$
- dirtyFlag = new Text(fileTextGroup, SWT.BORDER);
- dirtyFlag.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- dirtyFlag.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- previewTree.refresh(true);
- }
- });
- createLabel(fileTextGroup, "", 1); // spacer //$NON-NLS-1$
-
- createLabel(fileTextGroup, Policy.bind("Label_decorat&ion_for_added__22"), 1); //$NON-NLS-1$
- addedFlag = new Text(fileTextGroup, SWT.BORDER);
- addedFlag.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- addedFlag.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- previewTree.refresh(true);
- }
- });
- createLabel(fileTextGroup, "", 1); // spacer //$NON-NLS-1$
-
- // **********
- // ICONS
- // **********
-
- Group iconGroup = new Group(top, SWT.SHADOW_IN);
- iconGroup.setText(Policy.bind("Icon_Overlays_24")); //$NON-NLS-1$
- layout = new GridLayout();
- layout.numColumns = 3;
- iconGroup.setLayout(layout);
- data = data = new GridData(GridData.FILL, GridData.BEGINNING, true, false);
- iconGroup.setLayoutData(data);
-
- createIconDecoratorPage(iconGroup);
-
- // **********
- // PREVIEW
- // **********
-
- Group previewGroup = new Group(top, SWT.SHADOW_IN);
- previewGroup.setText(Policy.bind("Example__1")); //$NON-NLS-1$
- layout = new GridLayout();
- previewGroup.setLayout(layout);
- data = new GridData(GridData.FILL, GridData.FILL, true, true);
- previewGroup.setLayoutData(data);
-
- // Preview Pane
- previewTree = new TreeViewer(previewGroup);
- data = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
- data.horizontalSpan = 2;
- data.heightHint = 125;
- previewTree.getTree().setLayoutData(data);
- previewTree.setContentProvider(previewContentProvider);
- previewTree.setLabelProvider(new PreviewLabelProvider());
- return top;
- }
-
- private Control createIconDecoratorPage(Composite parent) {
- Composite imageGroup = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- imageGroup.setLayout(layout);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- imageGroup.setLayoutData(data);
-
- imageShowDirty = createCheckBox(imageGroup, Policy.bind("Sho&w_outgoing_25")); //$NON-NLS-1$
- imageShowHasRemote = createCheckBox(imageGroup, Policy.bind("Show_has_&remote_26")); //$NON-NLS-1$
- imageShowAdded = createCheckBox(imageGroup, Policy.bind("S&how_is_added_27")); //$NON-NLS-1$
- imageShowNewResource = createCheckBox(imageGroup, Policy.bind("CVSDecoratorPreferencesPage.newResources")); //$NON-NLS-1$
- return imageGroup;
- }
-
- private Control createGeneralDecoratorPage(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- composite.setLayout(layout);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- composite.setLayoutData(data);
- createLabel(composite, Policy.bind("CVSDecoratorPreferencesPage.generalDescription"), 1); //$NON-NLS-1$
- showDirty = createCheckBox(composite, Policy.bind("&Compute_deep_outgoing_state_for_folders_(disabling_this_will_improve_decorator_performance)_28")); //$NON-NLS-1$
- return composite;
- }
-
- private Label createLabel(Composite parent, String text, int span) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = span;
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.BEGINNING;
- label.setLayoutData(data);
- return label;
- }
-
- private Button createCheckBox(Composite group, String label) {
- Button button = new Button(group, SWT.CHECK);
- button.setText(label);
- button.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- previewTree.refresh(true);
- }
- });
- return button;
- }
-
- /**
- * Initializes states of the controls from the preference store.
- */
- private void initializeValues() {
- IPreferenceStore store = getPreferenceStore();
-
- fileTextFormat.setText(store.getString(ICVSUIConstants.PREF_FILETEXT_DECORATION));
- folderTextFormat.setText(store.getString(ICVSUIConstants.PREF_FOLDERTEXT_DECORATION));
- projectTextFormat.setText(store.getString(ICVSUIConstants.PREF_PROJECTTEXT_DECORATION));
-
- addedFlag.setText(store.getString(ICVSUIConstants.PREF_ADDED_FLAG));
- dirtyFlag.setText(store.getString(ICVSUIConstants.PREF_DIRTY_FLAG));
-
- imageShowDirty.setSelection(store.getBoolean(ICVSUIConstants.PREF_SHOW_DIRTY_DECORATION));
- imageShowAdded.setSelection(store.getBoolean(ICVSUIConstants.PREF_SHOW_ADDED_DECORATION));
- imageShowHasRemote.setSelection(store.getBoolean(ICVSUIConstants.PREF_SHOW_HASREMOTE_DECORATION));
- imageShowNewResource.setSelection(store.getBoolean(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION));
-
- showDirty.setSelection(store.getBoolean(ICVSUIConstants.PREF_CALCULATE_DIRTY));
- setValid(true);
- }
-
- /**
- * @see IWorkbenchPreferencePage#init(IWorkbench)
- */
- public void init(IWorkbench workbench) {
- }
-
- /**
- * OK was clicked. Store the CVS preferences.
- *
- * @return whether it is okay to close the preference page
- */
- public boolean performOk() {
- IPreferenceStore store = getPreferenceStore();
- store.setValue(ICVSUIConstants.PREF_FILETEXT_DECORATION, fileTextFormat.getText());
- store.setValue(ICVSUIConstants.PREF_FOLDERTEXT_DECORATION, folderTextFormat.getText());
- store.setValue(ICVSUIConstants.PREF_PROJECTTEXT_DECORATION, projectTextFormat.getText());
-
- store.setValue(ICVSUIConstants.PREF_ADDED_FLAG, addedFlag.getText());
- store.setValue(ICVSUIConstants.PREF_DIRTY_FLAG, dirtyFlag.getText());
-
- store.setValue(ICVSUIConstants.PREF_SHOW_DIRTY_DECORATION, imageShowDirty.getSelection());
- store.setValue(ICVSUIConstants.PREF_SHOW_ADDED_DECORATION, imageShowAdded.getSelection());
- store.setValue(ICVSUIConstants.PREF_SHOW_HASREMOTE_DECORATION, imageShowHasRemote.getSelection());
- store.setValue(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION, imageShowNewResource.getSelection());
-
- store.setValue(ICVSUIConstants.PREF_CALCULATE_DIRTY, showDirty.getSelection());
-
- CVSUIPlugin.broadcastPropertyChange(new PropertyChangeEvent(this, CVSUIPlugin.P_DECORATORS_CHANGED, null, null));
- CVSUIPlugin.getPlugin().savePluginPreferences();
- return true;
- }
-
- /**
- * Defaults was clicked. Restore the CVS preferences to
- * their default values
- */
- protected void performDefaults() {
- super.performDefaults();
- IPreferenceStore store = getPreferenceStore();
-
- fileTextFormat.setText(store.getDefaultString(ICVSUIConstants.PREF_FILETEXT_DECORATION));
- folderTextFormat.setText(store.getDefaultString(ICVSUIConstants.PREF_FOLDERTEXT_DECORATION));
- projectTextFormat.setText(store.getDefaultString(ICVSUIConstants.PREF_PROJECTTEXT_DECORATION));
-
- addedFlag.setText(store.getDefaultString(ICVSUIConstants.PREF_ADDED_FLAG));
- dirtyFlag.setText(store.getDefaultString(ICVSUIConstants.PREF_DIRTY_FLAG));
-
- imageShowDirty.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_SHOW_DIRTY_DECORATION));
- imageShowAdded.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_SHOW_ADDED_DECORATION));
- imageShowHasRemote.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_SHOW_HASREMOTE_DECORATION));
- imageShowNewResource.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION));
-
- showDirty.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_CALCULATE_DIRTY));
- }
-
- /**
- * Returns preference store that belongs to the our plugin.
- * This is important because we want to store
- * our preferences separately from the desktop.
- *
- * @return the preference store for this plugin
- */
- protected IPreferenceStore doGetPreferenceStore() {
- return CVSUIPlugin.getPlugin().getPreferenceStore();
- }
-
- /**
- * Add another project to the list at the end.
- */
- private void addVariables(Text target, Map bindings) {
-
- final List variables = new ArrayList(bindings.size());
-
- ILabelProvider labelProvider = new LabelProvider() {
- public String getText(Object element) {
- return ((StringPair)element).s1 + " - " + ((StringPair)element).s2; //$NON-NLS-1$
- }
- };
-
- IStructuredContentProvider contentsProvider = new IStructuredContentProvider() {
- public Object[] getElements(Object inputElement) {
- return variables.toArray(new StringPair[variables.size()]);
- }
- public void dispose() {}
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
- };
-
- for (Iterator it = bindings.keySet().iterator(); it.hasNext();) {
- StringPair variable = new StringPair();
- variable.s1 = (String) it.next(); // variable
- variable.s2 = (String) bindings.get(variable.s1); // description
- variables.add(variable);
- }
-
- ListSelectionDialog dialog =
- new ListSelectionDialog(
- this.getShell(),
- this,
- contentsProvider,
- labelProvider,
- Policy.bind("Select_the_&variables_to_add_to_the_decoration_format__30")); //$NON-NLS-1$
- dialog.setTitle(Policy.bind("Add_Variables_31")); //$NON-NLS-1$
- if (dialog.open() != ListSelectionDialog.OK)
- return;
-
- Object[] result = dialog.getResult();
-
- for (int i = 0; i < result.length; i++) {
- target.insert("{"+((StringPair)result[i]).s1 +"}"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- protected CVSDecoration buildDecoration(String name) {
- Preferences prefs = new Preferences();
-
- prefs.setDefault(ICVSUIConstants.PREF_SHOW_DIRTY_DECORATION, imageShowDirty.getSelection());
- prefs.setDefault(ICVSUIConstants.PREF_SHOW_ADDED_DECORATION, imageShowAdded.getSelection());
- prefs.setDefault(ICVSUIConstants.PREF_SHOW_HASREMOTE_DECORATION, imageShowHasRemote.getSelection());
- prefs.setDefault(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION, imageShowNewResource.getSelection());
- prefs.setDefault(ICVSUIConstants.PREF_CALCULATE_DIRTY, true);
- prefs.setDefault(ICVSUIConstants.PREF_DIRTY_FLAG, dirtyFlag.getText());
- prefs.setDefault(ICVSUIConstants.PREF_ADDED_FLAG, addedFlag.getText());
-
- CVSDecoration decoration =
- new CVSDecoration(name, prefs, fileTextFormat.getText(), folderTextFormat.getText(), projectTextFormat.getText());
-
- decoration.setKeywordSubstitution(Command.KSUBST_TEXT.getShortDisplayText()); //$NON-NLS-1$
- decoration.setRevision("1.45"); //$NON-NLS-1$
- try {
- decoration.setLocation(CVSRepositoryLocation.fromString(":pserver:alize@cvs.site.org:/home/cvsroot")); //$NON-NLS-1$
- } catch (CVSException e) {
- // continue without a location, since the location is hard coded an exception should never occur
- }
- return decoration;
- }
-
- private Map getFolderBindingDescriptions() {
- Map bindings = new HashMap();
- bindings.put(CVSDecoratorConfiguration.RESOURCE_NAME, Policy.bind("name_of_the_resource_being_decorated_34")); //$NON-NLS-1$
- bindings.put(CVSDecoratorConfiguration.RESOURCE_TAG, Policy.bind("the_tag_applied_to_the_resource_(version,_branch,_or_date)_35")); //$NON-NLS-1$
- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_HOST, Policy.bind("the_repository_location__s_hostname_36")); //$NON-NLS-1$
- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_METHOD, Policy.bind("the_connection_method_(e.g._pserver,_ssh)_37")); //$NON-NLS-1$
- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_USER, Policy.bind("user_name_for_the_connection_38")); //$NON-NLS-1$
- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_ROOT, Policy.bind("repository_home_directory_on_server_39")); //$NON-NLS-1$
- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_REPOSITORY, Policy.bind("root_relative_directory_40")); //$NON-NLS-1$
- bindings.put(CVSDecoratorConfiguration.DIRTY_FLAG, Policy.bind("flag_indicating_that_the_folder_has_a_child_resource_with_outgoing_changes_41")); //$NON-NLS-1$
- return bindings;
- }
-
- private Map getFileBindingDescriptions() {
- Map bindings = new HashMap();
- bindings.put(CVSDecoratorConfiguration.RESOURCE_NAME, Policy.bind("name_of_the_resource_being_decorated_42")); //$NON-NLS-1$
- bindings.put(CVSDecoratorConfiguration.RESOURCE_TAG, Policy.bind("the_tag_applied_to_the_resource_43")); //$NON-NLS-1$
- bindings.put(CVSDecoratorConfiguration.FILE_KEYWORD, Policy.bind("keyword_substitution_rule_for_the_resource_44")); //$NON-NLS-1$
- bindings.put(CVSDecoratorConfiguration.FILE_REVISION, Policy.bind("last_revision_loaded_into_workspace_45")); //$NON-NLS-1$
- bindings.put(CVSDecoratorConfiguration.DIRTY_FLAG, Policy.bind("flag_indicating_that_the_file_has_outgoing_changes_46")); //$NON-NLS-1$
- bindings.put(CVSDecoratorConfiguration.ADDED_FLAG, Policy.bind("flag_indicating_that_the_file_has_been_added_to_the_server_47")); //$NON-NLS-1$
- return bindings;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFieldEditorPreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFieldEditorPreferencePage.java
deleted file mode 100644
index 3703a9ca0..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFieldEditorPreferencePage.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * This class acts as an abstract superclass for CVS preference pages that use
- * field editors.
- */
-public abstract class CVSFieldEditorPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
-
- public static IPreferenceStore getCVSPreferenceStore() {
- return CVSUIPlugin.getPlugin().getPreferenceStore();
- }
-
- /**
- * Constructor for CVSFieldEditorPreferencePage.
- */
- public CVSFieldEditorPreferencePage() {
- super(GRID);
- setPreferenceStore(getCVSPreferenceStore());
- String description = getPageDescription();
- if (description != null)
- setDescription(description);
- }
-
- /**
- * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
- */
- protected Control createContents(Composite parent) {
- Control control = super.createContents(parent);
- String id = getPageHelpContextId();
- if (id != null)
- WorkbenchHelp.setHelp(control, id);
- Dialog.applyDialogFont(control);
- return control;
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- public void init(IWorkbench workbench) {
- }
-
- /**
- * Method getPageHelpContextId must be overridden by subclasses to provide
- * the help context ID of the page. Return null for no page F1 help.
- *
- * @return String
- */
- protected abstract String getPageHelpContextId();
-
- /**
- * Method getPageDescription must be overridden by subclasses to provide the
- * description of the page. Return null for no description.
- * @return String
- */
- protected abstract String getPageDescription();
-
- /**
- * @see org.eclipse.jface.preference.IPreferencePage#performOk()
- */
- public boolean performOk() {
- if (!super.performOk()) return false;
- pushPreferences();
- return true;
- }
-
- /**
- * Push the preferences to the Core plugin as required
- */
- protected void pushPreferences() {
- // Do nothing by default
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFilePropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFilePropertiesPage.java
deleted file mode 100644
index b700f744c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFilePropertiesPage.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import java.text.DateFormat;
-import java.util.Date;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.dialogs.Dialog;
-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.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.Util;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-public class CVSFilePropertiesPage extends CVSPropertiesPage {
- IFile file;
-
- /*
- * @see PreferencesPage#createContents
- */
- protected Control createContents(Composite parent) {
- initialize();
- noDefaultAndApplyButton();
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
-
- try {
- ICVSFile cvsResource = CVSWorkspaceRoot.getCVSFileFor(file);
- if (!cvsResource.isManaged()) {
- if (cvsResource.isIgnored()) {
- createLabel(composite, Policy.bind("CVSFilePropertiesPage.ignored")); //$NON-NLS-1$
- } else {
- createLabel(composite, Policy.bind("CVSFilePropertiesPage.notManaged")); //$NON-NLS-1$
- }
- createLabel(composite, ""); //$NON-NLS-1$
- return composite;
- }
- ResourceSyncInfo syncInfo = cvsResource.getSyncInfo();
-
-
-
- if (syncInfo.isAdded()) {
- createLabel(composite, Policy.bind("CVSFilePropertiesPage.isAdded"), 2); //$NON-NLS-1$
- } else {
- // Base
- createLabel(composite, Policy.bind("CVSFilePropertiesPage.baseRevision")); //$NON-NLS-1$
- createLabel(composite, syncInfo.getRevision());
- Date baseTime = syncInfo.getTimeStamp();
- if (baseTime != null) {
- createLabel(composite, Policy.bind("CVSFilePropertiesPage.baseTimestamp")); //$NON-NLS-1$
- createLabel(composite, DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL).format(syncInfo.getTimeStamp()));
- }
-
- // Modified
- createLabel(composite, Policy.bind("CVSFilePropertiesPage.modified")); //$NON-NLS-1$
- createLabel(composite, cvsResource.isModified(null) ? Policy.bind("yes") : Policy.bind("no")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // Keyword Mode
- createLabel(composite, Policy.bind("CVSFilePropertiesPage.keywordMode")); //$NON-NLS-1$
- createLabel(composite, syncInfo.getKeywordMode().getLongDisplayText());
-
- // Tag
- createLabel(composite, Policy.bind("CVSFilePropertiesPage.tag")); //$NON-NLS-1$
- CVSTag tag = Util.getAccurateFileTag(cvsResource);
- createLabel(composite, getTagLabel(tag));
-
- // Permissions
- createLabel(composite, Policy.bind("CVSFilePropertiesPage.permissions")); //$NON-NLS-1$
- String permissions = syncInfo.getPermissions();
- if (permissions == null) {
- createLabel(composite, Policy.bind("CVSFilePropertiesPage.notAvailable")); //$NON-NLS-1$
- } else {
- createLabel(composite, syncInfo.getPermissions());
- }
- } catch (TeamException e) {
- // Display error text
- createLabel(composite, Policy.bind("CVSFilePropertiesPage.error")); //$NON-NLS-1$
- createLabel(composite, ""); //$NON-NLS-1$
- }
- WorkbenchHelp.setHelp(getControl(), IHelpContextIds.FILE_PROPERTY_PAGE);
- Dialog.applyDialogFont(parent);
- return composite;
- }
- /**
- * Utility method that creates a label instance
- * and sets the default layout data.
- *
- * @param parent the parent for the new label
- * @param text the text for the new label
- * @return the new label
- */
- protected Label createLabel(Composite parent, String text, int span) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = span;
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
- return label;
- }
- protected Label createLabel(Composite parent, String text) {
- return createLabel(parent, text, 1);
- }
- /**
- * Initializes the page
- */
- private void initialize() {
- // Get the file that is the source of this property page
- file = null;
- IAdaptable element = getElement();
- if (element instanceof IFile) {
- file = (IFile)element;
- } else {
- Object adapter = element.getAdapter(IFile.class);
- if (adapter instanceof IFile) {
- file = (IFile)adapter;
- }
- }
- }
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFolderPropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFolderPropertiesPage.java
deleted file mode 100644
index 400465eb8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFolderPropertiesPage.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.Util;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-public class CVSFolderPropertiesPage extends CVSPropertiesPage {
-
- IFolder folder;
- private Label root;
- private Label repository;
-
- /**
- * @see PreferencePage#createContents(Composite)
- */
- protected Control createContents(Composite parent) {
- initialize();
- noDefaultAndApplyButton();
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
-
- try {
- ICVSFolder cvsResource = CVSWorkspaceRoot.getCVSFolderFor(folder);
- if (!cvsResource.isManaged()) {
- if (cvsResource.isIgnored()) {
- createLabel(composite, Policy.bind("CVSFolderPropertiesPage.ignored"), 2); //$NON-NLS-1$
- } else {
- createLabel(composite, Policy.bind("CVSFolderPropertiesPage.notManaged"), 2); //$NON-NLS-1$
- }
- } else if (!cvsResource.isCVSFolder()) {
- // We have a managed folder which is not a cvs folder.
- // This is really an invalid state but it does happen once in a while
- createLabel(composite, Policy.bind("CVSFolderPropertiesPage.notCVSFolder"), 2); //$NON-NLS-1$
- } else {
- FolderSyncInfo syncInfo = cvsResource.getFolderSyncInfo();
- createLabel(composite, Policy.bind("CVSFolderPropertiesPage.root")); //$NON-NLS-1$
- root = createLabel(composite, syncInfo.getRoot());
- createLabel(composite, Policy.bind("CVSFolderPropertiesPage.repository")); //$NON-NLS-1$
- repository = createLabel(composite, syncInfo.getRepository());
-
- // Tag
- createLabel(composite, Policy.bind("CVSFilePropertiesPage.tag")); //$NON-NLS-1$
- CVSTag tag = syncInfo.getTag();
-
- if (tag != null && tag.getType() == CVSTag.BRANCH) {
- tag = Util.getAccurateFolderTag(folder, tag);
- }
-
- createLabel(composite, getTagLabel(tag));
-
- // Static-ness
- if (syncInfo.getIsStatic()) {
- createLabel(composite, Policy.bind("CVSFolderPropertiesPage.static")); //$NON-NLS-1$
- createLabel(composite, syncInfo.getIsStatic() ? Policy.bind("yes") : Policy.bind("no")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- createLabel(composite, "", 2); // spacer //$NON-NLS-1$
-
- // Allow the folder to be disconnected from CVS control
- final Button disconnect = new Button(composite, SWT.NONE);
- disconnect.setText(Policy.bind("CVSFolderPropertiesPage.disconnect")); //$NON-NLS-1$
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END);
- data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint, disconnect.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- disconnect.setLayoutData(data);
- disconnect.addListener(SWT.Selection, new Listener() {
- public void handleEvent (Event event) {
- // perform a disconnect
- if (disconnectFolder()) {
- root.setText(Policy.bind("CVSFilePropertiesPage.none")); //$NON-NLS-1$
- repository.setText(Policy.bind("CVSFilePropertiesPage.none")); //$NON-NLS-1$
- disconnect.setEnabled(false);
- }
- }
- });
- }
- } catch (TeamException e) {
- // Display error text
- createLabel(composite, Policy.bind("CVSFilePropertiesPage.error"), 2); //$NON-NLS-1$
- }
- WorkbenchHelp.setHelp(getControl(), IHelpContextIds.FOLDER_PROPERTY_PAGE);
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- /**
- * Utility method that creates a label instance
- * and sets the default layout data.
- *
- * @param parent the parent for the new label
- * @param text the text for the new label
- * @return the new label
- */
- protected Label createLabel(Composite parent, String text, int span) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = span;
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
- return label;
- }
-
- protected Label createLabel(Composite parent, String text) {
- return createLabel(parent, text, 1);
- }
- /**
- * Initializes the page
- */
- private void initialize() {
- // Get the file that is the source of this property page
- folder = null;
- IAdaptable element = getElement();
- if (element instanceof IFolder) {
- folder = (IFolder)element;
- } else {
- Object adapter = element.getAdapter(IFolder.class);
- if (adapter instanceof IFolder) {
- folder = (IFolder)adapter;
- }
- }
- }
-
- private boolean disconnectFolder() {
- if (MessageDialog.openQuestion(getShell(), Policy.bind("CVSFolderPropertiesPage.disconnectTitle"), Policy.bind("CVSFolderPropertiesPage.disconnectQuestion"))) { //$NON-NLS-1$ //$NON-NLS-2$
- final ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor(folder);
- try {
- PlatformUI.getWorkbench().getProgressService().run(true, false, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- cvsFolder.unmanage(null);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(getShell(), null, null, e);
- return false;
- } catch (InterruptedException e) {
- // Ignore
- }
- return true;
- } else {
- return false;
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java
deleted file mode 100644
index 1408a89f2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java
+++ /dev/null
@@ -1,452 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import java.text.SimpleDateFormat;
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.core.util.ResourceStateChangeListeners;
-import org.eclipse.team.internal.core.ExceptionCollector;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.themes.ITheme;
-import org.osgi.framework.Bundle;
-
-public class CVSLightweightDecorator extends LabelProvider implements ILightweightLabelDecorator, IResourceStateChangeListener, IPropertyChangeListener {
-
- // Decorator id as defined in the decorator extension point
- public final static String ID = "org.eclipse.team.cvs.ui.decorator"; //$NON-NLS-1$
-
- private static ExceptionCollector exceptions = new ExceptionCollector(Policy.bind("CVSDecorator.exceptionMessage"), CVSUIPlugin.ID, IStatus.ERROR, CVSUIPlugin.getPlugin().getLog()); //$NON-NLS-1$;
-
- private static String DECORATOR_FORMAT = "yyyy/MM/dd HH:mm:ss"; //$NON-NLS-1$
- private static SimpleDateFormat decorateFormatter = new SimpleDateFormat(DECORATOR_FORMAT, Locale.getDefault());
-
- private static String[] fonts = new String[] {
- CVSDecoratorConfiguration.IGNORED_FONT,
- CVSDecoratorConfiguration.OUTGOING_CHANGE_FONT};
-
- private static String[] colors = new String[] {
- CVSDecoratorConfiguration.OUTGOING_CHANGE_BACKGROUND_COLOR,
- CVSDecoratorConfiguration.OUTGOING_CHANGE_FOREGROUND_COLOR,
- CVSDecoratorConfiguration.IGNORED_BACKGROUND_COLOR,
- CVSDecoratorConfiguration.IGNORED_FOREGROUND_COLOR};
-
- public CVSLightweightDecorator() {
- ResourceStateChangeListeners.getListener().addResourceStateChangeListener(this);
- TeamUI.addPropertyChangeListener(this);
- CVSUIPlugin.addPropertyChangeListener(this);
-
- // This is an optimization to ensure that while decorating our fonts and colors are
- // pre-created and decoration can occur without having to syncExec.
- ensureFontAndColorsCreated(fonts, colors);
-
- PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().addPropertyChangeListener(this);
- CVSProviderPlugin.broadcastDecoratorEnablementChanged(true /* enabled */);
- }
-
- /**
- * This method will ensure that the fonts and colors used by the decorator
- * are cached in the registries. This avoids having to syncExec when
- * decorating since we ensure that the fonts and colors are pre-created.
- *
- * @param fonts fonts ids to cache
- * @param colors color ids to cache
- */
- private void ensureFontAndColorsCreated(final String[] fonts, final String[] colors) {
- CVSUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- public void run() {
- ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
- for (int i = 0; i < colors.length; i++) {
- theme.getColorRegistry().get(colors[i]);
-
- }
- for (int i = 0; i < fonts.length; i++) {
- theme.getFontRegistry().get(fonts[i]);
- }
- }
- });
- }
-
- public static boolean isDirty(final ICVSResource cvsResource) throws CVSException {
- return !cvsResource.isIgnored() && cvsResource.isModified(null);
- }
-
- public static boolean isDirty(IResource resource) {
-
- // No need to decorate non-existant resources
- if (!resource.exists()) return false;
-
- try {
- return isDirty(CVSWorkspaceRoot.getCVSResourceFor(resource));
- } catch (CVSException e) {
- //if we get an error report it to the log but assume dirty.
- boolean accessible = resource.getProject().isAccessible();
- if (accessible) {
- // We only care about the failure if the project is open
- handleException(e);
- }
- // Return dirty if the project is open and clean otherwise
- return accessible;
- }
-
- }
-
- /*
- * Answers null if a provider does not exist or the provider is not a CVS provider. These resources
- * will be ignored by the decorator.
- */
- private CVSTeamProvider getCVSProviderFor(IResource resource) {
- RepositoryProvider p =
- RepositoryProvider.getProvider(
- resource.getProject(),
- CVSProviderPlugin.getTypeId());
- if (p == null) {
- return null;
- }
- return (CVSTeamProvider) p;
- }
-
- /**
- * Returns the resource for the given input object, or
- * null if there is no resource associated with it.
- *
- * @param object the object to find the resource for
- * @return the resource for the given object, or null
- */
- private IResource getResource(Object object) {
- if (object instanceof IResource) {
- return (IResource) object;
- }
- if (object instanceof IAdaptable) {
- return (IResource) ((IAdaptable) object).getAdapter(
- IResource.class);
- }
- return null;
- }
-
- /**
- * This method should only be called by the decorator thread.
- *
- * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object, org.eclipse.jface.viewers.IDecoration)
- */
- public void decorate(Object element, IDecoration decoration) {
- IResource resource = getResource(element);
- if (resource == null || resource.getType() == IResource.ROOT)
- return;
-
- CVSTeamProvider cvsProvider = getCVSProviderFor(resource);
- if (cvsProvider == null)
- return;
-
- try {
- CVSDecoration cvsDecoration = decorate(resource);
- cvsDecoration.setWatchEditEnabled(cvsProvider.isWatchEditEnabled());
- cvsDecoration.apply(decoration);
- } catch(CVSException e) {
- handleException(e);
- } catch (IllegalStateException e) {
- // This is thrown by Core if the workspace is in an illegal state
- // If we are not active, ignore it. Otherwise, propogate it.
- // (see bug 78303)
- if (Platform.getBundle(CVSUIPlugin.ID).getState() == Bundle.ACTIVE) {
- throw e;
- }
- }
- }
-
- public static CVSDecoration decorate(IResource resource) throws CVSException {
- IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- CVSDecoration cvsDecoration = new CVSDecoration(resource.getName());
- cvsDecoration.setResourceType(resource.getType());
-
- if (cvsResource.isIgnored()) {
- cvsDecoration.setIgnored(true);
- }
- if (!cvsDecoration.isIgnored()) {
- // Dirty
- boolean computeDeepDirtyCheck = store.getBoolean(ICVSUIConstants.PREF_CALCULATE_DIRTY);
- int type = resource.getType();
- if (type == IResource.FILE || computeDeepDirtyCheck) {
- cvsDecoration.setDirty(CVSLightweightDecorator.isDirty(resource));
- }
- // Tag
- CVSTag tag = getTagToShow(resource);
- if (tag != null) {
- String name = tag.getName();
- if (tag.getType() == CVSTag.DATE) {
- Date date = tag.asDate();
- if (date != null) {
- name = decorateFormatter.format(date);
- }
- }
- cvsDecoration.setTag(name);
- }
- // Has a remote
- cvsDecoration.setHasRemote(CVSWorkspaceRoot.hasRemote(resource));
- // Is a new resource
- if (store.getBoolean(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION)) {
- if (cvsResource.exists()) {
- if (cvsResource.isFolder()) {
- if (!((ICVSFolder) cvsResource).isCVSFolder()) {
- cvsDecoration.setNewResource(true);
- }
- } else if (!cvsResource.isManaged()) {
- cvsDecoration.setNewResource(true);
- }
- }
- }
- }
- // Extract type specific properties
- if (resource.getType() == IResource.FILE) {
- extractFileProperties((IFile) resource, cvsDecoration);
- } else {
- extractContainerProperties((IContainer) resource, cvsDecoration);
- }
- return cvsDecoration;
- }
-
- private static void extractContainerProperties(IContainer resource, CVSDecoration cvsDecoration) throws CVSException {
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(resource);
- FolderSyncInfo folderInfo = folder.getFolderSyncInfo();
- if (folderInfo != null) {
- cvsDecoration.setLocation(KnownRepositories.getInstance().getRepository(folderInfo.getRoot()));
- cvsDecoration.setRepository(folderInfo.getRepository());
- cvsDecoration.setVirtualFolder(folderInfo.isVirtualDirectory());
- }
- }
-
- private static void extractFileProperties(IFile resource, CVSDecoration cvsDecoration) throws CVSException {
- ICVSFile file = CVSWorkspaceRoot.getCVSFileFor(resource);
- ResourceSyncInfo fileInfo = file.getSyncInfo();
- KSubstOption option = KSubstOption.fromFile((IFile) resource);
- if (fileInfo != null) {
- cvsDecoration.setAdded(fileInfo.isAdded());
- cvsDecoration.setRevision(fileInfo.getRevision());
- cvsDecoration.setReadOnly(file.isReadOnly());
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile) resource);
- cvsDecoration.setNeedsMerge(fileInfo.isNeedsMerge(file.getTimeStamp()));
- option = fileInfo.getKeywordMode();
- }
- cvsDecoration.setKeywordSubstitution(option.getShortDisplayText());
- }
-
- /**
- * Only show the tag if the resources tag is different than the parents. Or else, tag
- * names will clutter the text decorations.
- */
- protected static CVSTag getTagToShow(IResource resource) throws CVSException {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- CVSTag tag = null;
-
- // for unmanaged resources don't show a tag since they will be added in
- // the context of their parents tag. For managed resources only show tags
- // if different than parent.
- boolean managed = false;
-
- if(cvsResource.isFolder()) {
- FolderSyncInfo folderInfo = ((ICVSFolder)cvsResource).getFolderSyncInfo();
- if(folderInfo != null) {
- tag = folderInfo.getTag();
- managed = true;
- }
- } else {
- ResourceSyncInfo info = ((ICVSFile)cvsResource).getSyncInfo();
- if(info != null) {
- tag = info.getTag();
- managed = true;
- }
- }
-
- ICVSFolder parent = cvsResource.getParent();
- if(parent != null && managed) {
- FolderSyncInfo parentInfo = parent.getFolderSyncInfo();
- if(parentInfo != null) {
- CVSTag parentTag = parentInfo.getTag();
- parentTag = (parentTag == null ? CVSTag.DEFAULT : parentTag);
- tag = (tag == null ? CVSTag.DEFAULT : tag);
- // must compare tags by name because CVS doesn't do a good job of
- // using T and N prefixes for folders and files.
- if( parentTag.getName().equals(tag.getName())) {
- tag = null;
- }
- }
- }
- return tag;
- }
-
- /*
- * Add resource and its parents to the List
- */
-
- private void addWithParents(IResource resource, Set resources) {
- IResource current = resource;
-
- while (current.getType() != IResource.ROOT) {
- resources.add(current);
- current = current.getParent();
- }
- }
-
- /*
- * Perform a blanket refresh of all CVS decorations
- */
- public static void refresh() {
- CVSUIPlugin.getPlugin().getWorkbench().getDecoratorManager().update(CVSUIPlugin.DECORATOR_ID);
- }
-
- /*
- * Update the decorators for every resource in project
- */
-
- public void refresh(IProject project) {
- final List resources = new ArrayList();
- try {
- project.accept(new IResourceVisitor() {
- public boolean visit(IResource resource) {
- resources.add(resource);
- return true;
- }
- });
- postLabelEvent(new LabelProviderChangedEvent(this, resources.toArray()));
- } catch (CoreException e) {
- handleException(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.IResourceStateChangeListener#resourceSyncInfoChanged(org.eclipse.core.resources.IResource[])
- */
- public void resourceSyncInfoChanged(IResource[] changedResources) {
- resourceStateChanged(changedResources);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.IResourceStateChangeListener#externalSyncInfoChange(org.eclipse.core.resources.IResource[])
- */
- public void externalSyncInfoChange(IResource[] changedResources) {
- resourceStateChanged(changedResources);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.IResourceStateChangeListener#resourceModificationStateChanged(org.eclipse.core.resources.IResource[])
- */
- public void resourceModified(IResource[] changedResources) {
- resourceStateChanged(changedResources);
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.core.IResourceStateChangeListener#resourceStateChanged(org.eclipse.core.resources.IResource[])
- */
- public void resourceStateChanged(IResource[] changedResources) {
- // add depth first so that update thread processes parents first.
- //System.out.println(">> State Change Event");
- Set resourcesToUpdate = new HashSet();
-
- IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- boolean showingDeepDirtyIndicators = store.getBoolean(ICVSUIConstants.PREF_CALCULATE_DIRTY);
-
- for (int i = 0; i < changedResources.length; i++) {
- IResource resource = changedResources[i];
-
- if(showingDeepDirtyIndicators) {
- addWithParents(resource, resourcesToUpdate);
- } else {
- resourcesToUpdate.add(resource);
- }
- }
-
- postLabelEvent(new LabelProviderChangedEvent(this, resourcesToUpdate.toArray()));
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.core.IResourceStateChangeListener#projectConfigured(org.eclipse.core.resources.IProject)
- */
- public void projectConfigured(IProject project) {
- refresh(project);
- }
- /**
- * @see org.eclipse.team.internal.ccvs.core.IResourceStateChangeListener#projectDeconfigured(org.eclipse.core.resources.IProject)
- */
- public void projectDeconfigured(IProject project) {
- refresh(project);
- }
-
- /**
- * Post the label event to the UI thread
- *
- * @param events the events to post
- */
- private void postLabelEvent(final LabelProviderChangedEvent event) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- fireLabelProviderChanged(event);
- }
- });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
- */
- public void dispose() {
- super.dispose();
- PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().removePropertyChangeListener(this);
- CVSProviderPlugin.broadcastDecoratorEnablementChanged(false /* disabled */);
- TeamUI.removePropertyChangeListener(this);
- CVSUIPlugin.removePropertyChangeListener(this);
- }
-
- /**
- * Handle exceptions that occur in the decorator.
- */
- private static void handleException(Exception e) {
- exceptions.handleException(e);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if (isEventOfInterest(event)) {
- ensureFontAndColorsCreated(fonts, colors);
- refresh();
- }
- }
-
- private boolean isEventOfInterest(PropertyChangeEvent event) {
- String prop = event.getProperty();
- return prop.equals(TeamUI.GLOBAL_IGNORES_CHANGED)
- || prop.equals(TeamUI.GLOBAL_FILE_TYPES_CHANGED)
- || prop.equals(CVSUIPlugin.P_DECORATORS_CHANGED)
- || prop.equals(CVSDecoratorConfiguration.OUTGOING_CHANGE_BACKGROUND_COLOR)
- || prop.equals(CVSDecoratorConfiguration.OUTGOING_CHANGE_FOREGROUND_COLOR)
- || prop.equals(CVSDecoratorConfiguration.OUTGOING_CHANGE_FONT)
- || prop.equals(CVSDecoratorConfiguration.IGNORED_FOREGROUND_COLOR)
- || prop.equals(CVSDecoratorConfiguration.IGNORED_BACKGROUND_COLOR)
- || prop.equals(CVSDecoratorConfiguration.IGNORED_FONT);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPerspective.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPerspective.java
deleted file mode 100644
index 99ace83e2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPerspective.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import org.eclipse.team.internal.ccvs.ui.repo.*;
-import org.eclipse.team.ui.synchronize.ISynchronizeView;
-import org.eclipse.ui.*;
-
-public class CVSPerspective implements IPerspectiveFactory {
-
- public final static String ID = "org.eclipse.team.cvs.ui.cvsPerspective"; //$NON-NLS-1$
-
- /* (Non-javadoc)
- * Method declared on IPerpsectiveFactory
- */
- public void createInitialLayout(IPageLayout layout) {
- defineActions(layout);
- defineLayout(layout);
- }
-
- /**
- * Defines the initial actions for a page.
- */
- public void defineActions(IPageLayout layout) {
-
- // Add "new wizards".
- layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.project"); //$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder"); //$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file"); //$NON-NLS-1$
-
- // Add "show views".
- layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
- layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
- layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
- layout.addShowViewShortcut(HistoryView.VIEW_ID);
- layout.addShowViewShortcut(RepositoriesView.VIEW_ID);
- layout.addShowViewShortcut(ISynchronizeView.VIEW_ID);
-
- // Add "perspective short cut"
- layout.addPerspectiveShortcut("org.eclipse.ui.resourcePerspective"); //$NON-NLS-1$
- layout.addPerspectiveShortcut("org.eclipse.team.ui.TeamSynchronizingPerspective"); //$NON-NLS-1$
- }
-
- /**
- * Defines the initial layout for a page.
- */
- public void defineLayout(IPageLayout layout) {
- String editorArea = layout.getEditorArea();
- IFolderLayout top =
- layout.createFolder("top", IPageLayout.LEFT, 0.40f, editorArea); //$NON-NLS-1$
- top.addView(RepositoriesView.VIEW_ID);
- layout.addView(HistoryView.VIEW_ID, IPageLayout.BOTTOM, 0.70f, editorArea);
- layout.setEditorAreaVisible(true);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java
deleted file mode 100644
index d9cba7fbf..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java
+++ /dev/null
@@ -1,477 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.*;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.FontMetrics;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
-import org.eclipse.team.internal.ccvs.core.client.Command.QuietOption;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * CVS Preference Page
- *
- * Allows the configuration of CVS specific options.
- * The currently supported options are:
- * - Allow loading of CVS administration directory (CVSROOT)
- *
- * There are currently a couple of deficiencies:
- * 1. The Repository view is not refreshed when the show CVSROOT option is changed
- * 2. There is no help associated with the page
- */
-public class CVSPreferencesPage extends PreferencePage implements IWorkbenchPreferencePage {
-
- private Button pruneEmptyDirectoriesField;
- private Text timeoutValue;
- private Combo quietnessCombo;
- private Combo compressionLevelCombo;
- private Combo ksubstCombo;
- private Button usePlatformLineend;
- private List ksubstOptions;
- private Button replaceUnmanaged;
- private Button repositoriesAreBinary;
- private Button determineVersionEnabled;
- private Button confirmMoveTag;
- private Button debugProtocol;
-
- private Button never;
- private Button prompt;
- private Button auto;
-
- public CVSPreferencesPage() {
- // sort the options by display text
- setDescription(Policy.bind("CVSPreferencePage.description")); //$NON-NLS-1$
- KSubstOption[] options = KSubstOption.getAllKSubstOptions();
- this.ksubstOptions = new ArrayList();
- for (int i = 0; i < options.length; i++) {
- KSubstOption option = options[i];
- if (! option.isBinary()) {
- ksubstOptions.add(option);
- }
- }
- Collections.sort(ksubstOptions, new Comparator() {
- public int compare(Object a, Object b) {
- String aKey = ((KSubstOption) a).getLongDisplayText();
- String bKey = ((KSubstOption) b).getLongDisplayText();
- return aKey.compareTo(bKey);
- }
- });
- }
-
- /**
- * Utility method that creates a combo box
- *
- * @param parent the parent for the new label
- * @return the new widget
- */
- protected Combo createCombo(Composite parent, int widthChars) {
- Combo combo = new Combo(parent, SWT.READ_ONLY);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- GC gc = new GC(combo);
- gc.setFont(combo.getFont());
- FontMetrics fontMetrics = gc.getFontMetrics();
- data.widthHint = Dialog.convertWidthInCharsToPixels(fontMetrics, widthChars);
- gc.dispose();
- combo.setLayoutData(data);
- return combo;
- }
-
- /**
- * Utility method that creates a combo box
- *
- * @param parent the parent for the new label
- * @return the new widget
- */
- protected Combo createCombo(Composite parent) {
- Combo combo = new Combo(parent, SWT.READ_ONLY);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- combo.setLayoutData(data);
- return combo;
- }
-
- /**
- * Creates composite control and sets the default layout data.
- *
- * @param parent the parent of the new composite
- * @param numColumns the number of columns for the new composite
- * @return the newly-created coposite
- */
- private Composite createComposite(Composite parent, int numColumns) {
- Composite composite = new Composite(parent, SWT.NULL);
-
- //GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
-
- //GridData
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- composite.setLayoutData(data);
- return composite;
- }
-
- /**
- * Creates an new checkbox instance and sets the default
- * layout data.
- *
- * @param group the composite in which to create the checkbox
- * @param label the string to set into the checkbox
- * @return the new checkbox
- */
- private Button createCheckBox(Composite group, String label) {
- Button button = new Button(group, SWT.CHECK | SWT.LEFT);
- button.setText(label);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- button.setLayoutData(data);
- return button;
- }
-
- /**
- * @see PreferencePage#createContents(Composite)
- */
- protected Control createContents(Composite parent) {
- Composite composite = createComposite(parent, 2);
-
- pruneEmptyDirectoriesField = createCheckBox(composite, Policy.bind("CVSPreferencePage.pruneEmptyDirectories")); //$NON-NLS-1$
- replaceUnmanaged = createCheckBox(composite, Policy.bind("CVSPreferencePage.replaceUnmanaged")); //$NON-NLS-1$
- repositoriesAreBinary = createCheckBox(composite, Policy.bind("CVSPreferencePage.repositoriesAreBinary")); //$NON-NLS-1$
- determineVersionEnabled = createCheckBox(composite, Policy.bind("CVSPreferencePage.determineVersionEnabled")); //$NON-NLS-1$
- confirmMoveTag = createCheckBox(composite, Policy.bind("CVSPreferencePage.confirmMoveTag")); //$NON-NLS-1$
- debugProtocol = createCheckBox(composite, Policy.bind("CVSPreferencePage.debugProtocol")); //$NON-NLS-1$
- usePlatformLineend = createCheckBox(composite, Policy.bind("CVSPreferencePage.lineend")); //$NON-NLS-1$
-
- createLabel(composite, ""); createLabel(composite, ""); //$NON-NLS-1$ //$NON-NLS-2$
-
- createLabel(composite, Policy.bind("CVSPreferencePage.timeoutValue")); //$NON-NLS-1$
- timeoutValue = createTextField(composite);
- timeoutValue.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- // Parse the timeout value
- try {
- int x = Integer.parseInt(timeoutValue.getText());
- if (x >= 0) {
- setErrorMessage(null);
- setValid(true);
- } else {
- setErrorMessage(Policy.bind("CVSPreferencesPage.Timeout_must_not_be_negative_1")); //$NON-NLS-1$
- setValid(false);
- }
- } catch (NumberFormatException ex) {
- setErrorMessage(Policy.bind("CVSPreferencesPage.Timeout_must_be_a_number_2")); //$NON-NLS-1$
- setValid(false);
- }
- }
- });
-
- createLabel(composite, Policy.bind("CVSPreferencePage.quietness")); //$NON-NLS-1$
- quietnessCombo = createCombo(composite);
-
- createLabel(composite, Policy.bind("CVSPreferencePage.compressionLevel")); //$NON-NLS-1$
- compressionLevelCombo = createCombo(composite);
-
- createLabel(composite, Policy.bind("CVSPreferencePage.defaultTextKSubst")); //$NON-NLS-1$
- int chars = 0;
- for (Iterator it = ksubstOptions.iterator(); it.hasNext();) {
- KSubstOption option = (KSubstOption) it.next();
- int c = option.getLongDisplayText().length();
- if(c > chars) {
- chars = c;
- }
- }
- ksubstCombo = createCombo(composite, chars);
-
- createLabel(composite, ""); createLabel(composite, ""); //$NON-NLS-1$ //$NON-NLS-2$
-
- createSaveCombo(composite);
-
- initializeValues();
-
- quietnessCombo.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- if (getQuietnessOptionFor(quietnessCombo.getSelectionIndex()).equals(Command.SILENT)) {
- MessageDialog.openWarning(getShell(), Policy.bind("CVSPreferencePage.silentWarningTitle"), Policy.bind("CVSPreferencePage.silentWarningMessage")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- });
-
- WorkbenchHelp.setHelp(pruneEmptyDirectoriesField, IHelpContextIds.PREF_PRUNE);
- WorkbenchHelp.setHelp(compressionLevelCombo, IHelpContextIds.PREF_COMPRESSION);
- WorkbenchHelp.setHelp(quietnessCombo, IHelpContextIds.PREF_QUIET);
- WorkbenchHelp.setHelp(ksubstCombo, IHelpContextIds.PREF_KEYWORDMODE);
- WorkbenchHelp.setHelp(usePlatformLineend, IHelpContextIds.PREF_LINEEND);
- WorkbenchHelp.setHelp(timeoutValue, IHelpContextIds.PREF_COMMS_TIMEOUT);
- WorkbenchHelp.setHelp(replaceUnmanaged, IHelpContextIds.PREF_REPLACE_DELETE_UNMANAGED);
- WorkbenchHelp.setHelp(repositoriesAreBinary, IHelpContextIds.PREF_TREAT_NEW_FILE_AS_BINARY);
- WorkbenchHelp.setHelp(determineVersionEnabled, IHelpContextIds.PREF_DETERMINE_SERVER_VERSION);
- WorkbenchHelp.setHelp(confirmMoveTag, IHelpContextIds.PREF_CONFIRM_MOVE_TAG);
- Dialog.applyDialogFont(parent);
- return composite;
- }
- /**
- * Utility method that creates a label instance
- * and sets the default layout data.
- *
- * @param parent the parent for the new label
- * @param text the text for the new label
- * @return the new label
- */
- private Label createLabel(Composite parent, String text) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = 1;
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
- return label;
- }
- /**
- * Creates an new text widget and sets the default
- * layout data.
- *
- * @param group the composite in which to create the checkbox
- * @return the new text widget
- */
- private Text createTextField(Composite group) {
- Text text = new Text(group, SWT.BORDER);
- text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- return text;
- }
- /**
- * Initializes states of the controls from the preference store.
- */
- private void initializeValues() {
- IPreferenceStore store = getPreferenceStore();
- pruneEmptyDirectoriesField.setSelection(store.getBoolean(ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES));
- timeoutValue.setText(new Integer(store.getInt(ICVSUIConstants.PREF_TIMEOUT)).toString());
- repositoriesAreBinary.setSelection(store.getBoolean(ICVSUIConstants.PREF_REPOSITORIES_ARE_BINARY));
- quietnessCombo.add(Policy.bind("CVSPreferencePage.notquiet")); //$NON-NLS-1$
- quietnessCombo.add(Policy.bind("CVSPreferencePage.somewhatquiet")); //$NON-NLS-1$
- quietnessCombo.add(Policy.bind("CVSPreferencePage.reallyquiet")); //$NON-NLS-1$
- quietnessCombo.select(store.getInt(ICVSUIConstants.PREF_QUIETNESS));
- for (int i = 0; i < 10; ++i) {
- compressionLevelCombo.add(Policy.bind("CVSPreferencePage.level" + i)); //$NON-NLS-1$
- }
- compressionLevelCombo.select(store.getInt(ICVSUIConstants.PREF_COMPRESSION_LEVEL));
- for (Iterator it = ksubstOptions.iterator(); it.hasNext();) {
- KSubstOption option = (KSubstOption) it.next();
- ksubstCombo.add(option.getLongDisplayText());
- }
- ksubstCombo.select(getKSubstComboIndexFor(store.getString(ICVSUIConstants.PREF_TEXT_KSUBST)));
- usePlatformLineend.setSelection(store.getBoolean(ICVSUIConstants.PREF_USE_PLATFORM_LINEEND));
- replaceUnmanaged.setSelection(store.getBoolean(ICVSUIConstants.PREF_REPLACE_UNMANAGED));
- determineVersionEnabled.setSelection(store.getBoolean(ICVSUIConstants.PREF_DETERMINE_SERVER_VERSION));
- confirmMoveTag.setSelection(store.getBoolean(ICVSUIConstants.PREF_CONFIRM_MOVE_TAG));
- debugProtocol.setSelection(store.getBoolean(ICVSUIConstants.PREF_DEBUG_PROTOCOL));
-
- initializeSaveRadios(store.getInt(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS));
- }
-
- /**
- * @see IWorkbenchPreferencePage#init(IWorkbench)
- */
- public void init(IWorkbench workbench) {
- }
-
- /**
- * OK was clicked. Store the CVS preferences.
- *
- * @return whether it is okay to close the preference page
- */
- public boolean performOk() {
-
- // Parse the timeout value
- int timeout = Integer.parseInt(timeoutValue.getText());
-
- IPreferenceStore store = getPreferenceStore();
-
- // set the provider preferences first because the preference change
- // listeners invoked from the preference store change may need these
- // values
-
- store.setValue(ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES, pruneEmptyDirectoriesField.getSelection());
- store.setValue(ICVSUIConstants.PREF_TIMEOUT, timeout);
- store.setValue(ICVSUIConstants.PREF_QUIETNESS, quietnessCombo.getSelectionIndex());
- store.setValue(ICVSUIConstants.PREF_COMPRESSION_LEVEL, compressionLevelCombo.getSelectionIndex());
- // Text mode processed separately to avoid empty string in properties file.
- String mode =((KSubstOption)ksubstOptions.get(ksubstCombo.getSelectionIndex())).toMode();
- if (mode.length() == 0) {
- mode = "-kkv"; //$NON-NLS-1$
- }
- store.setValue(ICVSUIConstants.PREF_TEXT_KSUBST, mode);
- store.setValue(ICVSUIConstants.PREF_USE_PLATFORM_LINEEND, usePlatformLineend.getSelection());
- store.setValue(ICVSUIConstants.PREF_REPLACE_UNMANAGED, replaceUnmanaged.getSelection());
- store.setValue(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS, getSaveRadio());
- store.setValue(ICVSUIConstants.PREF_REPOSITORIES_ARE_BINARY, repositoriesAreBinary.getSelection());
- store.setValue(ICVSUIConstants.PREF_DETERMINE_SERVER_VERSION, determineVersionEnabled.getSelection());
- store.setValue(ICVSUIConstants.PREF_CONFIRM_MOVE_TAG, confirmMoveTag.getSelection());
- store.setValue(ICVSUIConstants.PREF_DEBUG_PROTOCOL, debugProtocol.getSelection());
-
- CVSProviderPlugin.getPlugin().setReplaceUnmanaged(
- store.getBoolean(ICVSUIConstants.PREF_REPLACE_UNMANAGED));
- CVSProviderPlugin.getPlugin().setPruneEmptyDirectories(
- store.getBoolean(ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES));
- CVSProviderPlugin.getPlugin().setTimeout(
- store.getInt(ICVSUIConstants.PREF_TIMEOUT));
- CVSProviderPlugin.getPlugin().setQuietness(
- getQuietnessOptionFor(store.getInt(ICVSUIConstants.PREF_QUIETNESS)));
- CVSProviderPlugin.getPlugin().setCompressionLevel(
- store.getInt(ICVSUIConstants.PREF_COMPRESSION_LEVEL));
- CVSProviderPlugin.getPlugin().setDebugProtocol(
- store.getBoolean(ICVSUIConstants.PREF_DEBUG_PROTOCOL));
- CVSProviderPlugin.getPlugin().setRepositoriesAreBinary(store.getBoolean(ICVSUIConstants.PREF_REPOSITORIES_ARE_BINARY));
- KSubstOption oldKSubst = CVSProviderPlugin.getPlugin().getDefaultTextKSubstOption();
- KSubstOption newKSubst = KSubstOption.fromMode(store.getString(ICVSUIConstants.PREF_TEXT_KSUBST));
- CVSProviderPlugin.getPlugin().setDefaultTextKSubstOption(newKSubst);
- CVSProviderPlugin.getPlugin().setUsePlatformLineend(
- store.getBoolean(ICVSUIConstants.PREF_USE_PLATFORM_LINEEND));
- CVSProviderPlugin.getPlugin().setDetermineVersionEnabled(store.getBoolean(ICVSUIConstants.PREF_DETERMINE_SERVER_VERSION));
- CVSProviderPlugin.getPlugin().setConfirmMoveTagEnabled(store.getBoolean(ICVSUIConstants.PREF_CONFIRM_MOVE_TAG));
-
- // changing the default keyword substitution mode for text files may affect
- // information displayed in the decorators
- if (! oldKSubst.equals(newKSubst)) {
- CVSUIPlugin.broadcastPropertyChange(new PropertyChangeEvent(this, CVSUIPlugin.P_DECORATORS_CHANGED, null, null));
- }
-
- CVSUIPlugin.getPlugin().savePluginPreferences();
- return true;
- }
-
- /**
- * Defaults was clicked. Restore the CVS preferences to
- * their default values
- */
- protected void performDefaults() {
- super.performDefaults();
- IPreferenceStore store = getPreferenceStore();
- pruneEmptyDirectoriesField.setSelection(
- store.getDefaultBoolean(ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES));
- timeoutValue.setText(new Integer(store.getDefaultInt(ICVSUIConstants.PREF_TIMEOUT)).toString());
- quietnessCombo.select(store.getDefaultInt(ICVSUIConstants.PREF_QUIETNESS));
- compressionLevelCombo.select(store.getDefaultInt(ICVSUIConstants.PREF_COMPRESSION_LEVEL));
- ksubstCombo.select(getKSubstComboIndexFor(store.getDefaultString(ICVSUIConstants.PREF_TEXT_KSUBST)));
- usePlatformLineend.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_USE_PLATFORM_LINEEND));
- replaceUnmanaged.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_REPLACE_UNMANAGED));
- initializeSaveRadios(store.getDefaultInt(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS));
- repositoriesAreBinary.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_REPOSITORIES_ARE_BINARY));
- confirmMoveTag.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_CONFIRM_MOVE_TAG));
- debugProtocol.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_DEBUG_PROTOCOL));
- }
-
- private void createSaveCombo(Composite composite) {
- Group group = new Group(composite, SWT.NULL);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- data.horizontalSpan = 2;
- group.setLayoutData(data);
- GridLayout layout = new GridLayout();
- group.setLayout(layout);
- group.setText(Policy.bind("CVSPreferencePage.Save_dirty_editors_before_CVS_operations_1")); //$NON-NLS-1$
-
- never = new Button(group, SWT.RADIO | SWT.LEFT);
- never.setLayoutData(new GridData());
- never.setText(Policy.bind("CVSPreferencePage.&Never_2")); //$NON-NLS-1$
-
- prompt = new Button(group, SWT.RADIO | SWT.LEFT);
- prompt.setLayoutData(new GridData());
- prompt.setText(Policy.bind("CVSPreferencePage.&Prompt_3")); //$NON-NLS-1$
-
- auto = new Button(group, SWT.RADIO | SWT.LEFT);
- auto.setLayoutData(new GridData());
- auto.setText(Policy.bind("CVSPreferencePage.Auto-&save_4")); //$NON-NLS-1$
-
- WorkbenchHelp.setHelp(group, IHelpContextIds.PREF_SAVE_DIRTY_EDITORS);
- }
-
- /**
- * Returns preference store that belongs to the our plugin.
- * This is important because we want to store
- * our preferences separately from the desktop.
- *
- * @return the preference store for this plugin
- */
- protected IPreferenceStore doGetPreferenceStore() {
- return CVSUIPlugin.getPlugin().getPreferenceStore();
- }
-
- protected static QuietOption getQuietnessOptionFor(int option) {
- switch (option) {
- case 0: return Command.VERBOSE;
- case 1: return Command.PARTLY_QUIET;
- case 2: return Command.SILENT;
- }
- return null;
- }
-
- protected int getKSubstComboIndexFor(String mode) {
- KSubstOption ksubst = KSubstOption.fromMode(mode);
- int i = 0;
- for (Iterator it = ksubstOptions.iterator(); it.hasNext();) {
- KSubstOption option = (KSubstOption) it.next();
- if (ksubst.equals(option)) return i;
- i++;
- }
- // unknown option, add it to the list
- ksubstOptions.add(ksubst);
- ksubstCombo.add(ksubst.getLongDisplayText());
- return i;
- }
-
- protected void initializeSaveRadios(int option) {
- auto.setSelection(false);
- never.setSelection(false);
- prompt.setSelection(false);
- switch(option) {
- case ICVSUIConstants.OPTION_AUTOMATIC:
- auto.setSelection(true); break;
- case ICVSUIConstants.OPTION_NEVER:
- never.setSelection(true); break;
- case ICVSUIConstants.OPTION_PROMPT:
- prompt.setSelection(true); break;
- }
- }
-
- protected int getSaveRadio() {
- if(auto.getSelection()) {
- return ICVSUIConstants.OPTION_AUTOMATIC;
- } else if(never.getSelection()) {
- return ICVSUIConstants.OPTION_NEVER;
- } else {
- return ICVSUIConstants.OPTION_PROMPT;
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java
deleted file mode 100644
index e4948bf04..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java
+++ /dev/null
@@ -1,473 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableViewer;
-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.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.ICVSResourceVisitor;
-import org.eclipse.team.internal.ccvs.core.IUserInfo;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-public class CVSProjectPropertiesPage extends CVSPropertiesPage {
- IProject project;
- ICVSRepositoryLocation oldLocation;
- ICVSRepositoryLocation newLocation = null;
-
- private static final int TABLE_HEIGHT_HINT = 150;
-
- // Widgets
- Text methodText;
- Text userText;
- Text hostText;
- Text pathText;
- Text moduleText;
- Text portText;
- Text tagText;
- private Button fetchButton;
- private Button watchEditButton;
-
- IUserInfo info;
- CVSTeamProvider provider;
- private boolean fetch;
- private boolean watchEdit;
-
- public static boolean isCompatible(ICVSRepositoryLocation location, ICVSRepositoryLocation oldLocation) {
- if (!location.getHost().equals(oldLocation.getHost())) return false;
- if (!location.getRootDirectory().equals(oldLocation.getRootDirectory())) return false;
- if (location.equals(oldLocation)) return false;
- return true;
- }
-
- private class RepositorySelectionDialog extends Dialog {
- ICVSRepositoryLocation[] allLocations;
- ICVSRepositoryLocation[] compatibleLocatons;
- ICVSRepositoryLocation selectedLocation;
-
- TableViewer viewer;
- Button okButton;
- boolean showCompatible = true;
-
- public RepositorySelectionDialog(Shell shell, ICVSRepositoryLocation oldLocation) {
- super(shell);
- initialize(oldLocation);
- }
- private void initialize(ICVSRepositoryLocation oldLocation) {
- allLocations = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownRepositoryLocations();
- List locations = new ArrayList();
- for (int i = 0; i < allLocations.length; i++) {
- ICVSRepositoryLocation location = allLocations[i];
- if (isCompatible(location, oldLocation)) {
- locations.add(location);
- }
- }
- compatibleLocatons = (ICVSRepositoryLocation[]) locations.toArray(new ICVSRepositoryLocation[locations.size()]);
- }
- protected void createButtonsForButtonBar(Composite parent) {
- // create OK and Cancel buttons by default
- okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- okButton.setEnabled(false);
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- }
- protected Control createDialogArea(Composite parent) {
- parent.getShell().setText(Policy.bind("CVSProjectPropertiesPage.Select_a_Repository_1")); //$NON-NLS-1$
- Composite composite = (Composite) super.createDialogArea(parent);
-
- createLabel(composite, Policy.bind("CVSProjectPropertiesPage.Select_a_CVS_repository_location_to_share_the_project_with__2"), 1); //$NON-NLS-1$
- Table table = new Table(composite, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.heightHint = TABLE_HEIGHT_HINT;
- table.setLayoutData(data);
- viewer = new TableViewer(table);
- viewer.setLabelProvider(new WorkbenchLabelProvider());
- viewer.setContentProvider(new WorkbenchContentProvider() {
- public Object[] getElements(Object inputElement) {
- if (showCompatible) {
- return compatibleLocatons;
- } else {
- return allLocations;
- }
- }
- });
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection)event.getSelection();
- if (selection.isEmpty()) {
- selectedLocation = null;
- okButton.setEnabled(false);
- } else {
- selectedLocation = (ICVSRepositoryLocation)selection.getFirstElement();
- okButton.setEnabled(true);
- }
- }
- });
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- okPressed();
- }
- });
- viewer.setInput(compatibleLocatons);
-
- final Button compatibleButton = createCheckBox(composite, Policy.bind("CVSProjectPropertiesPage.31")); //$NON-NLS-1$
- compatibleButton.setSelection(showCompatible);
- compatibleButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- showCompatible = compatibleButton.getSelection();
- viewer.refresh();
- }
- });
-
- Dialog.applyDialogFont(parent);
-
- return composite;
- }
- protected void cancelPressed() {
- selectedLocation = null;
- super.cancelPressed();
- }
- public ICVSRepositoryLocation getLocation() {
- return selectedLocation;
- }
- }
-
- /*
- * @see PreferencesPage#createContents
- */
- protected Control createContents(Composite parent) {
- initialize();
-
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
-
- Label label = createLabel(composite, Policy.bind("CVSProjectPropertiesPage.connectionType"), 1); //$NON-NLS-1$
- methodText = createReadOnlyText(composite, "", 1); //$NON-NLS-1$
-
- label = createLabel(composite, Policy.bind("CVSProjectPropertiesPage.user"), 1); //$NON-NLS-1$
- userText = createReadOnlyText(composite, "", 1); //$NON-NLS-1$
-
- label = createLabel(composite, Policy.bind("CVSPropertiesPage.host"), 1); //$NON-NLS-1$
- hostText = createReadOnlyText(composite, "", 1); //$NON-NLS-1$
-
- label = createLabel(composite, Policy.bind("CVSPropertiesPage.port"), 1); //$NON-NLS-1$
- portText = createReadOnlyText(composite, "", 1); //$NON-NLS-1$
-
- label = createLabel(composite, Policy.bind("CVSPropertiesPage.path"), 1); //$NON-NLS-1$
- pathText = createReadOnlyText(composite, "", 1); //$NON-NLS-1$
-
- label = createLabel(composite, Policy.bind("CVSPropertiesPage.module"), 1); //$NON-NLS-1$
- moduleText = createReadOnlyText(composite, "", 1); //$NON-NLS-1$
-
- label = createLabel(composite, Policy.bind("CVSPropertiesPage.tag"), 1); //$NON-NLS-1$
- tagText = createReadOnlyText(composite, "", 1); //$NON-NLS-1$
-
- createLabel(composite, "", 1); //$NON-NLS-1$
-
- // Should absent directories be fetched on update
- fetchButton = createCheckBox(composite, Policy.bind("CVSProjectPropertiesPage.fetchAbsentDirectoriesOnUpdate")); //$NON-NLS-1$
- fetchButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- fetch = fetchButton.getSelection();
- }
- });
-
- // Should the project be configured for watch/edit
- watchEditButton = createCheckBox(composite, Policy.bind("CVSProjectPropertiesPage.configureForWatchEdit")); //$NON-NLS-1$
- watchEditButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- watchEdit = watchEditButton.getSelection();
- }
- });
-
- createLabel(composite, "", 1); //$NON-NLS-1$
- createLabel(composite, "", 1); //$NON-NLS-1$
- createLabel(composite, "", 1); //$NON-NLS-1$
- createLabel(composite, "", 1); //$NON-NLS-1$
-
- label = new Label(composite, SWT.WRAP);
- label.setText(Policy.bind("CVSProjectPropertiesPage.You_can_change_the_sharing_of_this_project_to_another_repository_location._However,_this_is_only_possible_if_the_new_location_is___compatible___(on_the_same_host_with_the_same_repository_path)._1")); //$NON-NLS-1$
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = 200;
- data.horizontalSpan = 2;
- label.setLayoutData(data);
-
- Button changeButton = new Button(composite, SWT.PUSH);
- changeButton.setText(Policy.bind("CVSProjectPropertiesPage.Change_Sharing_5")); //$NON-NLS-1$
- changeButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- RepositorySelectionDialog dialog = new RepositorySelectionDialog(getShell(), oldLocation);
- dialog.open();
- ICVSRepositoryLocation location = dialog.getLocation();
- if (location == null) return;
- newLocation = location;
- initializeValues(newLocation);
- }
- });
-
- initializeValues(oldLocation);
- WorkbenchHelp.setHelp(getControl(), IHelpContextIds.PROJECT_PROPERTY_PAGE);
- Dialog.applyDialogFont(parent);
- return composite;
- }
- /**
- * Utility method that creates a label instance
- * and sets the default layout data.
- *
- * @param parent the parent for the new label
- * @param text the text for the new label
- * @return the new label
- */
- protected Label createLabel(Composite parent, String text, int span) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = span;
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
- return label;
- }
- /**
- * Utility method that creates a text instance
- * and sets the default layout data.
- *
- * @param parent the parent for the new label
- * @param text the text for the new text
- * @return the new text
- */
- protected Text createReadOnlyText(Composite parent, String text, int span) {
- Text txt = new Text(parent, SWT.LEFT | SWT.READ_ONLY);
- txt.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = span;
- data.horizontalAlignment = GridData.FILL;
- txt.setLayoutData(data);
- return txt;
- }
- /**
- * Creates a new checkbox instance and sets the default layout data.
- *
- * @param group the composite in which to create the checkbox
- * @param label the string to set into the checkbox
- * @return the new checkbox
- */
- protected Button createCheckBox(Composite group, String label) {
- Button button = new Button(group, SWT.CHECK | SWT.LEFT);
- button.setText(label);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- button.setLayoutData(data);
- return button;
- }
- /**
- * Initializes the page
- */
- private void initialize() {
- // Get the project that is the source of this property page
- project = null;
- IAdaptable element = getElement();
- if (element instanceof IProject) {
- project = (IProject)element;
- } else {
- Object adapter = element.getAdapter(IProject.class);
- if (adapter instanceof IProject) {
- project = (IProject)adapter;
- }
- }
- // Do some pre-checks to ensure we're in a good state
- provider = (CVSTeamProvider)RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId());
- if (provider == null) return;
- CVSWorkspaceRoot cvsRoot = provider.getCVSWorkspaceRoot();
- try {
- oldLocation = cvsRoot.getRemoteLocation();
- fetch = provider.getFetchAbsentDirectories();
- watchEdit = provider.isWatchEditEnabled();
- } catch (TeamException e) {
- handle(e);
- }
- }
- /**
- * Set the initial values of the widgets
- */
- private void initializeValues(ICVSRepositoryLocation location) {
- if (provider == null) return;
- CVSWorkspaceRoot cvsRoot = provider.getCVSWorkspaceRoot();
- ICVSFolder folder = cvsRoot.getLocalRoot();
-
- try {
- if (!folder.isCVSFolder()) return;
- methodText.setText(location.getMethod().getName());
- info = location.getUserInfo(true);
- userText.setText(info.getUsername());
- hostText.setText(location.getHost());
- int port = location.getPort();
- if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT) {
- portText.setText(Policy.bind("CVSPropertiesPage.defaultPort")); //$NON-NLS-1$
- } else {
- portText.setText("" + port); //$NON-NLS-1$
- }
- pathText.setText(location.getRootDirectory());
- FolderSyncInfo syncInfo = folder.getFolderSyncInfo();
- if (syncInfo == null) return;
- String label = syncInfo.getRepository();
- if (label.equals(FolderSyncInfo.VIRTUAL_DIRECTORY)) {
- label = Policy.bind("CVSPropertiesPage.virtualModule", label); //$NON-NLS-1$
- }
- moduleText.setText(label);
- fetchButton.setSelection(fetch);
- watchEditButton.setSelection(watchEdit);
- } catch (TeamException e) {
- handle(e);
- }
-
- initializeTag();
- }
-
- private void initializeTag() {
- provider = (CVSTeamProvider)RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId());
- if (provider == null) return;
- try {
- ICVSFolder local = CVSWorkspaceRoot.getCVSFolderFor(project);
- CVSTag tag = local.getFolderSyncInfo().getTag();
-
- tagText.setText(getTagLabel(tag));
-
- } catch (TeamException e) {
- handle(e);
- }
- }
- /*
- * @see PreferencesPage#performOk
- */
- public boolean performOk() {
- final boolean[] changeReadOnly = { false };
- try {
- if (fetch != provider.getFetchAbsentDirectories())
- provider.setFetchAbsentDirectories(fetch);
- if (watchEdit != provider.isWatchEditEnabled()) {
- provider.setWatchEditEnabled(watchEdit);
- changeReadOnly[0] = true;
- }
- } catch (CVSException e) {
- handle(e);
- }
- if (newLocation == null && !changeReadOnly[0]) {
- return true;
- }
- try {
- if (newLocation != null && !isCompatible(newLocation, oldLocation)) {
- if (!MessageDialog.openQuestion(getShell(), Policy.bind("CVSProjectPropertiesPage.32"), Policy.bind("CVSProjectPropertiesPage.33"))) { //$NON-NLS-1$ //$NON-NLS-2$
- return false;
- }
- }
- new ProgressMonitorDialog(getShell()).run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- monitor.beginTask(Policy.bind("CVSProjectPropertiesPage.progressTaskName"), //$NON-NLS-1$
- ((newLocation == null)?0:100) + (changeReadOnly[0]?100:0));
- if (newLocation != null)
- provider.setRemoteRoot(newLocation, Policy.subMonitorFor(monitor, 100));
- if (changeReadOnly[0])
- setReadOnly(watchEdit, Policy.infiniteSubMonitorFor(monitor, 100));
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- newLocation = null;
- if (changeReadOnly[0]) {
- CVSUIPlugin.broadcastPropertyChange(new PropertyChangeEvent(this, CVSUIPlugin.P_DECORATORS_CHANGED, null, null));
- }
- } catch (InvocationTargetException e) {
- handle(e);
- } catch (InterruptedException e) {
- return false;
- }
-
- return true;
- }
- /**
- * @param watchEdit
- */
- protected void setReadOnly(final boolean watchEdit, final IProgressMonitor monitor) throws CVSException {
- monitor.beginTask(null, 512);
- String taskName = watchEdit?
- Policy.bind("CVSProjectPropertiesPage.setReadOnly"): //$NON-NLS-1$
- Policy.bind("CVSProjectPropertiesPage.clearReadOnly"); //$NON-NLS-1$
- monitor.subTask(taskName);
- ICVSFolder root = CVSWorkspaceRoot.getCVSFolderFor(project);
- root.accept(new ICVSResourceVisitor() {
- public void visitFile(ICVSFile file) throws CVSException {
- // only change managed, unmodified files
- if (file.isManaged() && !file.isModified(null))
- file.setReadOnly(watchEdit);
- monitor.worked(1);
- }
-
- public void visitFolder(ICVSFolder folder) throws CVSException {
- folder.acceptChildren(this);
- }
- });
- monitor.done();
- }
- /**
- * Shows the given errors to the user.
- */
- protected void handle(Throwable t) {
- CVSUIPlugin.openError(getShell(), null, null, t);
- }
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectSetSerializer.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectSetSerializer.java
deleted file mode 100644
index 58c63e4aa..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectSetSerializer.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.IProjectSetSerializer;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFolder;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.operations.CheckoutSingleProjectOperation;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-public class CVSProjectSetSerializer implements IProjectSetSerializer {
-
- /**
- * @see IProjectSetSerializer#asReference(IProject[])
- *
- * "1.0,repoLocation,module,projectName[,tag]"
- */
- public String[] asReference(IProject[] providerProjects, Object context, IProgressMonitor monitor) throws TeamException {
- String[] result = new String[providerProjects.length];
- for (int i = 0; i < providerProjects.length; i++) {
- StringBuffer buffer = new StringBuffer();
- buffer.append("1.0,"); //$NON-NLS-1$
-
- IProject project = providerProjects[i];
- CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(project);
- CVSWorkspaceRoot root = provider.getCVSWorkspaceRoot();
- CVSRepositoryLocation location = CVSRepositoryLocation.fromString(root.getRemoteLocation().getLocation());
- location.setUserMuteable(true);
- String repoLocation = location.getLocation();
- buffer.append(repoLocation);
- buffer.append(","); //$NON-NLS-1$
-
- ICVSFolder folder = root.getLocalRoot();
- FolderSyncInfo syncInfo = folder.getFolderSyncInfo();
- String module = syncInfo.getRepository();
- buffer.append(module);
- buffer.append(","); //$NON-NLS-1$
-
- String projectName = folder.getName();
- buffer.append(projectName);
- CVSTag tag = syncInfo.getTag();
- if (tag != null) {
- if (tag.getType() != CVSTag.DATE) {
- buffer.append(","); //$NON-NLS-1$
- String tagName = tag.getName();
- buffer.append(tagName);
- }
- }
- result[i] = buffer.toString();
- }
- return result;
- }
-
- /**
- * @see IProjectSetSerializer#addToWorkspace(String[])
- */
- public IProject[] addToWorkspace(String[] referenceStrings, String filename, Object context, IProgressMonitor monitor) throws TeamException {
- final int size = referenceStrings.length;
- final IProject[] projects = new IProject[size];
- final ICVSRepositoryLocation[] locations = new ICVSRepositoryLocation[size];
- final String[] modules = new String[size];
- final CVSTag[] tags = new CVSTag[size];
-
- for (int i = 0; i < size; i++) {
- StringTokenizer tokenizer = new StringTokenizer(referenceStrings[i], ","); //$NON-NLS-1$
- String version = tokenizer.nextToken();
- if (!version.equals("1.0")) { //$NON-NLS-1$
- // Bail out, this is a newer version
- return null;
- }
- String repo = tokenizer.nextToken();
- locations[i] = getLocationFromString(repo);
- modules[i] = tokenizer.nextToken();
- String projectName = tokenizer.nextToken();
- projects[i] = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
- if (tokenizer.hasMoreTokens()) {
- String tagName = tokenizer.nextToken();
- tags[i] = new CVSTag(tagName, CVSTag.BRANCH);
- }
- }
- // Check if any projects will be overwritten, and warn the user.
- boolean yesToAll = false;
- int action;
- final int[] num = new int[] {size};
- for (int i = 0; i < size; i++) {
- Shell shell = null;
- IProject project = projects[i];
- if (project.exists()) {
- if (shell == null) {
- if (context instanceof Shell) {
- shell = (Shell)context;
- } else {
- return null;
- }
- }
- action = confirmOverwrite(project, yesToAll, shell);
- yesToAll = action == 2;
-
- // message dialog
- switch (action) {
- // no
- case 1:
- // Remove it from the set
- locations[i] = null;
- num[0]--;
- break;
- // yes to all
- case 2:
- // yes
- case 0:
- break;
- // cancel
- case 3:
- default:
- return null;
- }
- }
- }
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- monitor.beginTask("", 1000 * num[0]); //$NON-NLS-1$
- try {
- for (int i = 0; i < size; i++) {
- if (locations[i] != null) {
- ICVSRemoteFolder remote = new RemoteFolder(null, locations[i], modules[i], tags[i]);
- new CheckoutSingleProjectOperation(null /* no part */, remote, projects[i], null /* location */, true)
- .run(new SubProgressMonitor(monitor, 1000));
- }
- }
- } finally {
- monitor.done();
- }
- }
- };
- try {
- op.run(monitor);
- } catch (InterruptedException e) {
- } catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- if (t instanceof TeamException) {
- throw (TeamException)t;
- }
- }
- List result = new ArrayList();
- for (int i = 0; i < projects.length; i++) {
- if (projects[i] != null) result.add(projects[i]);
- }
- return (IProject[])result.toArray(new IProject[result.size()]);
- }
-
- private ICVSRepositoryLocation getLocationFromString(String repo) throws CVSException {
- // create the new location
- ICVSRepositoryLocation newLocation = CVSRepositoryLocation.fromString(repo);
- if (newLocation.getUsername() == null || newLocation.getUsername().length() == 0) {
- // look for an existing location that matched
- ICVSRepositoryLocation[] locations = KnownRepositories.getInstance().getRepositories();
- for (int i = 0; i < locations.length; i++) {
- ICVSRepositoryLocation location = locations[i];
- if (location.getMethod() == newLocation.getMethod()
- && location.getHost().equals(newLocation.getHost())
- && location.getPort() == newLocation.getPort()
- && location.getRootDirectory().equals(newLocation.getRootDirectory()))
- return location;
- }
- }
- return newLocation;
- }
-
- private int confirmOverwrite(IProject project, boolean yesToAll, Shell shell) {
- if (yesToAll) return 2;
- if (!project.exists()) return 0;
- final MessageDialog dialog =
- new MessageDialog(shell, Policy.bind("CVSProjectSetSerializer.Confirm_Overwrite_Project_8"), null, Policy.bind("CVSProjectSetSerializer.The_project_{0}_already_exists._Do_you_wish_to_overwrite_it__9", project.getName()), MessageDialog.QUESTION, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.NO_LABEL,
- IDialogConstants.YES_TO_ALL_LABEL,
- IDialogConstants.CANCEL_LABEL},
- 0);
- final int[] result = new int[1];
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- result[0] = dialog.open();
- }
- });
- return result[0];
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPropertiesPage.java
deleted file mode 100644
index 552c75f18..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPropertiesPage.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-public abstract class CVSPropertiesPage extends PropertyPage {
-
- /**
- * Return the appropriate Tag label for properties pages
- * based on the tag type.
- * @param tag
- * @return String
- */
-
- public static String getTagLabel(CVSTag tag) {
-
- if (tag == null) {
- return Policy.bind("CVSFilePropertiesPage.none"); //$NON-NLS-1$
- }
-
- switch (tag.getType()) {
- case CVSTag.HEAD:
- return tag.getName();
- case CVSTag.VERSION:
- return Policy.bind("CVSFilePropertiesPage.version", tag.getName()); //$NON-NLS-1$
- case CVSTag.BRANCH:
- return Policy.bind("CVSFilePropertiesPage.branch", tag.getName()); //$NON-NLS-1$
- case CVSTag.DATE:
- return Policy.bind("CVSFilePropertiesPage.date", tag.getName()); //$NON-NLS-1$
- default :
- return tag.getName();
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
deleted file mode 100644
index 0818ffb2a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
+++ /dev/null
@@ -1,756 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.*;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.SubscriberChangeSetCollector;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.console.CVSOutputConsole;
-import org.eclipse.team.internal.ccvs.ui.model.CVSAdapterFactory;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryRoot;
-import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference;
-import org.eclipse.ui.*;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * UI Plugin for CVS provider-specific workbench functionality.
- */
-public class CVSUIPlugin extends AbstractUIPlugin {
- /**
- * The id of the CVS plug-in
- */
- public static final String ID = "org.eclipse.team.cvs.ui"; //$NON-NLS-1$
- public static final String DECORATOR_ID = "org.eclipse.team.cvs.ui.decorator"; //$NON-NLS-1$
-
- /**
- * Property constant indicating the decorator configuration has changed.
- */
- public static final String P_DECORATORS_CHANGED = CVSUIPlugin.ID + ".P_DECORATORS_CHANGED"; //$NON-NLS-1$
-
- private Hashtable imageDescriptors = new Hashtable(20);
- private static List propertyChangeListeners = new ArrayList(5);
-
- /**
- * The singleton plug-in instance
- */
- private static CVSUIPlugin plugin;
-
- /**
- * The CVS console
- */
- private CVSOutputConsole console;
-
- /**
- * The repository manager
- */
- private RepositoryManager repositoryManager;
-
- private SubscriberChangeSetCollector changeSetManager;
-
- /**
- * CVSUIPlugin constructor
- *
- * @param descriptor the plugin descriptor
- */
- public CVSUIPlugin() {
- super();
- plugin = this;
- }
-
- /**
- * Returns the standard display to be used. The method first checks, if
- * the thread calling this method has an associated display. If so, this
- * display is returned. Otherwise the method returns the default display.
- */
- public static Display getStandardDisplay() {
- Display display= Display.getCurrent();
- if (display == null) {
- display= Display.getDefault();
- }
- return display;
- }
-
- /**
- * Creates an image and places it in the image registry.
- */
- protected void createImageDescriptor(String id, URL baseURL) {
- URL url = null;
- try {
- url = new URL(baseURL, ICVSUIConstants.ICON_PATH + id);
- } catch (MalformedURLException e) {
- }
- ImageDescriptor desc = ImageDescriptor.createFromURL(url);
- imageDescriptors.put(id, desc);
- }
-
- /**
- * Returns the active workbench page. Note that the active page may not be
- * the one that the usr perceives as active in some situations so this
- * method of obtaining the activae page should only be used if no other
- * method is available.
- *
- * @return the active workbench page
- */
- public static IWorkbenchPage getActivePage() {
- return TeamUIPlugin.getActivePage();
- }
-
- /**
- * Register for changes made to Team properties.
- */
- public static void addPropertyChangeListener(IPropertyChangeListener listener) {
- propertyChangeListeners.add(listener);
- }
-
- /**
- * Deregister as a Team property changes.
- */
- public static void removePropertyChangeListener(IPropertyChangeListener listener) {
- propertyChangeListeners.remove(listener);
- }
-
- /**
- * Broadcast a Team property change.
- */
- public static void broadcastPropertyChange(PropertyChangeEvent event) {
- for (Iterator it = propertyChangeListeners.iterator(); it.hasNext();) {
- IPropertyChangeListener listener = (IPropertyChangeListener)it.next();
- listener.propertyChange(event);
- }
- }
-
- /**
- * Extract or convert to a TeamException
- */
- public static TeamException asTeamException(InvocationTargetException e) {
- Throwable exception = e.getTargetException();
- if (exception instanceof TeamException) {
- return (TeamException)exception;
- } else if (exception instanceof CoreException) {
- return new TeamException(((CoreException)exception).getStatus());
- } else {
- return new TeamException(new Status(IStatus.ERROR, CVSUIPlugin.ID, 0, Policy.bind("internal"), exception)); //$NON-NLS-1$
- }
- }
-
- /**
- * Run an operation involving the given resource. If an exception is thrown
- * and the code on the status is IResourceStatus.OUT_OF_SYNC_LOCAL then
- * the user will be prompted to refresh and try again. If they agree, then the
- * supplied operation will be run again.
- */
- public static void runWithRefresh(Shell parent, IResource[] resources,
- IRunnableWithProgress runnable, IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- boolean firstTime = true;
- while(true) {
- try {
- runnable.run(monitor);
- return;
- } catch (InvocationTargetException e) {
- if (! firstTime) throw e;
- IStatus status = null;
- if (e.getTargetException() instanceof CoreException) {
- status = ((CoreException)e.getTargetException()).getStatus();
- } else if (e.getTargetException() instanceof TeamException) {
- status = ((TeamException)e.getTargetException()).getStatus();
- } else {
- throw e;
- }
- if (status.getCode() == IResourceStatus.OUT_OF_SYNC_LOCAL) {
- if (promptToRefresh(parent, resources, status)) {
- try {
- for (int i = 0; i < resources.length; i++) {
- resources[i].refreshLocal(IResource.DEPTH_INFINITE, null);
- }
- } catch (CoreException coreEx) {
- // Throw the original exception to the caller
- log(coreEx);
- throw e;
- }
- firstTime = false;
- // Fall through and the operation will be tried again
- } else {
- // User chose not to continue. Treat it as a cancel.
- throw new InterruptedException();
- }
- } else {
- throw e;
- }
- }
- }
- }
-
- private static boolean promptToRefresh(final Shell shell, final IResource[] resources, final IStatus status) {
- final boolean[] result = new boolean[] { false};
- Runnable runnable = new Runnable() {
- public void run() {
- Shell shellToUse = shell;
- if (shell == null) {
- shellToUse = new Shell(Display.getCurrent());
- }
- String question;
- if (resources.length == 1) {
- question = Policy.bind("CVSUIPlugin.refreshQuestion", status.getMessage(), resources[0].getFullPath().toString()); //$NON-NLS-1$
- } else {
- question = Policy.bind("CVSUIPlugin.refreshMultipleQuestion", status.getMessage()); //$NON-NLS-1$
- }
- result[0] = MessageDialog.openQuestion(shellToUse, Policy.bind("CVSUIPlugin.refreshTitle"), question); //$NON-NLS-1$
- }
- };
- Display.getDefault().syncExec(runnable);
- return result[0];
- }
-
- /**
- * Creates a busy cursor and runs the specified runnable.
- * May be called from a non-UI thread.
- *
- * @param parent the parent Shell for the dialog
- * @param cancelable if true, the dialog will support cancelation
- * @param runnable the runnable
- *
- * @exception InvocationTargetException when an exception is thrown from the runnable
- * @exception InterruptedException when the progress monitor is cancelled
- */
- public static void runWithProgress(Shell parent, boolean cancelable,
- final IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
- Utils.runWithProgress(parent, cancelable, runnable);
- }
-
- /**
- * Creates a busy cursor and runs the specified runnable.
- * May be called from a non-UI thread.
- *
- * @param parent the parent Shell for the dialog
- * @param cancelable if true, the dialog will support cancelation
- * @param runnable the runnable
- * @param flags customizing attributes for the error handling
- *
- * @exception InvocationTargetException when an exception is thrown from the runnable
- * @exception InterruptedException when the progress monitor is cancelled
- */
- public static void runWithProgress(final Shell parent, final boolean cancelable,
- final IRunnableWithProgress runnable, int flags) throws InvocationTargetException, InterruptedException {
-
- if ((flags & PERFORM_SYNC_EXEC) > 0) {
-
- // create a runnable that deals with exceptions
- final Exception exception[] = new Exception[] { null };
- Runnable outerRunnable = new Runnable() {
- public void run() {
- try {
- Utils.runWithProgress(parent, cancelable, runnable);
- } catch (InvocationTargetException e) {
- exception[0] = e;
- } catch (InterruptedException e) {
- exception[0] = e;
- }
- }
- };
-
- // get a Display and perform the syncExec
- Display display;
- if (parent == null) {
- display = Display.getCurrent();
- if (display == null) {
- display = Display.getDefault();
- }
- } else {
- display = parent.getDisplay();
- }
- display.syncExec(outerRunnable);
-
- // handle any exception
- if (exception[0] != null) {
- Exception e = exception[0];
- if (e instanceof InvocationTargetException) {
- throw (InvocationTargetException) e;
- } else if (e instanceof InterruptedException) {
- throw (InterruptedException) e;
- } else {
- // impossible but we'll handle it anyway
- throw new InvocationTargetException(e);
- }
- }
- } else {
- Utils.runWithProgress(parent, cancelable, runnable);
- }
- }
-
- /**
- * Returns the image descriptor for the given image ID.
- * Returns null if there is no such image.
- */
- public ImageDescriptor getImageDescriptor(String id) {
- return (ImageDescriptor)imageDescriptors.get(id);
- }
-
- /**
- * Returns the singleton plug-in instance.
- *
- * @return the plugin instance
- */
- public static CVSUIPlugin getPlugin() {
- return plugin;
- }
-
- /**
- * Returns the repository manager
- *
- * @return the repository manager
- */
- public synchronized RepositoryManager getRepositoryManager() {
- if (repositoryManager == null) {
- repositoryManager = new RepositoryManager();
- repositoryManager.startup();
- }
- return repositoryManager;
- }
-
- public synchronized SubscriberChangeSetCollector getChangeSetManager() {
- if (changeSetManager == null) {
- changeSetManager = new SubscriberChangeSetCollector(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber());
- }
- return changeSetManager;
- }
-
- /**
- * Initializes the table of images used in this plugin.
- */
- private void initializeImages() {
- URL baseURL = getBundle().getEntry("/"); //$NON-NLS-1$
-
- // objects
- createImageDescriptor(ICVSUIConstants.IMG_REPOSITORY, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_REFRESH, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_REFRESH_ENABLED, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_REFRESH_DISABLED, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_LINK_WITH_EDITOR, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_LINK_WITH_EDITOR_ENABLED, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_COLLAPSE_ALL, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_COLLAPSE_ALL_ENABLED, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_NEWLOCATION, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_CVSLOGO, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_TAG, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_MODULE, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_CLEAR, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_CLEAR_ENABLED, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_CLEAR_DISABLED, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_BRANCHES_CATEGORY, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_VERSIONS_CATEGORY, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_DATES_CATEGORY, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_PROJECT_VERSION, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_WIZBAN_MERGE, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_WIZBAN_SHARE, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_WIZBAN_DIFF, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_WIZBAN_KEYWORD, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_WIZBAN_NEW_LOCATION, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_MERGEABLE_CONFLICT, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_QUESTIONABLE, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_MERGED, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_EDITED, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_NO_REMOTEDIR, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_CVS_CONSOLE, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_DATE, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_CHANGELOG, baseURL);
-
- // special
- createImageDescriptor("glyphs/glyph1.gif", baseURL); //$NON-NLS-1$
- createImageDescriptor("glyphs/glyph2.gif", baseURL); //$NON-NLS-1$
- createImageDescriptor("glyphs/glyph3.gif", baseURL); //$NON-NLS-1$
- createImageDescriptor("glyphs/glyph4.gif", baseURL); //$NON-NLS-1$
- createImageDescriptor("glyphs/glyph5.gif", baseURL); //$NON-NLS-1$
- createImageDescriptor("glyphs/glyph6.gif", baseURL); //$NON-NLS-1$
- createImageDescriptor("glyphs/glyph7.gif", baseURL); //$NON-NLS-1$
- createImageDescriptor("glyphs/glyph8.gif", baseURL); //$NON-NLS-1$
- }
- /**
- * Convenience method for logging statuses to the plugin log
- *
- * @param status the status to log
- */
- public static void log(IStatus status) {
- getPlugin().getLog().log(status);
- }
-
- public static void log(CoreException e) {
- log(e.getStatus().getSeverity(), Policy.bind("simpleInternal"), e); //$NON-NLS-1$
- }
-
- /**
- * Log the given exception along with the provided message and severity indicator
- */
- public static void log(int severity, String message, Throwable e) {
- log(new Status(severity, ID, 0, message, e));
- }
-
- // flags to tailor error reporting
- public static final int PERFORM_SYNC_EXEC = 1;
- public static final int LOG_TEAM_EXCEPTIONS = 2;
- public static final int LOG_CORE_EXCEPTIONS = 4;
- public static final int LOG_OTHER_EXCEPTIONS = 8;
- public static final int LOG_NONTEAM_EXCEPTIONS = LOG_CORE_EXCEPTIONS | LOG_OTHER_EXCEPTIONS;
-
- /**
- * Convenience method for showing an error dialog
- * @param shell a valid shell or null
- * @param exception the exception to be report
- * @param title the title to be displayed
- * @return IStatus the status that was displayed to the user
- */
- public static IStatus openError(Shell shell, String title, String message, Throwable exception) {
- return openError(shell, title, message, exception, LOG_OTHER_EXCEPTIONS);
- }
-
- /**
- * Convenience method for showing an error dialog
- * @param shell a valid shell or null
- * @param exception the exception to be report
- * @param title the title to be displayed
- * @param flags customizing attributes for the error handling
- * @return IStatus the status that was displayed to the user
- */
- public static IStatus openError(Shell providedShell, String title, String message, Throwable exception, int flags) {
- // Unwrap InvocationTargetExceptions
- if (exception instanceof InvocationTargetException) {
- Throwable target = ((InvocationTargetException)exception).getTargetException();
- // re-throw any runtime exceptions or errors so they can be handled by the workbench
- if (target instanceof RuntimeException) {
- throw (RuntimeException)target;
- }
- if (target instanceof Error) {
- throw (Error)target;
- }
- return openError(providedShell, title, message, target, flags);
- }
-
- // Determine the status to be displayed (and possibly logged)
- IStatus status = null;
- boolean log = false;
- if (exception instanceof CoreException) {
- status = ((CoreException)exception).getStatus();
- log = ((flags & LOG_CORE_EXCEPTIONS) > 0);
- } else if (exception instanceof TeamException) {
- status = ((TeamException)exception).getStatus();
- log = ((flags & LOG_TEAM_EXCEPTIONS) > 0);
- } else if (exception instanceof InterruptedException) {
- return new CVSStatus(IStatus.OK, Policy.bind("ok")); //$NON-NLS-1$
- } else if (exception != null) {
- status = new CVSStatus(IStatus.ERROR, Policy.bind("internal"), exception); //$NON-NLS-1$
- log = ((flags & LOG_OTHER_EXCEPTIONS) > 0);
- if (title == null) title = Policy.bind("SimpleInternal"); //$NON-NLS-1$
- }
-
- // Check for a build error and report it differently
- if (status.getCode() == IResourceStatus.BUILD_FAILED) {
- message = Policy.bind("buildError"); //$NON-NLS-1$
- log = true;
- }
-
- // Check for multi-status with only one child
- if (status.isMultiStatus() && status.getChildren().length == 1) {
- status = status.getChildren()[0];
- }
- if (status.isOK()) return status;
-
- // Log if the user requested it
- if (log) CVSUIPlugin.log(status.getSeverity(), status.getMessage(), exception);
-
- // Create a runnable that will display the error status
- final String displayTitle = title;
- final String displayMessage = message;
- final IStatus displayStatus = status;
- final IOpenableInShell openable = new IOpenableInShell() {
- public void open(Shell shell) {
- if (displayStatus.getSeverity() == IStatus.INFO && !displayStatus.isMultiStatus()) {
- MessageDialog.openInformation(shell, Policy.bind("information"), displayStatus.getMessage()); //$NON-NLS-1$
- } else {
- ErrorDialog.openError(shell, displayTitle, displayMessage, displayStatus);
- }
- }
- };
- openDialog(providedShell, openable, flags);
-
- // return the status we display
- return status;
- }
-
- /**
- * Interface that allows a shell to be passed to an open method. The
- * provided shell can be used without sync-execing, etc.
- */
- public interface IOpenableInShell {
- public void open(Shell shell);
- }
-
- /**
- * Open the dialog code provided in the IOpenableInShell, ensuring that
- * the provided whll is valid. This method will provide a shell to the
- * IOpenableInShell if one is not provided to the method.
- *
- * @param providedShell
- * @param openable
- * @param flags
- */
- public static void openDialog(Shell providedShell, final IOpenableInShell openable, int flags) {
- // If no shell was provided, try to get one from the active window
- if (providedShell == null) {
- IWorkbenchWindow window = CVSUIPlugin.getPlugin().getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- providedShell = window.getShell();
- // sync-exec when we do this just in case
- flags = flags | PERFORM_SYNC_EXEC;
- }
- }
-
- // Create a runnable that will display the error status
- final Shell shell = providedShell;
- Runnable outerRunnable = new Runnable() {
- public void run() {
- Shell displayShell;
- if (shell == null) {
- Display display = Display.getCurrent();
- displayShell = new Shell(display);
- } else {
- displayShell = shell;
- }
- openable.open(displayShell);
- if (shell == null) {
- displayShell.dispose();
- }
- }
- };
-
- // Execute the above runnable as determined by the parameters
- if (shell == null || (flags & PERFORM_SYNC_EXEC) > 0) {
- Display display;
- if (shell == null) {
- display = Display.getCurrent();
- if (display == null) {
- display = Display.getDefault();
- }
- } else {
- display = shell.getDisplay();
- }
- display.syncExec(outerRunnable);
- } else {
- outerRunnable.run();
- }
- }
-
-
- /**
- * Initializes the preferences for this plugin if necessary.
- */
- protected void initializePreferences() {
- IPreferenceStore store = getPreferenceStore();
- // Get the plugin preferences for CVS Core
- Preferences corePrefs = CVSProviderPlugin.getPlugin().getPluginPreferences();
-
- store.setDefault(ICVSUIConstants.PREF_REPOSITORIES_ARE_BINARY, false);
- store.setDefault(ICVSUIConstants.PREF_SHOW_COMMENTS, true);
- store.setDefault(ICVSUIConstants.PREF_SHOW_TAGS, true);
- store.setDefault(ICVSUIConstants.PREF_HISTORY_VIEW_EDITOR_LINKING, false);
- store.setDefault(ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES, CVSProviderPlugin.DEFAULT_PRUNE);
- store.setDefault(ICVSUIConstants.PREF_TIMEOUT, CVSProviderPlugin.DEFAULT_TIMEOUT);
- store.setDefault(ICVSUIConstants.PREF_CONSIDER_CONTENTS, true);
- store.setDefault(ICVSUIConstants.PREF_COMPRESSION_LEVEL, CVSProviderPlugin.DEFAULT_COMPRESSION_LEVEL);
- store.setDefault(ICVSUIConstants.PREF_TEXT_KSUBST, CVSProviderPlugin.DEFAULT_TEXT_KSUBST_OPTION.toMode());
- store.setDefault(ICVSUIConstants.PREF_USE_PLATFORM_LINEEND, true);
- store.setDefault(ICVSUIConstants.PREF_REPLACE_UNMANAGED, true);
- store.setDefault(ICVSUIConstants.PREF_CVS_RSH, CVSProviderPlugin.DEFAULT_CVS_RSH);
- store.setDefault(ICVSUIConstants.PREF_CVS_RSH_PARAMETERS, CVSProviderPlugin.DEFAULT_CVS_RSH_PARAMETERS);
- store.setDefault(ICVSUIConstants.PREF_CVS_SERVER, CVSProviderPlugin.DEFAULT_CVS_SERVER);
- store.setDefault(ICVSUIConstants.PREF_EXT_CONNECTION_METHOD_PROXY, "ext"); //$NON-NLS-1$
- store.setDefault(ICVSUIConstants.PREF_PROMPT_ON_CHANGE_GRANULARITY, true);
- store.setDefault(ICVSUIConstants.PREF_DETERMINE_SERVER_VERSION, true);
- store.setDefault(ICVSUIConstants.PREF_CONFIRM_MOVE_TAG, CVSProviderPlugin.DEFAULT_CONFIRM_MOVE_TAG);
- store.setDefault(ICVSUIConstants.PREF_DEBUG_PROTOCOL, false);
- store.setDefault(ICVSUIConstants.PREF_WARN_REMEMBERING_MERGES, true);
- store.setDefault(ICVSUIConstants.PREF_SHOW_COMPARE_REVISION_IN_DIALOG, false);
- store.setDefault(ICVSUIConstants.PREF_SHOW_AUTHOR_IN_EDITOR, false);
- store.setDefault(ICVSUIConstants.PREF_COMMIT_SET_DEFAULT_ENABLEMENT, false);
-
- PreferenceConverter.setDefault(store, ICVSUIConstants.PREF_CONSOLE_COMMAND_COLOR, new RGB(0, 0, 0));
- PreferenceConverter.setDefault(store, ICVSUIConstants.PREF_CONSOLE_MESSAGE_COLOR, new RGB(0, 0, 255));
- PreferenceConverter.setDefault(store, ICVSUIConstants.PREF_CONSOLE_ERROR_COLOR, new RGB(255, 0, 0));
- store.setDefault(ICVSUIConstants.PREF_CONSOLE_SHOW_ON_MESSAGE, false);
- store.setDefault(ICVSUIConstants.PREF_CONSOLE_LIMIT_OUTPUT, true);
- store.setDefault(ICVSUIConstants.PREF_CONSOLE_HIGH_WATER_MARK, 500000);
- store.setDefault(ICVSUIConstants.PREF_CONSOLE_WRAP, false);
- store.setDefault(ICVSUIConstants.PREF_CONSOLE_WIDTH, 80);
-
- store.setDefault(ICVSUIConstants.PREF_FILETEXT_DECORATION, CVSDecoratorConfiguration.DEFAULT_FILETEXTFORMAT);
- store.setDefault(ICVSUIConstants.PREF_FOLDERTEXT_DECORATION, CVSDecoratorConfiguration.DEFAULT_FOLDERTEXTFORMAT);
- store.setDefault(ICVSUIConstants.PREF_PROJECTTEXT_DECORATION, CVSDecoratorConfiguration.DEFAULT_PROJECTTEXTFORMAT);
-
- store.setDefault(ICVSUIConstants.PREF_FIRST_STARTUP, true);
- store.setDefault(ICVSUIConstants.PREF_ADDED_FLAG, CVSDecoratorConfiguration.DEFAULT_ADDED_FLAG);
- store.setDefault(ICVSUIConstants.PREF_DIRTY_FLAG, CVSDecoratorConfiguration.DEFAULT_DIRTY_FLAG);
- store.setDefault(ICVSUIConstants.PREF_SHOW_ADDED_DECORATION, true);
- store.setDefault(ICVSUIConstants.PREF_SHOW_HASREMOTE_DECORATION, true);
- store.setDefault(ICVSUIConstants.PREF_SHOW_DIRTY_DECORATION, false);
- store.setDefault(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION, true);
- store.setDefault(ICVSUIConstants.PREF_CALCULATE_DIRTY, true);
- store.setDefault(ICVSUIConstants.PREF_PROMPT_ON_MIXED_TAGS, true);
- store.setDefault(ICVSUIConstants.PREF_PROMPT_ON_SAVING_IN_SYNC, true);
- store.setDefault(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS, ICVSUIConstants.OPTION_PROMPT);
-
- store.setDefault(ICVSUIConstants.PREF_DEFAULT_PERSPECTIVE_FOR_SHOW_ANNOTATIONS, CVSPerspective.ID);
- store.setDefault(ICVSUIConstants.PREF_CHANGE_PERSPECTIVE_ON_SHOW_ANNOTATIONS, MessageDialogWithToggle.PROMPT);
-
- // Set the watch/edit preferences defaults and values
- store.setDefault(ICVSUIConstants.PREF_CHECKOUT_READ_ONLY, corePrefs.getDefaultBoolean(CVSProviderPlugin.READ_ONLY));
- store.setDefault(ICVSUIConstants.PREF_EDIT_ACTION, ICVSUIConstants.PREF_EDIT_PROMPT_EDIT);
- store.setDefault(ICVSUIConstants.PREF_EDIT_PROMPT, ICVSUIConstants.PREF_EDIT_PROMPT_IF_EDITORS);
- // Ensure that the preference values in UI match Core
- store.setValue(ICVSUIConstants.PREF_CHECKOUT_READ_ONLY, corePrefs.getBoolean(CVSProviderPlugin.READ_ONLY));
-
- // Forward the values to the CVS plugin
- CVSProviderPlugin.getPlugin().setPruneEmptyDirectories(store.getBoolean(ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES));
- CVSProviderPlugin.getPlugin().setTimeout(store.getInt(ICVSUIConstants.PREF_TIMEOUT));
- CVSProviderPlugin.getPlugin().setCvsRshCommand(store.getString(ICVSUIConstants.PREF_CVS_RSH));
- CVSProviderPlugin.getPlugin().setCvsRshParameters(store.getString(ICVSUIConstants.PREF_CVS_RSH_PARAMETERS));
- CVSProviderPlugin.getPlugin().setCvsServer(store.getString(ICVSUIConstants.PREF_CVS_SERVER));
- CVSRepositoryLocation.setExtConnectionMethodProxy(store.getString(ICVSUIConstants.PREF_EXT_CONNECTION_METHOD_PROXY));
- CVSProviderPlugin.getPlugin().setQuietness(CVSPreferencesPage.getQuietnessOptionFor(store.getInt(ICVSUIConstants.PREF_QUIETNESS)));
- CVSProviderPlugin.getPlugin().setCompressionLevel(store.getInt(ICVSUIConstants.PREF_COMPRESSION_LEVEL));
- CVSProviderPlugin.getPlugin().setReplaceUnmanaged(store.getBoolean(ICVSUIConstants.PREF_REPLACE_UNMANAGED));
- CVSProviderPlugin.getPlugin().setDefaultTextKSubstOption(KSubstOption.fromMode(store.getString(ICVSUIConstants.PREF_TEXT_KSUBST)));
- CVSProviderPlugin.getPlugin().setUsePlatformLineend(store.getBoolean(ICVSUIConstants.PREF_USE_PLATFORM_LINEEND));
- CVSProviderPlugin.getPlugin().setRepositoriesAreBinary(store.getBoolean(ICVSUIConstants.PREF_REPOSITORIES_ARE_BINARY));
- CVSProviderPlugin.getPlugin().setDetermineVersionEnabled(store.getBoolean(ICVSUIConstants.PREF_DETERMINE_SERVER_VERSION));
- CVSProviderPlugin.getPlugin().setConfirmMoveTagEnabled(store.getBoolean(ICVSUIConstants.PREF_CONFIRM_MOVE_TAG));
- CVSProviderPlugin.getPlugin().setDebugProtocol(CVSProviderPlugin.getPlugin().isDebugProtocol() || store.getBoolean(ICVSUIConstants.PREF_DEBUG_PROTOCOL));
- }
-
- /**
- * @see Plugin#start(BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- Policy.localize("org.eclipse.team.internal.ccvs.ui.messages"); //$NON-NLS-1$
-
- initializeImages();
- initializePreferences();
-
- CVSAdapterFactory factory = new CVSAdapterFactory();
- Platform.getAdapterManager().registerAdapters(factory, ICVSRemoteFile.class);
- Platform.getAdapterManager().registerAdapters(factory, ICVSRemoteFolder.class);
- Platform.getAdapterManager().registerAdapters(factory, ICVSRepositoryLocation.class);
- Platform.getAdapterManager().registerAdapters(factory, RepositoryRoot.class);
-
- try {
- console = new CVSOutputConsole();
- } catch (RuntimeException e) {
- // Don't let the console bring down the CVS UI
- log(IStatus.ERROR, "Errors occurred starting the CVS conbsole", e); //$NON-NLS-1$
- }
-
- // Must load the change set manager on startup since it listens to deltas
- getChangeSetManager();
-
- IPreferenceStore store = getPreferenceStore();
- if (store.getBoolean(ICVSUIConstants.PREF_FIRST_STARTUP)) {
- // If we enable the decorator in the XML, the CVS plugin will be loaded
- // on startup even if the user never uses CVS. Therefore, we enable the
- // decorator on the first start of the CVS plugin since this indicates that
- // the user has done something with CVS. Subsequent startups will load
- // the CVS plugin unless the user disables the decorator. In this case,
- // we will not reenable since we only enable auatomatically on the first startup.
- PlatformUI.getWorkbench().getDecoratorManager().setEnabled(CVSLightweightDecorator.ID, true);
- store.setValue(ICVSUIConstants.PREF_FIRST_STARTUP, false);
- }
-
- }
-
- public static IWorkingSet getWorkingSet(IResource[] resources, String name) {
- IWorkingSet workingSet = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(name);
- if (workingSet == null) {
- workingSet = PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSet(name, resources);
- PlatformUI.getWorkbench().getWorkingSetManager().addWorkingSet(workingSet);
- } else {
- workingSet.setElements(resources);
- }
- return workingSet;
- }
-
- /**
- * @see Plugin#stop(BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- try {
- try {
- if (repositoryManager != null)
- repositoryManager.shutdown();
- } catch (TeamException e) {
- throw new CoreException(e.getStatus());
- }
-
- if (console != null)
- console.shutdown();
- getChangeSetManager().dispose();
- } finally {
- super.stop(context);
- }
- }
-
- /**
- * @return the CVS console
- */
- public CVSOutputConsole getConsole() {
- return console;
- }
-
- /**
- * @return Returns the cvsWorkspaceSynchronizeViewPage.
- */
- public WorkspaceSynchronizeParticipant getCvsWorkspaceSynchronizeParticipant() {
- ISynchronizeParticipantReference reference = TeamUI.getSynchronizeManager().get(WorkspaceSynchronizeParticipant.ID, null);
- try {
- if(reference != null) {
- return (WorkspaceSynchronizeParticipant)reference.getParticipant();
- } else {
- return null;
- }
- } catch (TeamException e) {
- return null;
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommitCommentArea.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommitCommentArea.java
deleted file mode 100644
index 6bc55702a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommitCommentArea.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Sebastian Davids - bug 57208
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ui.dialogs.DialogArea;
-
-/**
- * This area provides the widgets for providing the CVS commit comment
- */
-public class CommitCommentArea extends DialogArea {
-
- private static final int WIDTH_HINT = 350;
- private static final int HEIGHT_HINT = 50;
-
- private Text text;
- private Combo previousCommentsCombo;
- private IProject mainProject;
- private String[] comments = new String[0];
- private String comment = ""; //$NON-NLS-1$
-
- public static final String OK_REQUESTED = "OkRequested";//$NON-NLS-1$
- public static final String COMMENT_MODIFIED = "CommentModified";//$NON-NLS-1$
- private String proposedComment;
-
- /**
- * Constructor for CommitCommentArea.
- * @param parentDialog
- * @param settings
- */
- public CommitCommentArea() {
- comments = CVSUIPlugin.getPlugin().getRepositoryManager().getPreviousComments();
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.DialogArea#createArea(org.eclipse.swt.widgets.Composite)
- */
- public void createArea(Composite parent) {
- Dialog.applyDialogFont(parent);
- Composite composite = createGrabbingComposite(parent, 1);
- initializeDialogUnits(composite);
-
- Label label = new Label(composite, SWT.NULL);
- label.setLayoutData(new GridData());
- label.setText(Policy.bind("ReleaseCommentDialog.enterComment")); //$NON-NLS-1$
-
- text = new Text(composite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = WIDTH_HINT;
- data.heightHint = HEIGHT_HINT;
-
- text.setLayoutData(data);
- text.selectAll();
- text.addTraverseListener(new TraverseListener() {
- public void keyTraversed(TraverseEvent e) {
- if (e.detail == SWT.TRAVERSE_RETURN && (e.stateMask & SWT.CTRL) != 0) {
- e.doit = false;
- CommitCommentArea.this.signalCtrlEnter();
- }
- }
- });
- text.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- String oldComment = comment;
- comment = text.getText();
- CommitCommentArea.this.signalCommentModified(oldComment, comment);
- }
- });
-
-
- label = new Label(composite, SWT.NULL);
- label.setLayoutData(new GridData());
- label.setText(Policy.bind("ReleaseCommentDialog.choosePrevious")); //$NON-NLS-1$
-
- previousCommentsCombo = new Combo(composite, SWT.READ_ONLY);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- previousCommentsCombo.setLayoutData(data);
-
- // Initialize the values before we register any listeners so
- // we don't get any platform specific selection behavior
- // (see bug 32078: http://bugs.eclipse.org/bugs/show_bug.cgi?id=32078)
- initializeValues();
-
- previousCommentsCombo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- int index = previousCommentsCombo.getSelectionIndex();
- if (index != -1)
- text.setText(comments[index]);
- }
- });
- }
-
- /**
- * Method initializeValues.
- */
- private void initializeValues() {
-
- // populate the previous comment list
- for (int i = 0; i < comments.length; i++) {
- previousCommentsCombo.add(HistoryView.flattenText(comments[i]));
- }
-
- // We don't want to have an initial selection
- // (see bug 32078: http://bugs.eclipse.org/bugs/show_bug.cgi?id=32078)
- previousCommentsCombo.setText(""); //$NON-NLS-1$
-
- // determine the initial comment text
- String initialComment = proposedComment;
- if (initialComment == null) {
- try {
- initialComment = getCommitTemplate();
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
- if (initialComment != null && initialComment.length() != 0) {
- text.setText(initialComment);
- }
- }
-
- /**
- * Method signalCtrlEnter.
- */
- private void signalCtrlEnter() {
- firePropertyChangeChange(OK_REQUESTED, null, null);
- }
-
- protected void signalCommentModified(String oldValue, String comment) {
- firePropertyChangeChange(COMMENT_MODIFIED, oldValue, comment);
- }
-
- private String getCommitTemplate() throws CVSException {
- CVSTeamProvider provider = getProvider();
- if (provider == null) return ""; //$NON-NLS-1$
- String template = provider.getCommitTemplate();
- if (template == null) template = ""; //$NON-NLS-1$
- return template;
- }
-
- /**
- * Method getProvider.
- */
- private CVSTeamProvider getProvider() {
- if (mainProject == null) return null;
- return (CVSTeamProvider) RepositoryProvider.getProvider(mainProject, CVSProviderPlugin.getTypeId());
- }
-
- /**
- * Return the entered comment
- *
- * @return the comment
- */
- public String[] getComments() {
- return comments;
- }
-
- /**
- * Returns the comment.
- * @return String
- */
- public String getComment() {
- if (comment != null && comment.length() > 0) finished();
- return comment;
- }
-
- /**
- * Method setProject.
- * @param iProject
- */
- public void setProject(IProject iProject) {
- this.mainProject = iProject;
- }
-
- private void finished() {
- // strip template from the comment entered
- try {
- String commitTemplate = getCommitTemplate();
- if (comment.startsWith(commitTemplate)) {
- comment = comment.substring(commitTemplate.length());
- } else if (comment.endsWith(commitTemplate)) {
- comment = comment.substring(0, comment.length() - commitTemplate.length());
- }
- } catch (CVSException e) {
- // we couldn't get the commit template. Log the error and continue
- CVSUIPlugin.log(e);
- }
- // if there is still a comment, remember it
- if (comment.length() > 0) {
- CVSUIPlugin.getPlugin().getRepositoryManager().addComment(comment);
- }
- }
-
- public void setFocus() {
- if (text != null) {
- text.setFocus();
- }
- }
-
- public void setProposedComment(String proposedComment) {
- this.proposedComment = proposedComment;
- }
-
- public boolean hasCommitTemplate() {
- try {
- String commitTemplate = getCommitTemplate();
- return commitTemplate != null && commitTemplate.length() > 0;
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- return false;
- }
- }
-
- public void setEnabled(boolean b) {
- text.setEnabled(b);
- previousCommentsCombo.setEnabled(b);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ComparePreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ComparePreferencePage.java
deleted file mode 100644
index 240e63e5d..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ComparePreferencePage.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.jface.preference.BooleanFieldEditor;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Preference page for configuring CVS comparisons
- */
-public class ComparePreferencePage extends CVSFieldEditorPreferencePage {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.CVSFieldEditorPreferencePage#getPageHelpContextId()
- */
- protected String getPageHelpContextId() {
- return IHelpContextIds.COMPARE_PREFERENCE_PAGE;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.CVSFieldEditorPreferencePage#getPageDescription()
- */
- protected String getPageDescription() {
- return Policy.bind("ComparePreferencePage.0"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
- */
- protected void createFieldEditors() {
- addField(new BooleanFieldEditor(
- ICVSUIConstants.PREF_CONSIDER_CONTENTS,
- Policy.bind("CVSPreferencePage.considerContentsInCompare"), //$NON-NLS-1$
- BooleanFieldEditor.DEFAULT,
- getFieldEditorParent()) {
- protected Button getChangeControl(Composite parent) {
- Button button = super.getChangeControl(parent);
- WorkbenchHelp.setHelp(button, IHelpContextIds.PREF_CONSIDER_CONTENT);
- return button;
- }
- });
- addField(new BooleanFieldEditor(
- ICVSUIConstants.PREF_SHOW_COMPARE_REVISION_IN_DIALOG,
- Policy.bind("CVSPreferencePage.showCompareMergeInSync"), //$NON-NLS-1$
- BooleanFieldEditor.DEFAULT,
- getFieldEditorParent()));
- addField(new BooleanFieldEditor(
- ICVSUIConstants.PREF_SHOW_AUTHOR_IN_EDITOR,
- Policy.bind("ComparePreferencePage.1"), //$NON-NLS-1$
- BooleanFieldEditor.DEFAULT,
- getFieldEditorParent()));
- addField(new BooleanFieldEditor(
- ICVSUIConstants.PREF_COMMIT_SET_DEFAULT_ENABLEMENT,
- Policy.bind("ComparePreferencePage.2"), //$NON-NLS-1$
- BooleanFieldEditor.DEFAULT,
- getFieldEditorParent()));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.CVSFieldEditorPreferencePage#pushPreferences()
- */
- protected void pushPreferences() {
- super.pushPreferences();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java
deleted file mode 100644
index ef8e8e321..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.text.SimpleDateFormat;
-import java.util.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ui.dialogs.DialogArea;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Dialog for obtaining a date from the user
- */
-public class DateTagDialog extends Dialog {
-
- DateArea dateArea;
- TimeArea timeArea;
- IDialogSettings settings;
- private Date dateEntered;
-
- public class DateArea extends DialogArea {
-
- private Combo fromDayCombo;
- private Combo fromMonthCombo;
- private Combo fromYearCombo;
-
- public void createArea(Composite parent) {
- Composite composite = createComposite(parent, 4, false);
- initializeDialogUnits(composite);
- createLabel(composite, Policy.bind("DateTagDialog.0"), 1); //$NON-NLS-1$
- fromMonthCombo = new Combo(composite, SWT.READ_ONLY);
- fromDayCombo = new Combo(composite, SWT.READ_ONLY);
- fromDayCombo.setTextLimit(2);
- fromYearCombo = new Combo(composite, SWT.NONE);
- fromYearCombo.setTextLimit(4);
-
- //set day, month and year combos with numbers
- //years allows a selection from the past 5 years
- //or any year written in
- String days[] = new String[31];
- for (int i = 0; i < 31; i++) {
- days[i] = String.valueOf(i+1);
- }
-
- String months[] = new String[12];
- SimpleDateFormat format = new SimpleDateFormat("MMMM"); //$NON-NLS-1$
- Calendar calendar = Calendar.getInstance();
- for (int i = 0; i < 12; i++) {
- calendar.set(Calendar.MONTH, i);
- months[i] = format.format(calendar.getTime());
- }
-
- String years[] = new String[5];
- Calendar calender = Calendar.getInstance();
- for (int i = 0; i < 5; i++) {
- years[i] = String.valueOf(calender.get(1) - i);
- }
- fromDayCombo.setItems(days);
- fromMonthCombo.setItems(months);
- fromYearCombo.setItems(years);
- }
-
- public void initializeValues(Calendar calendar ) {
- fromDayCombo.select(calendar.get(Calendar.DATE) - 1);
- fromMonthCombo.select(calendar.get(Calendar.MONTH));
- String yearValue = String.valueOf(calendar.get(Calendar.YEAR));
- int index = fromYearCombo.indexOf(yearValue);
- if (index == -1) {
- fromYearCombo.add(yearValue);
- index = fromYearCombo.indexOf(yearValue);
- }
- fromYearCombo.select(index);
- timeArea.initializeValues(calendar);
- }
-
- public void updateWidgetEnablements() {
- // Do nothing
- }
-
- public void adjustCalendar(Calendar calendar) {
- calendar.set(
- Integer.parseInt(String.valueOf(fromYearCombo.getText())),
- fromMonthCombo.getSelectionIndex(),
- Integer.parseInt(String.valueOf(fromDayCombo.getText())),
- 0,0,0);
- }
- }
- public class TimeArea extends DialogArea {
-
- private Combo hourCombo;
- private Combo minuteCombo;
- private Combo secondCombo;
- private Button includeTime, localTime, utcTime;
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DialogArea#createArea(org.eclipse.swt.widgets.Composite)
- */
- public void createArea(Composite parent) {
- Composite composite = createComposite(parent, 2, false);
- initializeDialogUnits(composite);
- includeTime = createCheckbox(composite, Policy.bind("DateTagDialog.1"), 2); //$NON-NLS-1$
- createLabel(composite, Policy.bind("DateTagDialog.2"), 1); //$NON-NLS-1$
- Composite dateComposite = new Composite(composite, SWT.NONE);
- GridLayout dateLayout = new GridLayout();
- dateLayout.numColumns = 3;
- dateComposite.setLayout(dateLayout);
- hourCombo = new Combo(dateComposite, SWT.READ_ONLY);
- hourCombo.setTextLimit(2);
- minuteCombo = new Combo(dateComposite, SWT.READ_ONLY);
- minuteCombo.setTextLimit(2);
- secondCombo = new Combo(dateComposite, SWT.READ_ONLY);
- secondCombo.setTextLimit(2);
- localTime = createRadioButton(composite, Policy.bind("DateTagDialog.3"), 2); //$NON-NLS-1$
- utcTime = createRadioButton(composite, Policy.bind("DateTagDialog.4"), 2); //$NON-NLS-1$
-
- String sixty[] = new String[60];
- for (int i = 0; i < 60; i++) {
- sixty[i] = String.valueOf(i);
- }
- String hours[] = new String[24];
- for (int i = 0; i < 24; i++) {
- hours[i] = String.valueOf(i);
- }
- hourCombo.setItems(hours);
- minuteCombo.setItems(sixty);
- secondCombo.setItems(sixty);
-
- includeTime.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateWidgetEnablements();
- }
- });
- }
-
- public void initializeValues(Calendar calendar) {
- hourCombo.select(calendar.get(Calendar.HOUR_OF_DAY));//24 hour clock
- minuteCombo.select(calendar.get(Calendar.MINUTE));
- secondCombo.select(calendar.get(Calendar.SECOND));
-
- includeTime.setSelection(settings.getBoolean("includeTime")); //$NON-NLS-1$
- localTime.setSelection(!settings.getBoolean("utcTime")); //$NON-NLS-1$
- utcTime.setSelection(settings.getBoolean("utcTime")); //$NON-NLS-1$
- }
- public void updateWidgetEnablements() {
- hourCombo.setEnabled(includeTime.getSelection());
- minuteCombo.setEnabled(includeTime.getSelection());
- secondCombo.setEnabled(includeTime.getSelection());
- localTime.setEnabled(includeTime.getSelection());
- utcTime.setEnabled(includeTime.getSelection());
- }
- public void adjustCalendar(Calendar calendar) {
- if (includeTime.getSelection()) {
- calendar.set(Calendar.HOUR_OF_DAY, hourCombo.getSelectionIndex());//24 hour clock
- calendar.set(Calendar.MINUTE, minuteCombo.getSelectionIndex());
- calendar.set(Calendar.SECOND, secondCombo.getSelectionIndex());
- if (utcTime.getSelection()) {
- calendar.setTimeZone(TimeZone.getTimeZone("GMT")); //$NON-NLS-1$
- }
- }
- }
- }
-
- public DateTagDialog(Shell parentShell) {
- super(parentShell);
- IDialogSettings workbenchSettings = CVSUIPlugin.getPlugin().getDialogSettings();
- this.settings = workbenchSettings.getSection("DateTagDialog");//$NON-NLS-1$
- if (this.settings == null) {
- this.settings = workbenchSettings.addNewSection("DateTagDialog");//$NON-NLS-1$
- }
- }
-
- /* (non-Javadoc)
- * Method declared on Window.
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(Policy.bind("DateTagDialog.5")); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected Control createDialogArea(Composite parent) {
- Composite topLevel = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- initializeDialogUnits(topLevel);
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- topLevel.setLayout(layout);
-
- createDateArea(topLevel);
- createTimeArea(topLevel);
- initializeValues();
- updateWidgetEnablements();
-
- // set F1 help
- WorkbenchHelp.setHelp(topLevel, IHelpContextIds.DATE_TAG_DIALOG);
- Dialog.applyDialogFont(parent);
- return topLevel;
- }
-
- private void createDateArea(Composite topLevel) {
- dateArea = new DateArea();
- dateArea.createArea(topLevel);
- }
-
- private void createTimeArea(Composite topLevel) {
- timeArea = new TimeArea();
- timeArea.createArea(topLevel);
- }
-
- private void initializeValues() {
- Calendar calendar = Calendar.getInstance();
- dateArea.initializeValues(calendar);
- timeArea.initializeValues(calendar);
- }
-
- private void updateWidgetEnablements() {
- timeArea.updateWidgetEnablements();
- dateArea.updateWidgetEnablements();
- }
-
- /**
- * Return the date specified by the user in UTC.
- * @return the date specified by the user
- */
- public Date getDate() {
- return dateEntered;
- }
-
- private Date privateGetDate() {
- Calendar calendar = Calendar.getInstance();
- dateArea.adjustCalendar(calendar);
- timeArea.adjustCalendar(calendar);
- return calendar.getTime();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
- */
- protected void buttonPressed(int buttonId) {
- if (buttonId == IDialogConstants.OK_ID) {
- dateEntered = privateGetDate();
- }
- super.buttonPressed(buttonId);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/EditorsDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/EditorsDialog.java
deleted file mode 100644
index 4a770a08e..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/EditorsDialog.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003 CSC SoftwareConsult GmbH & Co. OHG, Germany and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * CSC - Intial implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.EditorsInfo;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- *
- * A dialog for showing the result of a cvs editors command.
- * Currently not in use, but can be used before executing the edit command
- *
- * @author <a href="mailto:gregor.kohlwes@csc.com,kohlwes@gmx.net">Gregor Kohlwes</a>
- */
-public class EditorsDialog extends Dialog {
- /**
- * Constructor EditorsDialog.
- * @param shell
- * @param iEditorsInfos
- */
-
- EditorsView editorsView;
- EditorsInfo[] editorsInfo;
-
- public EditorsDialog(Shell shell, EditorsInfo[] infos) {
- super(shell);
- editorsInfo = infos;
- }
-
- protected Control createDialogArea(Composite container) {
-
- Composite parent = (Composite) super.createDialogArea(container);
-
- getShell().setText(Policy.bind("EditorsDialog.title")); //$NON-NLS-1$
- createMessageArea(parent);
- editorsView = new EditorsView();
- editorsView.createPartControl(container);
- editorsView.setInput(editorsInfo);
-
- // set F1 help
- WorkbenchHelp.setHelp(parent, IHelpContextIds.EDITORS_DIALOG);
-
- Dialog.applyDialogFont(parent);
-
- return parent;
- }
- /**
- * Method createMessageArea.
- * @param parent
- */
- private void createMessageArea(Composite parent) {
- Label label = new Label(parent, SWT.NONE);
- label.setText(Policy.bind("EditorsDialog.question")); //$NON-NLS-1$
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/EditorsView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/EditorsView.java
deleted file mode 100644
index fece678db..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/EditorsView.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003 CSC SoftwareConsult GmbH & Co. OHG, Germany and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * CSC - Intial implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.team.internal.ccvs.core.EditorsInfo;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- *
- * The <code>EditorsView</code> shows the result of cvs editors command
- *
- * @author <a href="mailto:gregor.kohlwes@csc.com,kohlwes@gmx.net">Gregor Kohlwes</a>
- * @see org.eclipse.team.internal.ccvs.ui.actions.ShowEditorsAction
- */
-public class EditorsView extends ViewPart {
- public static final String VIEW_ID = "org.eclipse.team.ccvs.ui.EditorsView"; //$NON-NLS-1$
-
- private Table table;
- private TableViewer tableViewer;
-
- class EditorsContentProvider implements IStructuredContentProvider {
-
- /**
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement) {
- return (EditorsInfo[]) inputElement;
- }
-
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
- }
-
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- public void inputChanged(
- Viewer viewer,
- Object oldInput,
- Object newInput) {
- }
-
- }
-
- class EditorsLabelProvider implements ITableLabelProvider {
- /**
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
- */
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- /**
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
- */
- public String getColumnText(Object element, int columnIndex) {
- if (element == null)
- return ""; //$NON-NLS-1$
- EditorsInfo info = (EditorsInfo) element;
-
- String result = null;
- switch (columnIndex) {
- case 0 :
- result = info.getFileName();
- break;
- case 1 :
- result = info.getUserName();
- break;
- case 2 :
- result = info.getDateString();
- break;
- case 3 :
- result = info.getComputerName();
- break;
- }
- // This method must not return null
- if (result == null) result = ""; //$NON-NLS-1$
- return result;
-
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void addListener(ILabelProviderListener listener) {
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
- */
- public void dispose() {
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
- */
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void removeListener(ILabelProviderListener listener) {
- }
-
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- public void createPartControl(Composite parent) {
- table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
-
- GridData gridData = new GridData(GridData.FILL_BOTH);
- gridData.widthHint=500;
- gridData.heightHint=100;
- table.setLayoutData(gridData);
-
- TableLayout layout = new TableLayout();
- table.setLayout(layout);
-
- tableViewer = new TableViewer(table);
- createColumns(table, layout);
-
- tableViewer.setContentProvider(new EditorsContentProvider());
- tableViewer.setLabelProvider(new EditorsLabelProvider());
- // set F1 help
- WorkbenchHelp.setHelp(tableViewer.getControl(), IHelpContextIds.CVS_EDITORS_VIEW);
- }
- public void setInput(EditorsInfo[] infos) {
- tableViewer.setInput(infos);
- }
- /**
- * Method createColumns.
- * @param table
- * @param layout
- * @param viewer
- */
- private void createColumns(Table table, TableLayout layout) {
-
- TableColumn col;
- // file name
- col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
- col.setText(Policy.bind("EditorsView.file")); //$NON-NLS-1$
- layout.addColumnData(new ColumnWeightData(30, true));
-
- // user name
- col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
- col.setText(Policy.bind("EditorsView.user")); //$NON-NLS-1$
- layout.addColumnData(new ColumnWeightData(20, true));
-
- // creation date
- col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
- col.setText(Policy.bind("EditorsView.date")); //$NON-NLS-1$
- layout.addColumnData(new ColumnWeightData(30, true));
-
- // computer name
- col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
- col.setText(Policy.bind("EditorsView.computer")); //$NON-NLS-1$
- layout.addColumnData(new ColumnWeightData(20, true));
-
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPart#setFocus()
- */
- public void setFocus() {
- }
- /**
- * Method getTable.
- */
- public Table getTable() {
- return table;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java
deleted file mode 100644
index 7ff41d56f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferencePage;
-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.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.IConnectionMethod;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-public class ExtMethodPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
-
- Text cvsRsh;
- Text cvsServer;
- Text cvsRshParameters;
- private Button useExternal;
- private Button useInternal;
- private Combo methodType;
- private Control internal, external;
-
- /*
- * @see PreferencePage#createContents(Composite)
- */
- protected Control createContents(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 1;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData());
-
- SelectionAdapter selectionListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateEnablements();
- }
- };
-
- useExternal = createRadioButton(composite, Policy.bind("ExtMethodPreferencePage.0"), 1); //$NON-NLS-1$
- useExternal.addSelectionListener(selectionListener);
- external = createExternalArea(composite);
-
- useInternal = createRadioButton(composite, Policy.bind("ExtMethodPreferencePage.1"), 1); //$NON-NLS-1$
- useInternal.addSelectionListener(selectionListener);
- internal = createInternalArea(composite);
-
- initializeDefaults();
- WorkbenchHelp.setHelp(composite, IHelpContextIds.EXT_PREFERENCE_PAGE);
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- private void updateEnablements() {
- external.setEnabled(useExternal.getSelection());
- cvsRsh.setEnabled(useExternal.getSelection());
- cvsRshParameters.setEnabled(useExternal.getSelection());
- cvsServer.setEnabled(useExternal.getSelection());
- internal.setEnabled(!useExternal.getSelection());
- methodType.setEnabled(!useExternal.getSelection());
- }
-
- private Control createInternalArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 5;
- layout.marginHeight = 5;
- layout.numColumns = 2;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Label intro = new Label(composite, SWT.LEFT | SWT.WRAP);
- intro.setText(Policy.bind("ExtMethodPreferencePage.2")); //$NON-NLS-1$
- GridData data = new GridData();
- data.horizontalSpan = 2;
- data.horizontalAlignment = GridData.FILL;
- data.widthHint = 300;
- intro.setLayoutData(data);
-
- createLabel(composite, Policy.bind("CVSPropertiesPage.connectionType"), 1); //$NON-NLS-1$
- methodType = createCombo(composite);
- return composite;
- }
- protected Control createExternalArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 5;
- layout.marginHeight = 5;
- layout.numColumns = 3;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Label intro = new Label(composite, SWT.LEFT | SWT.WRAP);
- intro.setText(Policy.bind("ExtMethodPreferencePage_message")); //$NON-NLS-1$
- GridData data = new GridData();
- data.horizontalSpan = 3;
- data.horizontalAlignment = GridData.FILL;
- data.widthHint = 300;
- intro.setLayoutData(data);
-
- new Label(composite, SWT.LEFT).setText(Policy.bind("ExtMethodPreferencePage_CVS_RSH")); //$NON-NLS-1$
- cvsRsh = new Text(composite, SWT.BORDER);
- cvsRsh.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- final Button b = new Button(composite, SWT.NONE);
- b.setText(Policy.bind("ExtMethodPreferencePage_Browse")); //$NON-NLS-1$
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint, b.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- b.setLayoutData(data);
- b.addListener(SWT.MouseDown, new Listener() {
- public void handleEvent (Event event) {
- FileDialog d = new FileDialog(getShell());
- d.setText(Policy.bind("ExtMethodPreferencePage_Details")); //$NON-NLS-1$
- String file = d.open();
- if(file!=null) {
- setCvsRshText(file);
- }
- }
- });
-
- new Label(composite, SWT.LEFT).setText(Policy.bind("ExtMethodPreferencePage_CVS_RSH_Parameters")); //$NON-NLS-1$
- cvsRshParameters = new Text(composite, SWT.BORDER);
- data = new GridData();
- data.horizontalSpan = 2;
- data.horizontalAlignment = GridData.FILL;
- cvsRshParameters.setLayoutData(data);
-
- new Label(composite, SWT.LEFT).setText(Policy.bind("ExtMethodPreferencePage_CVS_SERVER__7")); //$NON-NLS-1$
- cvsServer = new Text(composite, SWT.BORDER);
- data = new GridData();
- data.horizontalSpan = 2;
- data.horizontalAlignment = GridData.FILL;
- cvsServer.setLayoutData(data);
-
- WorkbenchHelp.setHelp(cvsRsh, IHelpContextIds.EXT_PREFERENCE_RSH);
- WorkbenchHelp.setHelp(cvsRshParameters, IHelpContextIds.EXT_PREFERENCE_PARAM);
- WorkbenchHelp.setHelp(cvsServer, IHelpContextIds.EXT_PREFERENCE_SERVER);
- return composite;
- }
-
- private void initializeDefaults() {
- IPreferenceStore store = getPreferenceStore();
- String rsh = store.getString(ICVSUIConstants.PREF_CVS_RSH);
- String parameter = store.getString(ICVSUIConstants.PREF_CVS_RSH_PARAMETERS);
- String server = store.getString(ICVSUIConstants.PREF_CVS_SERVER);
- String method = store.getString(ICVSUIConstants.PREF_EXT_CONNECTION_METHOD_PROXY);
- initializeDefaults(rsh, parameter, server, method);
- }
-
- /*
- * Set CVS_RSH program
- */
- protected void setCvsRshText(String s) {
- cvsRsh.setText(s);
- }
-
- /*
- * @see IWorkbenchPreferencePage#init(IWorkbench)
- */
- public void init(IWorkbench workbench) {
- }
-
- /*
- * @see IPreferencePage#performOk()
- */
- public boolean performOk() {
- IPreferenceStore store = getPreferenceStore();
- String method;
- if (useExternal.getSelection()) {
- method = "ext"; //$NON-NLS-1$
- store.setValue(ICVSUIConstants.PREF_CVS_RSH, cvsRsh.getText());
- store.setValue(ICVSUIConstants.PREF_CVS_RSH_PARAMETERS, cvsRshParameters.getText());
- store.setValue(ICVSUIConstants.PREF_CVS_SERVER, cvsServer.getText());
- CVSProviderPlugin.getPlugin().setCvsRshCommand(cvsRsh.getText());
- CVSProviderPlugin.getPlugin().setCvsRshParameters(cvsRshParameters.getText());
- CVSProviderPlugin.getPlugin().setCvsServer(cvsServer.getText());
- } else {
- method = methodType.getText();
- }
- store.setValue(ICVSUIConstants.PREF_EXT_CONNECTION_METHOD_PROXY, method);
- CVSRepositoryLocation.setExtConnectionMethodProxy(method);
- CVSUIPlugin.getPlugin().savePluginPreferences();
- return super.performOk();
- }
-
- /*
- * @see PreferencePage#performDefaults()
- */
- protected void performDefaults() {
- IPreferenceStore store = getPreferenceStore();
- String rsh = store.getDefaultString(ICVSUIConstants.PREF_CVS_RSH);
- String parameter = store.getDefaultString(ICVSUIConstants.PREF_CVS_RSH_PARAMETERS);
- String server = store.getDefaultString(ICVSUIConstants.PREF_CVS_SERVER);
- String method = store.getDefaultString(ICVSUIConstants.PREF_EXT_CONNECTION_METHOD_PROXY);
- initializeDefaults(rsh, parameter, server, method);
- super.performDefaults();
- }
-
- private void initializeDefaults(String rsh, String parameters, String server, String method) {
- cvsRsh.setText(rsh);
- cvsRshParameters.setText(parameters);
- cvsServer.setText(server);
- IConnectionMethod[] methods = CVSRepositoryLocation.getPluggedInConnectionMethods();
- for (int i = 0; i < methods.length; i++) {
- String name = methods[i].getName();
- if (!name.equals("ext")) { //$NON-NLS-1$
- methodType.add(name);
- }
- }
- if (method.equals("ext")) { //$NON-NLS-1$
- methodType.select(0);
- } else {
- methodType.select(methodType.indexOf(method));
- }
- useExternal.setSelection(method.equals("ext")); //$NON-NLS-1$
- useInternal.setSelection(!method.equals("ext")); //$NON-NLS-1$
- updateEnablements();
- }
-
- /*
- * @see PreferencePage#doGetPreferenceStore()
- */
- protected IPreferenceStore doGetPreferenceStore() {
- return CVSUIPlugin.getPlugin().getPreferenceStore();
- }
-
- protected Button createRadioButton(Composite parent, String label, int span) {
- Button button = new Button(parent, SWT.RADIO);
- button.setText(label);
- GridData data = new GridData();
- data.horizontalSpan = span;
- button.setLayoutData(data);
- return button;
- }
-
- protected Label createLabel(Composite parent, String text, int span) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = span;
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
- return label;
- }
- protected Combo createCombo(Composite parent) {
- Combo combo = new Combo(parent, SWT.READ_ONLY);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- data.horizontalSpan = 1;
- combo.setLayoutData(data);
- return combo;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/FileModificationValidator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/FileModificationValidator.java
deleted file mode 100644
index 45c3eabb4..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/FileModificationValidator.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSCoreFileModificationValidator;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.ui.actions.EditorsAction;
-
-/**
- * IFileModificationValidator that is pluged into the CVS Repository Provider
- */
-public class FileModificationValidator extends CVSCoreFileModificationValidator {
-
- public FileModificationValidator() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.CVSCoreFileModificationValidator#edit(org.eclipse.core.resources.IFile[], java.lang.Object)
- */
- protected IStatus edit(IFile[] readOnlyFiles, Object context) {
- return edit(readOnlyFiles, getShell(context));
- }
-
- private Shell getShell(Object context) {
- if (context instanceof Shell)
- return (Shell)context;
- return null;
- }
-
- private IStatus getStatus(InvocationTargetException e) {
- Throwable target = e.getTargetException();
- if (target instanceof TeamException) {
- return ((TeamException) target).getStatus();
- } else if (target instanceof CoreException) {
- return ((CoreException) target).getStatus();
- }
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, 0, Policy.bind("internal"), target); //$NON-NLS-1$
- }
-
- private IStatus edit(final IFile[] files, final Shell shell) {
- if (isPerformEdit()) {
- try {
- if (shell != null && !promptToEditFiles(files, shell)) {
- // The user didn't want to edit.
- // OK is returned but the file remains read-only
- throw new InterruptedException();
- }
-
- // Run the edit in a runnable in order to get a busy cursor.
- // This runnable is syncExeced in order to get a busy cursor
- IRunnableWithProgress editRunnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- performEdit(files, monitor);
- } catch (CVSException e) {
- new InvocationTargetException(e);
- }
- }
- };
- if (isRunningInUIThread()) {
- // Only show a busy cursor if validate edit is blocking the UI
- CVSUIPlugin.runWithProgress(shell, false, editRunnable);
- } else {
- // We can't show a busy cursor (i.e., run in the UI thread)
- // since this thread may hold locks and
- // running an edit in the UI thread could try to obtain the
- // same locks, resulting in a deadlock.
- editRunnable.run(new NullProgressMonitor());
- }
- } catch (InvocationTargetException e) {
- return getStatus(e);
- } catch (InterruptedException e) {
- // Must return an error to indicate that it is not OK to edit the files
- return new Status(IStatus.CANCEL, CVSUIPlugin.ID, 0, Policy.bind("FileModificationValidator.vetoMessage"), null); //$NON-NLS-1$;
- }
- } else {
- // Allow the files to be edited without notifying the server
- return setWritable(files);
- }
-
- return Status.OK_STATUS;
-
- }
-
- private boolean isRunningInUIThread() {
- return Display.getCurrent() != null;
- }
-
- private boolean promptToEditFiles(IFile[] files, Shell shell) throws InvocationTargetException, InterruptedException {
- if (files.length == 0)
- return true;
-
- if(isNeverPrompt())
- return true;
-
- // Contact the server to see if anyone else is editing the files
- EditorsAction editors = fetchEditors(files, shell);
- if (editors.isEmpty()) {
- if (isAlwaysPrompt())
- return (promptEdit(shell));
- return true;
- } else {
- return (editors.promptToEdit(shell));
- }
- }
-
- private boolean promptEdit(Shell shell) {
- // Open the dialog using a sync exec (there are no guarentees that we
- // were called from the UI thread
- final boolean[] result = new boolean[] { false };
- int flags = isRunningInUIThread() ? 0 : CVSUIPlugin.PERFORM_SYNC_EXEC;
- CVSUIPlugin.openDialog(shell, new CVSUIPlugin.IOpenableInShell() {
- public void open(Shell shell) {
- result[0] = MessageDialog.openQuestion(shell,Policy.bind("FileModificationValidator.3"),Policy.bind("FileModificationValidator.4")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }, flags);
- return result[0];
- }
-
- private boolean isPerformEdit() {
- return ICVSUIConstants.PREF_EDIT_PROMPT_EDIT.equals(CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_EDIT_ACTION));
- }
-
- private EditorsAction fetchEditors(IFile[] files, Shell shell) throws InvocationTargetException, InterruptedException {
- final EditorsAction editors = new EditorsAction(getProvider(files), files);
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- editors.run(monitor);
- }
- };
- if (isRunningInUIThread()) {
- // Show a busy cursor if we are running in the UI thread
- CVSUIPlugin.runWithProgress(shell, false, runnable);
- } else {
- // We can't show a busy cursor (i.e., run in the UI thread)
- // since this thread may hold locks and
- // running a CVS operation in the UI thread could try to obtain the
- // same locks, resulting in a deadlock.
- runnable.run(new NullProgressMonitor());
- }
- return editors;
- }
-
- private boolean isNeverPrompt() {
- return ICVSUIConstants.PREF_EDIT_PROMPT_NEVER.equals(CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_EDIT_PROMPT));
- }
-
- private boolean isAlwaysPrompt() {
- return ICVSUIConstants.PREF_EDIT_PROMPT_ALWAYS.equals(CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_EDIT_PROMPT));
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryDropAdapter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryDropAdapter.java
deleted file mode 100644
index 1e3fe6ee5..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryDropAdapter.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.ViewerDropAdapter;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.ui.part.ResourceTransfer;
-
-public class HistoryDropAdapter extends ViewerDropAdapter {
- HistoryView view;
-
- public HistoryDropAdapter(StructuredViewer viewer, HistoryView view) {
- super(viewer);
- this.view = view;
- }
- /*
- * Override dragOver to slam the detail to DROP_LINK, as we do not
- * want to really execute a DROP_MOVE, although we want to respond
- * to it.
- */
- public void dragOver(DropTargetEvent event) {
- if ((event.operations & DND.DROP_LINK) == DND.DROP_LINK) {
- event.detail = DND.DROP_LINK;
- }
- super.dragOver(event);
- }
- /*
- * Override drop to slam the detail to DROP_LINK, as we do not
- * want to really execute a DROP_MOVE, although we want to respond
- * to it.
- */
- public void drop(DropTargetEvent event) {
- super.drop(event);
- event.detail = DND.DROP_LINK;
- }
- public boolean performDrop(Object data) {
- if (data == null) return false;
- IResource[] sources = (IResource[])data;
- if (sources.length == 0) return false;
- IResource resource = sources[0];
- if (!(resource instanceof IFile)) return false;
- view.showHistory(resource, true /* fetch */);
- return true;
- }
- public boolean validateDrop(Object target, int operation, TransferData transferType) {
- if (transferType != null && ResourceTransfer.getInstance().isSupportedType(transferType)) {
- return true;
- }
- return false;
- }
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryFilter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryFilter.java
deleted file mode 100644
index 2be43c760..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryFilter.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.Date;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.team.internal.ccvs.core.ILogEntry;
-
-public class HistoryFilter extends ViewerFilter {
- private HistoryView view;
- public String author;
- public Date fromDate;
- public Date toDate;
- public String comment;
- public boolean isOr;
-
- public HistoryFilter(HistoryView hView, String author, String comment, Date fromDate, Date toDate, boolean isOr) {
- this.view = hView;
- this.author = author;
- this.comment = comment;
- this.fromDate = fromDate;
- this.toDate = toDate;
- this.isOr = isOr;
- }
- /**
- * @see ViewerFilter#select(Viewer, Object, Object)
- */
- public boolean select(Viewer aviewer, Object parentElement, Object element) {
- if (element instanceof ILogEntry) {
- ILogEntry entry = (ILogEntry)element;
- if (isOr) {
- //empty fields should be considered a non-match
- return (hasAuthor() && authorMatch(entry) )
- || (hasDate() && dateMatch(entry))
- || (hasComment() && commentMatch(entry));
- } else {
- //"and" search
- //empty fields should be considered a match
- return (!hasAuthor() || authorMatch(entry))
- && (!hasDate() || dateMatch(entry))
- && (!hasComment() || commentMatch(entry));
- }
- }
- return false;
- }
- protected boolean authorMatch(ILogEntry entry) {
- return entry.getAuthor().equals(author);
- }
- protected boolean commentMatch(ILogEntry entry) {
- return !(entry.getComment().toLowerCase().indexOf(comment.toLowerCase()) == -1);
- }
- protected boolean dateMatch(ILogEntry entry) {
- return (fromDate.before(entry.getDate()))
- && (toDate.after(entry.getDate()));
- }
- protected boolean hasAuthor() {
- return !author.equals(""); //$NON-NLS-1$
- }
- protected boolean hasComment() {
- return !comment.equals(""); //$NON-NLS-1$
- }
- protected boolean hasDate() {
- return fromDate != null && toDate != null;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryFilterAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryFilterAction.java
deleted file mode 100644
index 3dda72428..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryFilterAction.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-
-public class HistoryFilterAction implements IViewActionDelegate {
- private HistoryView view;
- private HistoryFilter filter;
-
- /**
- * @see IViewActionDelegate#init(IViewPart)
- */
- public void init(IViewPart view) {
- this.view = (HistoryView)view;
- }
- /**
- * @see IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- HistoryFilterDialog historyDialog = new HistoryFilterDialog(view);
- if (filter != null) {
- historyDialog.setFilter(filter);
- }
- if (historyDialog.open() == Window.CANCEL) {
- return;
- }
- if (filter != null) {
- view.getViewer().removeFilter(filter);
- }
- filter = historyDialog.getFilter();
- //don't add the filter if it is blank
- if (!(filter.hasAuthor() || filter.hasDate() || filter.hasComment())) {
- return;
- }
- view.getViewer().addFilter(filter);
- }
- /**
- * @see IActionDelegate#selectionChanged(IAction, ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryFilterDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryFilterDialog.java
deleted file mode 100644
index 1e27ea851..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryFilterDialog.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-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.Combo;
-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;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-public class HistoryFilterDialog extends Dialog {
-
- private HistoryView historyView;
- private HistoryFilter historyFilter;
-
- //widgets
- private Button orRadio;
- private Button andRadio;
- private Combo fromDayCombo;
- private Combo toDayCombo;
- private Combo fromMonthCombo;
- private Combo toMonthCombo;
- private Combo fromYearCombo;
- private Combo toYearCombo;
- private Text author;
- private Text comment;
-
- public HistoryFilterDialog(HistoryView view) {
- super(view.getViewSite().getShell());
- this.historyView = view;
- }
-
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(Policy.bind("HistoryFilterDialog.title")); //$NON-NLS-1$
- }
-
- protected Control createDialogArea(Composite parent) {
- Composite topLevel = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- topLevel.setLayout(layout);
-
- //"and" and "or" search radio buttons
- Label label = new Label(topLevel, SWT.NONE);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- label.setLayoutData(data);
- label.setText(Policy.bind("HistoryFilterDialog.showMatching")); //$NON-NLS-1$
-
- andRadio = new Button(topLevel, SWT.RADIO);
- andRadio.setText(Policy.bind("HistoryFilterDialog.matchingAll")); //$NON-NLS-1$
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- andRadio.setLayoutData(data);
- andRadio.setSelection(true);
-
- orRadio = new Button(topLevel, SWT.RADIO);
- orRadio.setText(Policy.bind("HistoryFilterDialog.matchingAny")); //$NON-NLS-1$
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- orRadio.setLayoutData(data);
-
- //author
- label = new Label(topLevel, SWT.NONE);
- label.setText(Policy.bind("HistoryFilterDialog.author")); //$NON-NLS-1$
- author = new Text(topLevel, SWT.BORDER);
- author.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- //comment
- label = new Label(topLevel, SWT.NONE);
- label.setText(Policy.bind("HistoryFilterDialog.comment")); //$NON-NLS-1$
- comment = new Text(topLevel, SWT.BORDER);
- comment.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- //"from" date
- label = new Label(topLevel, SWT.NONE);
- label.setText(Policy.bind("HistoryFilterDialog.fromDate")); //$NON-NLS-1$
- Composite fdComposite = new Composite(topLevel, SWT.NONE);
- GridLayout fdLayout = new GridLayout();
- fdLayout.numColumns = 3;
- fdComposite.setLayout(fdLayout);
- fromMonthCombo = new Combo(fdComposite, SWT.READ_ONLY);
- fromDayCombo = new Combo(fdComposite, SWT.READ_ONLY);
- fromYearCombo = new Combo(fdComposite, SWT.NONE);
- fromYearCombo.setTextLimit(4);
-
- //"to" date
- label = new Label(topLevel, SWT.NONE);
- label.setText(Policy.bind("HistoryFilterDialog.toDate")); //$NON-NLS-1$
- Composite tdComposite = new Composite(topLevel, SWT.NONE);
- GridLayout tdLayout = new GridLayout();
- tdLayout.numColumns = 3;
- tdComposite.setLayout(tdLayout);
- toMonthCombo = new Combo(tdComposite, SWT.READ_ONLY);
- toDayCombo = new Combo(tdComposite, SWT.READ_ONLY);
- toYearCombo = new Combo(tdComposite, SWT.NONE);
- toYearCombo.setTextLimit(4);
-
- //set day, month and year combos with numbers
- //years allows a selection from the past 5 years
- //or any year written in
- String days[] = new String[32];
- days[0] = "---"; //$NON-NLS-1$
- for (int i = 1; i < 32; i++) {
- days[i] = String.valueOf(i);
- }
-
- String months[] = new String[13];
- months[0] = "---"; //$NON-NLS-1$
- SimpleDateFormat format = new SimpleDateFormat("MMMM"); //$NON-NLS-1$
- Calendar calendar = Calendar.getInstance();
- for (int i = 1; i < 13; i++) {
- calendar.set(Calendar.MONTH, i - 1);
- months[i] = format.format(calendar.getTime());
- }
-
- String years[] = new String[5];
- Calendar calender = Calendar.getInstance();
- for (int i = 0; i < 5; i++) {
- years[i] = String.valueOf(calender.get(1) - i);
- }
- fromDayCombo.setItems(days);
- fromDayCombo.select(0);
- toDayCombo.setItems(days);
- toDayCombo.select(0);
- fromMonthCombo.setItems(months);
- fromMonthCombo.select(0);
- toMonthCombo.setItems(months);
- toMonthCombo.select(0);
- fromYearCombo.setItems(years);
- toYearCombo.setItems(years);
- fromYearCombo.select(0);
- toYearCombo.select(0);
-
- initializeValues();
-
- // set F1 help
- WorkbenchHelp.setHelp(topLevel, IHelpContextIds.HISTORY_FILTER_DIALOG);
- Dialog.applyDialogFont(parent);
- return topLevel;
- }
- void initializeValues() {
- if (historyFilter == null) return;
- if (historyFilter.author != null) {
- author.setText(historyFilter.author);
- }
- if (historyFilter.comment != null) {
- comment.setText(historyFilter.comment);
- }
- orRadio.setSelection(historyFilter.isOr);
- andRadio.setSelection(!historyFilter.isOr);
- Calendar calendar = Calendar.getInstance();
- if (historyFilter.fromDate != null) {
- calendar.setTime(historyFilter.fromDate);
- fromDayCombo.select(calendar.get(Calendar.DATE));
- fromMonthCombo.select(calendar.get(Calendar.MONTH) + 1);
- String yearValue = String.valueOf(calendar.get(Calendar.YEAR));
- int index = fromYearCombo.indexOf(yearValue);
- if (index == -1) {
- fromYearCombo.add(yearValue);
- index = fromYearCombo.indexOf(yearValue);
- }
- fromYearCombo.select(index);
- }
- if (historyFilter.toDate != null) {
- calendar.setTime(historyFilter.toDate);
- toDayCombo.select(calendar.get(Calendar.DATE));
- toMonthCombo.select(calendar.get(Calendar.MONTH) + 1);
- String yearValue = String.valueOf(calendar.get(Calendar.YEAR));
- int index = toYearCombo.indexOf(yearValue);
- if (index == -1) {
- toYearCombo.add(yearValue);
- index = toYearCombo.indexOf(yearValue);
- }
- toYearCombo.select(index);
- }
- }
- /**
- * A button has been pressed. Process the dialog contents.
- */
- protected void buttonPressed(int buttonId) {
- if (IDialogConstants.CANCEL_ID == buttonId) {
- super.buttonPressed(buttonId);
- return;
- }
- Date fromDate = null, toDate = null;
-
- if ((fromMonthCombo.getSelectionIndex() > 0)
- && (toMonthCombo.getSelectionIndex() > 0)
- && (fromDayCombo.getSelectionIndex() > 0)
- && (toDayCombo.getSelectionIndex() > 0)
- && (fromYearCombo.getText().length() > 0)
- && (toYearCombo.getText().length() > 0)) {
-
- //set the calendar with the user input
- //set the hours, minutes and seconds to 00
- //so as to cover the whole day
- Calendar calendar = Calendar.getInstance();
- calendar.set(
- Integer.parseInt(String.valueOf(fromYearCombo.getText())),
- fromMonthCombo.getSelectionIndex() - 1,
- Integer.parseInt(String.valueOf(fromDayCombo.getText())),
- 00, 00, 00);
- fromDate = calendar.getTime();
-
- //set the calendar with the user input
- //set the hours, minutes and seconds to 23, 59, 59
- //so as to cover the whole day
- calendar.set(
- Integer.parseInt(String.valueOf(toYearCombo.getText())),
- toMonthCombo.getSelectionIndex() - 1,
- Integer.parseInt(String.valueOf(toDayCombo.getText())),
- 23, 59, 59);
- toDate = calendar.getTime();
- }
-
- //create the filter
- historyFilter = new HistoryFilter(
- historyView,
- author.getText(),
- comment.getText(),
- fromDate,
- toDate,
- orRadio.getSelection());
-
- super.buttonPressed(buttonId);
- }
-
- /**
- * Returns the filter that was created from the provided
- * user input.
- */
- public HistoryFilter getFilter() {
- return historyFilter;
- }
- /**
- * Set the intial value of the dialog to the given filter.
- */
- public void setFilter(HistoryFilter filter) {
- this.historyFilter = filter;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryTableProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryTableProvider.java
deleted file mode 100644
index 528977f13..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryTableProvider.java
+++ /dev/null
@@ -1,428 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.text.DateFormat;
-import java.util.Date;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-
-/**
- * This class provides the table and it's required components for a file's revision
- * history
- */
-public class HistoryTableProvider {
-
- private ICVSFile currentFile;
- private String currentRevision;
- private TableViewer viewer;
- private Font currentRevisionFont;
-
- /**
- * Constructor for HistoryTableProvider.
- */
- public HistoryTableProvider() {
- super();
- }
-
- //column constants
- private static final int COL_REVISION = 0;
- private static final int COL_TAGS = 1;
- private static final int COL_DATE = 2;
- private static final int COL_AUTHOR = 3;
- private static final int COL_COMMENT = 4;
-
- /**
- * The history label provider.
- */
- class HistoryLabelProvider extends LabelProvider implements ITableLabelProvider, IColorProvider, IFontProvider {
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
- public String getColumnText(Object element, int columnIndex) {
- ILogEntry entry = adaptToLogEntry(element);
- if (entry == null) return ""; //$NON-NLS-1$
- switch (columnIndex) {
- case COL_REVISION:
- String revision = entry.getRevision();
- String currentRevision = getCurrentRevision();
- if (currentRevision != null && currentRevision.equals(revision)) {
- revision = Policy.bind("currentRevision", revision); //$NON-NLS-1$
- }
- return revision;
- case COL_TAGS:
- CVSTag[] tags = entry.getTags();
- StringBuffer result = new StringBuffer();
- for (int i = 0; i < tags.length; i++) {
- result.append(tags[i].getName());
- if (i < tags.length - 1) {
- result.append(", "); //$NON-NLS-1$
- }
- }
- return result.toString();
- case COL_DATE:
- Date date = entry.getDate();
- if (date == null) return Policy.bind("notAvailable"); //$NON-NLS-1$
- return DateFormat.getInstance().format(date);
- case COL_AUTHOR:
- return entry.getAuthor();
- case COL_COMMENT:
- String comment = entry.getComment();
- int index = comment.indexOf("\n"); //$NON-NLS-1$
- switch (index) {
- case -1:
- return comment;
- case 0:
- return Policy.bind("HistoryView.[...]_4"); //$NON-NLS-1$
- default:
- return Policy.bind("CVSCompareRevisionsInput.truncate", comment.substring(0, index)); //$NON-NLS-1$
- }
- }
- return ""; //$NON-NLS-1$
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
- */
- public Color getForeground(Object element) {
- ILogEntry entry = adaptToLogEntry(element);
- if (entry.isDeletion()) {
- return Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
- } else {
- return null;
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object)
- */
- public Color getBackground(Object element) {
- return null;
- }
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.IFontProvider#getFont(java.lang.Object)
- */
- public Font getFont(Object element) {
- ILogEntry entry = adaptToLogEntry(element);
- if (entry == null)
- return null;
- String revision = entry.getRevision();
- String currentRevision = getCurrentRevision();
- if (currentRevision != null && currentRevision.equals(revision)) {
- if (currentRevisionFont == null) {
- Font defaultFont = JFaceResources.getDefaultFont();
- FontData[] data = defaultFont.getFontData();
- for (int i = 0; i < data.length; i++) {
- data[i].setStyle(SWT.BOLD);
- }
- currentRevisionFont = new Font(viewer.getTable().getDisplay(), data);
- }
- return currentRevisionFont;
- }
- return null;
- }
- }
-
- /**
- * The history sorter
- */
- class HistorySorter extends ViewerSorter {
- private boolean reversed = false;
- private int columnNumber;
-
- private VersionCollator versionCollator = new VersionCollator();
-
- // column headings: "Revision" "Tags" "Date" "Author" "Comment"
- private int[][] SORT_ORDERS_BY_COLUMN = {
- {COL_REVISION, COL_DATE, COL_AUTHOR, COL_COMMENT, COL_TAGS}, /* revision */
- {COL_TAGS, COL_REVISION, COL_DATE, COL_AUTHOR, COL_COMMENT}, /* tags */
- {COL_DATE, COL_REVISION, COL_AUTHOR, COL_COMMENT, COL_TAGS}, /* date */
- {COL_AUTHOR, COL_REVISION, COL_DATE, COL_COMMENT, COL_TAGS}, /* author */
- {COL_COMMENT, COL_REVISION, COL_DATE, COL_AUTHOR, COL_TAGS} /* comment */
- };
-
- /**
- * The constructor.
- */
- public HistorySorter(int columnNumber) {
- this.columnNumber = columnNumber;
- }
- /**
- * Compares two log entries, sorting first by the main column of this sorter,
- * then by subsequent columns, depending on the column sort order.
- */
- public int compare(Viewer viewer, Object o1, Object o2) {
- ILogEntry e1 = adaptToLogEntry(o1);
- ILogEntry e2 = adaptToLogEntry(o2);
- int result = 0;
- if (e1 == null || e2 == null) {
- result = super.compare(viewer, o1, o2);
- } else {
- int[] columnSortOrder = SORT_ORDERS_BY_COLUMN[columnNumber];
- for (int i = 0; i < columnSortOrder.length; ++i) {
- result = compareColumnValue(columnSortOrder[i], e1, e2);
- if (result != 0)
- break;
- }
- }
- if (reversed)
- result = -result;
- return result;
- }
- /**
- * Compares two markers, based only on the value of the specified column.
- */
- int compareColumnValue(int columnNumber, ILogEntry e1, ILogEntry e2) {
- switch (columnNumber) {
- case 0: /* revision */
- return versionCollator.compare(e1.getRevision(), e2.getRevision());
- case 1: /* tags */
- CVSTag[] tags1 = e1.getTags();
- CVSTag[] tags2 = e2.getTags();
- if (tags2.length == 0) {
- return -1;
- }
- if (tags1.length == 0) {
- return 1;
- }
- return getCollator().compare(tags1[0].getName(), tags2[0].getName());
- case 2: /* date */
- Date date1 = e1.getDate();
- Date date2 = e2.getDate();
- return date1.compareTo(date2);
- case 3: /* author */
- return getCollator().compare(e1.getAuthor(), e2.getAuthor());
- case 4: /* comment */
- return getCollator().compare(e1.getComment(), e2.getComment());
- default:
- return 0;
- }
- }
- /**
- * Returns the number of the column by which this is sorting.
- */
- public int getColumnNumber() {
- return columnNumber;
- }
- /**
- * Returns true for descending, or false
- * for ascending sorting order.
- */
- public boolean isReversed() {
- return reversed;
- }
- /**
- * Sets the sorting order.
- */
- public void setReversed(boolean newReversed) {
- reversed = newReversed;
- }
- }
-
- protected ILogEntry adaptToLogEntry(Object element) {
- // Get the log entry for the provided object
- ILogEntry entry = null;
- if (element instanceof ILogEntry) {
- entry = (ILogEntry) element;
- } else if (element instanceof IAdaptable) {
- entry = (ILogEntry)((IAdaptable)element).getAdapter(ILogEntry.class);
- }
- return entry;
- }
-
- /**
- * Create a TableViewer that can be used to display a list of ILogEntry instances.
- * Ths method provides the labels and sorter but does not provide a content provider
- *
- * @param parent
- * @return TableViewer
- */
- public TableViewer createTable(Composite parent) {
- Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- GridData data = new GridData(GridData.FILL_BOTH);
- table.setLayoutData(data);
-
- TableLayout layout = new TableLayout();
- table.setLayout(layout);
-
- TableViewer viewer = new TableViewer(table);
-
- createColumns(table, layout, viewer);
-
- viewer.setLabelProvider(new HistoryLabelProvider());
-
- // By default, reverse sort by revision.
- HistorySorter sorter = new HistorySorter(COL_REVISION);
- sorter.setReversed(true);
- viewer.setSorter(sorter);
-
- table.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if(currentRevisionFont != null) {
- currentRevisionFont.dispose();
- }
- }
- });
-
- this.viewer = viewer;
- return viewer;
- }
-
- /**
- * Create a CheckBoxTableViewer that can be used to display a list of ILogEntry instances.
- * Ths method provides the labels and sorter but does not provide a content provider
- *
- * @param parent
- * @return TableViewer
- */
- public CheckboxTableViewer createCheckBoxTable(Composite parent) {
- Table table = new Table(parent, SWT.CHECK | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- GridData data = new GridData(GridData.FILL_BOTH);
- table.setLayoutData(data);
-
- TableLayout layout = new TableLayout();
- table.setLayout(layout);
-
- CheckboxTableViewer viewer = new CheckboxTableViewer(table);
-
- createColumns(table, layout, viewer);
-
- viewer.setLabelProvider(new HistoryLabelProvider());
-
- // By default, reverse sort by revision.
- HistorySorter sorter = new HistorySorter(COL_REVISION);
- sorter.setReversed(true);
- viewer.setSorter(sorter);
-
- table.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if(currentRevisionFont != null) {
- currentRevisionFont.dispose();
- }
- }
- });
-
- this.viewer = viewer;
- return viewer;
- }
-
- /**
- * Creates the columns for the history table.
- */
- private void createColumns(Table table, TableLayout layout, TableViewer viewer) {
- SelectionListener headerListener = getColumnListener(viewer);
- // revision
- TableColumn col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
- col.setText(Policy.bind("HistoryView.revision")); //$NON-NLS-1$
- col.addSelectionListener(headerListener);
- layout.addColumnData(new ColumnWeightData(20, true));
-
- // tags
- col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
- col.setText(Policy.bind("HistoryView.tags")); //$NON-NLS-1$
- col.addSelectionListener(headerListener);
- layout.addColumnData(new ColumnWeightData(20, true));
-
- // creation date
- col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
- col.setText(Policy.bind("HistoryView.date")); //$NON-NLS-1$
- col.addSelectionListener(headerListener);
- layout.addColumnData(new ColumnWeightData(20, true));
-
- // author
- col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
- col.setText(Policy.bind("HistoryView.author")); //$NON-NLS-1$
- col.addSelectionListener(headerListener);
- layout.addColumnData(new ColumnWeightData(20, true));
-
- //comment
- col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
- col.setText(Policy.bind("HistoryView.comment")); //$NON-NLS-1$
- col.addSelectionListener(headerListener);
- layout.addColumnData(new ColumnWeightData(50, true));
- }
-
- /**
- * Adds the listener that sets the sorter.
- */
- private SelectionListener getColumnListener(final TableViewer tableViewer) {
- /**
- * This class handles selections of the column headers.
- * Selection of the column header will cause resorting
- * of the shown tasks using that column's sorter.
- * Repeated selection of the header will toggle
- * sorting order (ascending versus descending).
- */
- return new SelectionAdapter() {
- /**
- * Handles the case of user selecting the
- * header area.
- * <p>If the column has not been selected previously,
- * it will set the sorter of that column to be
- * the current tasklist sorter. Repeated
- * presses on the same column header will
- * toggle sorting order (ascending/descending).
- */
- public void widgetSelected(SelectionEvent e) {
- // column selected - need to sort
- int column = tableViewer.getTable().indexOf((TableColumn) e.widget);
- HistorySorter oldSorter = (HistorySorter)tableViewer.getSorter();
- if (oldSorter != null && column == oldSorter.getColumnNumber()) {
- oldSorter.setReversed(!oldSorter.isReversed());
- tableViewer.refresh();
- } else {
- tableViewer.setSorter(new HistorySorter(column));
- }
- }
- };
- }
-
- public String getCurrentRevision() {
- return currentRevision;
- }
-
- /**
- * Method getRevision.
- * @param currentEdition
- */
- private String getRevision(ICVSFile currentEdition) throws CVSException {
- if (currentEdition == null) return ""; //$NON-NLS-1$
- ResourceSyncInfo info = currentEdition.getSyncInfo();
- if (info == null) return ""; //$NON-NLS-1$
- return info.getRevision();
- }
-
- public void setFile(ICVSFile file) throws CVSException {
- this.currentFile = file;
- this.currentRevision = getRevision(this.currentFile);
- }
-
- public ICVSFile getICVSFile() {
- return this.currentFile;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java
deleted file mode 100644
index 6943cc18d..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java
+++ /dev/null
@@ -1,880 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Update;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.actions.*;
-import org.eclipse.team.internal.ccvs.ui.operations.UpdateOperation;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.synchronize.SyncInfoCompareInput;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.part.ResourceTransfer;
-import org.eclipse.ui.part.ViewPart;
-import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-
-/**
- * The history view allows browsing of an array of resource revisions
- */
-public class HistoryView extends ViewPart {
- private IFile file;
- // cached for efficiency
- private ILogEntry[] entries;
-
- private HistoryTableProvider historyTableProvider;
-
- private TableViewer tableViewer;
- private TextViewer textViewer;
- private TableViewer tagViewer;
-
- private OpenLogEntryAction openAction;
- private IAction toggleTextAction;
- private IAction toggleListAction;
- private TextViewerAction copyAction;
- private TextViewerAction selectAllAction;
- private Action getContentsAction;
- private Action getRevisionAction;
- private Action refreshAction;
- private Action tagWithExistingAction;
- private Action linkWithEditorAction;
-
- private SashForm sashForm;
- private SashForm innerSashForm;
-
- private Image branchImage;
- private Image versionImage;
-
- private ILogEntry currentSelection;
- private boolean linkingEnabled;
-
- private IPreferenceStore settings;
-
- private FetchLogEntriesJob fetchLogEntriesJob;
-
- private boolean shutdown = false;
-
- public static final String VIEW_ID = "org.eclipse.team.ccvs.ui.HistoryView"; //$NON-NLS-1$
-
- private IPartListener partListener = new IPartListener() {
- public void partActivated(IWorkbenchPart part) {
- if (part instanceof IEditorPart)
- editorActivated((IEditorPart) part);
- }
- public void partBroughtToTop(IWorkbenchPart part) {
- if(part == HistoryView.this)
- editorActivated(getViewSite().getPage().getActiveEditor());
- }
- public void partOpened(IWorkbenchPart part) {
- if(part == HistoryView.this)
- editorActivated(getViewSite().getPage().getActiveEditor());
- }
- public void partClosed(IWorkbenchPart part) {
- }
- public void partDeactivated(IWorkbenchPart part) {
- }
- };
-
- private IPartListener2 partListener2 = new IPartListener2() {
- public void partActivated(IWorkbenchPartReference ref) {
- }
- public void partBroughtToTop(IWorkbenchPartReference ref) {
- }
- public void partClosed(IWorkbenchPartReference ref) {
- }
- public void partDeactivated(IWorkbenchPartReference ref) {
- }
- public void partOpened(IWorkbenchPartReference ref) {
- }
- public void partHidden(IWorkbenchPartReference ref) {
- }
- public void partVisible(IWorkbenchPartReference ref) {
- if(ref.getPart(true) == HistoryView.this)
- editorActivated(getViewSite().getPage().getActiveEditor());
- }
- public void partInputChanged(IWorkbenchPartReference ref) {
- }
- };
-
-
- private class FetchLogEntriesJob extends Job {
- public ICVSRemoteFile remoteFile;
- public FetchLogEntriesJob() {
- super(Policy.bind("HistoryView.fetchHistoryJob")); //$NON-NLS-1$;
- }
- public void setRemoteFile(ICVSRemoteFile file) {
- this.remoteFile = file;
- }
- public IStatus run(IProgressMonitor monitor) {
- try {
- if(remoteFile != null && !shutdown) {
- entries = remoteFile.getLogEntries(monitor);
- final String revisionId = remoteFile.getRevision();
- getSite().getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if(entries != null && tableViewer != null && ! tableViewer.getTable().isDisposed()) {
- tableViewer.add(entries);
- selectRevision(revisionId);
- }
- }
- });
- }
- return Status.OK_STATUS;
- } catch (TeamException e) {
- return e.getStatus();
- }
- }
- };
-
- /**
- * Adds the action contributions for this view.
- */
- protected void contributeActions() {
- // Refresh (toolbar)
- CVSUIPlugin plugin = CVSUIPlugin.getPlugin();
- refreshAction = new Action(Policy.bind("HistoryView.refreshLabel"), plugin.getImageDescriptor(ICVSUIConstants.IMG_REFRESH_ENABLED)) { //$NON-NLS-1$
- public void run() {
- refresh();
- }
- };
- refreshAction.setToolTipText(Policy.bind("HistoryView.refresh")); //$NON-NLS-1$
- refreshAction.setDisabledImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_REFRESH_DISABLED));
- refreshAction.setHoverImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_REFRESH));
-
- // Link with Editor (toolbar)
- linkWithEditorAction = new Action(Policy.bind("HistoryView.linkWithLabel"), plugin.getImageDescriptor(ICVSUIConstants.IMG_LINK_WITH_EDITOR_ENABLED)) { //$NON-NLS-1$
- public void run() {
- setLinkingEnabled(isChecked());
- }
- };
- linkWithEditorAction.setToolTipText(Policy.bind("HistoryView.linkWithLabel")); //$NON-NLS-1$
- linkWithEditorAction.setHoverImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_LINK_WITH_EDITOR));
- linkWithEditorAction.setChecked(isLinkingEnabled());
-
- // Double click open action
- openAction = new OpenLogEntryAction();
- tableViewer.getTable().addListener(SWT.DefaultSelection, new Listener() {
- public void handleEvent(Event e) {
- openAction.selectionChanged(null, tableViewer.getSelection());
- openAction.run(null);
- }
- });
-
- getContentsAction = getContextMenuAction(Policy.bind("HistoryView.getContentsAction"), true /* needs progress */, new IWorkspaceRunnable() { //$NON-NLS-1$
- public void run(IProgressMonitor monitor) throws CoreException {
- ICVSRemoteFile remoteFile = currentSelection.getRemoteFile();
- monitor.beginTask(null, 100);
- try {
- if(confirmOverwrite()) {
- InputStream in = remoteFile.getContents(new SubProgressMonitor(monitor, 50));
- file.setContents(in, false, true, new SubProgressMonitor(monitor, 50));
- }
- } catch (TeamException e) {
- throw new CoreException(e.getStatus());
- } finally {
- monitor.done();
- }
- }
- });
- WorkbenchHelp.setHelp(getContentsAction, IHelpContextIds.GET_FILE_CONTENTS_ACTION);
-
- getRevisionAction = getContextMenuAction(Policy.bind("HistoryView.getRevisionAction"), true /* needs progress */, new IWorkspaceRunnable() { //$NON-NLS-1$
- public void run(IProgressMonitor monitor) throws CoreException {
- ICVSRemoteFile remoteFile = currentSelection.getRemoteFile();
- try {
- if(confirmOverwrite()) {
- CVSTag revisionTag = new CVSTag(remoteFile.getRevision(), CVSTag.VERSION);
-
- if(CVSAction.checkForMixingTags(getSite().getShell(), new IResource[] {file}, revisionTag)) {
- new UpdateOperation(
- null,
- new IResource[] {file},
- new Command.LocalOption[] {Update.IGNORE_LOCAL_CHANGES},
- revisionTag)
- .run(monitor);
- historyTableProvider.setFile(remoteFile);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- tableViewer.refresh();
- }
- });
- }
- }
- } catch (InvocationTargetException e) {
- CVSException.wrapException(e);
- } catch (InterruptedException e) {
- // Cancelled by user
- }
- }
- });
- WorkbenchHelp.setHelp(getRevisionAction, IHelpContextIds.GET_FILE_REVISION_ACTION);
-
- // Override MoveRemoteTagAction to work for log entries
- final IActionDelegate tagActionDelegate = new MoveRemoteTagAction() {
- protected ICVSResource[] getSelectedCVSResources() {
- ICVSResource[] resources = super.getSelectedCVSResources();
- if (resources == null || resources.length == 0) {
- ArrayList logEntrieFiles = null;
- if (!selection.isEmpty()) {
- logEntrieFiles = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof ILogEntry) {
- logEntrieFiles.add(((ILogEntry)next).getRemoteFile());
- continue;
- }
- if (next instanceof IAdaptable) {
- IAdaptable a = (IAdaptable) next;
- Object adapter = a.getAdapter(ICVSResource.class);
- if (adapter instanceof ICVSResource) {
- logEntrieFiles.add(((ILogEntry)adapter).getRemoteFile());
- continue;
- }
- }
- }
- }
- if (logEntrieFiles != null && !logEntrieFiles.isEmpty()) {
- return (ICVSResource[])logEntrieFiles.toArray(new ICVSResource[logEntrieFiles.size()]);
- }
- }
- return resources;
- }
- };
- tagWithExistingAction = getContextMenuAction(Policy.bind("HistoryView.tagWithExistingAction"), false /* no progress */, new IWorkspaceRunnable() { //$NON-NLS-1$
- public void run(IProgressMonitor monitor) throws CoreException {
- tagActionDelegate.selectionChanged(tagWithExistingAction, tableViewer.getSelection());
- tagActionDelegate.run(tagWithExistingAction);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if( ! ((MoveRemoteTagAction)tagActionDelegate).wasCancelled()) {
- refresh();
- }
- }
- });
- }
- });
- WorkbenchHelp.setHelp(getRevisionAction, IHelpContextIds.TAG_WITH_EXISTING_ACTION);
-
- // Toggle text visible action
- final IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- toggleTextAction = new Action(Policy.bind("HistoryView.showComment")) { //$NON-NLS-1$
- public void run() {
- setViewerVisibility();
- store.setValue(ICVSUIConstants.PREF_SHOW_COMMENTS, toggleTextAction.isChecked());
- }
- };
- toggleTextAction.setChecked(store.getBoolean(ICVSUIConstants.PREF_SHOW_COMMENTS));
- WorkbenchHelp.setHelp(toggleTextAction, IHelpContextIds.SHOW_COMMENT_IN_HISTORY_ACTION);
- // Toggle list visible action
- toggleListAction = new Action(Policy.bind("HistoryView.showTags")) { //$NON-NLS-1$
- public void run() {
- setViewerVisibility();
- store.setValue(ICVSUIConstants.PREF_SHOW_TAGS, toggleListAction.isChecked());
- }
- };
- toggleListAction.setChecked(store.getBoolean(ICVSUIConstants.PREF_SHOW_TAGS));
- WorkbenchHelp.setHelp(toggleListAction, IHelpContextIds.SHOW_TAGS_IN_HISTORY_ACTION);
-
- // Contribute actions to popup menu
- MenuManager menuMgr = new MenuManager();
- Menu menu = menuMgr.createContextMenu(tableViewer.getTable());
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager menuMgr) {
- fillTableMenu(menuMgr);
- }
- });
- menuMgr.setRemoveAllWhenShown(true);
- tableViewer.getTable().setMenu(menu);
- getSite().registerContextMenu(menuMgr, tableViewer);
-
- // Contribute toggle text visible to the toolbar drop-down
- IActionBars actionBars = getViewSite().getActionBars();
- IMenuManager actionBarsMenu = actionBars.getMenuManager();
- actionBarsMenu.add(toggleTextAction);
- actionBarsMenu.add(toggleListAction);
-
- // Create the local tool bar
- IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager();
- tbm.add(refreshAction);
- tbm.add(linkWithEditorAction);
- tbm.update(false);
-
- // Create actions for the text editor
- copyAction = new TextViewerAction(textViewer, ITextOperationTarget.COPY);
- copyAction.setText(Policy.bind("HistoryView.copy")); //$NON-NLS-1$
- actionBars.setGlobalActionHandler(ITextEditorActionConstants.COPY, copyAction);
-
- selectAllAction = new TextViewerAction(textViewer, ITextOperationTarget.SELECT_ALL);
- selectAllAction.setText(Policy.bind("HistoryView.selectAll")); //$NON-NLS-1$
- actionBars.setGlobalActionHandler(ITextEditorActionConstants.SELECT_ALL, selectAllAction);
-
- actionBars.updateActionBars();
-
- menuMgr = new MenuManager();
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager menuMgr) {
- fillTextMenu(menuMgr);
- }
- });
- StyledText text = textViewer.getTextWidget();
- menu = menuMgr.createContextMenu(text);
- text.setMenu(menu);
- }
- private void setViewerVisibility() {
- boolean showText = toggleTextAction.isChecked();
- boolean showList = toggleListAction.isChecked();
- if (showText && showList) {
- sashForm.setMaximizedControl(null);
- innerSashForm.setMaximizedControl(null);
- } else if (showText) {
- sashForm.setMaximizedControl(null);
- innerSashForm.setMaximizedControl(textViewer.getTextWidget());
- } else if (showList) {
- sashForm.setMaximizedControl(null);
- innerSashForm.setMaximizedControl(tagViewer.getTable());
- } else {
- sashForm.setMaximizedControl(tableViewer.getControl());
- }
- }
- /*
- * Method declared on IWorkbenchPart
- */
- public void createPartControl(Composite parent) {
- settings = CVSUIPlugin.getPlugin().getPreferenceStore();
- this.linkingEnabled = settings.getBoolean(ICVSUIConstants.PREF_HISTORY_VIEW_EDITOR_LINKING);
-
- initializeImages();
-
- sashForm = new SashForm(parent, SWT.VERTICAL);
- sashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- tableViewer = createTable(sashForm);
- innerSashForm = new SashForm(sashForm, SWT.HORIZONTAL);
- tagViewer = createTagTable(innerSashForm);
- textViewer = createText(innerSashForm);
- sashForm.setWeights(new int[] { 70, 30 });
- innerSashForm.setWeights(new int[] { 50, 50 });
-
- contributeActions();
-
- setViewerVisibility();
-
- // set F1 help
- WorkbenchHelp.setHelp(sashForm, IHelpContextIds.RESOURCE_HISTORY_VIEW);
- initDragAndDrop();
-
- // add listener for editor page activation - this is to support editor linking
- getSite().getPage().addPartListener(partListener);
- getSite().getPage().addPartListener(partListener2);
- }
- private void initializeImages() {
- CVSUIPlugin plugin = CVSUIPlugin.getPlugin();
- versionImage = plugin.getImageDescriptor(ICVSUIConstants.IMG_PROJECT_VERSION).createImage();
- branchImage = plugin.getImageDescriptor(ICVSUIConstants.IMG_TAG).createImage();
- }
- /**
- * Creates the group that displays lists of the available repositories
- * and team streams.
- *
- * @param the parent composite to contain the group
- * @return the group control
- */
- protected TableViewer createTable(Composite parent) {
-
- historyTableProvider = new HistoryTableProvider();
- TableViewer viewer = historyTableProvider.createTable(parent);
-
- viewer.setContentProvider(new IStructuredContentProvider() {
- public Object[] getElements(Object inputElement) {
- // Short-circuit to optimize
- if (entries != null) return entries;
-
- if (!(inputElement instanceof ICVSRemoteFile)) return null;
- final ICVSRemoteFile remoteFile = (ICVSRemoteFile)inputElement;
- if(fetchLogEntriesJob == null) {
- fetchLogEntriesJob = new FetchLogEntriesJob();
- }
- if(fetchLogEntriesJob.getState() != Job.NONE) {
- fetchLogEntriesJob.cancel();
- try {
- fetchLogEntriesJob.join();
- } catch (InterruptedException e) {
- CVSUIPlugin.log(new CVSException(Policy.bind("HistoryView.errorFetchingEntries", remoteFile.getName()), e)); //$NON-NLS-1$
- }
- }
- fetchLogEntriesJob.setRemoteFile(remoteFile);
- Utils.schedule(fetchLogEntriesJob, getViewSite());
- return new Object[0];
- }
- public void dispose() {
- }
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- entries = null;
- }
- });
-
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- if (selection == null || !(selection instanceof IStructuredSelection)) {
- textViewer.setDocument(new Document("")); //$NON-NLS-1$
- tagViewer.setInput(null);
- return;
- }
- IStructuredSelection ss = (IStructuredSelection)selection;
- if (ss.size() != 1) {
- textViewer.setDocument(new Document("")); //$NON-NLS-1$
- tagViewer.setInput(null);
- return;
- }
- ILogEntry entry = (ILogEntry)ss.getFirstElement();
- textViewer.setDocument(new Document(entry.getComment()));
- tagViewer.setInput(entry.getTags());
- }
- });
-
- return viewer;
- }
-
- private TableViewer createTagTable(Composite parent) {
- Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
- TableViewer result = new TableViewer(table);
- TableLayout layout = new TableLayout();
- layout.addColumnData(new ColumnWeightData(100));
- table.setLayout(layout);
- result.setContentProvider(new SimpleContentProvider() {
- public Object[] getElements(Object inputElement) {
- if (inputElement == null) return new Object[0];
- CVSTag[] tags = (CVSTag[])inputElement;
- return tags;
- }
- });
- result.setLabelProvider(new LabelProvider() {
- public Image getImage(Object element) {
- if (element == null) return null;
- CVSTag tag = (CVSTag)element;
- switch (tag.getType()) {
- case CVSTag.BRANCH:
- case CVSTag.HEAD:
- return branchImage;
- case CVSTag.VERSION:
- return versionImage;
- }
- return null;
- }
- public String getText(Object element) {
- return ((CVSTag)element).getName();
- }
- });
- result.setSorter(new ViewerSorter() {
- public int compare(Viewer viewer, Object e1, Object e2) {
- if (!(e1 instanceof CVSTag) || !(e2 instanceof CVSTag)) return super.compare(viewer, e1, e2);
- CVSTag tag1 = (CVSTag)e1;
- CVSTag tag2 = (CVSTag)e2;
- int type1 = tag1.getType();
- int type2 = tag2.getType();
- if (type1 != type2) {
- return type2 - type1;
- }
- return super.compare(viewer, tag1, tag2);
- }
- });
- return result;
- }
- protected TextViewer createText(Composite parent) {
- TextViewer result = new TextViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.READ_ONLY);
- result.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- copyAction.update();
- }
- });
- return result;
- }
- public void dispose() {
- shutdown = true;
- if (branchImage != null) {
- branchImage.dispose();
- branchImage = null;
- }
- if (versionImage != null) {
- versionImage.dispose();
- versionImage = null;
- }
-
- if(fetchLogEntriesJob != null) {
- if(fetchLogEntriesJob.getState() != Job.NONE) {
- fetchLogEntriesJob.cancel();
- try {
- fetchLogEntriesJob.join();
- } catch (InterruptedException e) {
- CVSUIPlugin.log(new CVSException(Policy.bind("HistoryView.errorFetchingEntries", ""), e)); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- }
- getSite().getPage().removePartListener(partListener);
- getSite().getPage().removePartListener(partListener2);
- }
- /**
- * Returns the table viewer contained in this view.
- */
- protected TableViewer getViewer() {
- return tableViewer;
- }
- /**
- * Adds drag and drop support to the history view.
- */
- void initDragAndDrop() {
- int ops = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
- Transfer[] transfers = new Transfer[] {ResourceTransfer.getInstance()};
- tableViewer.addDropSupport(ops, transfers, new HistoryDropAdapter(tableViewer, this));
- }
- private void fillTableMenu(IMenuManager manager) {
- // file actions go first (view file)
- manager.add(new Separator(IWorkbenchActionConstants.GROUP_FILE));
- if (file != null) {
- // Add the "Add to Workspace" action if 1 revision is selected.
- ISelection sel = tableViewer.getSelection();
- if (!sel.isEmpty()) {
- if (sel instanceof IStructuredSelection) {
- if (((IStructuredSelection)sel).size() == 1) {
- manager.add(getContentsAction);
- manager.add(getRevisionAction);
- manager.add(new Separator());
- manager.add(tagWithExistingAction);
- }
- }
- }
- }
- manager.add(new Separator("additions")); //$NON-NLS-1$
- manager.add(refreshAction);
- manager.add(new Separator("additions-end")); //$NON-NLS-1$
- }
- private void fillTextMenu(IMenuManager manager) {
- manager.add(copyAction);
- manager.add(selectAllAction);
- }
- /**
- * Makes the history view visible in the active perspective. If there
- * isn't a history view registered <code>null</code> is returned.
- * Otherwise the opened view part is returned.
- */
- public static HistoryView openInActivePerspective() {
- try {
- return (HistoryView)CVSUIPlugin.getActivePage().showView(VIEW_ID);
- } catch (PartInitException pe) {
- return null;
- }
- }
- /** (Non-javadoc)
- * Method declared on IWorkbenchPart
- */
- public void setFocus() {
- if (tableViewer != null) {
- Table control = tableViewer.getTable();
- if (control != null && !control.isDisposed()) {
- control.setFocus();
- }
- }
- }
-
- /**
- * Shows the history for the given IResource in the view.
- *
- * Only files are supported for now.
- */
- public void showHistory(IResource resource, boolean refetch) {
- if (resource instanceof IFile) {
- IFile newfile = (IFile)resource;
- if(!refetch && this.file != null && newfile.equals(this.file)) {
- return;
- }
- this.file = newfile;
- RepositoryProvider teamProvider = RepositoryProvider.getProvider(file.getProject(), CVSProviderPlugin.getTypeId());
- if (teamProvider != null) {
- try {
- // for a file this will return the base
- ICVSRemoteFile remoteFile = (ICVSRemoteFile)CVSWorkspaceRoot.getRemoteResourceFor(file);
- if(remoteFile != null) {
- historyTableProvider.setFile(remoteFile);
- // input is set asynchronously so we can't assume that the view
- // has been populated until the job that queries for the history
- // has completed.
- tableViewer.setInput(remoteFile);
- setContentDescription(remoteFile.getName());
- setTitleToolTip(resource.getFullPath().toString());
- }
- } catch (TeamException e) {
- CVSUIPlugin.openError(getViewSite().getShell(), null, null, e);
- }
- }
- } else {
- this.file = null;
- tableViewer.setInput(null);
- setContentDescription(""); //$NON-NLS-1$
- setTitleToolTip(""); //$NON-NLS-1$
- }
- }
-
- /**
- * An editor has been activated. Fetch the history if it is shared with CVS and the history view
- * is visible in the current page.
- *
- * @param editor the active editor
- * @since 3.0
- */
- protected void editorActivated(IEditorPart editor) {
- // Only fetch contents if the view is shown in the current page.
- if (editor == null || !isLinkingEnabled() || !checkIfPageIsVisible()) {
- return;
- }
- IEditorInput input = editor.getEditorInput();
- // Handle compare editors opened from the Synchronize View
- if (input instanceof SyncInfoCompareInput) {
- SyncInfoCompareInput syncInput = (SyncInfoCompareInput) input;
- SyncInfo info = syncInput.getSyncInfo();
- if(info instanceof CVSSyncInfo && info.getLocal().getType() == IResource.FILE) {
- ICVSRemoteFile remote = (ICVSRemoteFile)info.getRemote();
- ICVSRemoteFile base = (ICVSRemoteFile)info.getBase();
- if(remote != null) {
- showHistory(remote, false);
- } else if(base != null) {
- showHistory(base, false);
- }
- }
- // Handle editors opened on remote files
- } else if(input instanceof RemoteFileEditorInput) {
- ICVSRemoteFile remote = ((RemoteFileEditorInput)input).getCVSRemoteFile();
- if(remote != null) {
- showHistory(remote, false);
- }
- // Handle regular file editors
- } else if (input instanceof IFileEditorInput) {
- IFileEditorInput fileInput = (IFileEditorInput) input;
- IFile file = fileInput.getFile();
- showHistory(file, false /* don't fetch if already cached */);
- }
- }
-
- private boolean checkIfPageIsVisible() {
- return getViewSite().getPage().isPartVisible(this);
- }
- /**
- * Shows the history for the given ICVSRemoteFile in the view.
- */
- public void showHistory(ICVSRemoteFile remoteFile, boolean refetch) {
- try {
- if (remoteFile == null) {
- tableViewer.setInput(null);
- setContentDescription(""); //$NON-NLS-1$
- setTitleToolTip(""); //$NON-NLS-1$
- return;
- }
- ICVSFile existingFile = historyTableProvider.getICVSFile();
- if(!refetch && existingFile != null && existingFile.equals(remoteFile)) return;
- this.file = null;
- historyTableProvider.setFile(remoteFile);
- tableViewer.setInput(remoteFile);
- setContentDescription(remoteFile.getName());
- setTitleToolTip(remoteFile.getRepositoryRelativePath());
- } catch (TeamException e) {
- CVSUIPlugin.openError(getViewSite().getShell(), null, null, e);
- }
- }
-
- private Action getContextMenuAction(String title, final boolean needsProgressDialog, final IWorkspaceRunnable action) {
- return new Action(title) {
- public void run() {
- try {
- if (file == null) return;
- ISelection selection = tableViewer.getSelection();
- if (!(selection instanceof IStructuredSelection)) return;
- IStructuredSelection ss = (IStructuredSelection)selection;
- Object o = ss.getFirstElement();
- currentSelection = (ILogEntry)o;
- if(needsProgressDialog) {
- PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- action.run(monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } else {
- try {
- action.run(null);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(getViewSite().getShell(), null, null, e, CVSUIPlugin.LOG_NONTEAM_EXCEPTIONS);
- } catch (InterruptedException e) {
- // Do nothing
- }
- }
-
- public boolean isEnabled() {
- ISelection selection = tableViewer.getSelection();
- if (!(selection instanceof IStructuredSelection)) return false;
- IStructuredSelection ss = (IStructuredSelection)selection;
- if(ss.size() != 1) return false;
- return true;
- }
- };
- }
-
- private boolean confirmOverwrite() {
- if (file!=null && file.exists()) {
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor(file);
- try {
- if(cvsFile.isModified(null)) {
- String title = Policy.bind("HistoryView.overwriteTitle"); //$NON-NLS-1$
- String msg = Policy.bind("HistoryView.overwriteMsg"); //$NON-NLS-1$
- final MessageDialog dialog = new MessageDialog(getViewSite().getShell(), title, null, msg, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
- final int[] result = new int[1];
- getViewSite().getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- result[0] = dialog.open();
- }});
- if (result[0] != 0) {
- // cancel
- return false;
- }
- }
- } catch(CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
- return true;
- }
-
- /*
- * Refresh the view by refetching the log entries for the remote file
- */
- private void refresh() {
- entries = null;
- BusyIndicator.showWhile(tableViewer.getTable().getDisplay(), new Runnable() {
- public void run() {
- // if a local file was fed to the history view then we will have to refetch the handle
- // to properly display the current revision marker.
- if(file != null) {
- ICVSRemoteFile remoteFile;
- try {
- remoteFile = (ICVSRemoteFile) CVSWorkspaceRoot.getRemoteResourceFor(file);
- historyTableProvider.setFile(remoteFile);
- } catch (CVSException e) {
- // use previously fetched remote file, but log error
- CVSUIPlugin.log(e);
- }
- }
- tableViewer.refresh();
- }
- });
- }
-
- /**
- * Select the revision in the receiver.
- */
- public void selectRevision(String revision) {
- if (entries == null) {
- return;
- }
-
- ILogEntry entry = null;
- for (int i = 0; i < entries.length; i++) {
- if (entries[i].getRevision().equals(revision)) {
- entry = entries[i];
- break;
- }
- }
-
- if (entry != null) {
- IStructuredSelection selection = new StructuredSelection(entry);
- tableViewer.setSelection(selection, true);
- }
- }
-
- /**
- * Enabled linking to the active editor
- * @since 3.0
- */
- public void setLinkingEnabled(boolean enabled) {
- this.linkingEnabled = enabled;
-
- // remember the last setting in the dialog settings
- settings.setValue(ICVSUIConstants.PREF_HISTORY_VIEW_EDITOR_LINKING, enabled);
-
- // if turning linking on, update the selection to correspond to the active editor
- if (enabled) {
- editorActivated(getSite().getPage().getActiveEditor());
- }
- }
-
- /**
- * Returns if linking to the ative editor is enabled or disabled.
- * @return boolean indicating state of editor linking.
- */
- private boolean isLinkingEnabled() {
- return linkingEnabled;
- }
-
- /*
- * Flatten the text in the multiline comment
- */
- public static String flattenText(String string) {
- StringBuffer buffer = new StringBuffer(string.length() + 20);
- boolean skipAdjacentLineSeparator = true;
- for (int i = 0; i < string.length(); i++) {
- char c = string.charAt(i);
- if (c == '\r' || c == '\n') {
- if (!skipAdjacentLineSeparator)
- buffer.append(Policy.bind("separator")); //$NON-NLS-1$
- skipAdjacentLineSeparator = true;
- } else {
- buffer.append(c);
- skipAdjacentLineSeparator = false;
- }
- }
- return buffer.toString();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
deleted file mode 100644
index 8ac63fa4d..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui;
-
-public interface ICVSUIConstants {
- public final String PREFIX = CVSUIPlugin.ID + "."; //$NON-NLS-1$
-
- // image path
- public final String ICON_PATH = "icons/full/"; //$NON-NLS-1$
-
- // images
- public final String IMG_CVS_CONSOLE = "eview16/console_view.gif"; //$NON-NLS-1$
- public final String IMG_CVS_PERSPECTIVE = "eview16/cvs_persp.gif"; //$NON-NLS-1$
-
- // overlays
- public final String IMG_MERGEABLE_CONFLICT = "ovr16/confauto_ov.gif"; //$NON-NLS-1$
- public final String IMG_QUESTIONABLE = "ovr16/question_ov.gif"; //$NON-NLS-1$
- public final String IMG_MERGED = "ovr16/merged_ov.gif"; //$NON-NLS-1$
- public final String IMG_EDITED = "ovr16/edited_ov.gif"; //$NON-NLS-1$
- public final String IMG_NO_REMOTEDIR = "ovr16/no_remotedir_ov.gif"; //$NON-NLS-1$
-
- // objects
- public final String IMG_REPOSITORY = "obj16/repository_rep.gif"; //$NON-NLS-1$
- public final String IMG_TAG = "obj16/tag.gif"; //$NON-NLS-1$
- public final String IMG_BRANCHES_CATEGORY = "obj16/branches_rep.gif"; //$NON-NLS-1$
- public final String IMG_VERSIONS_CATEGORY = "obj16/versions_rep.gif"; //$NON-NLS-1$
- public final String IMG_DATES_CATEGORY = "obj16/dates.gif"; //$NON-NLS-1$
-
- public final String IMG_MODULE = "obj16/module_rep.gif"; //$NON-NLS-1$
- public final String IMG_PROJECT_VERSION = "obj16/prjversions_rep.gif"; //$NON-NLS-1$
- public final String IMG_DATE = "obj16/date.gif"; //$NON-NLS-1$
- public final String IMG_CHANGELOG = "obj16/changelog_obj.gif"; //$NON-NLS-1$
-
- // toolbar
- public final String IMG_REFRESH = "elcl16/refresh.gif"; //$NON-NLS-1$
- public final String IMG_CLEAR = "elcl16/clear_co.gif"; //$NON-NLS-1$
- public final String IMG_COLLAPSE_ALL = "elcl16/collapseall.gif"; //$NON-NLS-1$
- public final String IMG_LINK_WITH_EDITOR = "elcl16/synced.gif"; //$NON-NLS-1$
- public final String IMG_REMOVE_CONSOLE = "elcl16/console_rem.gif"; //$NON-NLS-1$
-
- // toolbar (disabled)
- public final String IMG_REFRESH_DISABLED = "dlcl16/refresh.gif"; //$NON-NLS-1$
- public final String IMG_CLEAR_DISABLED = "dlcl16/clear_co.gif"; //$NON-NLS-1$
- public final String IMG_REMOVE_CONSOLE_DISABLED = "dlcl16/console_rem.gif"; //$NON-NLS-1$
-
- // toolbar (enabled)
- public final String IMG_REFRESH_ENABLED = "elcl16/refresh.gif"; //$NON-NLS-1$
- public final String IMG_CLEAR_ENABLED = "elcl16/clear_co.gif"; //$NON-NLS-1$
- public final String IMG_COLLAPSE_ALL_ENABLED = "elcl16/collapseall.gif"; //$NON-NLS-1$
- public final String IMG_LINK_WITH_EDITOR_ENABLED = "elcl16/synced.gif"; //$NON-NLS-1$
-
- // wizards
- public final String IMG_NEWLOCATION = "etool16/newlocation_wiz.gif"; //$NON-NLS-1$
- public final String IMG_CVSLOGO = "etool16/newconnect_wiz.gif"; //$NON-NLS-1$
-
- // preferences
- public final String PREF_SHOW_COMMENTS = "pref_show_comments"; //$NON-NLS-1$
- public final String PREF_SHOW_TAGS = "pref_show_tags"; //$NON-NLS-1$
- public final String PREF_HISTORY_VIEW_EDITOR_LINKING = "pref_history_view_linking"; //$NON-NLS-1$
- public final String PREF_PRUNE_EMPTY_DIRECTORIES = "pref_prune_empty_directories"; //$NON-NLS-1$
- public final String PREF_TIMEOUT = "pref_timeout"; //$NON-NLS-1$
- public final String PREF_QUIETNESS = "pref_quietness"; //$NON-NLS-1$
- public final String PREF_CVS_RSH = "pref_cvs_rsh"; //$NON-NLS-1$
- public final String PREF_CVS_RSH_PARAMETERS = "pref_cvs_rsh_parameters"; //$NON-NLS-1$
- public final String PREF_CVS_SERVER = "pref_cvs_server"; //$NON-NLS-1$
- public final String PREF_CONSIDER_CONTENTS = "pref_consider_contents"; //$NON-NLS-1$
- public final String PREF_REPLACE_UNMANAGED = "pref_replace_unmanaged"; //$NON-NLS-1$
- public final String PREF_COMPRESSION_LEVEL = "pref_compression_level"; //$NON-NLS-1$
- public final String PREF_TEXT_KSUBST = "pref_text_ksubst"; //$NON-NLS-1$
- public final String PREF_USE_PLATFORM_LINEEND = "pref_lineend"; //$NON-NLS-1$
- public final String PREF_PROMPT_ON_MIXED_TAGS = "pref_prompt_on_mixed_tags"; //$NON-NLS-1$
- public final String PREF_PROMPT_ON_SAVING_IN_SYNC = "pref_prompt_on_saving_in_sync"; //$NON-NLS-1$
- public final String PREF_SAVE_DIRTY_EDITORS = "pref_save_dirty_editors"; //$NON-NLS-1$
- public final String PREF_PROMPT_ON_CHANGE_GRANULARITY = "pref_prompt_on_change_granularity"; //$NON-NLS-1$
- public final String PREF_REPOSITORIES_ARE_BINARY = "pref_repositories_are_binary"; //$NON-NLS-1$
- public final String PREF_DETERMINE_SERVER_VERSION = "pref_determine_server_version"; //$NON-NLS-1$
- public final String PREF_CONFIRM_MOVE_TAG = "pref_confirm_move_tag"; //$NON-NLS-1$
- public final String PREF_DEBUG_PROTOCOL = "pref_debug_protocol"; //$NON-NLS-1$
- public final String PREF_WARN_REMEMBERING_MERGES = "pref_remember_merges"; //$NON-NLS-1$
- public final String PREF_FIRST_STARTUP = "pref_first_startup"; //$NON-NLS-1$
- public final String PREF_EXT_CONNECTION_METHOD_PROXY = "pref_ext_connection_method_proxy"; //$NON-NLS-1$
- public final String PREF_SHOW_COMPARE_REVISION_IN_DIALOG = "pref_show_compare_revision_in_dialog"; //$NON-NLS-1$
- public final String PREF_SHOW_AUTHOR_IN_EDITOR = "pref_show_author_in_editor"; //$NON-NLS-1$
- public final String PREF_COMMIT_SET_DEFAULT_ENABLEMENT = "pref_enable_commit_sets"; //$NON-NLS-1$
-
- // console preferences
- public final String PREF_CONSOLE_COMMAND_COLOR = "pref_console_command_color"; //$NON-NLS-1$
- public final String PREF_CONSOLE_MESSAGE_COLOR = "pref_console_message_color"; //$NON-NLS-1$
- public final String PREF_CONSOLE_ERROR_COLOR = "pref_console_error_color"; //$NON-NLS-1$
- public final String PREF_CONSOLE_FONT = "pref_console_font"; //$NON-NLS-1$
- public final String PREF_CONSOLE_SHOW_ON_MESSAGE = "pref_console_show_on_message"; //$NON-NLS-1$
- public final String PREF_CONSOLE_LIMIT_OUTPUT = "pref_console_limit_output"; //$NON-NLS-1$
- public final String PREF_CONSOLE_HIGH_WATER_MARK = "pref_console_high_water_mark"; //$NON-NLS-1$
- public final String PREF_CONSOLE_WRAP = "pref_console_wrap"; //$NON-NLS-1$
- public final String PREF_CONSOLE_WIDTH = "pref_console_width"; //$NON-NLS-1$
-
- // decorator preferences
- public final String PREF_FILETEXT_DECORATION = "pref_filetext_decoration"; //$NON-NLS-1$
- public final String PREF_FOLDERTEXT_DECORATION = "pref_foldertext_decoration"; //$NON-NLS-1$
- public final String PREF_PROJECTTEXT_DECORATION = "pref_projecttext_decoration"; //$NON-NLS-1$
-
- public final String PREF_SHOW_DIRTY_DECORATION = "pref_show_overlaydirty"; //$NON-NLS-1$
- public final String PREF_SHOW_ADDED_DECORATION = "pref_show_added"; //$NON-NLS-1$
- public final String PREF_SHOW_HASREMOTE_DECORATION = "pref_show_hasremote"; //$NON-NLS-1$
- public final String PREF_SHOW_NEWRESOURCE_DECORATION = "pref_show_newresource"; //$NON-NLS-1$
-
- public final String PREF_DIRTY_FLAG = "pref_dirty_flag"; //$NON-NLS-1$
- public final String PREF_ADDED_FLAG = "pref_added_flag"; //$NON-NLS-1$
-
- public final String PREF_CALCULATE_DIRTY = "pref_calculate_dirty"; //$NON-NLS-1$
-
- // watch/edit preferences
- public final String PREF_CHECKOUT_READ_ONLY = "pref_checkout_read_only"; //$NON-NLS-1$
- public final String PREF_EDIT_ACTION = "pref_edit_action"; //$NON-NLS-1$
- public final String PREF_EDIT_PROMPT_EDIT = "edit"; //$NON-NLS-1$
- public final String PREF_EDIT_PROMPT_HIGHJACK = "highjack"; //$NON-NLS-1$
- public final String PREF_EDIT_PROMPT = "pref_edit_prompt"; //$NON-NLS-1$
- public final String PREF_EDIT_PROMPT_NEVER = "never"; //$NON-NLS-1$
- public final String PREF_EDIT_PROMPT_ALWAYS = "always"; //$NON-NLS-1$
- public final String PREF_EDIT_PROMPT_IF_EDITORS = "only"; //$NON-NLS-1$
-
- // Repositories view preferences
- public final String PREF_GROUP_VERSIONS_BY_PROJECT = "pref_group_versions_by_project"; //$NON-NLS-1$
-
- // Work in Progress preferences
- public final String PREF_CHANGE_PERSPECTIVE_ON_SHOW_ANNOTATIONS= "pref_change_perspective_on_show_annotations"; //$NON-NLS-1$
- public final String PREF_DEFAULT_PERSPECTIVE_FOR_SHOW_ANNOTATIONS= "pref_default_perspective_for_show_annotations"; //$NON-NLS-1$
-
- // Wizard banners
- public final String IMG_WIZBAN_SHARE = "wizban/newconnect_wizban.gif"; //$NON-NLS-1$
- public final String IMG_WIZBAN_MERGE = "wizban/mergestream_wizban.gif"; //$NON-NLS-1$
- public final String IMG_WIZBAN_DIFF = "wizban/createpatch_wizban.gif"; //$NON-NLS-1$
- public final String IMG_WIZBAN_KEYWORD = "wizban/keywordsub_wizban.gif"; //$NON-NLS-1$
- public final String IMG_WIZBAN_NEW_LOCATION = "wizban/newlocation_wizban.gif"; //$NON-NLS-1$
- public final String IMG_WIZBAN_CHECKOUT = "wizban/newconnect_wizban.gif"; //$NON-NLS-1$
-
- // Properties
- public final String PROP_NAME = "cvs.name"; //$NON-NLS-1$
- public final String PROP_REVISION = "cvs.revision"; //$NON-NLS-1$
- public final String PROP_AUTHOR = "cvs.author"; //$NON-NLS-1$
- public final String PROP_COMMENT = "cvs.comment"; //$NON-NLS-1$
- public final String PROP_DATE = "cvs.date"; //$NON-NLS-1$
- public final String PROP_DIRTY = "cvs.dirty"; //$NON-NLS-1$
- public final String PROP_MODIFIED = "cvs.modified"; //$NON-NLS-1$
- public final String PROP_KEYWORD = "cvs.date"; //$NON-NLS-1$
- public final String PROP_TAG = "cvs.tag"; //$NON-NLS-1$
- public final String PROP_PERMISSIONS = "cvs.permissions"; //$NON-NLS-1$
- public final String PROP_HOST = "cvs.host"; //$NON-NLS-1$
- public final String PROP_USER = "cvs.user"; //$NON-NLS-1$
- public final String PROP_METHOD = "cvs.method"; //$NON-NLS-1$
- public final String PROP_PORT = "cvs.port"; //$NON-NLS-1$
- public final String PROP_ROOT = "cvs.root"; //$NON-NLS-1$
-
- // preference options
- public final int OPTION_NEVER = 1;
- public final int OPTION_PROMPT = 2;
- public final int OPTION_AUTOMATIC = 3;
-
- public final String OPTION_NO_PERSPECTIVE= "none"; //$NON-NLS-1$
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java
deleted file mode 100644
index 5088907cd..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-/**
- * Here's how to reference the help context in code:
- *
- * WorkbenchHelp.setHelp(actionOrControl, IHelpContextIds.NAME_DEFIED_BELOW);
- */
-public interface IHelpContextIds {
-
- public static final String PREFIX = CVSUIPlugin.ID + "."; //$NON-NLS-1$
-
- // Dialogs
- public static final String TAG_CONFIGURATION_OVERVIEW = PREFIX + "tag_configuration_overview"; //$NON-NLS-1$
- public static final String TAG_CONFIGURATION_REFRESHLIST = PREFIX + "tag_configuration_refreshlist"; //$NON-NLS-1$
- public static final String TAG_CONFIGURATION_REFRESHACTION = PREFIX + "tag_configuration_refreshaction"; //$NON-NLS-1$
- public static final String USER_VALIDATION_DIALOG = PREFIX + "user_validation_dialog_context"; //$NON-NLS-1$
- public static final String RELEASE_COMMENT_DIALOG = PREFIX + "release_comment_dialog_context"; //$NON-NLS-1$
- public static final String BRANCH_DIALOG = PREFIX + "branch_dialog_context"; //$NON-NLS-1$
- public static final String ADD_TO_VERSION_CONTROL_DIALOG = PREFIX + "add_to_version_control_dialog_context"; //$NON-NLS-1$
- public static final String EDITORS_DIALOG = PREFIX + "editors_dialog_context"; //$NON-NLS-1$
- public static final String HISTORY_FILTER_DIALOG = PREFIX + "history_filter_dialog_context"; //$NON-NLS-1$
- public static final String DATE_TAG_DIALOG = PREFIX + "date_tag_dialog_context"; //$NON-NLS-1$
- public static final String KEYBOARD_INTERACTIVE_DIALOG = PREFIX + "keyboard_interactive_dialog_context"; //$NON-NLS-1$
- public static final String COMMIT_SET_DIALOG = PREFIX + "commit_set_dialog_context"; //$NON-NLS-1$
-
- // Different uses of the TagSelectionDialog
- public static final String REPLACE_TAG_SELECTION_DIALOG = PREFIX + "replace_tag_selection_dialog_context"; //$NON-NLS-1$
- public static final String COMPARE_TAG_SELECTION_DIALOG = PREFIX + "compare_tag_selection_dialog_context"; //$NON-NLS-1$
- public static final String TAG_REMOTE_WITH_EXISTING_DIALOG = PREFIX + "tag_remote_with_existing_dialog_context"; //$NON-NLS-1$
-
- // Different uses of the TagAsVersionDialog
- public static final String TAG_AS_VERSION_DIALOG = PREFIX + "tag_as_version_dialog_context"; //$NON-NLS-1$
-
- // Wizard Pages
- public static final String SHARING_AUTOCONNECT_PAGE = PREFIX + "sharing_autoconnect_page_context"; //$NON-NLS-1$
- public static final String SHARING_SELECT_REPOSITORY_PAGE = PREFIX + "sharing_select_repository_page_context"; //$NON-NLS-1$
- public static final String SHARING_NEW_REPOSITORY_PAGE = PREFIX + "sharing_new_repository_page_context"; //$NON-NLS-1$
- public static final String SHARING_MODULE_PAGE = PREFIX + "sharing_module_page_context"; //$NON-NLS-1$
- public static final String SHARING_TAG_SELETION_PAGE = PREFIX + "sharing_tag_selection_page_context"; //$NON-NLS-1$
- public static final String SHARING_SYNC_PAGE = PREFIX + "sharing_sync_page_context"; //$NON-NLS-1$
-
- public static final String PATCH_SELECTION_PAGE = PREFIX + "patch_selection_page_context"; //$NON-NLS-1$
- public static final String PATCH_OPTIONS_PAGE = PREFIX + "patch_options_page_context"; //$NON-NLS-1$
-
- public static final String KEYWORD_SUBSTITUTION_SELECTION_PAGE = PREFIX + "keyword_substituton_selection_page_context"; //$NON-NLS-1$
- public static final String KEYWORD_SUBSTITUTION_SUMMARY_PAGE = PREFIX + "keyword_substituton_summary_page_context"; //$NON-NLS-1$
- public static final String KEYWORD_SUBSTITUTION_SHARED_PAGE = PREFIX + "keyword_substituton_shared_page_context"; //$NON-NLS-1$
- public static final String KEYWORD_SUBSTITUTION_CHANGED_PAGE = PREFIX + "keyword_substituton_changed_page_context"; //$NON-NLS-1$
- public static final String KEYWORD_SUBSTITUTION_COMMIT_COMMENT_PAGE = PREFIX + "keyword_substituton_commit_comment_page_context"; //$NON-NLS-1$
-
- public static final String MERGE_START_PAGE = PREFIX + "merge_start_page_context"; //$NON-NLS-1$
- public static final String MERGE_END_PAGE = PREFIX + "merge_end_page_context"; //$NON-NLS-1$
-
- public static final String CHECKOUT_MODULE_SELECTION_PAGE = PREFIX + "checkout_module_selection_context"; //$NON-NLS-1$
- public static final String CHECKOUT_CONFIGURATION_PAGE = PREFIX + "checkout_configuration_context"; //$NON-NLS-1$
- public static final String CHECKOUT_LOCATION_SELECTION_PAGE = PREFIX + "checkout_location_selection_context"; //$NON-NLS-1$
- public static final String CHECKOUT_PROJECT_SELECTION_PAGE = PREFIX + "checkout_into_resource_selection_page_context"; //$NON-NLS-1$
- public static final String CHECKOUT_TAG_SELETION_PAGE = PREFIX + "checkout_tag_selection_page_context"; //$NON-NLS-1$
-
- public static final String UPDATE_TAG_SELETION_PAGE = PREFIX + "update_tag_selection_page_context"; //$NON-NLS-1$
-
- public static final String RESTORE_FROM_REPOSITORY_FILE_SELECTION_PAGE = PREFIX + "restore_from_repository_file_selection_page_context"; //$NON-NLS-1$
- public static final String REFRESH_REMOTE_PROJECT_SELECTION_PAGE = PREFIX + "refresh_remote_project_selection_page_context"; //$NON-NLS-1$
-
- // Preference Pages
- public static final String PREF_PRUNE = PREFIX + "prune_empty_directories_pref"; //$NON-NLS-1$
- public static final String PREF_QUIET = PREFIX + "quietness_level_pref"; //$NON-NLS-1$
- public static final String PREF_COMPRESSION = PREFIX + "compression_level_pref"; //$NON-NLS-1$
- public static final String PREF_KEYWORDMODE = PREFIX + "default_keywordmode_pref"; //$NON-NLS-1$
- public static final String PREF_LINEEND = PREFIX + "line_end_pref"; //$NON-NLS-1$
- public static final String PREF_COMMS_TIMEOUT = PREFIX + "comms_timeout_pref"; //$NON-NLS-1$
- public static final String PREF_CONSIDER_CONTENT = PREFIX + "consider_content_pref"; //$NON-NLS-1$
- public static final String PREF_REPLACE_DELETE_UNMANAGED = PREFIX + "replace_deletion_of_unmanaged_pref"; //$NON-NLS-1$
- public static final String PREF_SAVE_DIRTY_EDITORS = PREFIX + "save_dirty_editors_pref"; //$NON-NLS-1$
-
- public static final String PREF_TREAT_NEW_FILE_AS_BINARY = PREFIX + "treat_new_files_as_binary_pref"; //$NON-NLS-1$
- public static final String PREF_DETERMINE_SERVER_VERSION = PREFIX + "determine_server_version"; //$NON-NLS-1$
- public static final String PREF_CONFIRM_MOVE_TAG = PREFIX + "confirm_move_tag"; //$NON-NLS-1$
-
- public static final String CONSOLE_PREFERENCE_PAGE = PREFIX + "console_preference_page_context"; //$NON-NLS-1$
- public static final String EXT_PREFERENCE_PAGE = PREFIX + "ext_preference_page_context"; //$NON-NLS-1$
- public static final String EXT_PREFERENCE_RSH = PREFIX + "ext_preference_rsh_context"; //$NON-NLS-1$
- public static final String EXT_PREFERENCE_PARAM = PREFIX + "ext_preference_param_context"; //$NON-NLS-1$
- public static final String EXT_PREFERENCE_SERVER = PREFIX + "ext_preference_server_context"; //$NON-NLS-1$
- public static final String DECORATORS_PREFERENCE_PAGE = PREFIX + "decorators_preference_page_context"; //$NON-NLS-1$
- public static final String WATCH_EDIT_PREFERENCE_PAGE = PREFIX + "watch_edit_preference_page_context"; //$NON-NLS-1$
- public static final String PASSWORD_MANAGEMENT_PAGE = PREFIX + "password_management_preference_page_context"; //$NON-NLS-1$
- public static final String COMPARE_PREFERENCE_PAGE = PREFIX + "cvs_compare_preference_page_context"; //$NON-NLS-1$
-
- // Views
- public static final String CONSOLE_VIEW = PREFIX + "console_view_context"; //$NON-NLS-1$
- public static final String REPOSITORIES_VIEW = PREFIX + "repositories_view_context"; //$NON-NLS-1$
- public static final String RESOURCE_HISTORY_VIEW = PREFIX + "resource_history_view_context"; //$NON-NLS-1$
- public static final String COMPARE_REVISIONS_VIEW = PREFIX + "compare_revision_view_context"; //$NON-NLS-1$
-
- public static final String CVS_EDITORS_VIEW = PREFIX + "cvs_editors_view_context"; //$NON-NLS-1$
- public static final String ANNOTATE_VIEW = PREFIX + "annotate_view_context"; //$NON-NLS-1$
-
- // Viewers
- public static final String CATCHUP_RELEASE_VIEWER = PREFIX + "catchup_release_viewer_context"; //$NON-NLS-1$
-
- // Add to .cvsignore dialog
- public static final String ADD_TO_CVSIGNORE = PREFIX + "add_to_cvsignore_context"; //$NON-NLS-1$
-
- // Actions
- public static final String GET_ANNOTATE_ACTION = PREFIX + "get_annotate_action_context"; //$NON-NLS-1$
- public static final String GET_FILE_REVISION_ACTION = PREFIX + "get_file_revision_action_context"; //$NON-NLS-1$
- public static final String GET_FILE_CONTENTS_ACTION = PREFIX + "get_file_contents_action_context"; //$NON-NLS-1$
- public static final String TAG_WITH_EXISTING_ACTION = PREFIX + "tag_with_existing_action_context"; //$NON-NLS-1$
- public static final String NEW_REPOSITORY_LOCATION_ACTION = PREFIX + "new_repository_location_action_context"; //$NON-NLS-1$
- public static final String NEW_DEV_ECLIPSE_REPOSITORY_LOCATION_ACTION = PREFIX + "new_dev_eclipse repository_location_action_context"; //$NON-NLS-1$
- public static final String SHOW_COMMENT_IN_HISTORY_ACTION = PREFIX + "show_comment_in_history_action_context"; //$NON-NLS-1$
- public static final String SHOW_TAGS_IN_HISTORY_ACTION = PREFIX + "show_tag_in_history_action_context"; //$NON-NLS-1$
- public static final String SELECT_WORKING_SET_ACTION = PREFIX + "select_working_set_action_context"; //$NON-NLS-1$
- public static final String DESELECT_WORKING_SET_ACTION = PREFIX + "deselect_working_set_action_context"; //$NON-NLS-1$
- public static final String EDIT_WORKING_SET_ACTION = PREFIX + "edit_working_set_action_context"; //$NON-NLS-1$
- public static final String REMOVE_REPOSITORY_LOCATION_ACTION = PREFIX + "remove_root_action_context"; //$NON-NLS-1$
- public static final String SHOW_IN_RESOURCE_HISTORY = PREFIX + "show_in_history_action_context"; //$NON-NLS-1$
- public static final String SELECT_NEW_RESOURCES_ACTION = PREFIX + "select_new_action_context"; //$NON-NLS-1$
- public static final String CONFIRM_MERGE_ACTION = PREFIX + "confirm_merge_action_context"; //$NON-NLS-1$;
- public static final String DISCONNECT_ACTION = PREFIX + "disconnect_action_context"; //$NON-NLS-1$;
-
- // Sync view menu actions
- public static final String SYNC_COMMIT_ACTION = PREFIX + "sync_commit_action_context"; //$NON-NLS-1$
- public static final String SYNC_FORCED_COMMIT_ACTION = PREFIX + "sync_forced_commit_action_context"; //$NON-NLS-1$
- public static final String SYNC_UPDATE_ACTION = PREFIX + "sync_update_action_context"; //$NON-NLS-1$
- public static final String SYNC_FORCED_UPDATE_ACTION = PREFIX + "sync_forced_update_action_context"; //$NON-NLS-1$
- public static final String SYNC_ADD_ACTION = PREFIX + "sync_add_action_context"; //$NON-NLS-1$
- public static final String SYNC_IGNORE_ACTION = PREFIX + "sync_ignore_action_context"; //$NON-NLS-1$
- public static final String MERGE_UPDATE_ACTION = PREFIX + "merge_update_action_context"; //$NON-NLS-1$
- public static final String MERGE_FORCED_UPDATE_ACTION = PREFIX + "merge_forced_update_action_context"; //$NON-NLS-1$
- public static final String MERGE_UPDATE_WITH_JOIN_ACTION = PREFIX + "merge_update_with_joinaction_context"; //$NON-NLS-1$
-
- // properties pages
- public static final String REPOSITORY_LOCATION_PROPERTY_PAGE = PREFIX + "repository_location_property_page_context"; //$NON-NLS-1$
- public static final String REPOSITORY_ENCODING_PROPERTY_PAGE = PREFIX + "repository_encoding_property_page_context"; //$NON-NLS-1$
- public static final String PROJECT_PROPERTY_PAGE = PREFIX + "project_property_page_context"; //$NON-NLS-1$
- public static final String FOLDER_PROPERTY_PAGE = PREFIX + "folder_property_page_context"; //$NON-NLS-1$
- public static final String FILE_PROPERTY_PAGE = PREFIX + "file_property_page_context"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IRepositoryListener.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IRepositoryListener.java
deleted file mode 100644
index e488cdf7f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IRepositoryListener.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-
-public interface IRepositoryListener {
- public void repositoryAdded(ICVSRepositoryLocation root);
- public void repositoryRemoved(ICVSRepositoryLocation root);
- public void repositoriesChanged(ICVSRepositoryLocation[] roots);
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IgnoreResourcesDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IgnoreResourcesDialog.java
deleted file mode 100644
index 6348357fb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IgnoreResourcesDialog.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.resource.JFaceColors;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.team.internal.ccvs.core.util.FileNameMatcher;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-public class IgnoreResourcesDialog extends Dialog {
- // resources that should be ignored
- private IResource[] resources;
-
- // preference keys
- private final String ACTION_KEY = "Action"; //$NON-NLS-1$
- private static final int ADD_NAME_ENTRY = 0;
- private static final int ADD_EXTENSION_ENTRY = 1;
- private static final int ADD_CUSTOM_ENTRY = 2;
-
- // dialogs settings that are persistent between workbench sessions
- private IDialogSettings settings;
-
- // buttons
- private Button addNameEntryButton;
- private Button addExtensionEntryButton;
- private Button addCustomEntryButton;
- private Text customEntryText;
- private Label statusMessageLabel;
-
- private int selectedAction;
- private String customPattern;
-
- // layout controls
- private static final int LABEL_INDENT_WIDTH = 32;
-
- /**
- * Creates a new dialog for ignoring resources.
- * @param shell the parent shell
- * @param resources the array of resources to be ignored
- */
- public IgnoreResourcesDialog(Shell shell, IResource[] resources) {
- super(shell);
- this.resources = resources;
-
- IDialogSettings workbenchSettings = CVSUIPlugin.getPlugin().getDialogSettings();
- this.settings = workbenchSettings.getSection("IgnoreResourcesDialog");//$NON-NLS-1$
- if (settings == null) {
- this.settings = workbenchSettings.addNewSection("IgnoreResourcesDialog");//$NON-NLS-1$
- }
-
- try {
- selectedAction = settings.getInt(ACTION_KEY);
- } catch (NumberFormatException e) {
- selectedAction = ADD_NAME_ENTRY;
- }
- }
-
- /**
- * Determines the ignore pattern to use for a resource given the selected action.
- *
- * @param resource the resource
- * @return the ignore pattern for the specified resource
- */
- public String getIgnorePatternFor(IResource resource) {
- switch (selectedAction) {
- case ADD_NAME_ENTRY:
- return resource.getName();
- case ADD_EXTENSION_ENTRY: {
- String extension = resource.getFileExtension();
- return (extension == null) ? resource.getName() : "*." + extension; //$NON-NLS-1$
- }
- case ADD_CUSTOM_ENTRY:
- return customPattern;
- }
- throw new IllegalStateException();
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void createButtonsForButtonBar(Composite parent) {
- createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- if (resources.length == 1) {
- newShell.setText(Policy.bind("IgnoreResourcesDialog.titleSingle", resources[0].getName())); //$NON-NLS-1$
- } else {
- newShell.setText(Policy.bind("IgnoreResourcesDialog.titleMany", Integer.toString(resources.length))); //$NON-NLS-1$
- }
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected Control createContents(Composite parent) {
- Control control = super.createContents(parent);
- updateEnablements();
- return control;
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected Control createDialogArea(Composite parent) {
- Composite top = new Composite(parent, SWT.NONE);
- top.setLayout(new GridLayout());
-
- WorkbenchHelp.setHelp(top, IHelpContextIds.ADD_TO_CVSIGNORE);
-
- createIndentedLabel(top, Policy.bind("IgnoreResourcesDialog.prompt"), 0); //$NON-NLS-1$
-
- Listener selectionListener = new Listener() {
- public void handleEvent(Event event) {
- updateEnablements();
- }
- };
- Listener modifyListener = new Listener() {
- public void handleEvent(Event event) {
- validate();
- }
- };
-
- addNameEntryButton = createRadioButton(top, Policy.bind("IgnoreResourcesDialog.addNameEntryButton")); //$NON-NLS-1$
- addNameEntryButton.addListener(SWT.Selection, selectionListener);
- addNameEntryButton.setSelection(selectedAction == ADD_NAME_ENTRY);
- createIndentedLabel(top, Policy.bind("IgnoreResourcesDialog.addNameEntryExample"), LABEL_INDENT_WIDTH); //$NON-NLS-1$
-
- addExtensionEntryButton = createRadioButton(top, Policy.bind("IgnoreResourcesDialog.addExtensionEntryButton")); //$NON-NLS-1$
- addExtensionEntryButton.addListener(SWT.Selection, selectionListener);
- addExtensionEntryButton.setSelection(selectedAction == ADD_EXTENSION_ENTRY);
- createIndentedLabel(top, Policy.bind("IgnoreResourcesDialog.addExtensionEntryExample"), LABEL_INDENT_WIDTH); //$NON-NLS-1$
-
- addCustomEntryButton = createRadioButton(top, Policy.bind("IgnoreResourcesDialog.addCustomEntryButton")); //$NON-NLS-1$
- addCustomEntryButton.addListener(SWT.Selection, selectionListener);
- addCustomEntryButton.setSelection(selectedAction == ADD_CUSTOM_ENTRY);
- createIndentedLabel(top, Policy.bind("IgnoreResourcesDialog.addCustomEntryExample"), LABEL_INDENT_WIDTH); //$NON-NLS-1$
-
- customEntryText = createIndentedText(top, resources[0].getName(), LABEL_INDENT_WIDTH);
- customEntryText.addListener(SWT.Modify, modifyListener);
-
- statusMessageLabel = createIndentedLabel(top, "", 0); //$NON-NLS-1$
- Dialog.applyDialogFont(parent);
- return top;
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void okPressed() {
- settings.put(ACTION_KEY, selectedAction);
- super.okPressed();
- }
-
- private Label createIndentedLabel(Composite parent, String text, int indent) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.FILL_HORIZONTAL);
- data.horizontalIndent = indent;
- label.setLayoutData(data);
- return label;
- }
-
- private Text createIndentedText(Composite parent, String text, int indent) {
- Text textbox = new Text(parent, SWT.BORDER);
- textbox.setText(text);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalIndent = indent;
- textbox.setLayoutData(data);
- return textbox;
- }
-
- private Button createRadioButton(Composite parent, String text) {
- Button button = new Button(parent, SWT.RADIO);
- button.setText(text);
- button.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.FILL_HORIZONTAL));
- return button;
- }
-
- private void updateEnablements() {
- if (addNameEntryButton.getSelection()) {
- selectedAction = ADD_NAME_ENTRY;
- } else if (addExtensionEntryButton.getSelection()) {
- selectedAction = ADD_EXTENSION_ENTRY;
- } else if (addCustomEntryButton.getSelection()) {
- selectedAction = ADD_CUSTOM_ENTRY;
- }
- customEntryText.setEnabled(selectedAction == ADD_CUSTOM_ENTRY);
- validate();
- }
-
- private void validate() {
- if (selectedAction == ADD_CUSTOM_ENTRY) {
- customPattern = customEntryText.getText();
- if (customPattern.length() == 0) {
- setError(Policy.bind("IgnoreResourcesDialog.patternMustNotBeEmpty")); //$NON-NLS-1$
- return;
- }
- FileNameMatcher matcher = new FileNameMatcher(new String[] { customPattern });
- for (int i = 0; i < resources.length; i++) {
- String name = resources[i].getName();
- if (! matcher.match(name)) {
- setError(Policy.bind("IgnoreResourcesDialog.patternDoesNotMatchFile", name)); //$NON-NLS-1$
- return;
- }
- }
- }
- setError(null);
- }
-
- private void setError(String text) {
- if (text == null) {
- statusMessageLabel.setText(""); //$NON-NLS-1$
- getButton(IDialogConstants.OK_ID).setEnabled(true);
- } else {
- statusMessageLabel.setText(text);
- statusMessageLabel.setForeground(JFaceColors.getErrorText(getShell().getDisplay()));
- getButton(IDialogConstants.OK_ID).setEnabled(false);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/KeyboardInteractiveDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/KeyboardInteractiveDialog.java
deleted file mode 100644
index 5add39551..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/KeyboardInteractiveDialog.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/* -*-mode:java; c-basic-offset:2; -*- */
-/**********************************************************************
-Copyright (c) 2004, Atsuhiko Yamanaka, JCraft,Inc. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- Atsuhiko Yamanaka, JCraft,Inc. - initial API and implementation.
-**********************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * A dialog for keyboad-interactive authentication for the ssh2 connection.
- */
-public class KeyboardInteractiveDialog extends Dialog {
- // widgets
- private Text[] texts;
-
- protected String domain;
- protected String destination;
- protected String name;
- protected String instruction;
- protected String lang;
- protected String[] prompt;
- protected boolean[] echo;
- private String message;
- private String[] result;
-
- /**
- * Creates a nwe KeyboardInteractiveDialog.
- *
- * @param parentShell the parent shell
- * @param destication the location
- * @param name the name
- * @param instruction the instruction
- * @param prompt the titles for textfields
- * @param echo '*' should be used or not
- */
- public KeyboardInteractiveDialog(Shell parentShell,
- String location,
- String destination,
- String name,
- String instruction,
- String[] prompt,
- boolean[] echo){
- super(parentShell);
- this.domain=location;
- this.destination=destination;
- this.name=name;
- this.instruction=instruction;
- this.prompt=prompt;
- this.echo=echo;
- this.message=Policy.bind("KeyboradInteractiveDialog.message", destination+(name!=null && name.length()>0 ? ": "+name : "")); //NON-NLS-1$ //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- /**
- * @see Window#configureShell
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(message);
- }
- /**
- * @see Window#create
- */
- public void create() {
- super.create();
- if(texts.length>0){
- texts[0].setFocus();
- }
- }
- /**
- * @see Dialog#createDialogArea
- */
- protected Control createDialogArea(Composite parent) {
- Composite main=new Composite(parent, SWT.NONE);
- GridLayout layout=new GridLayout();
- layout.numColumns=3;
- main.setLayout(layout);
- main.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- // set F1 help
- WorkbenchHelp.setHelp(main, IHelpContextIds.KEYBOARD_INTERACTIVE_DIALOG);
-
- if (message!=null) {
- Label messageLabel=new Label(main, SWT.WRAP);
- messageLabel.setText(message);
- GridData data=new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan=3;
- messageLabel.setLayoutData(data);
- }
- if(domain!=null){
- Label label = new Label(main, SWT.WRAP);
- label.setText(Policy.bind("KeyboardInteractiveDialog.labelRepository", domain)); //$NON-NLS-1$
- GridData data=new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan=3;
- label.setLayoutData(data);
- }
- if (instruction!=null && instruction.length()>0) {
- Label messageLabel=new Label(main, SWT.WRAP);
- messageLabel.setText(instruction);
- GridData data=new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan=3;
- messageLabel.setLayoutData(data);
- }
- createPasswordFields(main);
- return main;
- }
- /**
- * Creates the widgets that represent the entry area.
- *
- * @param parent the parent of the widgets
- */
- protected void createPasswordFields(Composite parent) {
- texts=new Text[prompt.length];
-
- for(int i=0; i<prompt.length; i++){
- new Label(parent, SWT.NONE).setText(prompt[i]);
- texts[i]=new Text(parent, SWT.BORDER);
- GridData data=new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint=convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH);
- texts[i].setLayoutData(data);
-
- if(!echo[i]){
- texts[i].setEchoChar('*');
- }
- new Label(parent, SWT.NONE);
- }
-
- }
- /**
- * Returns the entered values, or null
- * if the user canceled.
- *
- * @return the entered values
- */
- public String[] getResult() {
- return result;
- }
- /**
- * Notifies that the ok button of this dialog has been pressed.
- * <p>
- * The default implementation of this framework method sets
- * this dialog's return code to <code>Window.OK</code>
- * and closes the dialog. Subclasses may override.
- * </p>
- */
- protected void okPressed() {
- result=new String[prompt.length];
- for(int i=0; i<texts.length; i++){
- result[i]=texts[i].getText();
- }
- super.okPressed();
- }
- /**
- * Notifies that the cancel button of this dialog has been pressed.
- * <p>
- * The default implementation of this framework method sets
- * this dialog's return code to <code>Window.CANCEL</code>
- * and closes the dialog. Subclasses may override.
- * </p>
- */
- protected void cancelPressed() {
- result=null;
- super.cancelPressed();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ListSelectionArea.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ListSelectionArea.java
deleted file mode 100644
index 73bc6d5c3..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ListSelectionArea.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.internal.ui.dialogs.DialogArea;
-
-/**
- * Reusable area that provides a list to select from and a select all and
- * deselect all button.
- */
-public class ListSelectionArea extends DialogArea {
- private Object inputElement;
- private IStructuredContentProvider contentProvider;
- private ILabelProvider labelProvider;
- private String message;
- private List initialSelections;
-
- // the visual selection widget group
- private CheckboxTableViewer listViewer;
-
- private Object[] previousCheckedElements;
-
- public static final String LIST_SELECTION = "ListSelection"; //$NON-NLS-1$
-
- /**
- * Constructor for ListSelectionArea.
- * @param parentDialog
- * @param settings
- */
- public ListSelectionArea(
- Object input,
- IStructuredContentProvider contentProvider,
- ILabelProvider labelProvider,
- String message) {
- this.inputElement = input;
- this.contentProvider = contentProvider;
- this.labelProvider = labelProvider;
- this.message = message;
- this.initialSelections = new ArrayList();
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.DialogArea#createArea(org.eclipse.swt.widgets.Composite)
- */
- public void createArea(Composite parent) {
-
- Dialog.applyDialogFont(parent);
-
- final Composite composite = createComposite(parent, 1, true);
-
- initializeDialogUnits(composite);
-
- if (message != null)
- createWrappingLabel(composite, message, 1);
-
- listViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- data.heightHint = 0; // It will expand to the size of the wizard page!
- data.widthHint = 0;
- listViewer.getTable().setLayoutData(data);
-
- listViewer.setLabelProvider(labelProvider);
- listViewer.setContentProvider(contentProvider);
-
- listViewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- Object[] checkedElements = getViewer().getCheckedElements();
- firePropertyChangeChange(LIST_SELECTION, previousCheckedElements, checkedElements);
- previousCheckedElements = checkedElements;
- }
- });
-
- addSelectionButtons(composite);
-
- initializeViewer();
-
- // initialize page
- if (!getInitialElementSelections().isEmpty())
- checkInitialSelections();
- }
-
- /**
- * Initializes this dialog's viewer after it has been laid out.
- */
- private void initializeViewer() {
- listViewer.setInput(inputElement);
- }
-
- /**
- * Visually checks the previously-specified elements in this dialog's list
- * viewer.
- */
- private void checkInitialSelections() {
- Iterator itemsToCheck = getInitialElementSelections().iterator();
-
- while (itemsToCheck.hasNext())
- listViewer.setChecked(itemsToCheck.next(),true);
- }
-
- /**
- * Add the selection and deselection buttons to the dialog.
- * @param composite org.eclipse.swt.widgets.Composite
- */
- private void addSelectionButtons(Composite composite) {
- Composite buttonComposite = new Composite(composite, SWT.RIGHT);
- buttonComposite.setLayout(new GridLayout(2, false));
- buttonComposite.setData(new GridData(SWT.END, SWT.BEGINNING, true, false));
-
- Button selectButton = createButton(buttonComposite, Policy.bind("ListSelectionArea.selectAll"), GridData.HORIZONTAL_ALIGN_FILL); //$NON-NLS-1$
-
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- listViewer.setAllChecked(true);
- }
- };
- selectButton.addSelectionListener(listener);
-
-
- Button deselectButton = createButton(buttonComposite, Policy.bind("ListSelectionArea.deselectAll"), GridData.HORIZONTAL_ALIGN_FILL); //$NON-NLS-1$
-
- listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- listViewer.setAllChecked(false);
-
- }
- };
- deselectButton.addSelectionListener(listener);
- }
-
- /**
- * Returns the list of initial element selections.
- * @return List
- */
- protected List getInitialElementSelections(){
- return initialSelections;
- }
-
- /**
- * Sets the initial selection in this selection dialog to the given elements.
- *
- * @param selectedElements the array of elements to select
- */
- public void setInitialSelections(Object[] selectedElements) {
- initialSelections = new ArrayList(selectedElements.length);
- for (int i = 0; i < selectedElements.length; i++)
- initialSelections.add(selectedElements[i]);
- }
-
- /**
- * Sets the initial selection in this selection dialog to the given elements.
- *
- * @param selectedElements the List of elements to select
- */
- public void setInitialElementSelections(List selectedElements) {
- initialSelections = selectedElements;
- }
- /**
- * Returns the listViewer.
- * @return CheckboxTableViewer
- */
- public CheckboxTableViewer getViewer() {
- return listViewer;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/OverlayIconCache.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/OverlayIconCache.java
deleted file mode 100644
index c6c06b12f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/OverlayIconCache.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.team.internal.ui.*;
-
-/**
- * Maintains a cache of OverlayIcons.
- */
-public class OverlayIconCache {
- private Map /*from OverlayIcon to Image*/ cache = new HashMap();
-
- /**
- * Returns and caches an image corresponding to the specified icon.
- * @param icon the icon
- * @return the image
- */
- public Image getImageFor(OverlayIcon icon) {
- Image image = (Image) cache.get(icon);
- if (image == null) {
- image = icon.createImage();
- cache.put(icon, image);
- }
- return image;
- }
-
- /**
- * Disposes of all images in the cache.
- */
- public void disposeAll() {
- for (Iterator it = cache.values().iterator(); it.hasNext();) {
- Image image = (Image) it.next();
- image.dispose();
- }
- cache.clear();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/PasswordManagementPreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/PasswordManagementPreferencePage.java
deleted file mode 100644
index 813ad1b95..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/PasswordManagementPreferencePage.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.*;
-import java.util.List;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.TableEditor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-public class PasswordManagementPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
- private TableViewer viewer;
- private Button removeButton;
- private Button removeAllButton;
-
- class TableLabelProvider extends LabelProvider implements ITableLabelProvider {
- public String getColumnText(Object element, int columnIndex) {
- ICVSRepositoryLocation entry = (ICVSRepositoryLocation)element;
- switch (columnIndex) {
- case 0:
- return entry.toString();
- case 1:
- return entry.getUsername();
- default:
- return null;
- }
- }
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
- };
-
- public void init(IWorkbench workbench) {
- setDescription(Policy.bind("PasswordManagementPreferencePage.2")); //$NON-NLS-1$
- }
-
- /**
- * Creates preference page controls on demand.
- *
- * @param parent the parent for the preference page
- */
- protected Control createContents(Composite ancestor) {
-
- Composite parent = new Composite(ancestor, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 2;
- parent.setLayout(layout);
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- parent.setLayoutData(data);
-
- viewer = new TableViewer(parent, SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- Table table = viewer.getTable();
- new TableEditor(table);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.widthHint = convertWidthInCharsToPixels(30);
- /*
- * The hardcoded hint does not look elegant, but in reality
- * it does not make anything bound to this 100-pixel value,
- * because in any case the tree on the left is taller and
- * that's what really determines the height.
- */
- gd.heightHint = 100;
- table.setLayoutData(gd);
- table.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- handleSelection();
- }
- });
- // Create the table columns
- new TableColumn(table, SWT.NULL);
- new TableColumn(table, SWT.NULL);
- TableColumn[] columns = table.getColumns();
- columns[0].setText(Policy.bind("PasswordManagementPreferencePage.3")); //$NON-NLS-1$
- columns[1].setText(Policy.bind("PasswordManagementPreferencePage.4")); //$NON-NLS-1$
- viewer.setColumnProperties(new String[] {"location", "username"}); //$NON-NLS-1$ //$NON-NLS-2$
- viewer.setLabelProvider(new TableLabelProvider());
- viewer.setContentProvider(new IStructuredContentProvider() {
- public void dispose() {
- }
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- public Object[] getElements(Object inputElement) {
- if (inputElement == null) return null;
- ICVSRepositoryLocation[] locations = ((KnownRepositories)inputElement).getRepositories();
- List repos = new ArrayList();
- for (int i = 0; i < locations.length; i++) {
- ICVSRepositoryLocation l = locations[i];
- if(l.getUserInfoCached())
- repos.add(l);
- }
- return (ICVSRepositoryLocation[]) repos.toArray(new ICVSRepositoryLocation[repos.size()]);
- }
- });
- TableLayout tl = new TableLayout();
- tl.addColumnData(new ColumnWeightData(15));
- tl.addColumnData(new ColumnWeightData(1, 100));
- table.setLayout(tl);
-
- Composite buttons = new Composite(parent, SWT.NULL);
- buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
- layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- buttons.setLayout(layout);
-
- removeButton = new Button(buttons, SWT.PUSH);
- removeButton.setText(Policy.bind("PasswordManagementPreferencePage.5")); //$NON-NLS-1$
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint, removeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- removeButton.setLayoutData(data);
- removeButton.setEnabled(false);
- removeButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- remove();
- }
- });
- removeAllButton = new Button(buttons, SWT.PUSH);
- removeAllButton.setText(Policy.bind("PasswordManagementPreferencePage.6")); //$NON-NLS-1$
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint, removeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- removeAllButton.setLayoutData(data);
- removeAllButton.setEnabled(true);
- removeAllButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- removeAll();
- }
- });
- Dialog.applyDialogFont(ancestor);
- viewer.setInput(KnownRepositories.getInstance());
- handleSelection();
-
- WorkbenchHelp.setHelp(getControl(), IHelpContextIds.PASSWORD_MANAGEMENT_PAGE);
-
- return parent;
- }
-
- public boolean performOk() {
- return true;
- }
-
- protected void performDefaults() {
- super.performDefaults();
- }
-
- private void remove() {
- IStructuredSelection s = (IStructuredSelection)viewer.getSelection();
- for (Iterator it = s.iterator(); it.hasNext();) {
- ICVSRepositoryLocation location = (ICVSRepositoryLocation) it.next();
- location.flushUserInfo();
- }
- viewer.refresh();
- handleSelection();
- }
-
- private void removeAll() {
- ICVSRepositoryLocation[] locations = KnownRepositories.getInstance().getRepositories();
- for (int i = 0; i < locations.length; i++) {
- ICVSRepositoryLocation l = locations[i];
- if(l.getUserInfoCached())
- l.flushUserInfo();
- }
- viewer.refresh();
- handleSelection();
- }
-
- private void handleSelection() {
- if (viewer.getTable().getSelectionCount() > 0) {
- removeButton.setEnabled(true);
- } else {
- removeButton.setEnabled(false);
- }
- removeAllButton.setEnabled(viewer.getTable().getItemCount() > 0);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Policy.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Policy.java
deleted file mode 100644
index a3cee4bad..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Policy.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.team.internal.core.InfiniteSubProgressMonitor;
-
-public class Policy {
- public static boolean DEBUG_CONSOLE_BUFFERING = false;
-
- static {
- //init debug options
- if (CVSUIPlugin.getPlugin().isDebugging()) {
- DEBUG_CONSOLE_BUFFERING = "true".equalsIgnoreCase(Platform.getDebugOption(CVSUIPlugin.ID + "/consolebuffering")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- protected static ResourceBundle bundle = null;
-
- /**
- * Creates a NLS catalog for the given locale.
- */
- public static void localize(String bundleName) {
- bundle = ResourceBundle.getBundle(bundleName);
- }
-
- /**
- * Lookup the message with the given ID in this catalog and bind its
- * substitution locations with the given string.
- */
- public static String bind(String id, String binding) {
- return bind(id, new String[] { binding });
- }
-
- /**
- * Lookup the message with the given ID in this catalog and bind its
- * substitution locations with the given strings.
- */
- public static String bind(String id, String binding1, String binding2) {
- return bind(id, new String[] { binding1, binding2 });
- }
-
- /**
- * Gets a string from the resource bundle. We don't want to crash because of a missing String.
- * Returns the key if not found.
- */
- public static String bind(String key) {
- try {
- return bundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * Gets a string from the resource bundle and binds it with the given arguments. If the key is
- * not found, return the key.
- */
- public static String bind(String key, Object[] args) {
- try {
- return MessageFormat.format(bind(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * Progress monitor helpers
- */
- public static void checkCanceled(IProgressMonitor monitor) {
- if (monitor.isCanceled())
- cancelOperation();
- }
- public static void cancelOperation() {
- throw new OperationCanceledException();
- }
- public static IProgressMonitor monitorFor(IProgressMonitor monitor) {
- if (monitor == null)
- return new NullProgressMonitor();
- return monitor;
- }
- public static IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks) {
- if (monitor == null)
- return new NullProgressMonitor();
- if (monitor instanceof NullProgressMonitor)
- return monitor;
- return new SubProgressMonitor(monitor, ticks);
- }
- public static IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks, int style) {
- if (monitor == null)
- return new NullProgressMonitor();
- if (monitor instanceof NullProgressMonitor)
- return monitor;
- return new SubProgressMonitor(monitor, ticks, style);
- }
-
- public static IProgressMonitor infiniteSubMonitorFor(IProgressMonitor monitor, int ticks) {
- if (monitor == null)
- return new NullProgressMonitor();
- if (monitor instanceof NullProgressMonitor)
- return monitor;
- return new InfiniteSubProgressMonitor(monitor, ticks);
- }
-
- public static ResourceBundle getBundle() {
- return bundle;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ReleaseCommentDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ReleaseCommentDialog.java
deleted file mode 100644
index c92c5b583..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ReleaseCommentDialog.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-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.*;
-import org.eclipse.team.internal.ui.dialogs.DetailsDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Prompts the user for a multi-line comment for releasing to CVS.
- */
-public class ReleaseCommentDialog extends DetailsDialog {
-
- CommitCommentArea commitCommentArea;
- // dialogs settings that are persistent between workbench sessions
- private IDialogSettings settings;
- private static final String HEIGHT_KEY = "width-key"; //$NON-NLS-1$
- private static final String WIDTH_KEY = "height-key"; //$NON-NLS-1$
-
- /**
- * ReleaseCommentDialog constructor.
- *
- * @param parentShell the parent of this dialog
- * @param proposedComment
- */
- public ReleaseCommentDialog(Shell parentShell, IResource[] resourcesToCommit, String proposedComment, int depth) {
- super(parentShell, Policy.bind("ReleaseCommentDialog.title")); //$NON-NLS-1$
- int shellStyle = getShellStyle();
- setShellStyle(shellStyle | SWT.RESIZE | SWT.MAX);
- commitCommentArea = new CommitCommentArea();
- // Get a project from which the commit template can be obtained
- if (resourcesToCommit.length > 0)
- commitCommentArea.setProject(resourcesToCommit[0].getProject());
- commitCommentArea.setProposedComment(proposedComment);
-
- IDialogSettings workbenchSettings = CVSUIPlugin.getPlugin().getDialogSettings();
- this.settings = workbenchSettings.getSection("ReleaseCommentDialog");//$NON-NLS-1$
- if (settings == null) {
- this.settings = workbenchSettings.addNewSection("ReleaseCommentDialog");//$NON-NLS-1$
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#includeDetailsButton()
- */
- protected boolean includeDetailsButton() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#includeErrorMessage()
- */
- protected boolean includeErrorMessage() {
- return false;
- }
-
- /*
- * @see Dialog#createDialogArea(Composite)
- */
- protected void createMainDialogArea(Composite parent) {
- getShell().setText(Policy.bind("ReleaseCommentDialog.title")); //$NON-NLS-1$
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- commitCommentArea.createArea(composite);
- commitCommentArea.addPropertyChangeListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty() == CommitCommentArea.OK_REQUESTED)
- okPressed();
- }
- });
-
- // set F1 help
- WorkbenchHelp.setHelp(composite, IHelpContextIds.RELEASE_COMMENT_DIALOG);
- Dialog.applyDialogFont(parent);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.window.Window#getInitialSize()
- */
- protected Point getInitialSize() {
- int width, height;
- try {
- height = settings.getInt(HEIGHT_KEY);
- width = settings.getInt(WIDTH_KEY);
- } catch(NumberFormatException e) {
- return super.getInitialSize();
- }
- Point p = super.getInitialSize();
- return new Point(width, p.y);
- }
-
- public String getComment() {
- return commitCommentArea.getComment();
- }
-
- public IResource[] getResourcesToCommit() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#createDropDownDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected Composite createDropDownDialogArea(Composite parent) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#updateEnablements()
- */
- protected void updateEnablements() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.window.Window#close()
- */
- public boolean close() {
- Rectangle bounds = getShell().getBounds();
- settings.put(HEIGHT_KEY, bounds.height);
- settings.put(WIDTH_KEY, bounds.width);
- return super.close();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createContents(org.eclipse.swt.widgets.Composite)
- */
- protected Control createContents(Composite parent) {
- Control c = super.createContents(parent);
- commitCommentArea.setFocus();
- return c;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteAnnotationEditorInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteAnnotationEditorInput.java
deleted file mode 100644
index 2935d8903..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteAnnotationEditorInput.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.io.InputStream;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.ui.IStorageEditorInput;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * An editor input for a cvs annotation response
- */
-public class RemoteAnnotationEditorInput extends RemoteFileEditorInput implements IWorkbenchAdapter, IStorageEditorInput {
-
- InputStream contents;
-
- public RemoteAnnotationEditorInput(ICVSRemoteFile file, InputStream contents) {
- super(file, new NullProgressMonitor());
- this.contents = contents;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.RemoteFileEditorInput#initializeStorage(org.eclipse.team.internal.ccvs.core.ICVSRemoteFile, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void initializeStorage(ICVSRemoteFile file, IProgressMonitor monitor) throws TeamException {
- if (contents != null) {
- storage = new RemoteAnnotationStorage(file, contents);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteAnnotationStorage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteAnnotationStorage.java
deleted file mode 100644
index fdbc38ab3..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteAnnotationStorage.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.eclipse.core.resources.IEncodedStorage;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.core.Policy;
-import org.eclipse.team.internal.core.TeamPlugin;
-
-public class RemoteAnnotationStorage extends PlatformObject implements IEncodedStorage {
-
- private InputStream contents;
- private ICVSRemoteFile file;
-
- public RemoteAnnotationStorage(ICVSRemoteFile file, InputStream contents) {
- this.file = file;
- this.contents = contents;
- }
-
- public InputStream getContents() throws CoreException {
- try {
- // Contents are a ByteArrayInputStream which can be reset to the beginning
- contents.reset();
- } catch (IOException e) {
- CVSUIPlugin.log(CVSException.wrapException(e));
- }
- return contents;
- }
-
- public String getCharset() throws CoreException {
- InputStream contents = getContents();
- try {
- String charSet = TeamPlugin.getCharset(getName(), contents);
- return charSet;
- } catch (IOException e) {
- throw new CVSException(new Status(IStatus.ERROR, CVSUIPlugin.ID, IResourceStatus.FAILED_DESCRIBING_CONTENTS, Policy.bind("RemoteAnnotationStorage.1", getFullPath().toString()), e)); //$NON-NLS-1$
- } finally {
- try {
- contents.close();
- } catch (IOException e1) {
- // Ignore
- }
- }
- }
-
- public IPath getFullPath() {
- ICVSRepositoryLocation location = file.getRepository();
- IPath path = new Path(null, location.getRootDirectory());
- path = path.setDevice(location.getHost() + Path.DEVICE_SEPARATOR);
- path = path.append(file.getRepositoryRelativePath());
- return path;
- }
- public String getName() {
- return file.getName();
- }
- public boolean isReadOnly() {
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteFileEditorInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteFileEditorInput.java
deleted file mode 100644
index 14412b245..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteFileEditorInput.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.ui.IPersistableElement;
-import org.eclipse.ui.IStorageEditorInput;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * An editor input for a file in a repository.
- */
-public class RemoteFileEditorInput implements IWorkbenchAdapter, IStorageEditorInput {
- ICVSRemoteFile file;
- IStorage storage;
-
- /**
- * Creates FileEditionEditorInput on the given file.
- */
- public RemoteFileEditorInput(ICVSRemoteFile file, IProgressMonitor monitor) {
- this.file = file;
- try {
- initializeStorage(file, monitor);
- } catch (TeamException e) {
- // Log and continue
- CVSUIPlugin.log(e);
- }
- }
-
- /**
- * Initialize the strogae of this instance from the given file.
- * @param file the file being displayed
- * @param monitor a progress monitor
- */
- protected void initializeStorage(ICVSRemoteFile file, IProgressMonitor monitor) throws TeamException {
- // Cache the contents of the file for use in the editor
- storage = ((IResourceVariant)file).getStorage(monitor);
- }
-
- /**
- * Returns whether the editor input exists.
- * <p>
- * This method is primarily used to determine if an editor input should
- * appear in the "File Most Recently Used" menu. An editor input will appear
- * in the list until the return value of <code>exists</code> becomes
- * <code>false</code> or it drops off the bottom of the list.
- *
- * @return <code>true</code> if the editor input exists; <code>false</code>
- * otherwise
- */
- public boolean exists() {
- return true;
- }
- public boolean equals(Object o) {
- if (!(o instanceof RemoteFileEditorInput)) return false;
- RemoteFileEditorInput input = (RemoteFileEditorInput)o;
- return file.equals(input.file);
- }
- /**
- * Returns an object which is an instance of the given class
- * associated with this object. Returns <code>null</code> if
- * no such object can be found.
- *
- * @param adapter the adapter class to look up
- * @return a object castable to the given class,
- * or <code>null</code> if this object does not
- * have an adapter for the given class
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) {
- return this;
- }
- return null;
- }
- /**
- * Returns the children of this object. When this object
- * is displayed in a tree, the returned objects will be this
- * element's children. Returns an empty array if this
- * object has no children.
- *
- * @param object The object to get the children for.
- */
- public Object[] getChildren(Object o) {
- return new Object[0];
- }
- /**
- * Returns the content type of the input. For instance, if the input
- * wraps an <code>IFile</code> the content type would be derived from
- * the extension or mime type. If the input wraps another object it
- * may just be the object type. The content type is used for
- * editor mapping.
- */
- public String getContentType() {
- String name = file.getName();
- return name.substring(name.lastIndexOf('.')+1);
- }
- /**
- * Returns the fully qualified path name of the input.
- */
- public String getFullPath() {
- //use path to make sure slashes are correct
- ICVSRepositoryLocation location = file.getRepository();
- IPath path = new Path(null, location.getRootDirectory());
- path = path.setDevice(location.getHost() + Path.DEVICE_SEPARATOR);
- path = path.append(file.getRepositoryRelativePath());
- String fullPath;
- try {
- String revision = file.getRevision();
- fullPath = Policy.bind("RemoteFileEditorInput.fullPathAndRevision", path.toString(), revision); //$NON-NLS-1$
- } catch (TeamException e) {
- CVSUIPlugin.log(e);
- fullPath = path.toString();
- }
- return fullPath;
- }
- /**
- * Returns the image descriptor for this input.
- *
- * @return the image descriptor for this input
- */
- public ImageDescriptor getImageDescriptor() {
- IWorkbenchAdapter fileAdapter = (IWorkbenchAdapter)file.getAdapter(IWorkbenchAdapter.class);
- return fileAdapter == null ? null : fileAdapter.getImageDescriptor(file);
- }
- /**
- * @see IWorkbenchAdapter#getImageDescriptor
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- IWorkbenchAdapter fileAdapter = (IWorkbenchAdapter)file.getAdapter(IWorkbenchAdapter.class);
- return fileAdapter == null ? null : fileAdapter.getImageDescriptor(file);
- }
- /**
- * @see IWorkbenchAdapter#getLabel
- */
- public String getLabel(Object o) {
- return file.getName();
- }
- /**
- * Returns the input name for display purposes. For instance, if
- * the fully qualified input name is "a\b\MyFile.gif" the return value for
- * <code>getName</code> is "MyFile.gif".
- */
- public String getName() {
- String name = file.getName();
- try {
- return Policy.bind("nameAndRevision", name, file.getRevision()); //$NON-NLS-1$
- } catch (TeamException e) {
- return name;
- }
- }
- /**
- * Returns the logical parent of the given object in its tree.
- * Returns <code>null</code> if there is no parent, or if this object doesn't
- * belong to a tree.
- *
- * @param object The object to get the parent for.
- */
- public Object getParent(Object o) {
- return null;
- }
- /*
- * Returns an interface used to persist the object. If the editor input
- * cannot be persisted this method returns <code>null</code>.
- */
- public IPersistableElement getPersistable() {
- //not persistable
- return null;
- }
- /**
- * Returns the underlying IStorage object.
- *
- * @return an IStorage object.
- * @exception CoreException if this method fails
- */
- public IStorage getStorage() throws CoreException {
- if (storage == null) {
- initializeStorage(file, new NullProgressMonitor());
- }
- return storage;
- }
- /**
- * Returns the tool tip text for this editor input. This text
- * is used to differentiate between two input with the same name.
- * For instance, MyClass.java in folder X and MyClass.java in folder Y.
- * <p>
- * The format of the path will vary with each input type. For instance,
- * if the editor input is of type <code>IFileEditorInput</code> this method
- * should return the fully qualified resource path. For editor input of
- * other types it may be different.
- * </p>
- * @return the tool tip text
- */
- public String getToolTipText() {
- return getFullPath();
- }
-
- /**
- * Returns the remote CVS file shown in this editor input.
- * @return the remote file handle.
- */
- public ICVSRemoteFile getCVSRemoteFile() {
- return file;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteRevisionQuickDiffProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteRevisionQuickDiffProvider.java
deleted file mode 100644
index 91e3ffff4..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteRevisionQuickDiffProvider.java
+++ /dev/null
@@ -1,351 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.io.*;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.ISubscriberChangeEvent;
-import org.eclipse.team.core.subscribers.ISubscriberChangeListener;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.editors.text.IStorageDocumentProvider;
-import org.eclipse.ui.texteditor.*;
-import org.eclipse.ui.texteditor.quickdiff.IQuickDiffReferenceProvider;
-
-/**
- * A QuickDiff provider that provides a reference to the latest revision of a file
- * in the CVS repository. The provider notifies when the file's sync state changes
- * and the diff should be recalculated (e.g. commit, update...) or when the file
- * is changed (e.g. replace with).
- *
- * Here are the file states and what this provider does for each:
- *
- * 1. File is unmanaged : reference == empty document
- * 2. Unmanaged file transitions to managed : empty reference updated with new remote revision
- * 3. A managed file has new remote (commit, refresh remote) : reference updated with new
- * remote revision
- * 4. A managed file cleaned, remote is the same (replace with, update) : refresh diff bar
- * with existing reference
- *
- * [Note: Currently an empty document must be returned for an unmanaged file. This
- * results in the entire document appearing as outgoing changes in the quickdiff bar.
- * This is required because the quickdiff support relies on IDocument change events
- * to update the quickdiff, and returning null for the reference document doesn't
- * allow the transition to later return a IDocument.]
- *
- * @since 3.0
- */
-public class RemoteRevisionQuickDiffProvider implements IQuickDiffReferenceProvider {
- // The editor showing this quickdiff and provides access to the editor input and
- // ultimatly the IFile.
- private ITextEditor fEditor = null;
-
- // The document containing the remote file. Can be null if the assigned editor doesn't have
- // a CVS remote resource associated with it.
- private IDocument fReference = null;
-
- // Will be true when the document has been read and initialized.
- private boolean fReferenceInitialized = false;
-
- // Document provider allows us to register/deregister the element state change listener.
- private IDocumentProvider fDocumentProvider = null;
-
- // Unique id for this reference provider as set via setId().
- private String fId;
-
- // A handle to the remote CVS file for this provider.
- private SyncInfo fLastSyncState;
-
- // Job that re-creates the reference document.
- private Job fUpdateJob;
-
- private boolean DEBUG = false;
-
- /**
- * Updates the document if a sync changes occurs to the associated CVS file.
- */
- private ISubscriberChangeListener teamChangeListener = new ISubscriberChangeListener() {
- public void subscriberResourceChanged(ISubscriberChangeEvent[] deltas) {
- if(fReferenceInitialized) {
- for (int i = 0; i < deltas.length; i++) {
- ISubscriberChangeEvent delta = deltas[i];
- IResource resource = delta.getResource();
- if(resource.getType() == IResource.FILE &&
- fLastSyncState != null && resource.equals(fLastSyncState.getLocal())) {
- if(delta.getFlags() == ISubscriberChangeEvent.SYNC_CHANGED) {
- fetchContentsInJob();
- }
- }
- }
- }
- }
- };
-
- /**
- * Updates the document if the document is changed (e.g. replace with)
- */
- private IElementStateListener documentListener = new IElementStateListener() {
- public void elementDirtyStateChanged(Object element, boolean isDirty) {
- }
-
- public void elementContentAboutToBeReplaced(Object element) {
- }
-
- public void elementContentReplaced(Object element) {
- if(fEditor != null && fEditor.getEditorInput() == element) {
- fetchContentsInJob();
- }
- }
-
- public void elementDeleted(Object element) {
- }
-
- public void elementMoved(Object originalElement, Object movedElement) {
- }
- };
-
- /*
- * @see org.eclipse.test.quickdiff.DocumentLineDiffer.IQuickDiffReferenceProvider#getReference()
- */
- public IDocument getReference(IProgressMonitor monitor) throws CoreException {
- if(! fReferenceInitialized) return null;
- if (fReference == null) {
- readDocument(monitor);
- }
- return fReference;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.quickdiff.IQuickDiffProviderImplementation#setActiveEditor(org.eclipse.ui.texteditor.ITextEditor)
- */
- public void setActiveEditor(ITextEditor targetEditor) {
- if(! (targetEditor.getEditorInput() instanceof IFileEditorInput)) return;
- fEditor = targetEditor;
- fDocumentProvider= fEditor.getDocumentProvider();
-
- if(fDocumentProvider != null) {
- CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().addListener(teamChangeListener);
- fDocumentProvider.addElementStateListener(documentListener);
- }
- fReferenceInitialized= true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.quickdiff.IQuickDiffProviderImplementation#isEnabled()
- */
- public boolean isEnabled() {
- if (! fReferenceInitialized)
- return false;
- try {
- return getManagedCVSFile() != null;
- } catch (CVSException e) {
- return false;
- }
- }
-
- /*
- * @see org.eclipse.jface.text.source.diff.DocumentLineDiffer.IQuickDiffReferenceProvider#dispose()
- */
- public void dispose() {
- fReferenceInitialized = false;
- // stop update job
- if(fUpdateJob != null && fUpdateJob.getState() != Job.NONE) {
- fUpdateJob.cancel();
- }
-
- // remove listeners
- if(fDocumentProvider != null) {
- fDocumentProvider.removeElementStateListener(documentListener);
- }
- CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().removeListener(teamChangeListener);
- }
-
- /*
- * @see org.eclipse.quickdiff.QuickDiffTestPlugin.IQuickDiffProviderImplementation#setId(java.lang.String)
- */
- public void setId(String id) {
- fId= id;
- }
-
- /*
- * @see org.eclipse.jface.text.source.diff.DocumentLineDiffer.IQuickDiffReferenceProvider#getId()
- */
- public String getId() {
- return fId;
- }
-
- /**
- * Determine if the file represented by this quickdiff provider has changed with
- * respect to it's remote state. Return true if the remote contents should be
- * refreshed, and false if not.
- */
- private boolean computeChange(IProgressMonitor monitor) throws TeamException {
- boolean needToUpdateReferenceDocument = false;
- if(fReferenceInitialized) {
- SyncInfo info = getSyncState(getFileFromEditor());
- if(info == null && fLastSyncState != null) {
- return true;
- } else if(info == null) {
- return false;
- }
-
- if(fLastSyncState == null) {
- needToUpdateReferenceDocument = true;
- } else if(! fLastSyncState.equals(info)) {
- needToUpdateReferenceDocument = true;
- }
- if(DEBUG) debug(fLastSyncState, info);
- fLastSyncState = info;
- }
- return needToUpdateReferenceDocument;
- }
-
- private void debug(SyncInfo lastSyncState, SyncInfo info) {
- String last = "[none]"; //$NON-NLS-1$
- if(lastSyncState != null) {
- last = lastSyncState.toString();
- }
- System.out.println("+ CVSQuickDiff: was " + last + " is " + info.toString()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- private SyncInfo getSyncState(IResource resource) throws TeamException {
- if (resource == null) return null;
- return CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().getSyncInfo(resource);
- }
-
- /**
- * Creates a document and initializes it with the contents of a CVS remote
- * resource.
- * @param monitor the progress monitor
- * @throws CoreException
- */
- private void readDocument(IProgressMonitor monitor) throws CoreException {
- if(! fReferenceInitialized) return;
- if(fReference == null)
- fReference = new Document();
- if(computeChange(monitor)) {
- ICVSRemoteFile remoteFile = (ICVSRemoteFile)fLastSyncState.getRemote();
- if (fLastSyncState.getRemote() != null && fDocumentProvider instanceof IStorageDocumentProvider) {
- IStorageDocumentProvider provider= (IStorageDocumentProvider) fDocumentProvider;
- String encoding= provider.getEncoding(fEditor.getEditorInput());
- if (encoding == null) {
- encoding= provider.getDefaultEncoding();
- }
- if(monitor.isCanceled()) return;
- InputStream stream= remoteFile.getContents(monitor);
- if (stream == null || monitor.isCanceled() || ! fReferenceInitialized) {
- return;
- }
- setDocumentContent(fReference, stream, encoding);
- } else {
- // the remote is null, so ensure that the document is null
- if(monitor.isCanceled()) return;
- fReference.set(""); //$NON-NLS-1$
- }
- if(DEBUG) System.out.println("+ CVSQuickDiff: updating document " + (fReference!=null ? "remote found" : "remote empty")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
-
- /**
- * Intitializes the given document with the given stream using the given encoding.
- *
- * @param document the document to be initialized
- * @param contentStream the stream which delivers the document content
- * @param encoding the character encoding for reading the given stream
- * @exception CoreException if the given stream can not be read
- */
- private static void setDocumentContent(IDocument document, InputStream contentStream, String encoding) throws CoreException {
- Reader in= null;
- try {
- final int DEFAULT_FILE_SIZE= 15 * 1024;
-
- in= new BufferedReader(new InputStreamReader(contentStream, encoding), DEFAULT_FILE_SIZE);
- CharArrayWriter caw= new CharArrayWriter(DEFAULT_FILE_SIZE);
- char[] readBuffer= new char[2048];
- int n= in.read(readBuffer);
- while (n > 0) {
- caw.write(readBuffer, 0, n);
- n= in.read(readBuffer);
- }
- document.set(caw.toString());
- //System.out.println("+ CVSQuickDiff: updating document : " + caw.toString());
- } catch (IOException x) {
- throw new CVSException(Policy.bind("RemoteRevisionQuickDiffProvider.readingFile"), x); //$NON-NLS-1$
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException x) {
- throw new CVSException(Policy.bind("RemoteRevisionQuickDiffProvider.closingFile"), x); //$NON-NLS-1$
- }
- }
- }
- }
-
- /**
- * Returns the ICVSFile associated with he active editor or <code>null</code>
- * if the provider doesn't not have access to a CVS managed file.
- * @return the handle to a CVS file
- */
- private ICVSFile getManagedCVSFile() throws CVSException {
- if(fEditor != null) {
- IFile file = getFileFromEditor();
- if(file != null && CVSWorkspaceRoot.isSharedWithCVS(file)) {
- return CVSWorkspaceRoot.getCVSFileFor(file);
- }
- }
- return null;
- }
-
- private IFile getFileFromEditor() {
- if(fEditor != null) {
- IEditorInput input= fEditor.getEditorInput();
- if (input instanceof IFileEditorInput) {
- return ((IFileEditorInput)input).getFile();
- }
- }
- return null;
- }
-
- /**
- * Runs a job that updates the document. If a previous job is already running it
- * is stopped before the new job can start.
- */
- private void fetchContentsInJob() {
- if(! fReferenceInitialized) return;
- if(fUpdateJob != null && fUpdateJob.getState() != Job.NONE) {
- fUpdateJob.cancel();
- }
- fUpdateJob = new Job(Policy.bind("RemoteRevisionQuickDiffProvider.fetchingFile")) { //$NON-NLS-1$
- protected IStatus run(IProgressMonitor monitor) {
- try {
- readDocument(monitor);
- } catch (CoreException e) {
- // continue and return ok for now. The error will be reported
- // when the quick diff supports calls getReference() again.
- // continue
- }
- return Status.OK_STATUS;
- }
- };
- fUpdateJob.schedule();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResizableWizardDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResizableWizardDialog.java
deleted file mode 100644
index 2025039f5..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResizableWizardDialog.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Shell;
-
-public class ResizableWizardDialog extends WizardDialog {
- /**
- * Creates a new resizable wizard dialog.
- */
- public ResizableWizardDialog(Shell parent, IWizard wizard) {
- super(parent, wizard);
- setShellStyle(getShellStyle() | SWT.RESIZE);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java
deleted file mode 100644
index 20e229e79..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import org.eclipse.compare.CompareUI;
-import org.eclipse.compare.IEncodedStreamContentAccessor;
-import org.eclipse.compare.IStreamContentAccessor;
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.compare.structuremergeviewer.IStructureComparator;
-import org.eclipse.core.internal.dtree.IComparator;
-import org.eclipse.core.resources.IEncodedStorage;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-
-/**
- * A class for comparing ICVSRemoteResource objects
- */
-public class ResourceEditionNode implements IStructureComparator, ITypedElement, IEncodedStreamContentAccessor {
- private ICVSRemoteResource resource;
- private ResourceEditionNode[] children;
-
- /**
- * Creates a new ResourceEditionNode on the given resource edition.
- */
- public ResourceEditionNode(ICVSRemoteResource resourceEdition) {
- this.resource = resourceEdition;
- }
-
- /**
- * Returns true if both resources names are identical.
- * The content is not considered.
- * @see IComparator#equals
- */
- public boolean equals(Object other) {
- if (other instanceof ITypedElement) {
- String otherName = ((ITypedElement)other).getName();
- return getName().equals(otherName);
- }
- return super.equals(other);
- }
-
- /**
- * Enumerate children of this node (if any).
- */
- public Object[] getChildren() {
- if (children == null) {
- children = new ResourceEditionNode[0];
- if (resource != null) {
- try {
- CVSUIPlugin.runWithProgress(null, true /*cancelable*/, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ICVSRemoteResource[] members = resource.members(monitor);
- children = new ResourceEditionNode[members.length];
- for (int i = 0; i < members.length; i++) {
- children[i] = new ResourceEditionNode(members[i]);
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InterruptedException e) {
- // operation canceled
- } catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- if (t instanceof TeamException) {
- CVSUIPlugin.log(((TeamException) t));
- }
- }
- }
- }
- return children;
- }
-
- /**
- * @see IStreamContentAccessor#getContents()
- */
- public InputStream getContents() throws CoreException {
- IStorage storage = getStorage();
- if (storage != null) {
- return storage.getContents();
- }
- return new ByteArrayInputStream(new byte[0]);
- }
-
- public Image getImage() {
- return CompareUI.getImage(resource);
- }
-
- /**
- * Returns the name of this node.
- */
- public String getName() {
- return resource == null ? "" : resource.getName(); //$NON-NLS-1$
- }
-
- public ICVSRemoteResource getRemoteResource() {
- return resource;
- }
-
- /**
- * Returns the comparison type for this node.
- */
- public String getType() {
- if (resource == null) {
- return UNKNOWN_TYPE;
- }
- if (resource.isContainer()) {
- return FOLDER_TYPE;
- }
- String name = resource.getName();
- name = name.substring(name.lastIndexOf('.') + 1);
- return name.length() == 0 ? UNKNOWN_TYPE : name;
- }
-
- /**
- * @see IComparator#equals
- */
- public int hashCode() {
- return getName().hashCode();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.compare.IEncodedStreamContentAccessor#getCharset()
- */
- public String getCharset() throws CoreException {
- // Use the local file encoding if there is one
- IResource local = resource.getIResource();
- if (local != null && local.getType() == IResource.FILE) {
- return ((IFile)local).getCharset();
- }
- // See if the remote file has an encoding
- IStorage storage = getStorage();
- if (storage instanceof IEncodedStorage) {
- String charset = ((IEncodedStorage)storage).getCharset();
- if (charset != null) {
- return charset;
- }
- }
- return null;
- }
-
- private IStorage getStorage() throws TeamException {
- if (resource == null) {
- return null;
- }
- final IStorage[] holder = new IStorage[1];
- try {
- CVSUIPlugin.runWithProgress(null, true /*cancelable*/, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- holder[0] = ((IResourceVariant)resource).getStorage(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InvocationTargetException e) {
- throw TeamException.asTeamException(e);
- } catch (InterruptedException e) {
- // Shouldn't happen. Ignore
- }
- return holder[0];
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourcePropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourcePropertiesPage.java
deleted file mode 100644
index 35c401709..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourcePropertiesPage.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.dialogs.Dialog;
-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.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-/**
- * A property page which displays the CVS-specific properties for the
- * selected resource.
- */
-public class ResourcePropertiesPage extends PropertyPage {
- // The resource to show properties for
- IResource resource;
-
- /*
- * @see PreferencePage#createContents(Composite)
- */
- protected Control createContents(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = layout.marginWidth = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- try {
- IResource resource = getSelectedElement();
- if (resource != null) {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if (!cvsResource.isManaged()) {
- createPair(composite, Policy.bind("ResourcePropertiesPage.status"), Policy.bind("ResourcePropertiesPage.notManaged")); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- boolean hasRemote = false;
- if(cvsResource.isFolder()) {
- hasRemote = ((ICVSFolder)cvsResource).isCVSFolder();
- } else {
- ResourceSyncInfo info = cvsResource.getSyncInfo();
- if(info!=null && !info.isAdded()) {
- hasRemote = true;
- }
- }
- createPair(composite, Policy.bind("ResourcePropertiesPage.status"), hasRemote ? Policy.bind("ResourcePropertiesPage.versioned") : Policy.bind("ResourcePropertiesPage.notVersioned")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
- } catch (TeamException e) {
- createPair(composite, Policy.bind("ResourcePropertiesPage.error"), e.getMessage()); //$NON-NLS-1$
- }
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- /**
- * Creates a key-value property pair in the given parent.
- *
- * @param parent the parent for the labels
- * @param left the string for the left label
- * @param right the string for the right label
- */
- protected void createPair(Composite parent, String left, String right) {
- Label label = new Label(parent, SWT.NONE);
- label.setText(left);
-
- label = new Label(parent, SWT.NONE);
- label.setText(right);
- label.setToolTipText(right);
- label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- }
-
- /**
- * Returns the element selected when the properties was run
- *
- * @return the selected element
- */
- protected IResource getSelectedElement() {
- // get the resource that is the source of this property page
- IResource resource = null;
- IAdaptable element = getElement();
- if (element instanceof IResource) {
- resource = (IResource)element;
- } else {
- Object adapter = element.getAdapter(IResource.class);
- if (adapter instanceof IResource) {
- resource = (IResource)adapter;
- }
- }
- return resource;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/SimpleContentProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/SimpleContentProvider.java
deleted file mode 100644
index 6fa9117f8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/SimpleContentProvider.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import org.eclipse.jface.viewers.*;
-
-/**
- * A default content provider to prevent subclasses from
- * having to implement methods they don't need.
- */
-public class SimpleContentProvider implements IStructuredContentProvider {
-
- /**
- * SimpleContentProvider constructor.
- */
- public SimpleContentProvider() {
- super();
- }
-
- /*
- * @see SimpleContentProvider#dispose()
- */
- public void dispose() {
- }
-
- /*
- * @see SimpleContentProvider#getElements()
- */
- public Object[] getElements(Object element) {
- return new Object[0];
- }
-
- /*
- * @see SimpleContentProvider#inputChanged()
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagetLocationSelectionDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagetLocationSelectionDialog.java
deleted file mode 100644
index 5e3317424..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagetLocationSelectionDialog.java
+++ /dev/null
@@ -1,438 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.io.File;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.JFaceColors;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.DirectoryDialog;
-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.Text;
-import org.eclipse.ui.dialogs.SelectionDialog;
-
-/**
- * Select the target location that will be the parent of the selected projects.
- * The behavior of the dialog differs between 1 project and multiple projects.
- * For one project, the location specified is the location of the project and
- * the project name can be modified. For multiple projects, it is the parent
- * location which is specified.
- */
-public class TagetLocationSelectionDialog extends SelectionDialog {
-
- // widgets
- private Text projectNameField;
- private Text locationPathField;
- private Label locationLabel;
- private Label statusMessageLabel;
- private Button browseButton;
-
- // state
- private boolean useDefaults = true;
- private IProject[] targetProjects;
- private String newProjectName;
- private String targetLocation;
-
- // constants
- private static final int SIZING_TEXT_FIELD_WIDTH = 250;
-
- /**
- * Constructor.
- * @param parentShell
- */
- public TagetLocationSelectionDialog(Shell parentShell, String title, IProject targetProject) {
- this(parentShell, title, new IProject[] { targetProject });
- }
-
- /**
- * Constructor.
- * @param parentShell
- */
- public TagetLocationSelectionDialog(Shell parentShell, String title, IProject[] targetProjects) {
- super(parentShell);
- setTitle(title);
- this.targetProjects = targetProjects;
- if (targetProjects.length == 1) newProjectName = targetProjects[0].getName();
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected Control createDialogArea(Composite parent) {
- // page group
- Composite composite = (Composite) super.createDialogArea(parent);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- if (isSingleCheckout())
- createProjectNameGroup(composite);
- createProjectLocationGroup(composite);
-
- //Add in a label for status messages if required
- statusMessageLabel = new Label(composite, SWT.NONE);
- statusMessageLabel.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- /**
- * Creates the project name specification controls.
- *
- * @param parent the parent composite
- */
- private void createProjectNameGroup(Composite parent) {
- // project specification group
- Composite projectGroup = new Composite(parent,SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- projectGroup.setLayout(layout);
- projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // new project label
- Label projectLabel = new Label(projectGroup,SWT.NONE);
- projectLabel.setText(Policy.bind("TargetLocationSelectionDialog.projectNameLabel")); //$NON-NLS-1$
-
- // new project name entry field
- projectNameField = new Text(projectGroup, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- projectNameField.setLayoutData(data);
-
- // Set the initial value first before listener
- // to avoid handling an event during the creation.
- projectNameField.setText(getNewProjectName());
- projectNameField.selectAll();
-
- createNameListener();
-
- }
-
- /**
- * Create the listener that is used to validate the entries for the receiver
- */
- private void createNameListener() {
-
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- newProjectName = projectNameField.getText();
- setLocationForSelection(false);
- applyValidationResult(checkValid());
- }
- };
-
- this.projectNameField.addListener(SWT.Modify, listener);
- }
-
- /**
- * Set the location to the default location if we are set to useDefaults.
- */
- private void setLocationForSelection(boolean changed) {
- if (useDefaults) {
- IPath defaultPath = null;
- if (isSingleCheckout()) {
- try {
- defaultPath = getSingleProject().getDescription().getLocation();
- } catch (CoreException e) {
- // ignore
- }
- if (defaultPath == null) {
- defaultPath = Platform.getLocation().append(getSingleProject().getName());
- }
- } else {
- defaultPath = Platform.getLocation();
- }
- locationPathField.setText(defaultPath.toOSString());
- targetLocation = null;
- } else if (changed) {
- IPath location = null;
- try {
- location = this.targetProjects[0].getDescription().getLocation();
- } catch (CoreException e) {
- // ignore the exception
- }
- if (location == null) {
- targetLocation = null;
- locationPathField.setText(""); //$NON-NLS-1$
- } else {
- if (isSingleCheckout()) {
- targetLocation = location.toOSString();
- } else {
- targetLocation = location.removeLastSegments(1).toOSString();
- }
- locationPathField.setText(targetLocation);
- }
- }
- }
-
- /**
- * Creates the project location specification controls.
- *
- * @param parent the parent composite
- */
- private final void createProjectLocationGroup(Composite parent) {
-
- // project specification group
- Composite projectGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- projectGroup.setLayout(layout);
- projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- final Button useDefaultsButton =
- new Button(projectGroup, SWT.CHECK | SWT.RIGHT);
- useDefaultsButton.setText(Policy.bind("TargetLocationSelectionDialog.useDefaultLabel")); //$NON-NLS-1$
- useDefaultsButton.setSelection(this.useDefaults);
- GridData buttonData = new GridData();
- buttonData.horizontalSpan = 3;
- useDefaultsButton.setLayoutData(buttonData);
-
- createUserSpecifiedProjectLocationGroup(projectGroup, !this.useDefaults);
-
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- useDefaults = useDefaultsButton.getSelection();
- browseButton.setEnabled(!useDefaults);
- locationPathField.setEnabled(!useDefaults);
- locationLabel.setEnabled(!useDefaults);
- setLocationForSelection(true);
- }
- };
- useDefaultsButton.addSelectionListener(listener);
- }
-
- /**
- * Creates the project location specification controls.
- *
- * @return the parent of the widgets created
- * @param projectGroup the parent composite
- * @param enabled - sets the initial enabled state of the widgets
- */
- private Composite createUserSpecifiedProjectLocationGroup(Composite projectGroup, boolean enabled) {
-
- // location label
- locationLabel = new Label(projectGroup, SWT.NONE);
- if (isSingleCheckout()) {
- locationLabel.setText(Policy.bind("TargetLocationSelectionDialog.locationLabel")); //$NON-NLS-1$
- } else {
- locationLabel.setText(Policy.bind("TargetLocationSelectionDialog.parentDirectoryLabel")); //$NON-NLS-1$
- }
- locationLabel.setEnabled(enabled);
-
- // project location entry field
- locationPathField = new Text(projectGroup, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- locationPathField.setLayoutData(data);
- locationPathField.setEnabled(enabled);
-
- // browse button
- this.browseButton = new Button(projectGroup, SWT.PUSH);
- this.browseButton.setText(Policy.bind("TargetLocationSelectionDialog.browseLabel")); //$NON-NLS-1$
- this.browseButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- handleLocationBrowseButtonPressed();
- }
- });
- this.browseButton.setEnabled(enabled);
- setButtonLayoutData(this.browseButton);
-
- // Set the initial value first before listener
- // to avoid handling an event during the creation.
- setLocationForSelection(true);
- createLocationListener();
- return projectGroup;
-
- }
-
- /**
- * Open an appropriate directory browser
- */
- private void handleLocationBrowseButtonPressed() {
- DirectoryDialog dialog = new DirectoryDialog(locationPathField.getShell());
- if (isSingleCheckout()) {
- dialog.setMessage(Policy.bind("TargetLocationSelectionDialog.messageForSingle", newProjectName)); //$NON-NLS-1$
- } else {
- dialog.setMessage(Policy.bind("TargetLocationSelectionDialog.messageForMulti", new Integer(targetProjects.length).toString())); //$NON-NLS-1$
- }
-
- String dirName = locationPathField.getText();
- if (!dirName.equals("")) {//$NON-NLS-1$
- File path = new File(dirName);
- if (path.exists())
- dialog.setFilterPath(dirName);
- }
-
- String selectedDirectory = dialog.open();
- if (selectedDirectory != null) {
- if (targetProjects.length == 1) {
- locationPathField.setText(new Path(selectedDirectory).append(newProjectName).toOSString());
- } else {
- locationPathField.setText(new Path(selectedDirectory).toOSString());
- }
- }
- targetLocation = locationPathField.getText();
- }
-
- /**
- * Method isSingleCheckout.
- * @return boolean
- */
- private boolean isSingleCheckout() {
- return targetProjects.length == 1;
- }
-
- private IProject getSingleProject() {
- if (newProjectName == null || newProjectName.length() == 0 || targetProjects[0].getName().equals(newProjectName))
- return targetProjects[0];
- else
- return ResourcesPlugin.getWorkspace().getRoot().getProject(newProjectName);
- }
-
- /**
- * Create the listener that is used to validate the location entered by the iser
- */
- private void createLocationListener() {
-
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- applyValidationResult(checkValid());
- }
- };
-
- this.locationPathField.addListener(SWT.Modify, listener);
- }
-
- /**
- * Check the message. If it is null then continue otherwise inform the user via the
- * status value and disable the OK.
- * @param message - the error message to show if it is not null.
- */
- private void applyValidationResult(String errorMsg) {
-
- if (errorMsg == null) {
- statusMessageLabel.setText("");//$NON-NLS-1$
- getOkButton().setEnabled(true);
- } else {
- statusMessageLabel.setForeground(
- JFaceColors.getErrorText(
- statusMessageLabel.getDisplay()));
- statusMessageLabel.setText(errorMsg);
- getOkButton().setEnabled(false);
- }
- }
- /**
- * Check whether the entries are valid. If so return null. Otherwise
- * return a string that indicates the problem.
- */
- private String checkValid() {
- if (isSingleCheckout()) {
- String valid = checkValidName();
- if (valid != null)
- return valid;
- }
- return checkValidLocation();
- }
- /**
- * Check if the entry in the widget location is valid. If it is valid return null. Otherwise
- * return a string that indicates the problem.
- */
- private String checkValidLocation() {
-
- if (useDefaults) {
- targetLocation = null;
- return null;
- } else {
- targetLocation = locationPathField.getText();
- if (targetLocation.equals("")) {//$NON-NLS-1$
- return(Policy.bind("TagetLocationSelectionDialog.locationEmpty")); //$NON-NLS-1$
- }
- else{
- IPath path = new Path("");//$NON-NLS-1$
- if (!path.isValidPath(targetLocation)) {
- return Policy.bind("TagetLocationSelectionDialog.invalidLocation"); //$NON-NLS-1$
- }
- }
-
- if (isSingleCheckout()) {
- IStatus locationStatus =
- ResourcesPlugin.getWorkspace().validateProjectLocation(
- getSingleProject(),
- new Path(targetLocation));
-
- if (!locationStatus.isOK())
- return locationStatus.getMessage();
- } else {
- for (int i = 0; i < targetProjects.length; i++) {
- ResourcesPlugin.getWorkspace().validateProjectLocation(
- targetProjects[i],
- new Path(targetLocation).append(targetProjects[i].getName()));
- }
- }
-
- return null;
- }
- }
- /**
- * Check if the entries in the widget are valid. If they are return null otherwise
- * return a string that indicates the problem.
- */
- private String checkValidName() {
-
- newProjectName = this.projectNameField.getText();
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IStatus nameStatus = workspace.validateName(newProjectName, IResource.PROJECT);
- if (!nameStatus.isOK())
- return nameStatus.getMessage();
-// IProject newProject = workspace.getRoot().getProject(newProjectName);
-// if (newProject.exists()) {
-// return Policy.bind("TagetLocationSelectionDialog.alreadyExists", newProjectName); //$NON-NLS-1$
-// }
-
- return null;
- }
-
- /**
- * @return String
- */
- public String getNewProjectName() {
- return newProjectName;
- }
-
- /**
- * @return String
- */
- public String getTargetLocation() {
- return targetLocation;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TextViewerAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TextViewerAction.java
deleted file mode 100644
index f2491e590..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TextViewerAction.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.ui.texteditor.IUpdate;
-
-public class TextViewerAction extends Action implements IUpdate {
- private int operationCode = -1;
- private ITextOperationTarget operationTarget;
-
- public TextViewerAction(ITextViewer viewer, int operationCode) {
- this.operationCode = operationCode;
- operationTarget = viewer.getTextOperationTarget();
- update();
- }
- public void update() {
- boolean wasEnabled = isEnabled();
- boolean isEnabled = (operationTarget != null && operationTarget.canDoOperation(operationCode));
- setEnabled(isEnabled);
- if (wasEnabled != isEnabled) {
- firePropertyChange(ENABLED, wasEnabled ? Boolean.TRUE : Boolean.FALSE, isEnabled ? Boolean.TRUE : Boolean.FALSE);
- }
- }
- public void run() {
- if (operationCode != -1 && operationTarget != null) {
- operationTarget.doOperation(operationCode);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TimeoutProgressMonitorDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TimeoutProgressMonitorDialog.java
deleted file mode 100644
index 4b7d1f0ce..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TimeoutProgressMonitorDialog.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.operation.ModalContext;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-public class TimeoutProgressMonitorDialog extends ProgressMonitorDialog {
- // the timeout
- private int timeout;
- // the number of currently running runnables.
- private int runningRunnables = 0;
-
- /**
- * Creates a progress monitor dialog under the given shell.
- * The dialog has a standard title and no image.
- * <code>open</code> is non-blocking.
- *
- * @param parent the parent shell
- * @param timeout the delay after which the dialog will be opened during a run()
- */
- public TimeoutProgressMonitorDialog(Shell parent, int timeout) {
- super(parent);
- this.timeout = timeout;
- }
-
- /* (non-Javadoc)
- * Method declared on ITeamRunnableContext.
- * Runs the given <code>IRunnableWithProgress</code> with the progress monitor for this
- * progress dialog. The dialog is opened before it is run, and closed after it completes.
- */
- public void run(final boolean fork, boolean cancelable, final IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
- setCancelable(cancelable);
- create(); // create the Shell but don't open it yet
- try {
- runningRunnables++;
- final Display display = getShell().getDisplay();
- display.timerExec(timeout, new Runnable() {
- public void run() {
- Shell shell = getShell();
- if (shell != null && ! shell.isDisposed()) open();
- }
- });
-
- final Exception[] holder = new Exception[1];
- BusyIndicator.showWhile(display, new Runnable() {
- public void run() {
- try {
- ModalContext.run(runnable, fork, getProgressMonitor(), display);
- } catch (InvocationTargetException ite) {
- holder[0] = ite;
- } catch (InterruptedException ie) {
- holder[0] = ie;
- }
- }
- });
- if (holder[0] != null) {
- if (holder[0] instanceof InvocationTargetException) {
- throw (InvocationTargetException) holder[0];
- } else if (holder[0] instanceof InterruptedException) {
- throw (InterruptedException) holder[0];
- }
- }
- } finally {
- runningRunnables--;
- close();
- }
- }
-
- public boolean close() {
- if (runningRunnables <= 0) return super.close();
- return false;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/UserValidationDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/UserValidationDialog.java
deleted file mode 100644
index 6aad93aed..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/UserValidationDialog.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ui.ITeamUIImages;
-import org.eclipse.team.ui.TeamImages;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * A dialog for prompting for a username and password
- */
-public class UserValidationDialog extends Dialog {
- // widgets
- protected Text usernameField;
- protected Text passwordField;
- protected Button allowCachingButton;
-
- protected String domain;
- protected String defaultUsername;
- protected String password = null;
- protected boolean allowCaching = false;
- protected Image keyLockImage;
-
- // whether or not the username can be changed
- protected boolean isUsernameMutable = true;
- protected boolean showAllowCachingButton = true;
- protected String username = null;
- protected String message = null;
-
- /**
- * Creates a new UserValidationDialog.
- *
- * @param parentShell the parent shell
- * @param location the location
- * @param defaultName the default user name
- * @param message a mesage to display to the user
- */
- public UserValidationDialog(Shell parentShell, String location, String defaultName, String message) {
- super(parentShell);
- this.defaultUsername = defaultName;
- this.domain = location;
- this.message = message;
- }
- /**
- * @see Window#configureShell
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(Policy.bind("UserValidationDialog.required")); //$NON-NLS-1$
- // set F1 help
- WorkbenchHelp.setHelp(newShell, IHelpContextIds.USER_VALIDATION_DIALOG);
- }
- /**
- * @see Window#create
- */
- public void create() {
- super.create();
- // add some default values
- usernameField.setText(defaultUsername);
-
- if (isUsernameMutable) {
- // give focus to username field
- usernameField.selectAll();
- usernameField.setFocus();
- } else {
- usernameField.setEditable(false);
- passwordField.setFocus();
- }
- }
-
- /**
- * @see Dialog#createDialogArea
- */
- protected Control createDialogArea(Composite parent) {
- Composite top = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
-
- top.setLayout(layout);
- top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Composite imageComposite = new Composite(top, SWT.NONE);
- layout = new GridLayout();
- imageComposite.setLayout(layout);
- imageComposite.setLayoutData(new GridData(GridData.FILL_VERTICAL));
-
- Composite main = new Composite(top, SWT.NONE);
- layout = new GridLayout();
- layout.numColumns = 3;
- main.setLayout(layout);
- main.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Label imageLabel = new Label(imageComposite, SWT.NONE);
- keyLockImage = TeamImages.getImageDescriptor(ITeamUIImages.IMG_KEY_LOCK).createImage();
- imageLabel.setImage(keyLockImage);
- GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- imageLabel.setLayoutData(data);
-
- if (message != null) {
- Label messageLabel = new Label(main, SWT.WRAP);
- messageLabel.setText(message);
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- data.horizontalSpan = 3;
- data.widthHint = 300;
- messageLabel.setLayoutData(data);
- }
- if (domain != null) {
- Label d = new Label(main, SWT.WRAP);
- d.setText(Policy.bind("UserValidationDialog.5")); //$NON-NLS-1$
- data = new GridData();
- d.setLayoutData(data);
- Label label = new Label(main, SWT.WRAP);
- if (isUsernameMutable) {
- label.setText(Policy.bind("UserValidationDialog.labelUser", domain)); //$NON-NLS-1$
- } else {
- label.setText(Policy.bind("UserValidationDialog.labelPassword", new Object[]{defaultUsername, domain})); //$NON-NLS-1$
- }
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- data.horizontalSpan = 2;
- data.widthHint = 300;
- label.setLayoutData(data);
- }
- createUsernameFields(main);
- createPasswordFields(main);
-
- if(domain != null && showAllowCachingButton) {
- allowCachingButton = new Button(main, SWT.CHECK);
- allowCachingButton.setText(Policy.bind("UserValidationDialog.6")); //$NON-NLS-1$
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- data.horizontalSpan = 3;
- allowCachingButton.setLayoutData(data);
- allowCachingButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- allowCaching = allowCachingButton.getSelection();
- }
- });
- Composite warningComposite = new Composite(main, SWT.NONE);
- layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 0;
- layout.marginHeight = 0;
- warningComposite.setLayout(layout);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 3;
- warningComposite.setLayoutData(data);
- Label warningLabel = new Label(warningComposite, SWT.NONE);
- warningLabel.setImage(getImage(DLG_IMG_MESSAGE_WARNING));
- warningLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_BEGINNING));
- Label warningText = new Label(warningComposite, SWT.WRAP);
- warningText.setText(Policy.bind("UserValidationDialog.7")); //$NON-NLS-1$
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = 300;
- warningText.setLayoutData(data);
- }
-
- Dialog.applyDialogFont(parent);
-
- return main;
- }
- /**
- * Create a spacer.
- */
- protected void createSpacer(Composite top, int columnSpan, int vertSpan) {
- Label l = new Label(top, SWT.NONE);
- GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- data.horizontalSpan = columnSpan;
- data.verticalSpan = vertSpan;
- l.setLayoutData(data);
- }
-
- /**
- * Creates the three widgets that represent the password entry area.
- *
- * @param parent the parent of the widgets
- */
- protected void createPasswordFields(Composite parent) {
- new Label(parent, SWT.NONE).setText(Policy.bind("UserValidationDialog.password")); //$NON-NLS-1$
-
- passwordField = new Text(parent, SWT.BORDER | SWT.PASSWORD);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH);
- passwordField.setLayoutData(data);
- }
- /**
- * Creates the three widgets that represent the user name entry area.
- *
- * @param parent the parent of the widgets
- */
- protected void createUsernameFields(Composite parent) {
- new Label(parent, SWT.NONE).setText(Policy.bind("UserValidationDialog.user")); //$NON-NLS-1$
-
- usernameField = new Text(parent, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH);
- usernameField.setLayoutData(data);
- }
-
- /**
- * Returns the password entered by the user, or null
- * if the user canceled.
- *
- * @return the entered password
- */
- public String getPassword() {
- return password;
- }
-
- /**
- * Returns the username entered by the user, or null
- * if the user canceled.
- *
- * @return the entered username
- */
- public String getUsername() {
- return username;
- }
-
- /**
- * Returns <code>true</code> if the save password checkbox was selected.
- * @return <code>true</code> if the save password checkbox was selected and <code>false</code>
- * otherwise.
- */
- public boolean getAllowCaching() {
- return allowCaching;
- }
-
- /**
- * Notifies that the ok button of this dialog has been pressed.
- * <p>
- * The default implementation of this framework method sets
- * this dialog's return code to <code>Window.OK</code>
- * and closes the dialog. Subclasses may override.
- * </p>
- */
- protected void okPressed() {
- password = passwordField.getText();
- username = usernameField.getText();
-
- super.okPressed();
- }
- /**
- * Sets whether or not the username field should be mutable.
- * This method must be called before create(), otherwise it
- * will be ignored.
- *
- * @param value whether the username is mutable
- */
- public void setUsernameMutable(boolean value) {
- isUsernameMutable = value;
- }
-
- public void setShowAllowCachingButton(boolean value) {
- showAllowCachingButton = value;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#close()
- */
- public boolean close() {
- if(keyLockImage != null) {
- keyLockImage.dispose();
- }
- return super.close();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/VersionCollator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/VersionCollator.java
deleted file mode 100644
index 475fa5d72..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/VersionCollator.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Collator to compare two CVS revisions
- */
-public class VersionCollator {
- public int compare(String revision1, String revision2) {
- if (revision1 == null && revision2 == null) return 0;
- if (revision1 == null) return -1;
- if (revision2 == null) return 1;
- int[] revision1Segments = getIntSegments(revision1);
- int[] revision2Segments = getIntSegments(revision2);
- for (int i = 0; i < revision1Segments.length && i < revision2Segments.length; i++) {
- int i1 = revision1Segments[i];
- int i2 = revision2Segments[i];
- if (i1 != i2) {
- return i1 > i2 ? 1 : -1;
- }
- }
- if (revision1Segments.length != revision2Segments.length) {
- return revision1Segments.length > revision2Segments.length ? 1 : -1;
- }
- return 0;
- }
-
- int[] getIntSegments(String string) {
- int size = string.length();
- if (size == 0) return new int[0];
- StringBuffer buffer = new StringBuffer();
- List list = new ArrayList();
- for (int i = 0; i < size; i++) {
- char ch = string.charAt(i);
- if (ch == '.') {
- list.add(new Integer(buffer.toString()));
- buffer = new StringBuffer();
- } else {
- buffer.append(ch);
- }
- }
- list.add(new Integer(buffer.toString()));
- int[] result = new int[list.size()];
- Iterator it = list.iterator();
- for (int i = 0; i < result.length; i++) {
- result[i] = ((Integer)it.next()).intValue();
- }
- return result;
- }
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WatchEditPreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WatchEditPreferencePage.java
deleted file mode 100644
index 4e44d34ab..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WatchEditPreferencePage.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jface.preference.*;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-
-/**
- * This page contains preferences related to the cvs watch/edit commands
- */
-public class WatchEditPreferencePage extends CVSFieldEditorPreferencePage {
-
- private RadioGroupFieldEditor promptEditor;
- private RadioGroupFieldEditor actionEditor;
- private IPreferenceStore store;
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.CVSFieldEditorPreferencePage#getPageHelpContextId()
- */
- protected String getPageHelpContextId() {
- return IHelpContextIds.WATCH_EDIT_PREFERENCE_PAGE;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.CVSFieldEditorPreferencePage#getPageDescription()
- */
- protected String getPageDescription() {
- return Policy.bind("WatchEditPreferencePage.description"); //$NON-NLS-1$;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
- */
- protected void createFieldEditors() {
- addField(new BooleanFieldEditor(
- ICVSUIConstants.PREF_CHECKOUT_READ_ONLY,
- Policy.bind("WatchEditPreferencePage.checkoutReadOnly"), //$NON-NLS-1$
- BooleanFieldEditor.DEFAULT,
- getFieldEditorParent()));
-
- actionEditor = new RadioGroupFieldEditor(
- ICVSUIConstants.PREF_EDIT_ACTION,
- Policy.bind("WatchEditPreferencePage.validateEditSaveAction"), //$NON-NLS-1$
- 1,
- new String[][] {{Policy.bind("WatchEditPreferencePage.edit"), ICVSUIConstants.PREF_EDIT_PROMPT_EDIT}, //$NON-NLS-1$
- {Policy.bind("WatchEditPreferencePage.highjack"), ICVSUIConstants.PREF_EDIT_PROMPT_HIGHJACK}, //$NON-NLS-1$
- }, //$NON-NLS-1$ //$NON-NLS-2$
- getFieldEditorParent(), true);
- addField(actionEditor);
-
-
- promptEditor = new RadioGroupFieldEditor(
- ICVSUIConstants.PREF_EDIT_PROMPT,
- Policy.bind("WatchEditPreferencePage.editPrompt"), //$NON-NLS-1$
- 1,
- new String[][] {{Policy.bind("WatchEditPreferencePage.alwaysPrompt"), ICVSUIConstants.PREF_EDIT_PROMPT_ALWAYS}, //$NON-NLS-1$
- {Policy.bind("WatchEditPreferencePage.onlyPrompt"), ICVSUIConstants.PREF_EDIT_PROMPT_IF_EDITORS}, //$NON-NLS-1$
- {Policy.bind("WatchEditPreferencePage.neverPrompt"), ICVSUIConstants.PREF_EDIT_PROMPT_NEVER}, //$NON-NLS-1$
- }, //$NON-NLS-1$ //$NON-NLS-2$
- getFieldEditorParent(), true);
- store = getCVSPreferenceStore();
- addField(promptEditor);
- }
-
- private boolean isEditEnabled() {
- return store.getString(ICVSUIConstants.PREF_EDIT_ACTION).equals(ICVSUIConstants.PREF_EDIT_PROMPT_EDIT);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.CVSFieldEditorPreferencePage#pushPreferences()
- */
- protected void pushPreferences() {
- store = getCVSPreferenceStore();
- Preferences target = CVSProviderPlugin.getPlugin().getPluginPreferences();
- target.setValue(
- CVSProviderPlugin.READ_ONLY,
- store.getBoolean(ICVSUIConstants.PREF_CHECKOUT_READ_ONLY));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getSource() == actionEditor) {
- promptEditor.setEnabled(
- event.getNewValue().equals(ICVSUIConstants.PREF_EDIT_PROMPT_EDIT),
- getFieldEditorParent());
- }
- super.propertyChange(event);
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditorPreferencePage#initialize()
- */
- protected void initialize() {
- super.initialize();
- promptEditor.setEnabled(isEditEnabled(), getFieldEditorParent());
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkInProgressPreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkInProgressPreferencePage.java
deleted file mode 100644
index b97a9bf55..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkInProgressPreferencePage.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.text.Collator;
-import java.util.Arrays;
-import java.util.Comparator;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialogWithToggle;
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.RadioGroupFieldEditor;
-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.Group;
-import org.eclipse.team.internal.ui.preferences.ComboFieldEditor;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IPerspectiveRegistry;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.PlatformUI;
-
-public class WorkInProgressPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
-
- private static class PerspectiveDescriptorComparator implements Comparator {
- /*
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- */
- public int compare(Object o1, Object o2) {
- if (o1 instanceof IPerspectiveDescriptor && o2 instanceof IPerspectiveDescriptor) {
- String id1= ((IPerspectiveDescriptor)o1).getLabel();
- String id2= ((IPerspectiveDescriptor)o2).getLabel();
- return Collator.getInstance().compare(id1, id2);
- }
- return 0;
- }
- }
-
- private RadioGroupFieldEditor synchronizePerspectiveSwitch;
-
- public WorkInProgressPreferencePage() {
- super(GRID);
- setTitle(Policy.bind("WorkInProgressPreferencePage.0")); //$NON-NLS-1$
- setDescription(Policy.bind("WorkInProgressPreferencePage.1")); //$NON-NLS-1$
- setPreferenceStore(CVSUIPlugin.getPlugin().getPreferenceStore());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
- */
- public void createFieldEditors() {
-
- synchronizePerspectiveSwitch= new RadioGroupFieldEditor(
- ICVSUIConstants.PREF_CHANGE_PERSPECTIVE_ON_SHOW_ANNOTATIONS,
- Policy.bind("WorkInProgressPreferencePage.7"), //$NON-NLS-1$
- 3,
- new String[][] {
- {Policy.bind("WorkInProgressPreferencePage.8"), MessageDialogWithToggle.ALWAYS}, //$NON-NLS-1$
- {Policy.bind("WorkInProgressPreferencePage.2"), MessageDialogWithToggle.NEVER}, //$NON-NLS-1$
- {Policy.bind("WorkInProgressPreferencePage.3"), MessageDialogWithToggle.PROMPT} //$NON-NLS-1$
- },
- getFieldEditorParent(), true);
- addField(synchronizePerspectiveSwitch);
-
- final Group perspectiveGroup = createGroup(
- getFieldEditorParent(),
- Policy.bind("WorkInProgressPreferencePage.4")); //$NON-NLS-1$
-
- handleDeletedPerspectives();
- final String[][] perspectiveNamesAndIds = getPerspectiveNamesAndIds();
-
- ComboFieldEditor comboEditor= new ComboFieldEditor(
- ICVSUIConstants.PREF_DEFAULT_PERSPECTIVE_FOR_SHOW_ANNOTATIONS,
- Policy.bind("WorkInProgressPreferencePage.5"), //$NON-NLS-1$
- perspectiveNamesAndIds,
- perspectiveGroup);
- addField(comboEditor);
-
- Dialog.applyDialogFont(getFieldEditorParent());
- updateLayout(perspectiveGroup);
- getFieldEditorParent().layout(true);
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- public void init(IWorkbench workbench) {
- }
-
- private Group createGroup(Composite parent, String title) {
- Group display = new Group(parent, SWT.NONE);
- updateLayout(display);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- data.horizontalAlignment = GridData.FILL;
- display.setLayoutData(data);
- display.setText(title);
- return display;
- }
-
- private void updateLayout(Composite composite) {
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginWidth = 5;
- layout.marginHeight =5;
- layout.horizontalSpacing = 5;
- layout.verticalSpacing = 5;
- composite.setLayout(layout);
- }
-
- private static void handleDeletedPerspectives() {
- final IPreferenceStore store= CVSUIPlugin.getPlugin().getPreferenceStore();
- final String id= store.getString(ICVSUIConstants.PREF_DEFAULT_PERSPECTIVE_FOR_SHOW_ANNOTATIONS);
- if (PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(id) == null) {
- store.putValue(ICVSUIConstants.PREF_DEFAULT_PERSPECTIVE_FOR_SHOW_ANNOTATIONS, ICVSUIConstants.OPTION_NO_PERSPECTIVE);
- }
- }
-
- private String[][] getPerspectiveNamesAndIds() {
-
- final IPerspectiveRegistry registry= PlatformUI.getWorkbench().getPerspectiveRegistry();
- final IPerspectiveDescriptor[] perspectiveDescriptors= registry.getPerspectives();
-
- Arrays.sort(perspectiveDescriptors, new PerspectiveDescriptorComparator());
-
- final String[][] table = new String[perspectiveDescriptors.length + 1][2];
- table[0][0] = Policy.bind("WorkInProgressPreferencePage.6"); //$NON-NLS-1$
- table[0][1] = ICVSUIConstants.OPTION_NO_PERSPECTIVE;
- for (int i = 0; i < perspectiveDescriptors.length; i++) {
- table[i + 1][0] = perspectiveDescriptors[i].getLabel();
- table[i + 1][1] = perspectiveDescriptors[i].getId();
- }
- return table;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkbenchUserAuthenticator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkbenchUserAuthenticator.java
deleted file mode 100644
index ba4c47376..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkbenchUserAuthenticator.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Atsuhiko Yamanaka, JCraft,Inc. - implementation of promptForKeyboradInteractive
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.*;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ui.Utils;
-
-/**
- * An authenticator that prompts the user for authentication info,
- * and stores the results in the Platform's authentication keyring.
- */
-public class WorkbenchUserAuthenticator implements IUserAuthenticator {
- public static boolean USE_ALTERNATE_PROMPTER = false;
-
- /**
- * WorkbenchUserAuthenticator constructor.
- */
- public WorkbenchUserAuthenticator() {
- super();
- // Initialize USE_ALTERNATE_PROMPTER
- IIgnoreInfo[] ignores = Team.getAllIgnores();
- boolean found = false;
- for (int i = 0; i < ignores.length; i++) {
- if (ignores[i].getPattern().equals("*.notes")) { //$NON-NLS-1$
- found = true;
- }
- }
- if (!found) return;
- IFileTypeInfo[] types = Team.getAllTypes();
- for (int i = 0; i < types.length; i++) {
- if (types[i].getExtension().equals("notes")) { //$NON-NLS-1$
- USE_ALTERNATE_PROMPTER = true;
- return;
- }
- }
- USE_ALTERNATE_PROMPTER = false;
- }
- /**
- * @see IUserAuthenticator#authenticateUser
- */
- public void promptForUserInfo(final ICVSRepositoryLocation location, final IUserInfo userinfo, final String message) throws CVSException {
- if (!userinfo.isUsernameMutable() && USE_ALTERNATE_PROMPTER) {
- alternatePromptForUserInfo(userinfo);
- return;
- }
- // ask the user for a password
- final String[] result = new String[2];
- Display display = Display.getCurrent();
- final boolean allowCaching[] = {false};
- if (display != null) {
- allowCaching[0] = promptForPassword(location, userinfo.getUsername(), message, userinfo.isUsernameMutable(), result);
- } else {
- // sync exec in default thread
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- allowCaching[0] = promptForPassword(location, userinfo.getUsername(), message, userinfo.isUsernameMutable(), result);
- }
- });
- }
-
- if (result[0] == null) {
- throw new OperationCanceledException(Policy.bind("WorkbenchUserAuthenticator.cancelled")); //$NON-NLS-1$
- }
-
- if (userinfo.isUsernameMutable()) {
- userinfo.setUsername(result[0]);
-
- }
- userinfo.setPassword(result[1]);
-
- if(location != null) {
- if (userinfo.isUsernameMutable()) {
- location.setUsername(result[0]);
- }
- location.setPassword(result[1]);
- location.setAllowCaching(allowCaching[0]);
- }
- }
-
- /**
- * Asks the user to enter a password. Places the
- * results in the supplied string[]. result[0] must
- * contain the username, result[1] must contain the password.
- * If the user canceled, both values must be zero.
- *
- * @param location the location to obtain the password for
- * @param username the username
- * @param message a message to display to the user
- * @param userMutable whether the user can be changed in the dialog
- * @param result a String array of length two in which to put the result
- */
- private boolean promptForPassword(final ICVSRepositoryLocation location, final String username, final String message, final boolean userMutable, final String[] result) {
- Shell shell = Utils.findShell();
- if(shell == null) {
- return false;
- }
- String domain = location == null ? null : location.getLocation();
- UserValidationDialog dialog = new UserValidationDialog(shell, domain, (username==null)?"":username, message);//$NON-NLS-1$
- dialog.setUsernameMutable(userMutable);
- dialog.open();
- result[0] = dialog.getUsername();
- result[1] = dialog.getPassword();
- return dialog.getAllowCaching();
- }
-
- /**
- * Asks the user to enter values.
- *
- * @param location the location to obtain the password for
- * @param destication the location
- * @param name the name
- * @param instruction the instruction
- * @param prompt the titles for textfields
- * @param echo '*' should be used or not
- * @param result the entered values, or null if user canceled.
- */
- public String[] promptForKeyboradInteractive(final ICVSRepositoryLocation location,
- final String destination,
- final String name,
- final String instruction,
- final String[] prompt,
- final boolean[] echo) throws CVSException {
- final String[][] result = new String[1][];
- Display display = Display.getCurrent();
- if (display != null) {
- result[0]=_promptForUserInteractive(location, destination, name, instruction, prompt, echo);
- }
- else {
- // sync exec in default thread
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- result[0]=_promptForUserInteractive(location, destination, name, instruction, prompt, echo);
- }
- });
- }
- return result[0];
- }
-
- private String[] _promptForUserInteractive(final ICVSRepositoryLocation location,
- final String destination,
- final String name,
- final String instruction,
- final String[] prompt,
- final boolean[] echo) {
-
- Shell shell = Utils.findShell();
- if(shell == null) return new String[0];
- String domain = location == null ? null : location.getLocation();
- KeyboardInteractiveDialog dialog = new KeyboardInteractiveDialog(shell,
- domain,
- destination,
- name,
- instruction,
- prompt,
- echo);
- dialog.open();
- return dialog.getResult();
- }
-
- /**
- * Special alternate prompting. Returns the password. Username must be fixed.
- */
- private String alternatePromptForPassword(final String username) {
- Shell shell = Utils.findShell();
- AlternateUserValidationDialog dialog = new AlternateUserValidationDialog(shell, (username == null) ? "" : username); //$NON-NLS-1$
- dialog.setUsername(username);
- int result = dialog.open();
- if (result == Dialog.CANCEL) return null;
- return dialog.getPassword();
- }
-
- /**
- * Special alternate prompting.
- */
- public void alternatePromptForUserInfo(final IUserInfo userinfo) {
- // ask the user for a password
- final String[] result = new String[1];
- Display display = Display.getCurrent();
- if (display != null) {
- result[0] = alternatePromptForPassword(userinfo.getUsername());
- } else {
- // sync exec in default thread
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- result[0] = alternatePromptForPassword(userinfo.getUsername());
- }
- });
- }
-
- if (result[0] == null) {
- throw new OperationCanceledException(Policy.bind("WorkbenchUserAuthenticator.The_operation_was_canceled_by_the_user_1")); //$NON-NLS-1$
- }
-
- userinfo.setPassword(result[0]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.IUserAuthenticator#prompt(org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation, int, java.lang.String, java.lang.String, int[], int)
- */
- public int prompt(ICVSRepositoryLocation location, final int promptType, final String title, final String message, final int[] promptResponses, final int defaultResponse) {
- final Display display = CVSUIPlugin.getStandardDisplay();
- final int[] retval = new int[1];
- final String[] buttons = new String[promptResponses.length];
- for (int i = 0; i < promptResponses.length; i++) {
- int prompt = promptResponses[i];
- switch(prompt) {
- case IUserAuthenticator.OK_ID: buttons[i] = IDialogConstants.OK_LABEL; break;
- case IUserAuthenticator.CANCEL_ID: buttons[i] = IDialogConstants.CANCEL_LABEL; break;
- case IUserAuthenticator.NO_ID: buttons[i] = IDialogConstants.NO_LABEL; break;
- case IUserAuthenticator.YES_ID: buttons[i] = IDialogConstants.YES_LABEL; break;
- }
- }
-
- display.syncExec(new Runnable() {
- public void run() {
- final MessageDialog dialog = new MessageDialog(
- new Shell(display),
- title,
- null /* title image */,
- message,
- promptType,
- buttons,
- 1
- );
- retval[0] = dialog.open();
- }
- });
- return retval[0];
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkingSetSelectionArea.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkingSetSelectionArea.java
deleted file mode 100644
index 94c989180..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkingSetSelectionArea.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.window.Window;
-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.*;
-import org.eclipse.team.internal.ui.dialogs.DialogArea;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
-
-/**
- * @author Administrator
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-public class WorkingSetSelectionArea extends DialogArea {
-
- private Button noWorkingSetButton;
- private Button workingSetButton;
- private Combo mruList;
- private Button selectButton;
- private IWorkingSet workingSet, oldWorkingSet;
-
- private String noWorkingSetText;
- private String workingSetText;
-
- private static final String USE_WORKING_SET = "UseWorkingSet"; //$NON-NLS-1$
- public static final String SELECTED_WORKING_SET = "SelectedWorkingSet"; //$NON-NLS-1$
-
- /*
- * Used to update the mru list box when working sets are
- * renamed in the working set selection dialog.
- */
- private IPropertyChangeListener workingSetChangeListener = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- Object newValue = event.getNewValue();
-
- if (IWorkingSetManager.CHANGE_WORKING_SET_NAME_CHANGE.equals(property) &&
- newValue instanceof IWorkingSet) {
- String newName = ((IWorkingSet) newValue).getName();
- int count = mruList.getItemCount();
- for (int i = 0; i < count; i++) {
- String item = mruList.getItem(i);
- IWorkingSet workingSet = (IWorkingSet) mruList.getData(item);
- if (workingSet == newValue) {
- boolean isTopItem = (mruList.getData(mruList.getText()) == workingSet);
- mruList.remove(i);
- mruList.add(newName, i);
- mruList.setData(newName, workingSet);
- if (isTopItem) {
- mruList.setText(newName);
- }
- break;
- }
- }
- }
- }
- };
- private final IDialogSettings settings;
- private final Shell shell;
-
- public WorkingSetSelectionArea(Shell shell) {
- this(shell, null, null, null);
- }
-
- public WorkingSetSelectionArea(Shell shell, String noWorkingSetText, String workingSetText, IDialogSettings settings) {
- this.shell = shell;
- this.noWorkingSetText = noWorkingSetText;
- this.workingSetText = workingSetText;
- this.settings = settings;
- }
-
- /**
- * Overrides method in Dialog
- *
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite)
- */
- public void createArea(Composite parent) {
- Dialog.applyDialogFont(parent);
- final Composite composite = createComposite(parent, 2, false);
- initializeDialogUnits(composite);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.numColumns = 2;
- composite.setLayout(layout);
-
- // Create the checkbox to enable/disable working set use
- noWorkingSetButton = createRadioButton(composite, noWorkingSetText, 2);
- workingSetButton = createRadioButton(composite, workingSetText, 2);
- workingSetButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleWorkingSetButtonSelection();
- }
- });
-
- boolean useWorkingSet = false;
- if (settings != null) {
- useWorkingSet = settings.getBoolean(USE_WORKING_SET);
- }
- noWorkingSetButton.setSelection(!useWorkingSet);
- workingSetButton.setSelection(useWorkingSet);
-
- // Create the combo/button which allows working set selection
- mruList = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
- GridData data = new GridData(SWT.FILL, SWT.CENTER, true, true);
- data.horizontalIndent= 15;
- mruList.setLayoutData(data);
-
- selectButton = createButton(composite, Policy.bind("WorkingSetSelectionArea.workingSetOther"), GridData.HORIZONTAL_ALIGN_FILL); //$NON-NLS-1$
- selectButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- handleWorkingSetSelection();
- }
- });
-
- initializeMru();
- initializeWorkingSet();
-
- mruList.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleMruSelection();
- }
- });
- }
-
- /**
- * Method handleMruSelection.
- */
- private void handleMruSelection() {
- String selectedWorkingSet = mruList.getText();
- oldWorkingSet = workingSet;
- workingSet = (IWorkingSet) mruList.getData(selectedWorkingSet);
- if (settings != null)
- settings.put(SELECTED_WORKING_SET, selectedWorkingSet);
- handleWorkingSetChange();
- }
-
- /**
- * Opens the working set selection dialog if the "Other..." item
- * is selected in the most recently used working set list.
- */
- private void handleWorkingSetSelection() {
- IWorkingSetSelectionDialog dialog = PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSetSelectionDialog(shell, false);
- IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
- IWorkingSet workingSet = workingSetManager.getWorkingSet(mruList.getText());
-
- if (workingSet != null) {
- dialog.setSelection(new IWorkingSet[]{workingSet});
- }
- // add a change listener to detect a working set name change
- workingSetManager.addPropertyChangeListener(workingSetChangeListener);
- if (dialog.open() == Window.OK) {
- IWorkingSet[] result = dialog.getSelection();
- if (result != null && result.length > 0) {
- workingSet = result[0];
- String workingSetName = workingSet.getName();
- if (mruList.indexOf(workingSetName) != -1) {
- mruList.remove(workingSetName);
- }
- mruList.add(workingSetName, 0);
- mruList.setText(workingSetName);
- mruList.setData(workingSetName, workingSet);
- handleMruSelection();
- }
- else {
- workingSet = null;
- }
- // remove deleted working sets from the mru list box
- String[] mruNames = mruList.getItems();
- for (int i = 0; i < mruNames.length; i++) {
- if (workingSetManager.getWorkingSet(mruNames[i]) == null) {
- mruList.remove(mruNames[i]);
- }
- }
- }
- workingSetManager.removePropertyChangeListener(workingSetChangeListener);
- }
-
- /**
- * Sets the enabled state of the most recently used working set list
- * based on the checked state of the working set check box.
- */
- private void handleWorkingSetButtonSelection() {
- boolean useWorkingSet = workingSetButton.getSelection();
- if (settings != null)
- settings.put(USE_WORKING_SET, useWorkingSet);
- mruList.setEnabled(useWorkingSet);
- selectButton.setEnabled(useWorkingSet);
- if (useWorkingSet && mruList.getSelectionIndex() >= 0) {
- handleMruSelection();
- } else if (!useWorkingSet) {
- handleDeselection();
- }
- }
-
- private void handleDeselection() {
- oldWorkingSet = workingSet;
- workingSet = null;
- handleWorkingSetChange();
- }
-
- private void handleWorkingSetChange() {
- firePropertyChangeChange(SELECTED_WORKING_SET, oldWorkingSet, workingSet);
- }
-
- /**
- * Populates the most recently used working set list with MRU items from
- * the working set manager as well as adds an item to enable selection of
- * a working set not in the MRU list.
- */
- private void initializeMru() {
- IWorkingSet[] workingSets = PlatformUI.getWorkbench().getWorkingSetManager().getRecentWorkingSets();
-
- for (int i = 0; i < workingSets.length; i++) {
- String workingSetName = workingSets[i].getName();
- mruList.add(workingSetName);
- mruList.setData(workingSetName, workingSets[i]);
- }
- if (workingSets.length > 0) {
- mruList.setText(workingSets[0].getName());
- }
- }
-
- /**
- * Initializes the state of the working set part of the dialog.
- */
- private void initializeWorkingSet() {
- if (workingSet == null && settings != null && settings.getBoolean(USE_WORKING_SET)) {
- IWorkingSet mruSet = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(settings.get(SELECTED_WORKING_SET));
- if (mruSet != null) {
- // the call to setWorkingSet will re-invoke the initializeWorkingSet method
- setWorkingSet(mruSet);
- return;
- }
- }
- workingSetButton.setSelection(workingSet != null);
- handleWorkingSetButtonSelection();
- if (workingSet != null && mruList.indexOf(workingSet.getName()) != -1) {
- mruList.setText(workingSet.getName());
- }
- handleWorkingSetChange();
- }
-
- /**
- * Returns the selected working set or null if none is selected.
- *
- * @return the selected working set or null if none is selected.
- */
- public IWorkingSet getWorkingSet() {
- return workingSet;
- }
-
- /**
- * Indicate that the selected working set is actually being used so it can
- * be added to the "most recently used" list.
- */
- public void useSelectedWorkingSet() {
- // Add the selected working set to the MRU list before returning it
- if (workingSet != null) {
- PlatformUI.getWorkbench().getWorkingSetManager().addRecentWorkingSet(workingSet);
- }
- }
-
- /**
- * Sets the working set that should be selected in the most recently
- * used working set list.
- *
- * @param workingSet the working set that should be selected.
- * has to exist in the list returned by
- * org.eclipse.ui.IWorkingSetManager#getRecentWorkingSets().
- * Must not be null.
- */
- public void setWorkingSet(IWorkingSet workingSet) {
- oldWorkingSet = this.workingSet;
- this.workingSet = workingSet;
-
- if (workingSetButton != null && mruList != null) {
- initializeWorkingSet();
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/XMLWriter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/XMLWriter.java
deleted file mode 100644
index e9affe50b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/XMLWriter.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.io.*;
-import java.util.*;
-/**
- * A simple XML writer.
- */
-public class XMLWriter extends PrintWriter {
- protected int tab;
-
- /* constants */
- protected static final String XML_VERSION = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; //$NON-NLS-1$
-
-public XMLWriter(OutputStream output) throws UnsupportedEncodingException {
- super(new OutputStreamWriter(output, "UTF8")); //$NON-NLS-1$
- tab = 0;
- println(XML_VERSION);
-}
-public void endTag(String name) {
- tab--;
- printTag('/' + name, null);
-}
-public void printSimpleTag(String name, Object value) {
- if (value != null) {
- printTag(name, null, true, false);
- print(getEscaped(String.valueOf(value)));
- printTag('/' + name, null, false, true);
- }
-}
-public void printTabulation() {
- for (int i = 0; i < tab; i++)
- super.print('\t');
-}
-private void printTag(String name, HashMap parameters) {
- printTag(name, parameters, true, true);
-}
-private void printTag(String name, HashMap parameters, boolean tab, boolean newLine) {
- printTag(name, parameters, tab, newLine, false);
-}
-private void printTag(String name, HashMap parameters, boolean tab, boolean newLine, boolean end) {
- StringBuffer sb = new StringBuffer();
- sb.append("<"); //$NON-NLS-1$
- sb.append(name);
- if (parameters != null)
- for (Enumeration e = Collections.enumeration(parameters.keySet()); e.hasMoreElements();) {
- sb.append(" "); //$NON-NLS-1$
- String key = (String) e.nextElement();
- sb.append(key);
- sb.append("=\""); //$NON-NLS-1$
- sb.append(getEscaped(String.valueOf(parameters.get(key))));
- sb.append("\""); //$NON-NLS-1$
- }
- if (end)
- sb.append('/');
- sb.append(">"); //$NON-NLS-1$
- if (tab)
- printTabulation();
- if (newLine)
- println(sb.toString());
- else
- print(sb.toString());
-}
-public void startTag(String name, HashMap parameters) {
- startTag(name, parameters, true);
-}
-public void startTag(String name, HashMap parameters, boolean newLine) {
- printTag(name, parameters, true, newLine);
- tab++;
-}
-public void startAndEndTag(String name, HashMap parameters, boolean newLine) {
- printTag(name, parameters, true, true, true);
-}
-private static void appendEscapedChar(StringBuffer buffer, char c) {
- String replacement = getReplacement(c);
- if (replacement != null) {
- buffer.append('&');
- buffer.append(replacement);
- buffer.append(';');
- } else {
- buffer.append(c);
- }
-}
-public static String getEscaped(String s) {
- StringBuffer result = new StringBuffer(s.length() + 10);
- for (int i = 0; i < s.length(); ++i)
- appendEscapedChar(result, s.charAt(i));
- return result.toString();
-}
-private static String getReplacement(char c) {
- // Encode special XML characters into the equivalent character references.
- // These five are defined by default for all XML documents.
- switch (c) {
- case '<' :
- return "lt"; //$NON-NLS-1$
- case '>' :
- return "gt"; //$NON-NLS-1$
- case '"' :
- return "quot"; //$NON-NLS-1$
- case '\'' :
- return "apos"; //$NON-NLS-1$
- case '&' :
- return "amp"; //$NON-NLS-1$
- }
- return null;
-}
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java
deleted file mode 100644
index 1a075d9d5..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.AddOperation;
-
-/**
- * AddAction performs a 'cvs add' command on the selected resources. If a
- * container is selected, its children are recursively added.
- */
-public class AddAction extends WorkspaceAction {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
- public void execute(IAction action) throws InterruptedException, InvocationTargetException {
- if (!promptForAddOfIgnored()) return;
- new AddOperation(getTargetPart(), getSelectedResources()).run();
- }
-
- /**
- * Method promptForAddOfIgnored.
- */
- private boolean promptForAddOfIgnored() {
- IResource[] resources = getSelectedResources();
- boolean prompt = false;
- for (int i = 0; i < resources.length; i++) {
- ICVSResource resource = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
- try {
- if (resource.isIgnored()) {
- prompt = true;
- break;
- }
- } catch (CVSException e) {
- handle(e);
- }
- }
- if (prompt) {
- return MessageDialog.openQuestion(getShell(), Policy.bind("AddAction.addIgnoredTitle"), Policy.bind("AddAction.addIgnoredQuestion")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return true;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForManagedResources()
- */
- protected boolean isEnabledForManagedResources() {
- return false;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForUnmanagedResources()
- */
- protected boolean isEnabledForUnmanagedResources() {
- return true;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForIgnoredResources()
- */
- protected boolean isEnabledForIgnoredResources() {
- return true;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
- */
- protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
- // Add to version control should never be enabled for linked resources
- IResource resource = cvsResource.getIResource();
- if (resource.isLinked()) return false;
- return super.isEnabledForCVSResource(cvsResource);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java
deleted file mode 100644
index 474908630..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.internal.ccvs.ui.operations.BranchOperation;
-
-/**
- * BranchAction tags the selected resources with a branch tag specified by the user,
- * and optionally updates the local resources to point to the new branch.
- */
-public class BranchAction extends WorkspaceAction {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
- public void execute(IAction action) throws InvocationTargetException, InterruptedException {
- new BranchOperation(getTargetPart(), getSelectedResources()).run();
- }
-
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
deleted file mode 100644
index 5a9b337a3..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
+++ /dev/null
@@ -1,483 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSStatus;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.ILogEntry;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.AvoidableMessageDialog;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.team.internal.ui.dialogs.IPromptCondition;
-import org.eclipse.ui.IEditorActionDelegate;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.ide.IDE;
-
-/**
- * CVSAction is the common superclass for all CVS actions. It provides
- * facilities for enablement handling, standard error handling, selection
- * retrieval and prompting.
- */
-abstract public class CVSAction extends TeamAction implements IEditorActionDelegate {
-
- private List accumulatedStatus = new ArrayList();
-
- /**
- * Common run method for all CVS actions.
- */
- final public void run(IAction action) {
- try {
- if (!beginExecution(action)) return;
- execute(action);
- endExecution();
- } catch (InvocationTargetException e) {
- // Handle the exception and any accumulated errors
- handle(e);
- } catch (InterruptedException e) {
- // Show any problems that have occured so far
- handle(null);
- } catch (TeamException e) {
- // Handle the exception and any accumulated errors
- handle(e);
- }
- }
-
- /**
- * This method gets invoked before the <code>CVSAction#execute(IAction)</code>
- * method. It can preform any prechecking and initialization required before
- * the action is executed. Sunclasses may override but must invoke this
- * inherited method to ensure proper initialization of this superclass is performed.
- * These included prepartion to accumulate IStatus and checking for dirty editors.
- */
- protected boolean beginExecution(IAction action) throws TeamException {
- accumulatedStatus.clear();
- if(needsToSaveDirtyEditors()) {
- if(!saveAllEditors()) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Actions must override to do their work.
- */
- abstract protected void execute(IAction action) throws InvocationTargetException, InterruptedException;
-
- /**
- * This method gets invoked after <code>CVSAction#execute(IAction)</code>
- * if no exception occured. Sunclasses may override but should invoke this
- * inherited method to ensure proper handling oy any accumulated IStatus.
- */
- protected void endExecution() throws TeamException {
- if ( ! accumulatedStatus.isEmpty()) {
- handle(null);
- }
- }
-
- /**
- * Add a status to the list of accumulated status.
- * These will be provided to method handle(Exception, IStatus[])
- * when the action completes.
- */
- protected void addStatus(IStatus status) {
- accumulatedStatus.add(status);
- }
-
- /**
- * Return the list of status accumulated so far by the action. This
- * will include any OK status that were added using addStatus(IStatus)
- */
- protected IStatus[] getAccumulatedStatus() {
- return (IStatus[]) accumulatedStatus.toArray(new IStatus[accumulatedStatus.size()]);
- }
-
- /**
- * Return the title to be displayed on error dialogs.
- * Sunclasses should override to present a custon message.
- */
- protected String getErrorTitle() {
- return Policy.bind("CVSAction.errorTitle"); //$NON-NLS-1$
- }
-
- /**
- * Return the title to be displayed on error dialogs when warnigns occur.
- * Sunclasses should override to present a custon message.
- */
- protected String getWarningTitle() {
- return Policy.bind("CVSAction.warningTitle"); //$NON-NLS-1$
- }
-
- /**
- * Return the message to be used for the parent MultiStatus when
- * mulitple errors occur during an action.
- * Sunclasses should override to present a custon message.
- */
- protected String getMultiStatusMessage() {
- return Policy.bind("CVSAction.multipleProblemsMessage"); //$NON-NLS-1$
- }
-
- /**
- * Return the status to be displayed in an error dialog for the given list
- * of non-OK status.
- *
- * This method can be overridden bu subclasses. Returning an OK status will
- * prevent the error dialog from being shown.
- */
- protected IStatus getStatusToDisplay(IStatus[] problems) {
- if (problems.length == 1) {
- return problems[0];
- }
- MultiStatus combinedStatus = new MultiStatus(CVSUIPlugin.ID, 0, getMultiStatusMessage(), null); //$NON-NLS-1$
- for (int i = 0; i < problems.length; i++) {
- combinedStatus.merge(problems[i]);
- }
- return combinedStatus;
- }
-
- /**
- * Method that implements generic handling of an exception.
- *
- * Thsi method will also use any accumulated status when determining what
- * information (if any) to show the user.
- *
- * @param exception the exception that occured (or null if none occured)
- * @param status any status accumulated by the action before the end of
- * the action or the exception occured.
- */
- protected void handle(Exception exception) {
- // Get the non-OK statii
- List problems = new ArrayList();
- IStatus[] status = getAccumulatedStatus();
- if (status != null) {
- for (int i = 0; i < status.length; i++) {
- IStatus iStatus = status[i];
- if ( ! iStatus.isOK() || iStatus.getCode() == CVSStatus.SERVER_ERROR) {
- problems.add(iStatus);
- }
- }
- }
- // Handle the case where there are no problem statii
- if (problems.size() == 0) {
- if (exception == null) return;
- handle(exception, getErrorTitle(), null);
- return;
- }
-
- // For now, display both the exception and the problem status
- // Later, we can determine how to display both together
- if (exception != null) {
- handle(exception, getErrorTitle(), null);
- }
-
- String message = null;
- IStatus statusToDisplay = getStatusToDisplay((IStatus[]) problems.toArray(new IStatus[problems.size()]));
- if (statusToDisplay.isOK()) return;
- if (statusToDisplay.isMultiStatus() && statusToDisplay.getChildren().length == 1) {
- message = statusToDisplay.getMessage();
- statusToDisplay = statusToDisplay.getChildren()[0];
- }
- String title;
- if (statusToDisplay.getSeverity() == IStatus.ERROR) {
- title = getErrorTitle();
- } else {
- title = getWarningTitle();
- }
- CVSUIPlugin.openError(getShell(), title, message, new CVSException(statusToDisplay));
- }
-
- /**
- * Convenience method for running an operation with the appropriate progress.
- * Any exceptions are propogated so they can be handled by the
- * <code>CVSAction#run(IAction)</code> error handling code.
- *
- * @param runnable the runnable which executes the operation
- * @param cancelable indicate if a progress monitor should be cancelable
- * @param progressKind one of PROGRESS_BUSYCURSOR or PROGRESS_DIALOG
- */
- final protected void run(final IRunnableWithProgress runnable, boolean cancelable, int progressKind) throws InvocationTargetException, InterruptedException {
- final Exception[] exceptions = new Exception[] {null};
-
- // Ensure that no repository view refresh happens until after the action
- final IRunnableWithProgress innerRunnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- getRepositoryManager().run(runnable, monitor);
- }
- };
-
- switch (progressKind) {
- case PROGRESS_BUSYCURSOR :
- BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
- public void run() {
- try {
- innerRunnable.run(new NullProgressMonitor());
- } catch (InvocationTargetException e) {
- exceptions[0] = e;
- } catch (InterruptedException e) {
- exceptions[0] = e;
- }
- }
- });
- break;
- case PROGRESS_DIALOG :
- default :
- new ProgressMonitorDialog(getShell()).run(cancelable, true, innerRunnable);
- break;
- }
- if (exceptions[0] != null) {
- if (exceptions[0] instanceof InvocationTargetException)
- throw (InvocationTargetException)exceptions[0];
- else
- throw (InterruptedException)exceptions[0];
- }
- }
-
- /**
- * Answers if the action would like dirty editors to saved
- * based on the CVS preference before running the action. By
- * default, CVSActions do not save dirty editors.
- */
- protected boolean needsToSaveDirtyEditors() {
- return false;
- }
-
- /**
- * Returns the selected CVS resources
- */
- protected ICVSResource[] getSelectedCVSResources() {
- ArrayList resources = null;
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof ICVSResource) {
- resources.add(next);
- continue;
- }
- if (next instanceof IAdaptable) {
- IAdaptable a = (IAdaptable) next;
- Object adapter = a.getAdapter(ICVSResource.class);
- if (adapter instanceof ICVSResource) {
- resources.add(adapter);
- continue;
- }
- }
- }
- }
- if (resources != null && !resources.isEmpty()) {
- return (ICVSResource[])resources.toArray(new ICVSResource[resources.size()]);
- }
- return new ICVSResource[0];
- }
-
- /**
- * Get selected CVS remote folders
- */
- protected ICVSRemoteFolder[] getSelectedRemoteFolders() {
- ArrayList resources = null;
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof ICVSRemoteFolder) {
- resources.add(next);
- continue;
- }
- if (next instanceof IAdaptable) {
- IAdaptable a = (IAdaptable) next;
- Object adapter = a.getAdapter(ICVSRemoteFolder.class);
- if (adapter instanceof ICVSRemoteFolder) {
- resources.add(adapter);
- continue;
- }
- }
- }
- }
- if (resources != null && !resources.isEmpty()) {
- return (ICVSRemoteFolder[])resources.toArray(new ICVSRemoteFolder[resources.size()]);
- }
- return new ICVSRemoteFolder[0];
- }
-
- /**
- * Returns the selected remote resources
- */
- protected ICVSRemoteResource[] getSelectedRemoteResources() {
- ArrayList resources = null;
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof ICVSRemoteResource) {
- resources.add(next);
- continue;
- }
- if (next instanceof ILogEntry) {
- resources.add(((ILogEntry)next).getRemoteFile());
- continue;
- }
- if (next instanceof IAdaptable) {
- IAdaptable a = (IAdaptable) next;
- Object adapter = a.getAdapter(ICVSRemoteResource.class);
- if (adapter instanceof ICVSRemoteResource) {
- resources.add(adapter);
- continue;
- }
- }
- }
- }
- if (resources != null && !resources.isEmpty()) {
- ICVSRemoteResource[] result = new ICVSRemoteResource[resources.size()];
- resources.toArray(result);
- return result;
- }
- return new ICVSRemoteResource[0];
- }
-
- /**
- * A helper prompt condition for prompting for CVS dirty state.
- */
- public static IPromptCondition getOverwriteLocalChangesPrompt(final IResource[] dirtyResources) {
- return new IPromptCondition() {
- List resources = Arrays.asList(dirtyResources);
- public boolean needsPrompt(IResource resource) {
- return resources.contains(resource);
- }
- public String promptMessage(IResource resource) {
- return Policy.bind("ReplaceWithAction.localChanges", resource.getName());//$NON-NLS-1$
- }
- };
- }
-
- /**
- * Checks if a the resources' parent's tags are different then the given tag.
- * Prompts the user that they are adding mixed tags and returns <code>true</code> if
- * the user wants to continue or <code>false</code> otherwise.
- */
- public static boolean checkForMixingTags(final Shell shell, IResource[] resources, final CVSTag tag) throws CVSException {
- final IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- if(!store.getBoolean(ICVSUIConstants.PREF_PROMPT_ON_MIXED_TAGS)) {
- return true;
- };
-
- final boolean[] result = new boolean[] { true };
-
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (resource.getType() != IResource.PROJECT) {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- CVSTag parentTag = cvsResource.getParent().getFolderSyncInfo().getTag();
- // prompt if the tags are not equal
- // consider BASE to be equal the parent tag since we don't make BASE sticky on replace
- if (!CVSTag.equalTags(tag, parentTag) && !CVSTag.equalTags(tag, CVSTag.BASE)) {
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- AvoidableMessageDialog dialog = new AvoidableMessageDialog(
- shell,
- Policy.bind("CVSAction.mixingTagsTitle"), //$NON-NLS-1$
- null, // accept the default window icon
- Policy.bind("CVSAction.mixingTags", tag.getName()), //$NON-NLS-1$
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL},
- 0);
-
- result[0] = dialog.open() == 0;
- if(result[0] && dialog.isDontShowAgain()) {
- store.setValue(ICVSUIConstants.PREF_PROMPT_ON_MIXED_TAGS, false);
- }
- }
- });
- // only prompt once
- break;
- }
- }
- }
- return result[0];
- }
-
- /**
- * Based on the CVS preference for saving dirty editors this method will either
- * ignore dirty editors, save them automatically, or prompt the user to save them.
- *
- * @return <code>true</code> if the command succeeded, and <code>false</code>
- * if at least one editor with unsaved changes was not saved
- */
- private boolean saveAllEditors() {
- final int option = CVSUIPlugin.getPlugin().getPreferenceStore().getInt(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS);
- final boolean[] okToContinue = new boolean[] {true};
- if (option != ICVSUIConstants.OPTION_NEVER) {
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- boolean confirm = option == ICVSUIConstants.OPTION_PROMPT;
- IResource[] selectedResources = getSelectedResources();
- if (selectedResources != null) {
- okToContinue[0] = IDE.saveAllEditors(selectedResources, confirm);
- }
- }
- });
- }
- return okToContinue[0];
- }
- /**
- * @see org.eclipse.team.internal.ui.actions.TeamAction#handle(java.lang.Exception, java.lang.String, java.lang.String)
- */
- protected void handle(Exception exception, String title, String message) {
- CVSUIPlugin.openError(getShell(), title, message, exception, CVSUIPlugin.LOG_NONTEAM_EXCEPTIONS);
- }
-
- protected RepositoryManager getRepositoryManager() {
- return CVSUIPlugin.getPlugin().getRepositoryManager();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.TeamAction#getSelectedResources()
- */
- protected IResource[] getSelectedResources() {
- return Utils.getResources(selection.toArray());
- }
-
- public void setActiveEditor(IAction action, IEditorPart targetEditor) {
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAction.java
deleted file mode 100644
index bdd61d96f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.operations.CheckoutMultipleProjectsOperation;
-
-/**
- * Checkout a remote module into the workspace ensuring that the user is prompted for
- * any overwrites that may occur.
- */
-public class CheckoutAction extends CVSAction {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
- protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
- new CheckoutMultipleProjectsOperation(getTargetPart(), getSelectedRemoteFolders(), null)
- .run();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- ICVSRemoteFolder[] folders = getSelectedRemoteFolders();
- if (folders.length == 0) return false;
- // only enabled when all folders are in the same repository
- ICVSRepositoryLocation location = folders[0].getRepository();
- for (int i = 1; i < folders.length; i++) {
- ICVSRemoteFolder folder = folders[i];
- if (!folder.getRepository().equals(location)) {
- return false;
- }
- }
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAsAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAsAction.java
deleted file mode 100644
index c06aeb4fe..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAsAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.ui.operations.HasProjectMetaFileOperation;
-import org.eclipse.team.internal.ccvs.ui.wizards.CheckoutAsWizard;
-
-public class CheckoutAsAction extends CVSAction {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
- public void execute(IAction action) throws InvocationTargetException, InterruptedException {
- ICVSRemoteFolder[] folders = getSelectedRemoteFolders();
- CheckoutAsWizard wizard = new CheckoutAsWizard(getTargetPart(), folders, allowProjectConfiguration(folders));
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.open();
- }
-
- /*
- * Return true if the remote project does not have a .project file
- * so that the checkout wizard will give the option to launch
- * the New Project wizard
- */
- protected boolean allowProjectConfiguration(ICVSRemoteFolder[] folders) throws InvocationTargetException, InterruptedException {
- if (folders.length != 1) return false;
- return !HasProjectMetaFileOperation.hasMetaFile(getTargetPart(), folders[0]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- return getSelectedRemoteFolders().length > 0;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutWizardAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutWizardAction.java
deleted file mode 100644
index 036b22c2a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutWizardAction.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ccvs.ui.wizards.CheckoutWizard;
-import org.eclipse.ui.*;
-
-/**
- * Action that launches the checkout wizard
- */
-public class CheckoutWizardAction implements IWorkbenchWindowActionDelegate {
-
- Shell shell;
-
- /**
- * @see IWorkbenchWindowActionDelegate#dispose()
- */
- public void dispose() {
- }
-
- /**
- * @see IWorkbenchWindowActionDelegate#init(IWorkbenchWindow)
- */
- public void init(IWorkbenchWindow window) {
- this.shell = window.getShell();
- }
-
- /**
- * @see IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- CheckoutWizard wizard = new CheckoutWizard();
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.open();
- }
-
- /**
- * @see IActionDelegate#selectionChanged(IAction, ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java
deleted file mode 100644
index f9972b260..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.CommitOperation;
-
-/**
- * Action for checking in files to a CVS provider.
- * Prompts the user for a release comment.
- */
-public class CommitAction extends WorkspaceAction {
-
- /*
- * @see CVSAction#execute(IAction)
- */
- public void execute(IAction action) throws InvocationTargetException, InterruptedException {
- final CommitOperation operation = new CommitOperation(getTargetPart(), getSelectedResources(), null);
- final boolean[] retVal = {true};
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- retVal[0] = operation.performPrompting(monitor);
- } catch (CVSException e) {
- new InvocationTargetException(e);
- }
- }
- }, false, PROGRESS_BUSYCURSOR);
- if(retVal[0])
- operation.run();
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
- */
- protected String getErrorTitle() {
- return Policy.bind("CommitAction.commitFailed"); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForUnmanagedResources()
- */
- protected boolean isEnabledForUnmanagedResources() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
- */
- protected boolean isEnabledForNonExistantResources() {
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteResourcesAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteResourcesAction.java
deleted file mode 100644
index b7bc01154..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteResourcesAction.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.compare.CompareUI;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.operations.RemoteCompareOperation;
-
-/**
- * This action is used for comparing two arbitrary remote resources. This is
- * enabled in the repository explorer.
- */
-public class CompareRemoteResourcesAction extends CVSAction {
-
- public void execute(IAction action) throws InvocationTargetException, InterruptedException {
- ICVSRemoteResource[] editions = getSelectedRemoteResources();
- if (editions == null || editions.length != 2) {
- MessageDialog.openError(getShell(), Policy.bind("CompareRemoteResourcesAction.unableToCompare"), Policy.bind("CompareRemoteResourcesAction.selectTwoResources")); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- try {
- if (isSameFolder(editions)) {
- new RemoteCompareOperation(null, editions[0], RemoteCompareOperation.getTag(editions[1])).run();
- } else {
- ResourceEditionNode left = new ResourceEditionNode(editions[0]);
- ResourceEditionNode right = new ResourceEditionNode(editions[1]);
- CompareUI.openCompareEditorOnPage(new CVSCompareEditorInput(left, right), getTargetPage());
- }
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- }
-
- protected boolean isSameFolder(ICVSRemoteResource[] editions) {
- return editions[0].isContainer() && editions[0].getRepository().equals(editions[1].getRepository())
- && editions[0].getRepositoryRelativePath().equals(editions[1].getRepositoryRelativePath());
- }
-
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- ICVSRemoteResource[] resources = getSelectedRemoteResources();
- if (resources.length != 2) return false;
- if (resources[0].isContainer() != resources[1].isContainer()) return false;
- // Don't allow comparisons of two unrelated remote projects
- return !resources[0].isContainer() || isSameFolder(resources);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteWithTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteWithTagAction.java
deleted file mode 100644
index cd6c7e6a3..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteWithTagAction.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.operations.RemoteCompareOperation;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSelectionDialog;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
-
-/**
- * Compare to versions of a remote resource.
- */
-public class CompareRemoteWithTagAction extends CVSAction {
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
- protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
-
- final ICVSRemoteResource[] resources = getSelectedRemoteResources();
- if (resources.length == 0) return;
-
- // Obtain the tag to compare against
- final ICVSRemoteResource resource = resources[0];
- final CVSTag[] tag = new CVSTag[] { null};
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) {
- tag[0] = TagSelectionDialog.getTagToCompareWith(getShell(), TagSource.create(resources),
- TagSelectionDialog.INCLUDE_BRANCHES |
- TagSelectionDialog.INCLUDE_VERSIONS |
- TagSelectionDialog.INCLUDE_DATES |
- TagSelectionDialog.INCLUDE_HEAD_TAG);
- }
- }, false /* cancelable */, PROGRESS_BUSYCURSOR);
- if (tag[0] == null) return;
-
- // Run the compare operation in the background
- new RemoteCompareOperation(getTargetPart(), resource, tag[0])
- .run();
- }
-
- /**
- * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
- */
- protected boolean isEnabled() {
- ICVSRemoteResource[] resources = getSelectedRemoteResources();
- // Only support single select for now.
- // Need to avoid overlap if multi-select is supported
- return resources.length == 1;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java
deleted file mode 100644
index 98c59288a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-
-/**
- * This action shows the CVS workspace participant into a model dialog. For single file
- * selection, the compare editor is shown instead.
- *
- * @since 3.0
- */
-public class CompareWithRemoteAction extends SyncAction {
-
- /*
- * Update the text label for the action based on the tags in the selection.
- * @see TeamAction#setActionEnablement(org.eclipse.jface.action.IAction)
- */
- protected void setActionEnablement(IAction action) {
- super.setActionEnablement(action);
- action.setText(calculateActionTagValue());
- }
-
- /**
- * Enable for resources that are managed (using super) or whose parent is a CVS folder.
- *
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
- */
- protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
- return super.isEnabledForCVSResource(cvsResource) || cvsResource.getParent().isCVSFolder();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
- */
- protected boolean isEnabledForNonExistantResources() {
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java
deleted file mode 100644
index ef683b19c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.compare.CompareUI;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.CVSCompareRevisionsInput;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.ui.SaveablePartDialog;
-
-/**
- * Compare with revision will allow a user to browse the history of a file, compare with the
- * other revisions and merge changes from other revisions into the workspace copy.
- */
-public class CompareWithRevisionAction extends WorkspaceAction {
-
- /**
- * Returns the selected remote file
- */
- protected ICVSRemoteFile getSelectedRemoteFile() {
- IResource[] resources = getSelectedResources();
- if (resources.length != 1) return null;
- if (!(resources[0] instanceof IFile)) return null;
- IFile file = (IFile)resources[0];
- try {
- return (ICVSRemoteFile)CVSWorkspaceRoot.getRemoteResourceFor(file);
- } catch (TeamException e) {
- handle(e, null, null);
- return null;
- }
- }
-
- /*
- * @see CVSAction#execute(IAction)
- */
- public void execute(IAction action) throws InvocationTargetException, InterruptedException {
-
- // Setup holders
- final ICVSRemoteFile[] file = new ICVSRemoteFile[] { null };
- final ILogEntry[][] entries = new ILogEntry[][] { null };
-
- // Get the selected file
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- file[0] = getSelectedRemoteFile();
- }
- }, false /* cancelable */, PROGRESS_BUSYCURSOR);
-
- if (file[0] == null) {
- // No revisions for selected file
- MessageDialog.openWarning(getShell(), Policy.bind("CompareWithRevisionAction.noRevisions"), Policy.bind("CompareWithRevisionAction.noRevisionsLong")); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
-
- // Fetch the log entries
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- try {
- monitor.beginTask(Policy.bind("CompareWithRevisionAction.fetching"), 100); //$NON-NLS-1$
- entries[0] = file[0].getLogEntries(Policy.subMonitorFor(monitor, 100));
- monitor.done();
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- }, true /* cancelable */, PROGRESS_DIALOG);
-
- if (entries[0] == null) return;
-
- // Show the compare viewer
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- CVSCompareRevisionsInput input = new CVSCompareRevisionsInput((IFile)getSelectedResources()[0], entries[0]);
- if(CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_SHOW_COMPARE_REVISION_IN_DIALOG)) {
- // running with a null progress monitor is fine because we have already pre-fetched the log entries above.
- input.run(new NullProgressMonitor());
- SaveablePartDialog cd = createCompareDialog(getShell(), input);
- cd.setBlockOnOpen(true);
- cd.open();
- } else {
- CompareUI.openCompareEditor(input);
- }
- }
- }, false /* cancelable */, PROGRESS_BUSYCURSOR);
- }
-
- /**
- * Return the compare dialog to use to show the compare input.
- */
- protected SaveablePartDialog createCompareDialog(Shell shell, CVSCompareRevisionsInput input) {
- return new SaveablePartDialog(shell, input); //$NON-NLS-1$
- }
-
- /**
- * Return the text describing this action
- */
- protected String getActionTitle() {
- return Policy.bind("CompareWithRevisionAction.4"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
- */
- protected String getErrorTitle() {
- return Policy.bind("CompareWithRevisionAction.compare"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
- */
- protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
- return (!cvsResource.isFolder() && super.isEnabledForCVSResource(cvsResource));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForMultipleResources()
- */
- protected boolean isEnabledForMultipleResources() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForAddedResources()
- */
- protected boolean isEnabledForAddedResources() {
- return false;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
deleted file mode 100644
index 81c4abf7b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.subscriber.CompareParticipant;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSelectionDialog;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
-
-public class CompareWithTagAction extends WorkspaceAction {
-
- public void execute(IAction action) throws InvocationTargetException, InterruptedException {
- final IResource[] resources = getSelectedResources();
- CVSTag tag = promptForTag(resources);
- if (tag == null)
- return;
-
- CVSCompareSubscriber compareSubscriber = new CVSCompareSubscriber(resources, tag);
- if (SyncAction.isSingleFile(resources)) {
- SyncAction.showSingleFileComparison(getShell(), compareSubscriber, resources[0]);
- compareSubscriber.dispose();
- } else {
- try {
- compareSubscriber.primeRemoteTree();
- } catch(CVSException e) {
- // ignore, the compare will fail if there is a real problem.
- }
- // First check if there is an existing matching participant, if so then re-use it
- CompareParticipant participant = CompareParticipant.getMatchingParticipant(resources, tag);
- if (participant == null) {
- CVSCompareSubscriber s = compareSubscriber;
- participant = new CompareParticipant(s);
- TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[]{participant});
- }
- participant.refresh(resources, null, null, null); //$NON-NLS-1$
- }
- }
-
- protected CVSTag promptForTag(IResource[] resources) {
- CVSTag tag = TagSelectionDialog.getTagToCompareWith(getShell(), TagSource.create(resources), TagSelectionDialog.INCLUDE_ALL_TAGS);
- return tag;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
- */
- protected boolean isEnabledForNonExistantResources() {
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ConfigureTagsFromRepoViewOnFolder.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ConfigureTagsFromRepoViewOnFolder.java
deleted file mode 100644
index 81c0c5b73..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ConfigureTagsFromRepoViewOnFolder.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.model.RemoteModule;
-import org.eclipse.team.internal.ccvs.ui.tags.TagConfigurationDialog;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
-;
-
-/**
- * DefineTagAction remembers a tag by name
- */
-public class ConfigureTagsFromRepoViewOnFolder extends CVSAction {
-
- /**
- * Returns the selected remote folders
- */
- protected ICVSRemoteFolder[] getSelectedRemoteFolders() {
- ArrayList resources = null;
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof RemoteModule) {
- next = ((RemoteModule)next).getCVSResource();
- }
- if (next instanceof ICVSRemoteFolder) {
- ICVSRemoteFolder folder = (ICVSRemoteFolder)next;
- if (folder.isDefinedModule()) {
- resources.add(next);
- } else if(new Path(null, ((ICVSRemoteFolder)next).getRepositoryRelativePath()).segmentCount()==1) {
- resources.add(next);
- }
- }
- }
- }
- if (resources != null && !resources.isEmpty()) {
- return (ICVSRemoteFolder[])resources.toArray(new ICVSRemoteFolder[resources.size()]);
- }
- return new ICVSRemoteFolder[0];
- }
-
- /*
- * @see CVSAction@execute(IAction)
- */
- public void execute(IAction action) throws InvocationTargetException, InterruptedException {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- final ICVSRemoteFolder[] roots = getSelectedRemoteFolders();
- final Shell shell = getShell();
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- ICVSFolder[] cvsFolders = new ICVSFolder[roots.length];
- for (int i = 0; i < roots.length; i++) {
- cvsFolders[i] = roots[i];
- }
- TagConfigurationDialog d = new TagConfigurationDialog(shell, TagSource.create(cvsFolders));
- d.open();
- }
- });
- }
- }, false /* cancelable */, PROGRESS_BUSYCURSOR);
- }
-
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- ICVSRemoteFolder[] roots = getSelectedRemoteFolders();
- if (roots.length != 1) return false;
- return true;
- }
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
- */
- protected String getErrorTitle() {
- return Policy.bind("ConfigureTagsFromRepoViewConfigure_Tag_Error_1"); //$NON-NLS-1$
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditAction.java
deleted file mode 100644
index e798bdb84..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditAction.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.core.Team;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.PlatformUI;
-
-public class EditAction extends WorkspaceAction {
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
- protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
- // Get the editors
- final EditorsAction editors = new EditorsAction();
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- executeProviderAction(editors, Policy.subMonitorFor(monitor, 25));
-
- // If there are editors show them and prompt the user to execute the edit command
- if (!editors.promptToEdit(shell)) {
- return;
- }
-
- executeProviderAction(new IProviderAction() {
- public IStatus execute(CVSTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws CVSException {
- provider.edit(resources, false /* recurse */, true /* notify server */, ICVSFile.NO_NOTIFICATION, monitor);
- return Team.OK_STATUS;
- }
- }, Policy.subMonitorFor(monitor, 75));
- }
- });
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForAddedResources()
- */
- protected boolean isEnabledForAddedResources() {
- return false;
- }
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
- */
- protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
- if (cvsResource.isFolder()) return false;
- if (super.isEnabledForCVSResource(cvsResource)) {
- return ((ICVSFile)cvsResource).isReadOnly();
- } else {
- return false;
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditorsAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditorsAction.java
deleted file mode 100644
index 7f6d5a678..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditorsAction.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003 CSC SoftwareConsult GmbH & Co. OHG, Germany and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * CSC - Intial implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.Team;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction.IProviderAction;
-
-/**
- * This Action gets the <code>EditorsInfo[]</code>
- * It is used by the <code>ShowEditorAction</code>
- * and <code>ShowEditorAction</code>.
- *
- * @author <a href="mailto:gregor.kohlwes@csc.com,kohlwes@gmx.net">Gregor
- * Kohlwes</a>
- *
- */
-public class EditorsAction implements IProviderAction, IRunnableWithProgress {
- EditorsInfo[] f_editorsInfo = new EditorsInfo[0];
- CVSTeamProvider f_provider;
- IResource[] f_resources;
-
- public EditorsAction() {
- }
-
- public EditorsAction(CVSTeamProvider provider, IResource[] resources) {
- f_provider = provider;
- f_resources = resources;
- }
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction.IProviderAction#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource, org.eclipse.core.runtime.IProgressMonitor)
- */
- public IStatus execute(CVSTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws CVSException {
- f_editorsInfo = provider.editors(resources, monitor);
- return Team.OK_STATUS;
- }
-
- public boolean promptToEdit(Shell shell) {
- if (!isEmpty()) {
- final EditorsDialog view = new EditorsDialog(shell, f_editorsInfo);
- // Open the dialog using a sync exec (there are no guarentees that we
- // were called from the UI thread
- CVSUIPlugin.openDialog(shell, new CVSUIPlugin.IOpenableInShell() {
- public void open(Shell shell) {
- view.open();
- }
- }, CVSUIPlugin.PERFORM_SYNC_EXEC);
- return (view.getReturnCode() == EditorsDialog.OK);
- }
- return true;
- }
-
- /**
- * Contact the server to determine if there are any editors on the associatd files.
- *
- * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- if (f_provider == null || f_resources == null) {
- throw new InvocationTargetException(new RuntimeException(Policy.bind("EditorsAction.classNotInitialized", this.getClass().getName()))); //$NON-NLS-1$
- }
- try {
- execute(f_provider,f_resources,monitor);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- }
-
- /**
- * Returns the f_editorsInfo.
- * @return EditorsInfo[]
- */
- public EditorsInfo[] getEditorsInfo() {
- return f_editorsInfo;
- }
-
- /**
- * Indicates whether there are editors of any of the associated files.
- * The <code>run(IProgressMonitor)</code> must be invoked first to
- * fetch any editors from the server.
- * @return boolean
- */
- public boolean isEmpty() {
- return f_editorsInfo.length == 0;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java
deleted file mode 100644
index 21197ffe1..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard;
-
-/**
- * Action to generate a patch file using the CVS diff command.
- *
- * NOTE: This is a temporary action and should eventually be replaced
- * by a create patch command in the compare viewer.
- */
-public class GenerateDiffFileAction extends WorkspaceAction {
-
- // The initial size of this wizard.
- private final static int INITIAL_WIDTH = 300;
- private final static int INITIAL_HEIGHT = 350;
-
- /** (Non-javadoc)
- * Method declared on IActionDelegate.
- */
- public void execute(IAction action) {
- final String title = Policy.bind("GenerateCVSDiff.title"); //$NON-NLS-1$
- final IResource[] resources = getSelectedResources();
- final GenerateDiffFileWizard wizard = new GenerateDiffFileWizard(resources[0]);
- wizard.setWindowTitle(title);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.setMinimumPageSize(INITIAL_WIDTH, INITIAL_HEIGHT);
- dialog.open();
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForMultipleResources()
- */
- protected boolean isEnabledForMultipleResources() {
- return false;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForUnmanagedResources()
- */
- protected boolean isEnabledForUnmanagedResources() {
- return true;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java
deleted file mode 100644
index 80dbe9fdc..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.IgnoreResourcesDialog;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class IgnoreAction extends WorkspaceAction {
-
- /**
- * Define an operation that can be run in the background.
- * We divide the ignores by provider to obtain project
- * locks while modifying the .cvsignore files
- */
- class IgnoreOperation extends RepositoryProviderOperation {
-
- private final IgnoreResourcesDialog dialog;
-
- public IgnoreOperation(IWorkbenchPart part, IResource[] resources, IgnoreResourcesDialog dialog) {
- super(part, resources);
- this.dialog = dialog;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
- */
- protected String getTaskName(CVSTeamProvider provider) {
- return Policy.bind("IgnoreAction.0", provider.getProject().getName()); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(CVSTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws CVSException, InterruptedException {
- try {
- monitor.beginTask(null, resources.length);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- String pattern = dialog.getIgnorePatternFor(resource);
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- cvsResource.setIgnoredAs(pattern);
- monitor.worked(1);
- }
- } catch (TeamException e) {
- collectStatus(e.getStatus());
- return;
- } finally {
- monitor.done();
- }
- collectStatus(Status.OK_STATUS);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return Policy.bind("IgnoreAction.1"); //$NON-NLS-1$
- }
-
- }
-
- protected void execute(final IAction action) throws InvocationTargetException, InterruptedException {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- IResource[] resources = getSelectedResources();
- IgnoreResourcesDialog dialog = new IgnoreResourcesDialog(getShell(), resources);
- if (dialog.open() != IgnoreResourcesDialog.OK) return;
- new IgnoreOperation(getTargetPart(), resources, dialog).run();
-
- //if (action != null) action.setEnabled(isEnabled());
- }
- }, false /* cancelable */, PROGRESS_BUSYCURSOR);
- }
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
- */
- protected String getErrorTitle() {
- return Policy.bind("IgnoreAction.ignore"); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForManagedResources()
- */
- protected boolean isEnabledForManagedResources() {
- return false;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForUnmanagedResources()
- */
- protected boolean isEnabledForUnmanagedResources() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
- */
- protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
- if (super.isEnabledForCVSResource(cvsResource)) {
- // Perform an extra check against the subscriber to ensure there is no conflict
- CVSWorkspaceSubscriber subscriber = CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber();
- IResource resource = cvsResource.getIResource();
- if (resource == null) return false;
- try {
- SyncInfo info = subscriber.getSyncInfo(resource);
- return ((info.getKind() & SyncInfo.DIRECTION_MASK) == SyncInfo.OUTGOING);
- } catch (TeamException e) {
- // Let the enablement happen
- return true;
- }
- }
- return false;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java
deleted file mode 100644
index 795c1c833..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ccvs.ui.wizards.MergeWizard;
-
-public class MergeAction extends WorkspaceAction {
-
- /*
- * @see CVSAction#execute()
- */
- public void execute(IAction action) {
- final Shell shell = getShell();
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- MergeWizard wizard = new MergeWizard(getTargetPart(), getSelectedResources());
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.open();
- }
- });
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MoveRemoteTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MoveRemoteTagAction.java
deleted file mode 100644
index 923721ca2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MoveRemoteTagAction.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.ITagOperation;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSelectionDialog;
-
-public class MoveRemoteTagAction extends TagInRepositoryAction {
-
- /**
- * @see TagRemoteAction#promptForTag(ICVSFolder[])
- */
- protected ITagOperation configureOperation() {
- // Allow the user to select a tag
- ITagOperation operation = createTagOperation();
- TagSelectionDialog dialog = new TagSelectionDialog(getShell(), operation.getTagSource(),
- Policy.bind("MoveTagAction.title"), //$NON-NLS-1$
- Policy.bind("MoveTagAction.message"), //$NON-NLS-1$
- TagSelectionDialog.INCLUDE_BRANCHES | TagSelectionDialog.INCLUDE_VERSIONS,
- isFolderSelected(), /* show recurse */
- IHelpContextIds.TAG_REMOTE_WITH_EXISTING_DIALOG);
- dialog.setBlockOnOpen(true);
- if (dialog.open() == Dialog.CANCEL) {
- return null;
- }
- CVSTag tag = dialog.getResult();
- if (tag == null) return null;
- operation.setTag(tag);
- operation.moveTag();
- boolean recursive = dialog.getRecursive();
- if (!recursive) {
- operation.recurse();
- }
- return operation;
- }
-
- private boolean isFolderSelected() {
- ICVSResource[] resources = getSelectedCVSResources();
- for (int i = 0; i < resources.length; i++) {
- ICVSResource resource = resources[i];
- if (resource.isFolder())
- return true;
- }
- return false;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/NewRepositoryAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/NewRepositoryAction.java
deleted file mode 100644
index a1d5f2f64..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/NewRepositoryAction.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ccvs.ui.wizards.NewLocationWizard;
-import org.eclipse.ui.*;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-public class NewRepositoryAction implements IWorkbenchWindowActionDelegate, IViewActionDelegate {
- Shell shell;
-
- /**
- * @see IWorkbenchWindowActionDelegate#dispose()
- */
- public void dispose() {
- }
-
- /**
- * @see IWorkbenchWindowActionDelegate#init(IWorkbenchWindow)
- */
- public void init(IWorkbenchWindow window) {
- this.shell = window.getShell();
- }
-
- public void init(IViewPart view) {
- shell = view.getSite().getShell();
- }
-
- /**
- * @see IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- NewLocationWizard wizard = new NewLocationWizard();
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.open();
- }
-
- /**
- * @see IActionDelegate#selectionChanged(IAction, ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenLogEntryAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenLogEntryAction.java
deleted file mode 100644
index e3da4a6e5..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenLogEntryAction.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ILogEntry;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.ui.*;
-
-public class OpenLogEntryAction extends CVSAction {
- /**
- * Returns the selected remote files
- */
- protected ILogEntry[] getSelectedLogEntries() {
- ArrayList entries = null;
- if (!selection.isEmpty()) {
- entries = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof ILogEntry) {
- entries.add(next);
- continue;
- }
- if (next instanceof IAdaptable) {
- IAdaptable a = (IAdaptable) next;
- Object adapter = a.getAdapter(ILogEntry.class);
- if (adapter instanceof ILogEntry) {
- entries.add(adapter);
- continue;
- }
- }
- }
- }
- if (entries != null && !entries.isEmpty()) {
- ILogEntry[] result = new ILogEntry[entries.size()];
- entries.toArray(result);
- return result;
- }
- return new ILogEntry[0];
- }
- /*
- * @see CVSAction#execute(IAction)
- */
- public void execute(IAction action) throws InterruptedException, InvocationTargetException {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- IWorkbench workbench = CVSUIPlugin.getPlugin().getWorkbench();
- IEditorRegistry registry = workbench.getEditorRegistry();
- IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
- final ILogEntry[] entries = getSelectedLogEntries();
- for (int i = 0; i < entries.length; i++) {
- if (entries[i].isDeletion()) {
- MessageDialog.openError(getShell(), Policy.bind("OpenLogEntryAction.deletedTitle"), Policy.bind("OpenLogEntryAction.deleted")); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- ICVSRemoteFile file = entries[i].getRemoteFile();
- String filename = file.getName();
- IEditorDescriptor descriptor = registry.getDefaultEditor(filename);
- String id;
- if (descriptor == null) {
- id = "org.eclipse.ui.DefaultTextEditor"; //$NON-NLS-1$
- } else {
- id = descriptor.getId();
- }
- try {
- try {
- page.openEditor(new RemoteFileEditorInput(file, monitor), id);
- } catch (PartInitException e) {
- if (id.equals("org.eclipse.ui.DefaultTextEditor")) { //$NON-NLS-1$
- throw e;
- } else {
- page.openEditor(new RemoteFileEditorInput(file, monitor), "org.eclipse.ui.DefaultTextEditor"); //$NON-NLS-1$
- }
- }
- } catch (PartInitException e) {
- throw new InvocationTargetException(e);
- }
- }
- }
- }
- }, false, PROGRESS_BUSYCURSOR); //$NON-NLS-1$
- }
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- ILogEntry[] entries = getSelectedLogEntries();
- if (entries.length == 0) return false;
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenRemoteFileAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenRemoteFileAction.java
deleted file mode 100644
index 033fd3b9a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenRemoteFileAction.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ILogEntry;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.RemoteFileEditorInput;
-import org.eclipse.ui.*;
-
-public class OpenRemoteFileAction extends CVSAction {
- /**
- * Returns the selected remote files
- */
- protected ICVSRemoteFile[] getSelectedRemoteFiles() {
- ArrayList resources = null;
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof ICVSRemoteFile) {
- resources.add(next);
- continue;
- }
- if (next instanceof ILogEntry) {
- resources.add(((ILogEntry)next).getRemoteFile());
- continue;
- }
- if (next instanceof IAdaptable) {
- IAdaptable a = (IAdaptable) next;
- Object adapter = a.getAdapter(ICVSRemoteFile.class);
- if (adapter instanceof ICVSRemoteFile) {
- resources.add(adapter);
- continue;
- }
- }
- }
- }
- if (resources != null && !resources.isEmpty()) {
- ICVSRemoteFile[] result = new ICVSRemoteFile[resources.size()];
- resources.toArray(result);
- return result;
- }
- return new ICVSRemoteFile[0];
- }
- /*
- * @see CVSAction#execute(IAction)
- */
- public void execute(IAction action) throws InterruptedException, InvocationTargetException {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- IWorkbench workbench = CVSUIPlugin.getPlugin().getWorkbench();
- IEditorRegistry registry = workbench.getEditorRegistry();
- IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
- ICVSRemoteFile[] files = getSelectedRemoteFiles();
- for (int i = 0; i < files.length; i++) {
- ICVSRemoteFile file = files[i];
- String filename = file.getName();
- IEditorDescriptor descriptor = registry.getDefaultEditor(filename);
- String id;
- if (descriptor == null) {
- id = "org.eclipse.ui.DefaultTextEditor"; //$NON-NLS-1$
- } else {
- id = descriptor.getId();
- }
- try {
- try {
- page.openEditor(new RemoteFileEditorInput(files[i], monitor), id);
- } catch (PartInitException e) {
- if (id.equals("org.eclipse.ui.DefaultTextEditor")) { //$NON-NLS-1$
- throw e;
- } else {
- page.openEditor(new RemoteFileEditorInput(files[i], monitor), "org.eclipse.ui.DefaultTextEditor"); //$NON-NLS-1$
- }
- }
- } catch (PartInitException e) {
- throw new InvocationTargetException(e);
- }
- }
- }
- }, false, PROGRESS_BUSYCURSOR); //$NON-NLS-1$
- }
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- ICVSRemoteFile[] resources = getSelectedRemoteFiles();
- if (resources.length == 0) return false;
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java
deleted file mode 100644
index d182ccdb5..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.ReplaceOperation;
-import org.eclipse.team.internal.core.InfiniteSubProgressMonitor;
-import org.eclipse.team.internal.ui.dialogs.IPromptCondition;
-
-public class ReplaceWithRemoteAction extends WorkspaceAction {
- public void execute(IAction action) throws InvocationTargetException, InterruptedException {
-
- final IResource[][] resources = new IResource[][] {null};
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- try {
- monitor = Policy.monitorFor(monitor);
- monitor.beginTask(null, 100);
- resources[0] = checkOverwriteOfDirtyResources(getSelectedResources(), new InfiniteSubProgressMonitor(monitor, 100));
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- }, false /* cancelable */, PROGRESS_BUSYCURSOR);
-
- if (resources[0] == null || resources[0].length == 0) return;
-
- // Peform the replace in the background
- new ReplaceOperation(getTargetPart(), resources[0], null, true).run();
- }
-
- protected IPromptCondition getPromptCondition(IResource[] dirtyResources) {
- return getOverwriteLocalChangesPrompt(dirtyResources);
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
- */
- protected String getErrorTitle() {
- return Policy.bind("ReplaceWithRemoteAction.problemMessage"); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForAddedResources()
- */
- protected boolean isEnabledForAddedResources() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
- */
- protected boolean isEnabledForNonExistantResources() {
- return true;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
- */
- protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
- if (super.isEnabledForCVSResource(cvsResource)) {
- // Don't enable if there are sticky file revisions in the lineup
- if (!cvsResource.isFolder()) {
- ResourceSyncInfo info = cvsResource.getSyncInfo();
- if (info != null && info.getTag() != null) {
- String revision = info.getRevision();
- String tag = info.getTag().getName();
- if (revision.equals(tag)) return false;
- }
- }
- return true;
- } else {
- return false;
- }
- }
-
- /*
- * Update the text label for the action based on the tags in the
- * selection.
- *
- * @see TeamAction#setActionEnablement(org.eclipse.jface.action.IAction)
- */
- protected void setActionEnablement(IAction action) {
- super.setActionEnablement(action);
-
- action.setText(calculateActionTagValue());
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRevisionAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRevisionAction.java
deleted file mode 100644
index d0fc01de5..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRevisionAction.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.ui.CVSCompareRevisionsInput;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.SaveablePartDialog;
-
-/**
- * Displays a compare dialog and allows the same behavior as the compare. In addition
- * a replace button is added to the dialog that will replace the local with the currently
- * selected revision.
- *
- * @since 3.0
- */
-public class ReplaceWithRevisionAction extends CompareWithRevisionAction {
-
- protected static final int REPLACE_ID = 10;
- private CVSCompareRevisionsInput input;
-
- protected class ReplaceCompareDialog extends SaveablePartDialog {
- private Button replaceButton;
-
- public ReplaceCompareDialog(Shell shell, CVSCompareRevisionsInput input) {
- super(shell, input);
- // Don't allow editing of the merge viewers in the replace
- input.getCompareConfiguration().setLeftEditable(false);
- input.getCompareConfiguration().setRightEditable(false);
- }
-
- /**
- * Add the replace button to the dialog.
- */
- protected void createButtonsForButtonBar(Composite parent) {
- replaceButton = createButton(parent, REPLACE_ID, Policy.bind("ReplaceWithRevisionAction.0"), true); //$NON-NLS-1$
- replaceButton.setEnabled(false);
- input.getViewer().addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent e) {
- ISelection s= e.getSelection();
- replaceButton.setEnabled(s != null && ! s.isEmpty());
- }
- }
- );
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); //$NON-NLS-1$
- // Don't call super because we don't want the OK button to appear
- }
-
- /**
- * If the replace button was pressed.
- */
- protected void buttonPressed(int buttonId) {
- if(buttonId == REPLACE_ID) {
- try {
- input.replaceLocalWithCurrentlySelectedRevision();
- } catch (CoreException e) {
- Utils.handle(e);
- }
- buttonId = IDialogConstants.OK_ID;
- }
- super.buttonPressed(buttonId);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CompareWithRevisionAction#createCompareDialog(org.eclipse.swt.widgets.Shell, org.eclipse.team.internal.ccvs.ui.CVSCompareRevisionsInput)
- */
- protected SaveablePartDialog createCompareDialog(Shell shell, CVSCompareRevisionsInput input) {
- this.input = input;
- return new ReplaceCompareDialog(shell, input); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CompareWithRevisionAction#getActionTitle()
- */
- protected String getActionTitle() {
- return Policy.bind("ReplaceWithRevisionAction.1"); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java
deleted file mode 100644
index f0d90294f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.ReplaceOperation;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSelectionDialog;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
-
-/**
- * Action for replace with tag.
- */
-public class ReplaceWithTagAction extends WorkspaceAction {
- /*
- * Method declared on IActionDelegate.
- */
- public void execute(IAction action) throws InterruptedException, InvocationTargetException {
-
- // Setup the holders
- final IResource[][] resources = new IResource[][] {null};
- final CVSTag[] tag = new CVSTag[] {null};
- final boolean[] recurse = new boolean[] {true};
-
- // Show a busy cursor while display the tag selection dialog
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
-
- try {
- resources[0] =
- checkOverwriteOfDirtyResources(
- getSelectedResources(),
- null /* no progress just a busy cursor for now */);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- if(resources[0].length == 0) {
- // nothing to do
- return;
- }
- TagSelectionDialog dialog = new TagSelectionDialog(getShell(), TagSource.create(resources[0]),
- Policy.bind("ReplaceWithTagAction.message"), //$NON-NLS-1$
- Policy.bind("TagSelectionDialog.Select_a_Tag_1"), //$NON-NLS-1$
- TagSelectionDialog.INCLUDE_ALL_TAGS,
- true, /*show recurse*/
- IHelpContextIds.REPLACE_TAG_SELECTION_DIALOG); //$NON-NLS-1$
- dialog.setBlockOnOpen(true);
- if (dialog.open() == Dialog.CANCEL) {
- return;
- }
- tag[0] = dialog.getResult();
- recurse[0] = dialog.getRecursive();
-
- // For non-projects determine if the tag being loaded is the same as the resource's parent
- // If it's not, warn the user that they will have strange sync behavior
- try {
- if(!CVSAction.checkForMixingTags(getShell(), resources[0], tag[0])) {
- tag[0] = null;
- return;
- }
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- }
- }, false /* cancelable */, PROGRESS_BUSYCURSOR); //$NON-NLS-1$
-
- if (resources[0] == null || resources[0].length == 0 || tag[0] == null) return;
-
- // Peform the replace in the background
- new ReplaceOperation(getTargetPart(), resources[0], tag[0], recurse[0]).run();
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
- */
- protected String getErrorTitle() {
- return Policy.bind("ReplaceWithTagAction.replace"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
- */
- protected boolean isEnabledForNonExistantResources() {
- return true;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java
deleted file mode 100644
index 1c9c95e02..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.client.Command.QuietOption;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.ResizableWizardDialog;
-import org.eclipse.team.internal.ccvs.ui.wizards.RestoreFromRepositoryWizard;
-
-/**
- * @author Administrator
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-public class RestoreFromRepositoryAction extends CVSAction {
-
- /*
- * This class handles the output from "cvs log -R ..." where -R
- * indicates that only the RCS file name is to be returned. Files
- * that have been deleted will be in the Attic. The Attic may also
- * contains files that exist on a branch but not in HEAD
- */
- class AtticLogListener extends CommandOutputListener {
- private static final String ATTIC = "Attic"; //$NON-NLS-1$
- private static final String RCS_FILE_POSTFIX = ",v"; //$NON-NLS-1$
- private static final String LOGGING_PREFIX = "Logging "; //$NON-NLS-1$
- ICVSFolder currentFolder;
- List atticFiles = new ArrayList();
-
- public IStatus messageLine(
- String line,
- ICVSRepositoryLocation location,
- ICVSFolder commandRoot,
- IProgressMonitor monitor) {
-
- // Find all RCS file names that contain "Attic"
- int index = line.indexOf(ATTIC);
- if (index == -1) return OK;
- // Extract the file name and path from the RCS path
- // String filePath = line.substring(index);
- int start = line.indexOf(Session.SERVER_SEPARATOR, index);
- String fileName = line.substring(start + 1);
- if (fileName.endsWith(RCS_FILE_POSTFIX)) {
- fileName = fileName.substring(0, fileName.length() - RCS_FILE_POSTFIX.length());
- }
- try {
- atticFiles.add(currentFolder.getFile(fileName));
- } catch (CVSException e) {
- return e.getStatus();
- }
- return OK;
- }
-
- public IStatus errorLine(
- String line,
- ICVSRepositoryLocation location,
- ICVSFolder commandRoot,
- IProgressMonitor monitor) {
-
- CVSRepositoryLocation repo = (CVSRepositoryLocation)location;
- String folderPath = repo.getServerMessageWithoutPrefix(line, SERVER_PREFIX);
- if (folderPath != null) {
- if (folderPath.startsWith(LOGGING_PREFIX)) {
- folderPath = folderPath.substring(LOGGING_PREFIX.length());
- try {
- currentFolder = commandRoot.getFolder(folderPath);
- } catch (CVSException e) {
- return e.getStatus();
- }
- return OK;
- }
- }
- return super.errorLine(line, location, commandRoot, monitor);
- }
-
- public ICVSFile[] getAtticFilePaths() {
- return (ICVSFile[]) atticFiles.toArray(new ICVSFile[atticFiles.size()]);
- }
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
- protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
- IContainer resource = (IContainer)getSelectedResources()[0];
- ICVSFile[] files = fetchDeletedFiles(resource);
- if (files == null) return;
- if (files.length == 0) {
- MessageDialog.openInformation(getShell(), Policy.bind("RestoreFromRepositoryAction.noFilesTitle"), Policy.bind("RestoreFromRepositoryAction.noFilesMessage", resource.getName())); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- RestoreFromRepositoryWizard wizard = new RestoreFromRepositoryWizard(resource, files);
- WizardDialog dialog = new ResizableWizardDialog(shell, wizard);
- dialog.setMinimumPageSize(350, 250);
- dialog.open();
- }
-
- /**
- * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- IResource[] resources = getSelectedResources();
- if (resources.length != 1) return false;
- if (resources[0].getType() == IResource.FILE) return false;
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor((IContainer)resources[0]);
- if (!folder.isCVSFolder()) return false;
- return true;
- }
-
- private ICVSFile[] fetchDeletedFiles(final IContainer parent) {
- final ICVSFile[][] files = new ICVSFile[1][0];
- files[0] = null;
- try {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(parent);
- FolderSyncInfo info = folder.getFolderSyncInfo();
- ICVSRepositoryLocation location = KnownRepositories.getInstance().getRepository(info.getRoot());
- files[0] = fetchFilesInAttic(location, folder, monitor);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- }
- }, true, PROGRESS_DIALOG);
- } catch (InvocationTargetException e) {
- handle(e);
- } catch (InterruptedException e) {
- return null;
- }
- return files[0];
- }
-
- /*
- * Fetch the RCS paths (minus the Attic segment) of all files in the Attic.
- * This path includes the repository root path.
- */
- private ICVSFile[] fetchFilesInAttic(ICVSRepositoryLocation location, ICVSFolder parent, IProgressMonitor monitor) throws CVSException {
- monitor = Policy.monitorFor(monitor);
- monitor.beginTask(null, 100);
- AtticLogListener listener = new AtticLogListener();
- Session session = new Session(location, parent, true /* output to console */);
- session.open(Policy.subMonitorFor(monitor, 10), false /* read-only */);
- try {
- QuietOption quietness = CVSProviderPlugin.getPlugin().getQuietness();
- try {
- CVSProviderPlugin.getPlugin().setQuietness(Command.VERBOSE);
- IStatus status = Command.LOG.execute(
- session,
- Command.NO_GLOBAL_OPTIONS,
- new LocalOption[] { Log.RCS_FILE_NAMES_ONLY },
- new ICVSResource[] { parent }, listener,
- Policy.subMonitorFor(monitor, 90));
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- throw new CVSServerException(status);
- }
- } finally {
- CVSProviderPlugin.getPlugin().setQuietness(quietness);
- monitor.done();
- }
- } finally {
- session.close();
- }
- return listener.getAtticFilePaths();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SetKeywordSubstitutionAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SetKeywordSubstitutionAction.java
deleted file mode 100644
index dffb82f44..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SetKeywordSubstitutionAction.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
-import org.eclipse.team.internal.ccvs.ui.ResizableWizardDialog;
-import org.eclipse.team.internal.ccvs.ui.wizards.KSubstWizard;
-
-/**
- * TagAction tags the selected resources with a version tag specified by the user.
- */
-public class SetKeywordSubstitutionAction extends WorkspaceAction {
- private KSubstOption previousOption = null; // automatic
-
- /*
- * @see IActionDelegate#run(IAction)
- */
- public void execute(IAction action) {
- final IResource[] resources = getSelectedResources();
- KSubstWizard wizard = new KSubstWizard(resources, IResource.DEPTH_INFINITE, previousOption);
- WizardDialog dialog = new ResizableWizardDialog(getShell(), wizard);
- wizard.setParentDialog(dialog);
- dialog.setMinimumPageSize(350, 250);
- dialog.open();
- previousOption = wizard.getKSubstOption();
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java
deleted file mode 100644
index e7e190b74..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.listeners.LogEntry;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.ShowAnnotationOperation;
-
-public class ShowAnnotationAction extends WorkspaceAction {
-
- /**
- * Action to open a CVS Annotate View
- */
- public void execute(IAction action) throws InvocationTargetException, InterruptedException {
- final ICVSResource resource= getSingleSelectedCVSResource();
- if (resource == null)
- return;
- execute(resource);
- }
-
- /**
- * Fetch the revision number of a CVS resource and perform a ShowAnnotationOperation
- * in the background.
- *
- * @param cvsResource The CVS resource (must not be null)
- *
- * @throws InvocationTargetException
- * @throws InterruptedException
- */
- public void execute(final ICVSResource cvsResource) throws InvocationTargetException, InterruptedException {
- final String revision= getRevision(cvsResource);
- if (revision == null)
- return;
- boolean binary = isBinary(cvsResource);
- if (binary) {
- if (!MessageDialog.openQuestion(getShell(), Policy.bind("ShowAnnotationAction.2"), Policy.bind("ShowAnnotationAction.3", cvsResource.getName()))) { //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- }
- new ShowAnnotationOperation(getTargetPart(), cvsResource, revision, binary).run();
- }
-
- private boolean isBinary(ICVSResource cvsResource) {
- if (cvsResource.isFolder()) return false;
- try {
- byte[] syncBytes = ((ICVSFile)cvsResource).getSyncBytes();
- if (syncBytes == null)
- return false;
- return ResourceSyncInfo.isBinary(syncBytes);
- } catch (CVSException e) {
- return false;
- }
- }
-
- /**
- * Ony enabled for single resource selection
- */
- protected boolean isEnabled() throws TeamException {
- ICVSResource resource = getSingleSelectedCVSResource();
- return (resource != null && ! resource.isFolder() && resource.isManaged());
- }
-
- /**
- * This action is called from one of a Resource Navigator a CVS Resource
- * Navigator or a History Log Viewer. Return the selected resource as an
- * ICVSResource
- *
- * @return ICVSResource
- */
- private ICVSResource getSingleSelectedCVSResource() {
- // Selected from a CVS Resource Navigator
- final ICVSResource[] cvsResources = getSelectedCVSResources();
- if (cvsResources.length == 1) {
- return cvsResources[0];
- }
-
- // Selected from a History Viewer
- final Object[] logEntries = getSelectedResources(LogEntry.class);
- if (logEntries.length == 1) {
- final LogEntry aLogEntry = (LogEntry) logEntries[0];
- final ICVSRemoteFile cvsRemoteFile = aLogEntry.getRemoteFile();
- return cvsRemoteFile;
- }
-
- // Selected from a Resource Navigator
- final IResource[] resources = getSelectedResources();
- if (resources.length == 1) {
- return CVSWorkspaceRoot.getCVSResourceFor(resources[0]);
- }
- return null;
- }
-
-
- /**
- * Get the revision for the CVS resource. Throws an InvocationTargetException
- * if the revision could not be determined.
- *
- * @param cvsResource The CVS resource
- * @return The revision of the resource.
- * @throws InvocationTargetException
- */
- private String getRevision(ICVSResource cvsResource) throws InvocationTargetException {
- final ResourceSyncInfo info;
- try {
- info= cvsResource.getSyncInfo();
- if (info == null)
- throw new CVSException(Policy.bind("ShowAnnotationAction.noSyncInfo", cvsResource.getName())); //$NON-NLS-1$
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- return info.getRevision();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowCVSPerspectiveAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowCVSPerspectiveAction.java
deleted file mode 100644
index 53e039ab4..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowCVSPerspectiveAction.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-public class ShowCVSPerspectiveAction extends Action {
- public void run() {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow activeWindow = workbench.getActiveWorkbenchWindow();
- if (activeWindow == null) {
- return;
- }
- IWorkbenchPage activePage = activeWindow.getActivePage();
- if (activePage == null) {
- return;
- }
- IPerspectiveDescriptor cvsPerspective = workbench.getPerspectiveRegistry().findPerspectiveWithId("org.eclipse.team.cvs.ui.cvsPerspective"); //$NON-NLS-1$
- if(cvsPerspective!=null) {
- activePage.setPerspective(cvsPerspective);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowEditorsAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowEditorsAction.java
deleted file mode 100644
index 92624cfe8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowEditorsAction.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003 CSC SoftwareConsult GmbH & Co. OHG, Germany and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * CSC - Intial implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.internal.ccvs.core.EditorsInfo;
-import org.eclipse.team.internal.ccvs.ui.EditorsView;
-/**
- *
- *
- * Action for Show Editors in popup menus
- *
- * @author <a href="mailto:kohlwes@gmx.net">Gregor Kohlwes</a>
- *
- */
-public class ShowEditorsAction extends WorkspaceAction {
-
- protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
- final EditorsAction editorsAction = new EditorsAction();
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- executeProviderAction(editorsAction, monitor);
- }
- }, true /* cancelable */ , PROGRESS_DIALOG);
- EditorsInfo[] infos = editorsAction.getEditorsInfo();
- EditorsView view = (EditorsView)showView(EditorsView.VIEW_ID);
- if (view != null) {
- view.setInput(infos);
- }
-
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForAddedResources()
- */
- protected boolean isEnabledForAddedResources() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
- */
- protected boolean isEnabledForNonExistantResources() {
- return true;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForMultipleResources()
- */
- protected boolean isEnabledForMultipleResources() {
- // We support one selected Resource,
- // because the editors command will
- // show the editors of all children too.
- return false;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowHistoryAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowHistoryAction.java
deleted file mode 100644
index 47a88521a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowHistoryAction.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.ui.HistoryView;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-public class ShowHistoryAction extends CVSAction {
- /**
- * Returns the selected remote files
- */
- protected ICVSRemoteFile[] getSelectedRemoteFiles() {
- ArrayList resources = null;
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof ICVSRemoteFile) {
- resources.add(next);
- continue;
- }
- if (next instanceof IAdaptable) {
- IAdaptable a = (IAdaptable)next;
- Object adapter = a.getAdapter(ICVSRemoteFile.class);
- if (adapter instanceof ICVSRemoteFile) {
- resources.add(adapter);
- continue;
- }
- }
- }
- }
- if (resources != null && !resources.isEmpty()) {
- ICVSRemoteFile[] result = new ICVSRemoteFile[resources.size()];
- resources.toArray(result);
- return result;
- }
- return new ICVSRemoteFile[0];
- }
- /*
- * @see CVSAction#executeIAction)
- */
- public void execute(IAction action) throws InterruptedException, InvocationTargetException {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- ICVSRemoteFile[] files = getSelectedRemoteFiles();
- HistoryView view = (HistoryView)showView(HistoryView.VIEW_ID);
- if (view != null) {
- view.showHistory(files[0], true /* refetch */);
- }
- }
- }, false /* cancelable */, PROGRESS_BUSYCURSOR);
- }
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- ICVSRemoteFile[] resources = getSelectedRemoteFiles();
- return resources.length == 1;
- }
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
- */
- protected String getErrorTitle() {
- return Policy.bind("ShowHistoryAction.showHistory"); //$NON-NLS-1$
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowResourceInHistoryAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowResourceInHistoryAction.java
deleted file mode 100644
index dbd91c537..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowResourceInHistoryAction.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.ui.HistoryView;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-public class ShowResourceInHistoryAction extends WorkspaceAction {
- /*
- * @see IActionDelegate#run(IAction)
- */
- public void execute(IAction action) throws InterruptedException, InvocationTargetException {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- IResource[] resources = getSelectedResources();
- if (resources.length != 1) return;
- HistoryView view = (HistoryView)showView(HistoryView.VIEW_ID);
- if (view != null) {
- view.showHistory(resources[0], true /* fetch */);
- }
- }
- }, false /* cancelable */, PROGRESS_BUSYCURSOR);
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
- */
- protected String getErrorTitle() {
- return Policy.bind("ShowHistoryAction.showHistory"); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForMultipleResources()
- */
- protected boolean isEnabledForMultipleResources() {
- return false;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForAddedResources()
- */
- protected boolean isEnabledForAddedResources() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
- */
- protected boolean isEnabledForNonExistantResources() {
- return true;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
- */
- protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
- return (!cvsResource.isFolder() && super.isEnabledForCVSResource(cvsResource));
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
deleted file mode 100644
index 14acbc3b1..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.compare.CompareUI;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.*;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Action to initiate a CVS workspace synchronize
- */
-public class SyncAction extends WorkspaceAction {
-
- public void execute(IAction action) throws InvocationTargetException {
- final IResource[] resources = getResourcesToSync();
- if (resources == null || resources.length == 0) return;
-
- if(isSingleFile(resources)) {
- showSingleFileComparison(getShell(), CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber(), resources[0]);
- } else {
- // First check if there is an existing matching participant
- WorkspaceSynchronizeParticipant participant = (WorkspaceSynchronizeParticipant)SubscriberParticipant.getMatchingParticipant(WorkspaceSynchronizeParticipant.ID, resources);
- // If there isn't, create one and add to the manager
- if (participant == null) {
- participant = new WorkspaceSynchronizeParticipant(new ResourceScope(resources));
- TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[] {participant});
- }
- participant.refresh(resources, getTargetPart().getSite());
- }
- }
-
- /**
- * Refresh the subscriber directly and show the resulting synchronization state in a compare editor. If there
- * is no difference the user is prompted.
- *
- * @param resources the file to refresh and compare
- */
- public static void showSingleFileComparison(final Shell shell, final Subscriber subscriber, final IResource resource) {
- try {
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- subscriber.refresh(new IResource[]{resource}, IResource.DEPTH_ZERO, monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- final SyncInfo info = subscriber.getSyncInfo(resource);
- if (info == null) return;
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- if (info.getKind() == SyncInfo.IN_SYNC) {
- MessageDialog.openInformation(shell, Policy.bind("SyncAction.noChangesTitle"), Policy.bind("SyncAction.noChangesMessage")); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- SyncInfoCompareInput input = new SyncInfoCompareInput(subscriber.getName(), info);
- CompareUI.openCompareEditor(input);
- }
- }
- });
- } catch (InvocationTargetException e) {
- Utils.handle(e);
- } catch (InterruptedException e) {
- } catch (TeamException e) {
- Utils.handle(e);
- }
- }
-
- public static boolean isSingleFile(IResource[] resources) {
- return resources.length == 1 && resources[0].getType() == IResource.FILE;
- }
-
- protected IResource[] getResourcesToSync() {
- return getSelectedResources();
- }
-
- /**
- * Enable for resources that are managed (using super) or whose parent is a
- * CVS folder.
- *
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
- */
- protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
- return (super.isEnabledForCVSResource(cvsResource) || (cvsResource.getParent().isCVSFolder() && !cvsResource.isIgnored()));
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java
deleted file mode 100644
index 92a610bda..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialogWithToggle;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.window.Window;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.ITagOperation;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.team.internal.ccvs.ui.tags.TagAsVersionDialog;
-
-/**
- * TagAction tags the selected resources with a version tag specified by the user.
- */
-public abstract class TagAction extends WorkspaceAction {
-
- // remember if the execute action was cancelled
- private boolean wasCancelled = false;
-
- /**
- * @see CVSAction#execute(IAction)
- */
- public void execute(IAction action) throws InvocationTargetException, InterruptedException {
- setWasCancelled(false);
- if (!performPrompting()) {
- setWasCancelled(true);
- return;
- }
-
- // Prompt for the tag name
- final ITagOperation[] result = new ITagOperation[1];
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- result[0] = configureOperation();
- if (result[0] == null) {
- return;
- }
- }});
-
- if (result[0] == null) {
- setWasCancelled(true);
- return;
- }
-
- result[0].run();
- }
-
- protected boolean performPrompting() {
- return true;
- }
-
- /**
- * Prompts the user for a tag name.
- * Note: This method is designed to be overridden by test cases.
- * @return the operation, or null to cancel
- */
- protected ITagOperation configureOperation() {
- IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- ITagOperation operation = createTagOperation();
- if (operation.getCVSResources().length == 0) {
- return null;
- }
- TagAsVersionDialog dialog = new TagAsVersionDialog(getShell(),
- Policy.bind("TagAction.tagResources"), //$NON-NLS-1$
- operation);
- if (dialog.open() != Window.OK) return null;
-
- // The user has indicated they want to force a move. Make sure they really do.
- if (dialog.shouldMoveTag() && store.getBoolean(ICVSUIConstants.PREF_CONFIRM_MOVE_TAG)) {
- MessageDialogWithToggle confirmDialog = MessageDialogWithToggle.openYesNoQuestion(getShell(),
- Policy.bind("TagAction.moveTagConfirmTitle"), //$NON-NLS-1$
- Policy.bind("TagAction.moveTagConfirmMessage", dialog.getTagName()), //$NON-NLS-1$
- null,
- false,
- null,
- null);
-
- if (confirmDialog.getReturnCode() == IDialogConstants.YES_ID) {
- store.setValue(ICVSUIConstants.PREF_CONFIRM_MOVE_TAG, !confirmDialog.getToggleState());
- } else {
- return null;
- }
- }
-
- // The user is a cowboy and wants to do it.
- return dialog.getOperation();
- }
-
- protected abstract ITagOperation createTagOperation();
-
- protected String getErrorTitle() {
- return Policy.bind("TagAction.tagErrorTitle"); //$NON-NLS-1$
- }
-
- protected String getWarningTitle() {
- return Policy.bind("TagAction.tagWarningTitle"); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForAddedResources()
- */
- protected boolean isEnabledForAddedResources() {
- return false;
- }
-
- public boolean wasCancelled() {
- return wasCancelled;
- }
-
- public void setWasCancelled(boolean b) {
- wasCancelled = b;
- }
-
- public static void broadcastTagChange(final ICVSResource[] resources, final CVSTag tag) throws InvocationTargetException, InterruptedException {
- final RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- manager.run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) {
- try {
- for (int i = 0; i < resources.length; i++) {
- ICVSResource resource = resources[i];
- // Cache the new tag creation even if the tag may have had warnings.
- manager.addTags(getRootParent(resource), new CVSTag[] {tag});
- }
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
- private ICVSResource getRootParent(ICVSResource resource) throws CVSException {
- if (!resource.isManaged()) return resource;
- ICVSFolder parent = resource.getParent();
- if (parent == null) return resource;
- // Special check for a parent which is the repository itself
- if (parent.getName().length() == 0) return resource;
- return getRootParent(parent);
- }
- }, new NullProgressMonitor());
- }
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagInRepositoryAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagInRepositoryAction.java
deleted file mode 100644
index 14bd56d53..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagInRepositoryAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.ui.operations.ITagOperation;
-import org.eclipse.team.internal.ccvs.ui.operations.TagInRepositoryOperation;
-
-public class TagInRepositoryAction extends TagAction {
-
- /**
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- ICVSResource[] resources = getSelectedCVSResources();
- if (resources.length == 0) return false;
- for (int i = 0; i < resources.length; i++) {
- if (resources[i] instanceof ICVSRepositoryLocation) return false;
- }
- return true;
- }
-
- /**
- * @see CVSAction#needsToSaveDirtyEditors()
- */
- protected boolean needsToSaveDirtyEditors() {
- return false;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#requiresLocalSyncInfo()
- */
- protected boolean requiresLocalSyncInfo() {
- return false;
- }
-
- protected ITagOperation createTagOperation() {
- return new TagInRepositoryOperation(getTargetPart(), getSelectedRemoteResources());
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java
deleted file mode 100644
index 5f0a41f27..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.team.internal.ccvs.ui.CVSLightweightDecorator;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.ITagOperation;
-import org.eclipse.team.internal.ccvs.ui.operations.TagOperation;
-import org.eclipse.team.internal.ui.dialogs.IPromptCondition;
-import org.eclipse.team.internal.ui.dialogs.PromptingDialog;
-
-public class TagLocalAction extends TagAction {
-
- IResource[] resources;
-
- protected boolean performPrompting() {
- // Prompt for any uncommitted changes
- PromptingDialog prompt = new PromptingDialog(getShell(), getSelectedResources(),
- getPromptCondition(), Policy.bind("TagAction.uncommittedChangesTitle"));//$NON-NLS-1$
- try {
- resources = prompt.promptForMultiple();
- } catch(InterruptedException e) {
- return false;
- }
- if(resources.length == 0) {
- // nothing to do
- return false;
- }
-
- return true;
- }
-
- protected ITagOperation createTagOperation() {
- return new TagOperation(getTargetPart(), resources);
- }
-
- /**
- * Note: This method is designed to be overridden by test cases.
- */
- protected IPromptCondition getPromptCondition() {
- return new IPromptCondition() {
- public boolean needsPrompt(IResource resource) {
- return CVSLightweightDecorator.isDirty(resource);
- }
- public String promptMessage(IResource resource) {
- return Policy.bind("TagAction.uncommittedChanges", resource.getName());//$NON-NLS-1$
- }
- };
- }
-
- /**
- * Return the resources that have been selected by the user. The user has been given
- * a chance to remove any resources with outgoing changes so all provided resources
- * are to be tagged.
- * @return Returns the resources.
- */
- protected IResource[] getResources() {
- return resources;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UneditAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UneditAction.java
deleted file mode 100644
index 2c5ac01f8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UneditAction.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.team.core.Team;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-public class UneditAction extends WorkspaceAction {
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
- protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
-
- if(! MessageDialog.openConfirm(getShell(), Policy.bind("Uneditaction.confirmTitle"), Policy.bind("Uneditaction.confirmMessage"))) { //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
-
- run(new WorkspaceModifyOperation(null) {
- public void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- executeProviderAction(new IProviderAction() {
- public IStatus execute(CVSTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws CVSException {
- provider.unedit(resources, false /* recurse */, true /* notify server */, monitor);
- return Team.OK_STATUS;
- }
- }, monitor);
- }
- }, true /* cancelable */, PROGRESS_DIALOG);
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForAddedResources()
- */
- protected boolean isEnabledForAddedResources() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
- */
- protected boolean isEnabledForNonExistantResources() {
- return true;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
- */
- protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
- if (cvsResource.isFolder()) return false;
- if (super.isEnabledForCVSResource(cvsResource)) {
- return !((ICVSFile)cvsResource).isReadOnly() && ((ICVSFile)cvsResource).isEdited();
- } else {
- return false;
- }
- }
-
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java
deleted file mode 100644
index 61badd0fe..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.DisconnectOperation;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Unmanage action removes the cvs feature from a project and optionally
- * deletes the CVS meta information that is stored on disk.
- */
-public class UnmanageAction extends WorkspaceAction {
-
- static class DeleteProjectDialog extends MessageDialog {
-
- boolean deleteContent = false;
- Button radio1;
- Button radio2;
-
- DeleteProjectDialog(Shell parentShell, IProject[] projects) {
- super(
- parentShell,
- getTitle(projects),
- null, // accept the default window icon
- getMessage(projects),
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL},
- 0); // yes is the default
- }
-
- static String getTitle(IProject[] projects) {
- if (projects.length == 1)
- return Policy.bind("Unmanage.title"); //$NON-NLS-1$
- else
- return Policy.bind("Unmanage.titleN"); //$NON-NLS-1$
- }
-
- static String getMessage(IProject[] projects) {
- if (projects.length == 1) {
- IProject project = projects[0];
- return Policy.bind("Unmanage.message", project.getName()); //$NON-NLS-1$
- }
- else {
- return Policy.bind("Unmanage.messageN", new Integer(projects.length).toString()); //$NON-NLS-1$
- }
- }
-
- protected Control createCustomArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout());
- radio1 = new Button(composite, SWT.RADIO);
- radio1.addSelectionListener(selectionListener);
-
- radio1.setText(Policy.bind("Unmanage.option2")); //$NON-NLS-1$
-
- radio2 = new Button(composite, SWT.RADIO);
- radio2.addSelectionListener(selectionListener);
-
- radio2.setText(Policy.bind("Unmanage.option1")); //$NON-NLS-1$
-
- // set initial state
- radio1.setSelection(deleteContent);
- radio2.setSelection(!deleteContent);
-
- WorkbenchHelp.setHelp(composite, IHelpContextIds.DISCONNECT_ACTION);
-
- return composite;
- }
-
- private SelectionListener selectionListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- Button button = (Button) e.widget;
- if (button.getSelection()) {
- deleteContent = (button == radio1);
- }
- }
- };
-
- public boolean getDeleteContent() {
- return deleteContent;
- }
- }
-
- private boolean deleteContent = false;
-
- /*
- * @see IActionDelegate#run(IAction)
- */
- public void execute(IAction action) throws InterruptedException, InvocationTargetException {
- if(confirmDeleteProjects()) {
- new DisconnectOperation(getTargetPart(), getSelectedProjects(), deleteContent)
- .run();
- }
- }
-
- boolean confirmDeleteProjects() {
- final int[] result = new int[] { MessageDialog.OK };
- IProject[] projects = getSelectedProjects();
- final DeleteProjectDialog dialog = new DeleteProjectDialog(shell, projects);
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- result[0] = dialog.open();
- }
- });
- deleteContent = dialog.getDeleteContent();
- return result[0] == 0; // YES
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
- */
- protected String getErrorTitle() {
- return Policy.bind("Unmanage.unmanagingError");//$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
- */
- protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
- IResource resource = cvsResource.getIResource();
- return resource != null && resource.getType() == IResource.PROJECT;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java
deleted file mode 100644
index 758d4e8f2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.team.internal.ccvs.ui.wizards.UpdateWizard;
-
-/**
- * UpdateAction performs a 'cvs update' command on the selected resources.
- * If conflicts are present (file has been changed both remotely and locally),
- * the changes will be merged into the local file such that the user must
- * resolve the conflicts. This action is temporary code; it will be removed
- * when a functional synchronize view has been implemented.
- */
-public class UpdateAction extends WorkspaceAction {
- /*
- * @see IActionDelegate#run(IAction)
- */
- public void execute(IAction action) throws InterruptedException, InvocationTargetException {
- UpdateWizard wizard = new UpdateWizard(getTargetPart(), getSelectedResources());
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.open();
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForAddedResources()
- */
- protected boolean isEnabledForAddedResources() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
- */
- protected boolean isEnabledForNonExistantResources() {
- return true;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateSilentAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateSilentAction.java
deleted file mode 100644
index ba1e4af31..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateSilentAction.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.ui.operations.UpdateOperation;
-
-/**
- * Action that runs an update without prompting the user for a tag.
- *
- * @since 3.1
- */
-public class UpdateSilentAction extends UpdateAction {
- public void execute(IAction action) throws InterruptedException, InvocationTargetException {
- new UpdateOperation(getTargetPart(), getSelectedResources(), Command.NO_LOCAL_OPTIONS, null /* no tag */).run();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java
deleted file mode 100644
index 0970263b0..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java
+++ /dev/null
@@ -1,616 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.Util;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ui.dialogs.IPromptCondition;
-import org.eclipse.team.internal.ui.dialogs.PromptingDialog;
-
-/**
- * This class represents an action performed on a local CVS workspace
- */
-public abstract class WorkspaceAction extends CVSAction {
-
- public interface IProviderAction {
- public IStatus execute(CVSTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws CVSException;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#beginExecution(IAction)
- */
- protected boolean beginExecution(IAction action) throws TeamException {
- if (super.beginExecution(action)) {
- // Ensure that the required sync info is loaded
- if (requiresLocalSyncInfo()) {
- // There is a possibility of the selection containing an orphaned subtree.
- // If it does, they will be purged and enablement rechecked before the
- // operation is performed.
- handleOrphanedSubtrees();
- // Check enablement just in case the sync info wasn't loaded
- if (!isEnabled()) {
- MessageDialog.openInformation(getShell(), Policy.bind("CVSAction.disabledTitle"), Policy.bind("CVSAction.disabledMessage")); //$NON-NLS-1$ //$NON-NLS-2$
- return false;
- }
- }
- return true;
- } else {
- return false;
- }
- }
-
- /*
- * Determine if any of the selected resources are deascendants of
- * an orphaned CVS subtree and if they are, purge the CVS folders.
- */
- private boolean handleOrphanedSubtrees() {
- // invoke the inherited method so that overlaps are maintained
- IResource[] resources = getSelectedResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- handleOrphanedSubtree(resource);
- }
- return false;
- }
-
- /*
- * Determine if the resource is a descendant of an orphaned subtree.
- * If it is, purge the CVS folders of the subtree.
- */
- private void handleOrphanedSubtree(IResource resource) {
- try {
- if (!CVSWorkspaceRoot.isSharedWithCVS(resource)) return ;
- ICVSFolder folder;
- if (resource.getType() == IResource.FILE) {
- folder = CVSWorkspaceRoot.getCVSFolderFor(resource.getParent());
- } else {
- folder = CVSWorkspaceRoot.getCVSFolderFor((IContainer)resource);
- }
- handleOrphanedSubtree(folder);
- } catch (CVSException e) {
- CVSProviderPlugin.log(e);
- }
- }
-
- /*
- * Recursively check for and handle orphaned CVS folders
- */
- private void handleOrphanedSubtree(final ICVSFolder folder) throws CVSException {
- if (folder.getIResource().getType() == IResource.PROJECT) return;
- if (CVSWorkspaceRoot.isOrphanedSubtree((IContainer)folder.getIResource())) {
- try {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- folder.unmanage(null);
- } catch (CVSException e) {
- CVSProviderPlugin.log(e);
- }
- }
- }, true, PROGRESS_BUSYCURSOR);
- } catch (InvocationTargetException e) {
- // Ignore this since we logged the one we care about above
- } catch (InterruptedException e) {
- throw new OperationCanceledException();
- }
- }
- handleOrphanedSubtree(folder.getParent());
- }
-
- /**
- * Return true if the sync info is loaded for all selected resources.
- * The purpose of this method is to allow enablement code to be as fast
- * as possible. If the sync info is not loaded, the menu should be enabled
- * and, if choosen, the action will verify that it is indeed enabled before
- * performing the associated operation
- */
- protected boolean isSyncInfoLoaded(IResource[] resources) throws CVSException {
- return EclipseSynchronizer.getInstance().isSyncInfoLoaded(resources, getEnablementDepth());
- }
-
- /**
- * Returns the resource depth of the action for use in determining if the required
- * sync info is loaded. The default is IResource.DEPTH_INFINITE. Sunclasses can override
- * as required.
- */
- protected int getActionDepth() {
- return IResource.DEPTH_INFINITE;
- }
-
- /**
- * Returns the resource depth of the action enablement for use in determining if the required
- * sync info is loaded. The default is IResource.DEPTH_ZERO. Sunclasses can override
- * as required.
- */
- protected int getEnablementDepth() {
- return IResource.DEPTH_ZERO;
- }
-
- /**
- * Ensure that the sync info for all the provided resources has been loaded.
- * If an out-of-sync resource is found, prompt to refresh all the projects involved.
- */
- protected boolean ensureSyncInfoLoaded(IResource[] resources) throws CVSException {
- boolean keepTrying = true;
- while (keepTrying) {
- try {
- EclipseSynchronizer.getInstance().ensureSyncInfoLoaded(resources, getActionDepth());
- keepTrying = false;
- } catch (CVSException e) {
- if (e.getStatus().getCode() == IResourceStatus.OUT_OF_SYNC_LOCAL) {
- // determine the projects of the resources involved
- Set projects = new HashSet();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- projects.add(resource.getProject());
- }
- // prompt to refresh
- if (promptToRefresh(getShell(), (IResource[]) projects.toArray(new IResource[projects.size()]), e.getStatus())) {
- for (Iterator iter = projects.iterator();iter.hasNext();) {
- IProject project = (IProject) iter.next();
- try {
- project.refreshLocal(IResource.DEPTH_INFINITE, null);
- } catch (CoreException coreException) {
- throw CVSException.wrapException(coreException);
- }
- }
- } else {
- return false;
- }
- } else {
- throw e;
- }
- }
- }
- return true;
- }
-
- /**
- * Override to ensure that the sync info is available before performing the
- * real <code>isEnabled()</code> test.
- *
- * @see org.eclipse.team.internal.ui.actions.TeamAction#setActionEnablement(IAction)
- */
- protected void setActionEnablement(IAction action) {
- try {
- boolean requires = requiresLocalSyncInfo();
- if (!requires || (requires && isSyncInfoLoaded(getSelectedResources()))) {
- super.setActionEnablement(action);
- } else {
- // If the sync info is not loaded, enable the menu item
- // Performing the action will ensure that the action should really
- // be enabled before anything else is done
- action.setEnabled(true);
- }
- } catch (CVSException e) {
- // We couldn't determine if the sync info was loaded.
- // Enable the action so that performing the action will
- // reveal the error to the user.
- action.setEnabled(true);
- }
- }
-
- /**
- * Return true if the action requires the sync info for the selected resources.
- * If the sync info is required, the real enablement code will only be run if
- * the sync info is loaded from disc. Otherwise, the action is enabled and
- * performing the action will load the sync info and verify that the action is truely
- * enabled before doing anything else.
- *
- * This implementation returns <code>true</code>. Subclasses must override if they do
- * not require the sync info of the selected resources.
- *
- * @return boolean
- */
- protected boolean requiresLocalSyncInfo() {
- return true;
- }
-
- protected boolean promptToRefresh(final Shell shell, final IResource[] resources, final IStatus status) {
- final boolean[] result = new boolean[] { false};
- Runnable runnable = new Runnable() {
- public void run() {
- Shell shellToUse = shell;
- if (shell == null) {
- shellToUse = new Shell(Display.getCurrent());
- }
- String question;
- if (resources.length == 1) {
- question = Policy.bind("CVSAction.refreshQuestion", status.getMessage(), resources[0].getFullPath().toString()); //$NON-NLS-1$
- } else {
- question = Policy.bind("CVSAction.refreshMultipleQuestion", status.getMessage()); //$NON-NLS-1$
- }
- result[0] = MessageDialog.openQuestion(shellToUse, Policy.bind("CVSAction.refreshTitle"), question); //$NON-NLS-1$
- }
- };
- Display.getDefault().syncExec(runnable);
- return result[0];
- }
-
- /**
- * Most CVS workspace actions modify the workspace and thus should
- * save dirty editors.
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#needsToSaveDirtyEditors()
- */
- protected boolean needsToSaveDirtyEditors() {
- return true;
- }
-
- /**
- * The action is enabled for the appropriate resources. This method checks
- * that:
- * <ol>
- * <li>there is no overlap between a selected file and folder (overlapping
- * folders is allowed because of logical vs. physical mapping problem in
- * views)
- * <li>the state of the resources match the conditions provided by:
- * <ul>
- * <li>isEnabledForIgnoredResources()
- * <li>isEnabledForManagedResources()
- * <li>isEnabledForUnManagedResources() (i.e. not ignored and not managed)
- * </ul>
- * </ol>
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
-
- // invoke the inherited method so that overlaps are maintained
- IResource[] resources = super.getSelectedResources();
-
- // disable if no resources are selected
- if(resources.length==0) return false;
-
- // disable properly for single resource enablement
- if (!isEnabledForMultipleResources() && resources.length != 1) return false;
-
- // validate enabled for each resource in the selection
- List folderPaths = new ArrayList();
- List filePaths = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
-
- // only enable for accessible resources
- if(resource.getType() == IResource.PROJECT) {
- if (! resource.isAccessible()) return false;
- }
-
- // no CVS actions are enabled if the selection contains a linked resource
- if (CVSWorkspaceRoot.isLinkedResource(resource)) return false;
-
- // only enable for resources in a project shared with CVS
- if(RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId()) == null) {
- return false;
- }
-
- // collect files and folders separately to check for overlap later
- IPath resourceFullPath = resource.getFullPath();
- if(resource.getType() == IResource.FILE) {
- filePaths.add(resourceFullPath);
- } else {
- folderPaths.add(resourceFullPath);
- }
-
- // ensure that resource management state matches what the action requires
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if (!isEnabledForCVSResource(cvsResource)) {
- return false;
- }
- }
- // Ensure that there is no overlap between files and folders
- // NOTE: folder overlap must be allowed because of logical vs. physical
- if(!folderPaths.isEmpty()) {
- for (Iterator fileIter = filePaths.iterator(); fileIter.hasNext();) {
- IPath resourcePath = (IPath) fileIter.next();
- for (Iterator it = folderPaths.iterator(); it.hasNext();) {
- IPath folderPath = (IPath) it.next();
- if (folderPath.isPrefixOf(resourcePath)) {
- return false;
- }
- }
- }
- }
- return true;
- }
-
- /**
- * Method isEnabledForCVSResource.
- * @param cvsResource
- * @return boolean
- */
- protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
- boolean managed = false;
- boolean ignored = false;
- boolean added = false;
- if (cvsResource.isIgnored()) {
- ignored = true;
- } else if (cvsResource.isFolder()) {
- managed = ((ICVSFolder)cvsResource).isCVSFolder();
- } else {
- ResourceSyncInfo info = cvsResource.getSyncInfo();
- managed = info != null;
- if (managed) added = info.isAdded();
- }
- if (managed && ! isEnabledForManagedResources()) return false;
- if ( ! managed && ! isEnabledForUnmanagedResources()) return false;
- if ( ignored && ! isEnabledForIgnoredResources()) return false;
- if (added && ! isEnabledForAddedResources()) return false;
- if ( ! cvsResource.exists() && ! isEnabledForNonExistantResources()) return false;
- return true;
- }
-
- /**
- * Method isEnabledForIgnoredResources.
- * @return boolean
- */
- protected boolean isEnabledForIgnoredResources() {
- return false;
- }
-
- /**
- * Method isEnabledForUnmanagedResources.
- * @return boolean
- */
- protected boolean isEnabledForUnmanagedResources() {
- return false;
- }
-
- /**
- * Method isEnabledForManagedResources.
- * @return boolean
- */
- protected boolean isEnabledForManagedResources() {
- return true;
- }
-
- /**
- * Method isEnabledForAddedResources.
- * @return boolean
- */
- protected boolean isEnabledForAddedResources() {
- return true;
- }
-
- /**
- * Method isEnabledForAddedResources.
- * @return boolean
- */
- protected boolean isEnabledForMultipleResources() {
- return true;
- }
-
- /**
- * Method isEnabledForNonExistantResources.
- * @return boolean
- */
- protected boolean isEnabledForNonExistantResources() {
- return false;
- }
-
- /**
- * Method getNonOverlapping ensures that a resource is not covered more than once.
- * @param resources
- * @return IResource[]
- */
- public static IResource[] getNonOverlapping(IResource[] resources) {
- // Sort the resources so the shortest paths are first
- List sorted = new ArrayList();
- sorted.addAll(Arrays.asList(resources));
- Collections.sort(sorted, new Comparator() {
- public int compare(Object arg0, Object arg1) {
- IResource resource0 = (IResource) arg0;
- IResource resource1 = (IResource) arg1;
- return resource0.getFullPath().segmentCount() - resource1.getFullPath().segmentCount();
- }
- public boolean equals(Object arg0) {
- return false;
- }
- });
- // Collect all non-overlapping resources
- List coveredPaths = new ArrayList();
- for (Iterator iter = sorted.iterator(); iter.hasNext();) {
- IResource resource = (IResource) iter.next();
- IPath resourceFullPath = resource.getFullPath();
- boolean covered = false;
- for (Iterator it = coveredPaths.iterator(); it.hasNext();) {
- IPath path = (IPath) it.next();
- if(path.isPrefixOf(resourceFullPath)) {
- covered = true;
- }
- }
- if (covered) {
- // if the resource is covered by a parent, remove it
- iter.remove();
- } else {
- // if the resource is a non-covered folder, add it to the covered paths
- if (resource.getType() == IResource.FOLDER) {
- coveredPaths.add(resource.getFullPath());
- }
- }
- }
- return (IResource[]) sorted.toArray(new IResource[sorted.size()]);
- }
-
- /**
- * Override to ensure that the selected resources so not overlap.
- * This method assumes that all actions are deep.
- *
- * @see org.eclipse.team.internal.ui.actions.TeamAction#getSelectedResources()
- */
- protected IResource[] getSelectedResources() {
- return getNonOverlapping(super.getSelectedResources());
- }
-
- protected void executeProviderAction(IProviderAction action, IResource[] resources, IProgressMonitor monitor) throws InvocationTargetException {
- Hashtable table = getProviderMapping(resources);
- Set keySet = table.keySet();
- monitor.beginTask(null, keySet.size() * 1000);
- Iterator iterator = keySet.iterator();
-
- while (iterator.hasNext()) {
- IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1000);
- CVSTeamProvider provider = (CVSTeamProvider)iterator.next();
- List list = (List)table.get(provider);
- IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
- try {
- addStatus(action.execute(provider, providerResources, subMonitor));
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
-
- }
- }
-
- protected void executeProviderAction(IProviderAction action, IProgressMonitor monitor) throws InvocationTargetException {
- executeProviderAction(action, getSelectedResources(), monitor);
- }
-
- /**
- * Given the current selection this method returns a text label that can
- * be shown to the user that reflects the tags in the current selection.
- * These can be used in the <b>Compare With</b> and <b>Replace With</b> actions.
- */
- protected String calculateActionTagValue() {
- try {
- IResource[] resources = getSelectedResources();
- CVSTag commonTag = null;
- boolean sameTagType = true;
- boolean multipleSameNames = true;
-
- for (int i = 0; i < resources.length; i++) {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
- CVSTag tag = null;
- if(cvsResource.isFolder()) {
- FolderSyncInfo info = ((ICVSFolder)cvsResource).getFolderSyncInfo();
- if(info != null) {
- tag = info.getTag();
- }
- if (tag != null && tag.getType() == CVSTag.BRANCH) {
- tag = Util.getAccurateFolderTag(resources[i], tag);
- }
- } else {
- tag = Util.getAccurateFileTag(cvsResource);
- }
- if(tag == null) {
- tag = new CVSTag();
- }
- if(commonTag == null) {
- commonTag = tag;
- } else if(!commonTag.equals(tag)) {
- if(commonTag.getType() != tag.getType()) {
- sameTagType = false;
- }
- if(!commonTag.getName().equals(tag.getName())) {
- multipleSameNames = false;
- }
- }
- }
-
- // set text to default
- String actionText = Policy.bind("ReplaceWithLatestAction.multipleTags"); //$NON-NLS-1$
- if(commonTag != null) {
- int tagType = commonTag.getType();
- String tagName = commonTag.getName();
- // multiple tag names but of the same type
- if(sameTagType && !multipleSameNames) {
- if(tagType == CVSTag.BRANCH) {
- actionText = Policy.bind("ReplaceWithLatestAction.multipleBranches"); //$NON-NLS-1$
- } else {
- actionText = Policy.bind("ReplaceWithLatestAction.multipleVersions"); //$NON-NLS-1$
- }
- // same tag names and types
- } else if(sameTagType && multipleSameNames) {
- if(tagType == CVSTag.BRANCH) {
- actionText = Policy.bind("ReplaceWithLatestAction.singleBranch", tagName); //$NON-NLS-1$
- } else if(tagType == CVSTag.VERSION){
- actionText = Policy.bind("ReplaceWithLatestAction.singleVersion", tagName); //$NON-NLS-1$
- } else if(tagType == CVSTag.HEAD) {
- actionText = Policy.bind("ReplaceWithLatestAction.singleHEAD", tagName); //$NON-NLS-1$
- }
- }
- }
-
- return actionText;
- } catch (CVSException e) {
- // silently ignore
- return Policy.bind("ReplaceWithLatestAction.multipleTags"); //$NON-NLS-1$
- }
- }
-
- protected IResource[] checkOverwriteOfDirtyResources(IResource[] resources, IProgressMonitor monitor) throws CVSException, InterruptedException {
- List dirtyResources = new ArrayList();
- IResource[] selectedResources = getSelectedResources();
-
- try {
- monitor = Policy.monitorFor(monitor);
- monitor.beginTask(null, selectedResources.length * 100);
- monitor.setTaskName(Policy.bind("ReplaceWithAction.calculatingDirtyResources")); //$NON-NLS-1$
- for (int i = 0; i < selectedResources.length; i++) {
- IResource resource = selectedResources[i];
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if(cvsResource.isModified(Policy.subMonitorFor(monitor, 100))) {
- dirtyResources.add(resource);
- }
- }
- } finally {
- monitor.done();
- }
-
- PromptingDialog dialog = new PromptingDialog(getShell(), selectedResources,
- getPromptCondition((IResource[]) dirtyResources.toArray(new IResource[dirtyResources.size()])), Policy.bind("ReplaceWithAction.confirmOverwrite"));//$NON-NLS-1$
- return dialog.promptForMultiple();
- }
-
- /**
- * This is a helper for the CVS UI automated tests. It allows the tests to ignore prompting dialogs.
- * @param resources
- */
- protected IPromptCondition getPromptCondition(IResource[] resources) {
- return getOverwriteLocalChangesPrompt(resources);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsoleFactory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsoleFactory.java
deleted file mode 100644
index 48b16cbf5..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsoleFactory.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.console;
-
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-//commented out because of Bug 75387
-//import org.eclipse.team.internal.ccvs.ui.console.CVSOutputConsole.MyLifecycle;
-import org.eclipse.ui.console.*;
-
-/**
- * Console factory is used to show the console from the Console view "Open Console"
- * drop-down action. This factory is registered via the org.eclipse.ui.console.consoleFactory
- * extension point.
- *
- * @since 3.1
- */
-public class CVSConsoleFactory implements IConsoleFactory {
-
- public CVSConsoleFactory() {
- }
-
- public void openConsole() {
- showConsole();
- }
-
- public static void showConsole() {
- CVSOutputConsole console = CVSUIPlugin.getPlugin().getConsole();
- if (console != null) {
- IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
- IConsole[] existing = manager.getConsoles();
- boolean exists = false;
- for (int i = 0; i < existing.length; i++) {
- if(console == existing[i])
- exists = true;
- }
- if(! exists)
- manager.addConsoles(new IConsole[] {console});
- manager.showConsoleView(console);
- }
- }
-
- public static void closeConsole() {
- IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
- CVSOutputConsole console = CVSUIPlugin.getPlugin().getConsole();
- if (console != null) {
- manager.removeConsoles(new IConsole[] {console});
- ConsolePlugin.getDefault().getConsoleManager().addConsoleListener(console.new MyLifecycle());
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsolePageParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsolePageParticipant.java
deleted file mode 100644
index b6a52eabd..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSConsolePageParticipant.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.console;
-
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.console.*;
-import org.eclipse.ui.console.IConsole;
-import org.eclipse.ui.console.IConsolePageParticipant;
-import org.eclipse.ui.part.IPageBookViewPage;
-
-/**
- * Console helper that allows contributing actions to the console view when
- * the CVS console is visible. Added to the console via an extension point
- * from org.eclipse.ui.console.
- *
- * @since 3.1
- */
-public class CVSConsolePageParticipant implements IConsolePageParticipant {
-
- private CVSOutputConsole console;
- private IPageBookViewPage page;
- private ConsoleRemoveAction consoleRemoveAction;
-
- public void init(IPageBookViewPage page, IConsole console) {
- this.console = (CVSOutputConsole)console;
- this.page = page;
- this.consoleRemoveAction = new ConsoleRemoveAction();
- IActionBars bars = page.getSite().getActionBars();
- bars.getToolBarManager().appendToGroup(IConsoleConstants.LAUNCH_GROUP, consoleRemoveAction);
- }
-
- public void dispose() {
- this.consoleRemoveAction = null;
- this.page = null;
- this.console = null;
- }
-
- public void activated() {
- }
-
- public void deactivated() {
- }
-
- public Object getAdapter(Class adapter) {
- return null;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSOutputConsole.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSOutputConsole.java
deleted file mode 100644
index 1b152a347..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSOutputConsole.java
+++ /dev/null
@@ -1,424 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.console;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.resource.FontRegistry;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSStatus;
-import org.eclipse.team.internal.ccvs.core.client.Session;
-import org.eclipse.team.internal.ccvs.core.client.listeners.IConsoleListener;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.console.*;
-
-/**
- * Console that shows the output of CVS commands. It is shown as a page in the generic
- * console view. It supports coloring for message, command, and error lines in addition
- * the font can be configured.
- *
- * @since 3.0
- */
-public class CVSOutputConsole extends MessageConsole implements IConsoleListener, IPropertyChangeListener {
-
- // created colors for each line type - must be disposed at shutdown
- private Color commandColor;
- private Color messageColor;
- private Color errorColor;
-
- // used to time the commands
- private long commandStarted = 0;
-
- // streams for each command type - each stream has its own color
- private MessageConsoleStream commandStream;
- private MessageConsoleStream messageStream;
- private MessageConsoleStream errorStream;
-
- // preferences for showing the cvs console when cvs output is provided
- private boolean showOnMessage;
-
- private ConsoleDocument document;
- private IConsoleManager consoleManager;
-
- // format for timings printed to console
- private static final DateFormat TIME_FORMAT = new SimpleDateFormat(Policy.bind("Console.resultTimeFormat")); //$NON-NLS-1$
-
- // Indicates whether the console is visible in the Console view
- private boolean visible = false;
- // Indicates whether the console's streams have been initialized
- private boolean initialized = false;
-
- /*
- * Constant used for indenting error status printing
- */
- private static final String NESTING = " "; //$NON-NLS-1$
-
- /**
- * Used to notify this console of lifecycle methods <code>init()</code>
- * and <code>dispose()</code>.
- */
- public class MyLifecycle implements org.eclipse.ui.console.IConsoleListener {
- public void consolesAdded(IConsole[] consoles) {
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
- if (console == CVSOutputConsole.this) {
- init();
- }
- }
-
- }
- public void consolesRemoved(IConsole[] consoles) {
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
- if (console == CVSOutputConsole.this) {
- ConsolePlugin.getDefault().getConsoleManager().removeConsoleListener(this);
- dispose();
- }
- }
- }
- }
-
- /**
- * Constructor initializes preferences and colors but doesn't create the console
- * page yet.
- */
- public CVSOutputConsole() {
- super("CVS", CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_CVS_CONSOLE)); //$NON-NLS-1$
- showOnMessage = CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_CONSOLE_SHOW_ON_MESSAGE);
- document = new ConsoleDocument();
- consoleManager = ConsolePlugin.getDefault().getConsoleManager();
- CVSProviderPlugin.getPlugin().setConsoleListener(CVSOutputConsole.this);
- CVSUIPlugin.getPlugin().getPreferenceStore().addPropertyChangeListener(CVSOutputConsole.this);
- setAutoScroll(true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.AbstractConsole#init()
- */
- protected void init() {
- // Called when console is added to the console view
- super.init();
-
- initLimitOutput();
- initWrapSetting();
-
- // Ensure that initialization occurs in the ui thread
- CVSUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- JFaceResources.getFontRegistry().addListener(CVSOutputConsole.this);
- initializeStreams();
- dump();
- }
- });
- }
-
- private void initWrapSetting() {
- IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- if(store.getBoolean(ICVSUIConstants.PREF_CONSOLE_WRAP)) {
- setConsoleWidth(store.getInt(ICVSUIConstants.PREF_CONSOLE_WIDTH));
- } else {
- setConsoleWidth(-1);
- }
- }
-
- private void initLimitOutput() {
- IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- if(store.getBoolean(ICVSUIConstants.PREF_CONSOLE_LIMIT_OUTPUT)) {
- setWaterMarks(1000, store.getInt(ICVSUIConstants.PREF_CONSOLE_HIGH_WATER_MARK));
- } else {
- setWaterMarks(-1, 0);
- }
- }
-
- /*
- * Initialize thre streams of the console. Must be
- * called from the UI thread.
- */
- private void initializeStreams() {
- synchronized(document) {
- if (!initialized) {
- commandStream = newMessageStream();
- errorStream = newMessageStream();
- messageStream = newMessageStream();
- // install colors
- commandColor = createColor(CVSUIPlugin.getStandardDisplay(), ICVSUIConstants.PREF_CONSOLE_COMMAND_COLOR);
- commandStream.setColor(commandColor);
- messageColor = createColor(CVSUIPlugin.getStandardDisplay(), ICVSUIConstants.PREF_CONSOLE_MESSAGE_COLOR);
- messageStream.setColor(messageColor);
- errorColor = createColor(CVSUIPlugin.getStandardDisplay(), ICVSUIConstants.PREF_CONSOLE_ERROR_COLOR);
- errorStream.setColor(errorColor);
- // install font
- Font f = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry().get(ICVSUIConstants.PREF_CONSOLE_FONT);
- setFont(f);
- initialized = true;
- }
- }
- }
-
- private void dump() {
- synchronized(document) {
- visible = true;
- ConsoleDocument.ConsoleLine[] lines = document.getLines();
- for (int i = 0; i < lines.length; i++) {
- ConsoleDocument.ConsoleLine line = lines[i];
- appendLine(line.type, line.line);
- }
- document.clear();
- }
- }
-
- private void appendLine(int type, String line) {
- showConsole();
- synchronized(document) {
- if(visible) {
- switch(type) {
- case ConsoleDocument.COMMAND:
- commandStream.println(line);
- break;
- case ConsoleDocument.MESSAGE:
- messageStream.println(" " + line); //$NON-NLS-1$
- break;
- case ConsoleDocument.ERROR:
- errorStream.println(" " + line); //$NON-NLS-1$
- break;
- }
- } else {
- document.appendConsoleLine(type, line);
- }
- }
- }
-
- private void showConsole() {
- show(false);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.MessageConsole#dispose()
- */
- protected void dispose() {
- // Here we can't call super.dispose() because we actually want the partitioner to remain
- // connected, but we won't show lines until the console is added to the console manager
- // again.
-
- // Called when console is removed from the console view
- synchronized (document) {
- visible = false;
- JFaceResources.getFontRegistry().removeListener(this);
- }
- }
-
- /**
- * Clean-up created fonts.
- */
- public void shutdown() {
- // Call super dispose because we want the partitioner to be
- // disconnected.
- super.dispose();
- if (commandColor != null)
- commandColor.dispose();
- if (messageColor != null)
- messageColor.dispose();
- if (errorColor != null)
- errorColor.dispose();
- CVSUIPlugin.getPlugin().getPreferenceStore().removePropertyChangeListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.listeners.IConsoleListener#commandInvoked(java.lang.String)
- */
- public void commandInvoked(Session session, String line) {
- if (!session.isOutputToConsole()) return;
- commandStarted = System.currentTimeMillis();
- appendLine(ConsoleDocument.COMMAND, Policy.bind("Console.preExecutionDelimiter")); //$NON-NLS-1$
- appendLine(ConsoleDocument.COMMAND, line);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.listeners.IConsoleListener#messageLineReceived(java.lang.String)
- */
- public void messageLineReceived(Session session, String line, IStatus status) {
- if (session.isOutputToConsole()) {
- appendLine(ConsoleDocument.MESSAGE, " " + line); //$NON-NLS-1$
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.listeners.IConsoleListener#errorLineReceived(java.lang.String)
- */
- public void errorLineReceived(Session session, String line, IStatus status) {
- if (session.isOutputToConsole()) {
- appendLine(ConsoleDocument.ERROR, " " + line); //$NON-NLS-1$
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.listeners.IConsoleListener#commandCompleted(org.eclipse.core.runtime.IStatus, java.lang.Exception)
- */
- public void commandCompleted(Session session, IStatus status, Exception exception) {
- if (!session.isOutputToConsole()) return;
- long commandRuntime = System.currentTimeMillis() - commandStarted;
- String time;
- try {
- time = TIME_FORMAT.format(new Date(commandRuntime));
- } catch (RuntimeException e) {
- CVSUIPlugin.log(IStatus.ERROR, Policy.bind("Console.couldNotFormatTime"), e); //$NON-NLS-1$
- time = ""; //$NON-NLS-1$
- }
- String statusText;
- if (status != null) {
- boolean includeRoot = true;
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- statusText = Policy.bind("Console.resultServerError", status.getMessage(), time); //$NON-NLS-1$
- includeRoot = false;
- } else {
- statusText = Policy.bind("Console.resultOk", time); //$NON-NLS-1$
- }
- appendLine(ConsoleDocument.COMMAND, statusText);
- outputStatus(status, includeRoot, includeRoot ? 0 : 1);
- } else if (exception != null) {
- if (exception instanceof OperationCanceledException) {
- statusText = Policy.bind("Console.resultAborted", time); //$NON-NLS-1$
- } else {
- statusText = Policy.bind("Console.resultException", time); //$NON-NLS-1$
- }
- appendLine(ConsoleDocument.COMMAND, statusText);
- if (exception instanceof CoreException) {
- outputStatus(((CoreException)exception).getStatus(), true, 1);
- }
- } else {
- statusText = Policy.bind("Console.resultOk", time); //$NON-NLS-1$
- }
- appendLine(ConsoleDocument.COMMAND, Policy.bind("Console.postExecutionDelimiter")); //$NON-NLS-1$
- appendLine(ConsoleDocument.COMMAND, ""); //$NON-NLS-1$
- }
-
- private void outputStatus(IStatus status, boolean includeParent, int nestingLevel) {
- if (includeParent && !status.isOK()) {
- outputStatusMessage(status, nestingLevel);
- nestingLevel++;
- }
-
- // Include a CoreException in the status
- Throwable t = status.getException();
- if (t instanceof CoreException) {
- outputStatus(((CoreException)t).getStatus(), true, nestingLevel);
- }
-
- // Include child status
- IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- outputStatus(children[i], true, nestingLevel);
- }
- }
-
- private void outputStatusMessage(IStatus status, int nesting) {
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < nesting; i++) {
- buffer.append(NESTING);
- }
- buffer.append(messageLineForStatus(status));
- appendLine(ConsoleDocument.COMMAND, buffer.toString());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- // colors
- if (visible) {
- if (property.equals(ICVSUIConstants.PREF_CONSOLE_COMMAND_COLOR)) {
- Color newColor = createColor(CVSUIPlugin.getStandardDisplay(), ICVSUIConstants.PREF_CONSOLE_COMMAND_COLOR);
- commandStream.setColor(newColor);
- commandColor.dispose();
- commandColor = newColor;
- } else if (property.equals(ICVSUIConstants.PREF_CONSOLE_MESSAGE_COLOR)) {
- Color newColor = createColor(CVSUIPlugin.getStandardDisplay(), ICVSUIConstants.PREF_CONSOLE_MESSAGE_COLOR);
- messageStream.setColor(newColor);
- messageColor.dispose();
- messageColor = newColor;
- } else if (property.equals(ICVSUIConstants.PREF_CONSOLE_ERROR_COLOR)) {
- Color newColor = createColor(CVSUIPlugin.getStandardDisplay(), ICVSUIConstants.PREF_CONSOLE_ERROR_COLOR);
- errorStream.setColor(newColor);
- errorColor.dispose();
- errorColor = newColor;
- // font
- } else if (property.equals(ICVSUIConstants.PREF_CONSOLE_FONT)) {
- setFont(((FontRegistry) event.getSource()).get(ICVSUIConstants.PREF_CONSOLE_FONT));
- }
- }
- if (property.equals(ICVSUIConstants.PREF_CONSOLE_SHOW_ON_MESSAGE)) {
- Object value = event.getNewValue();
- if (value instanceof String) {
- showOnMessage = Boolean.valueOf((String) value).booleanValue();
- } else {
- showOnMessage = ((Boolean) value).booleanValue();
- }
- } else if(property.equals(ICVSUIConstants.PREF_CONSOLE_LIMIT_OUTPUT)) {
- initLimitOutput();
- } else if(property.equals(ICVSUIConstants.PREF_CONSOLE_WRAP)) {
- initWrapSetting();
- }
- }
-
- /**
- * Returns the NLSd message based on the status returned from the CVS
- * command.
- *
- * @param status an NLSd message based on the status returned from the CVS
- * command.
- */
- private String messageLineForStatus(IStatus status) {
- if (status.getSeverity() == IStatus.ERROR) {
- return Policy.bind("Console.error", status.getMessage()); //$NON-NLS-1$
- } else if (status.getSeverity() == IStatus.WARNING) {
- return Policy.bind("Console.warning", status.getMessage()); //$NON-NLS-1$
- } else if (status.getSeverity() == IStatus.INFO) {
- return Policy.bind("Console.info", status.getMessage()); //$NON-NLS-1$
- }
- return status.getMessage();
- }
-
- /**
- * Returns a color instance based on data from a preference field.
- */
- private Color createColor(Display display, String preference) {
- RGB rgb = PreferenceConverter.getColor(CVSUIPlugin.getPlugin().getPreferenceStore(), preference);
- return new Color(display, rgb);
- }
-
- /**
- * Show the console.
- * @param showNoMatterWhat ignore preferences if <code>true</code>
- */
- public void show(boolean showNoMatterWhat) {
- if(showNoMatterWhat || showOnMessage) {
- if(!visible)
- CVSConsoleFactory.showConsole();
- else
- consoleManager.showConsoleView(this);
- }
-
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/ConsoleDocument.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/ConsoleDocument.java
deleted file mode 100644
index ba8f41ef5..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/ConsoleDocument.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.console;
-
-/**
- * Simple circular buffer that stores a fix number of lines.
- */
-public class ConsoleDocument {
- public static final int COMMAND = 0; // command text
- public static final int MESSAGE = 1; // message received
- public static final int ERROR = 2; // error received
- public static final int STATUS = 3; // status text
- public static final int DELIMITER = 4; // delimiter text between runs
-
- private int[] lineTypes;
- private String[] lines;
-
- private int writeIndex = 0;
- private int readIndex = 0;
-
- private static final int BUFFER_SIZE = 200;
-
- protected static class ConsoleLine {
- public String line;
- public int type;
- ConsoleLine(String line, int type) {
- this.line = line;
- this.type = type;
- }
- }
-
- /**
- * Creates an empty console document.
- */
- public ConsoleDocument() {
- }
-
- /**
- * Clears the console document.
- */
- public void clear() {
- lineTypes = null;
- lines = null;
- writeIndex = 0;
- readIndex = 0;
- }
-
- /**
- * Appends a line of the specified type to the end of the console.
- */
- public void appendConsoleLine(int type, String line) {
- if(lines == null) {
- lines = new String[BUFFER_SIZE];
- lineTypes = new int[BUFFER_SIZE];
- }
- lines[writeIndex] = line; //$NON-NLS-1$
- lineTypes[writeIndex] = type;
-
- if(++writeIndex >= BUFFER_SIZE) {
- writeIndex = 0;
- }
- if(writeIndex == readIndex) {
- if(++readIndex >= BUFFER_SIZE) {
- readIndex = 0;
- }
- }
- }
-
- public ConsoleLine[] getLines() {
- if(isEmpty()) return new ConsoleLine[0];
- ConsoleLine[] docLines = new ConsoleLine[readIndex > writeIndex ? BUFFER_SIZE : writeIndex];
- int index = readIndex;
- for (int i = 0; i < docLines.length; i++) {
- docLines[i] = new ConsoleLine(lines[index], lineTypes[index]);
- if (++index >= BUFFER_SIZE) {
- index = 0;
- }
- }
- return docLines;
- }
-
- public boolean isEmpty() {
- return writeIndex == readIndex;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/ConsolePreferencesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/ConsolePreferencesPage.java
deleted file mode 100644
index c162cf8fd..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/ConsolePreferencesPage.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.console;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.*;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-public class ConsolePreferencesPage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
-
- public ConsolePreferencesPage() {
- super(GRID);
- setPreferenceStore(CVSUIPlugin.getPlugin().getPreferenceStore());
- }
- private ColorFieldEditor commandColorEditor;
- private ColorFieldEditor messageColorEditor;
- private ColorFieldEditor errorColorEditor;
- private BooleanFieldEditor showOnMessage;
- private BooleanFieldEditor restrictOutput;
- private BooleanFieldEditor wrap;
- private IntegerFieldEditor highWaterMark;
- private IntegerFieldEditor width;
-
- protected void createFieldEditors() {
- final Composite composite = getFieldEditorParent();
- createLabel(composite, Policy.bind("ConsolePreferencesPage.9")); //$NON-NLS-1$
- IPreferenceStore store = getPreferenceStore();
-
- // ** WRAP
- wrap = new BooleanFieldEditor(ICVSUIConstants.PREF_CONSOLE_WRAP, Policy.bind("ConsolePreferencesPage.6"), composite); //$NON-NLS-1$
- addField(wrap);
-
- width = new IntegerFieldEditor(ICVSUIConstants.PREF_CONSOLE_WIDTH, Policy.bind("ConsolePreferencesPage.7"), composite); //$NON-NLS-1$)
- width.setValidRange(80, Integer.MAX_VALUE - 1);
- addField(width);
- width.setEnabled(store.getBoolean(ICVSUIConstants.PREF_CONSOLE_WRAP), composite);
-
- // ** RESTRICT OUTPUT
- restrictOutput = new BooleanFieldEditor(ICVSUIConstants.PREF_CONSOLE_LIMIT_OUTPUT, Policy.bind("ConsolePreferencesPage.5"), composite); //$NON-NLS-1$
- addField(restrictOutput);
-
- highWaterMark = new IntegerFieldEditor(ICVSUIConstants.PREF_CONSOLE_HIGH_WATER_MARK, Policy.bind("ConsolePreferencesPage.8"), composite); //$NON-NLS-1$)
- highWaterMark.setValidRange(1000, Integer.MAX_VALUE - 1);
- addField(highWaterMark);
- highWaterMark.setEnabled(store.getBoolean(ICVSUIConstants.PREF_CONSOLE_LIMIT_OUTPUT), composite);
-
- // ** SHOW AUTOMATICALLY
- showOnMessage = new BooleanFieldEditor(ICVSUIConstants.PREF_CONSOLE_SHOW_ON_MESSAGE, Policy.bind("ConsolePreferencesPage.4"), composite); //$NON-NLS-1$
- addField(showOnMessage);
-
- createLabel(composite, Policy.bind("ConsolePreferencePage.consoleColorSettings")); //$NON-NLS-1$
-
- // ** COLORS AND FONTS
- commandColorEditor = createColorFieldEditor(ICVSUIConstants.PREF_CONSOLE_COMMAND_COLOR,
- Policy.bind("ConsolePreferencePage.commandColor"), composite); //$NON-NLS-1$
- addField(commandColorEditor);
-
- messageColorEditor = createColorFieldEditor(ICVSUIConstants.PREF_CONSOLE_MESSAGE_COLOR,
- Policy.bind("ConsolePreferencePage.messageColor"), composite); //$NON-NLS-1$
- addField(messageColorEditor);
-
- errorColorEditor = createColorFieldEditor(ICVSUIConstants.PREF_CONSOLE_ERROR_COLOR,
- Policy.bind("ConsolePreferencePage.errorColor"), composite); //$NON-NLS-1$
- addField(errorColorEditor);
-
- Dialog.applyDialogFont(composite);
- WorkbenchHelp.setHelp(composite, IHelpContextIds.CONSOLE_PREFERENCE_PAGE);
- }
-
-
- public void propertyChange(PropertyChangeEvent event) {
- super.propertyChange(event);
- highWaterMark.setEnabled(restrictOutput.getBooleanValue(), getFieldEditorParent());
- width.setEnabled(wrap.getBooleanValue(), getFieldEditorParent());
- }
-
- /**
- * Utility method that creates a label instance
- * and sets the default layout data.
- *
- * @param parent the parent for the new label
- * @param text the text for the new label
- * @return the new label
- */
- private Label createLabel(Composite parent, String text) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
- return label;
- }
- /**
- * Creates a new color field editor.
- */
- private ColorFieldEditor createColorFieldEditor(String preferenceName, String label, Composite parent) {
- ColorFieldEditor editor = new ColorFieldEditor(preferenceName, label, parent);
- editor.setPreferencePage(this);
- editor.setPreferenceStore(getPreferenceStore());
- return editor;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- public void init(IWorkbench workbench) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferencePage#performOk()
- */
- public boolean performOk() {
- CVSUIPlugin.getPlugin().savePluginPreferences();
- return super.performOk();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/ConsoleRemoveAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/ConsoleRemoveAction.java
deleted file mode 100644
index f9564f461..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/ConsoleRemoveAction.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.console;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ui.Utils;
-
-/**
- * Action that removed the CVS console from the console view. The console
- * can be re-added via the console view "Open Console" drop-down.
- *
- * @since 3.1
- */
-public class ConsoleRemoveAction extends Action {
-
- ConsoleRemoveAction() {
- Utils.initAction(this, "ConsoleRemoveAction.", Policy.getBundle()); //$NON-NLS-1$
- }
-
- public void run() {
- CVSConsoleFactory.closeConsole();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
deleted file mode 100644
index 15eeb5723..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
+++ /dev/null
@@ -1,1327 +0,0 @@
-###############################################################################
-# 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 Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-PasswordManagementPreferencePage.2=When you create a CVS repository location you have the option of saving the password to disk. This page allows you to manage the stored passwords. The following CVS repository locations have saved passwords:
-PasswordManagementPreferencePage.3=Location
-PasswordManagementPreferencePage.4=Username
-PasswordManagementPreferencePage.5=&Remove
-PasswordManagementPreferencePage.6=Remove &All
-UserValidationDialog.5=CVS Repository:
-UserValidationDialog.6=&Save Password
-UserValidationDialog.7=Saved passwords are stored on your computer in a file that's difficult, but not impossible, for an intruder to read.
-details=Press the details button for more information.
-simpleInternal=Internal error
-internal=An internal error has occurred, consult the error log for details.
-yes=Yes
-no=No
-information=Server Information
-exception=Server Exception
-confirmOverwriteTitle=Confirm Overwrite Project
-confirmOverwrite=The project already exists in the workspace. Its contents will be overwritten.
-question=Question
-localChanges=You have local changes which you are about to overwrite. Do you wish to continue?
-error=Error
-cvs=CVS
-notAvailable=Not Available
-buildError=A build error occurred after the CVS operation completed.
-ok=OK
-separator=/
-
-nameAndRevision={0} {1}
-currentRevision=*{0}
-
-AddAction.addFailed=Error occurred during Add
-AddAction.adding=Adding...
-AddAction.addIgnoredTitle=Add Ignored Resource?
-AddAction.addIgnoredQuestion=You have explicitly asked to version control one or more resources that otherwise would have been ignored. Continue?
-
-AddToVersionControlDialog.title=Add to CVS Version Control
-AddToVersionControlDialog.thereIsAnUnaddedResource=There is {0} resource that is not under CVS version control. Do you want to add it?
-AddToVersionControlDialog.thereAreUnaddedResources=There are {0} resources that are not under CVS version control. Do you want to add them?
-
-CheckoutAction.overlappingModuleExpansions=You have attempted to check out multiple remote modules that expand to the same local resource ''{0}''.
-
-AutoDefineTagsAction.defineTags = Auto-discover tags
-
-AvoidableMessageDialog.dontShowAgain=Don't show this again
-
-BranchWizard.title=Create a new CVS Branch
-BranchWizard.errorBranching=Error Branching Resources
-BranchWizardPage.pageDescription=Creates a new branch and a starting point version.
-BranchWizardPage.pageDescriptionVersion=Creates a new branch based on the version in the workspace.
-BranchWizardPage.specifyVersion=The version will provide a starting point for merging the branch back to the source branch.
-BranchWizardPage.branchName=Branch Name:
-BranchWizardPage.versionName=Version Name:
-BranchWizardPage.startWorking=Start working in the branch
-BranchWizardPage.versionPrefix=Root_
-BranchWizard.versionNameWarning=Version name: {0}
-BranchWizard.branchNameWarning=Branch name: {0}
-BranchWizard.branchAndVersionMustBeDifferent=The branch name and version name must be different.
-BranchWizard.branchNameAlreadyExists=Branch name already exists.
-BranchWizard.versionNameAlreadyExists=Version name already exists.
-BranchWizardPage.existingVersionsAndBranches=Existing Versions and Branches
-
-ConsolePreferencePage.consoleColorSettings=Console text color settings:
-ConsolePreferencePage.commandColor=Command &Line:
-ConsolePreferencePage.messageColor=&Message:
-ConsolePreferencePage.errorColor=E&rror:
-ConsolePreferencePage.font=Console font setting:
-
-CVSAction.errorTitle=Errors occurred
-CVSAction.warningTitle=Warnings occurred
-CVSAction.multipleProblemsMessage=Multiple problems occurred:
-CVSAction.mixingTagsTitle=Confirm Mixing Tags
-CVSAction.mixingTags=You are mixing tags within a project. Beware that synchronization uses the tag information associated with each resource to determine the remote resource with which the local resource is compared. \n\nThis means that the part(s) of your project that you are replacing with another tag will be synchronized with the tag ''{0}'' while other resources in the project will be synchronized with another tag. \n\nDo you wish to continue?
-
-CVSAnnotateView.showFileAnnotation=CVS Annotate - {0}
-CVSAnnotateView.viewInstructions=This view shows annotations for a file in CVS. Select a file and then choose \"Team->Show Annotation\" from the context menu.
-
-ShowAnnotationAction.noSyncInfo=Cannot display annotation for {0} because it doesn't have a remote revision.
-ShowAnnotationOperation.taskName=Fetching annotations from repository
-ShowAnnotationOperation.0=Error opening perspective
-ShowAnnotationOperation.1=Confirm Perspective Switch
-ShowAnnotationOperation.2=The CVS Annotate View is associated with the {0} perspective. Do you want to switch to that perspective now?
-ShowAnnotationOperation.4=&Remember my decision
-
-CVSCatchupReleaseViewer.commit=&Commit...
-CVSCatchupReleaseViewer.update=&Update from Repository
-CVSCatchupReleaseViewer.forceCommit=Override and Co&mmit...
-CVSCatchupReleaseViewer.forceUpdate=Override and U&pdate
-CVSCatchupReleaseViewer.ignore=A&dd to .cvsignore
-CVSCatchupReleaseViewer.mergeUpdate=&Merge Changes into Local Copy
-CVSCatchupReleaseViewer.commonFile=Common file: {0}
-CVSCatchupReleaseViewer.commonFileRevision=Common file: {0} {1}
-CVSCatchupReleaseViewer.noCommonFile=No common file
-CVSCatchupReleaseViewer.noRepositoryFile=No repository file
-CVSCatchupReleaseViewer.repositoryFile=Repository file: {0}
-CVSCatchupReleaseViewer.repositoryFileRevision=Repository file: {0} {1} [{2}]
-CVSCatchupReleaseViewer.workspaceFile=Workspace file: {0}
-CVSCatchupReleaseViewer.showInHistory=Show in &Resource History
-CVSCatchupReleaseViewer.fileDecoration={0} ({1})
-CVSCatchupReleaseViewer.folderDecoration={0} {1}
-CVSCatchupReleaseViewer.confirmMerge=Mark as Mer&ged
-CVSCatchupReleaseViewer.addAction=&Add to Version Control
-CVSCatchupReleaseViewer.labelWithSyncKind={0} {1}
-
-CVSCompareEditorInput.branchLabel=<branch-{0}>
-CVSCompareEditorInput.headLabel=<HEAD>
-CVSCompareEditorInput.comparing=Comparing...
-CVSCompareEditorInput.different=Cannot compare resources of different kind.
-CVSCompareEditorInput.inBranch={0} in {1}
-CVSCompareEditorInput.inHead={0} in HEAD
-CVSCompareEditorInput.0=File is new
-CVSCompareEditorInput.1=File has been deleted
-CVSCompareEditorInput.repository=Repository: {0} {1}
-CVSCompareEditorInput.titleAncestor=Compare {0} {1}-{2} and {3}
-CVSCompareEditorInput.titleNoAncestor=Compare {0} {1} and {2}
-CVSCompareEditorInput.titleNoAncestorDifferent=Compare {0} {1} and {2} {3}
-CVSCompareEditorInput.workspace=Workspace: {0}
-CVSCompareEditorInput.workspaceLabel=<workspace>
-CVSCompareEditorInput.noWorkspaceFile=No workspace file
-CVSCompareEditorInput.noRepositoryFile=No repository file
-
-CVSCompareRevisionsInput.addToWorkspace=Get
-CVSCompareRevisionsInput.compareResourceAndVersions=Revisions of ''{0}''
-CVSCompareRevisionsInput.errorReplacingTitle=Unable to Replace
-CVSCompareRevisionsInput.errorReplacingMessage=Resource(s) could not be loaded. A communication error may have occurred, or \
- the resource(s) may not exist on the server, or you may \
- not have permission to access them.
-CVSCompareRevisionsInput.repository=Repository file: {0}
-CVSCompareRevisionsInput.structureCompare=Structure Compare
-CVSCompareRevisionsInput.workspace=Workspace file: {0}
-CVSCompareRevisionsInput.truncate={0}[...]
-
-CVSDecorator.projectDecoration={0} [{1}]
-CVSDecorator.projectDecorationWithTag={0} [{1} {2}]
-CVSDecorator.fileDecorationWithTag={0} [{1}:{2}]
-CVSDecorator.fileDecorationNoTag={0} [{1}]
-CVSDecorator.folderDecoration={0} [{1}]
-
-CVSDecoratorPreferencesPage.description=CVS Decorator settings:
-CVSDecoratorPreferencesPage.iconDescription=Choose which CVS resource states should be indicated using an icon decorator:
-CVSDecoratorPreferencesPage.generalDescription=Set general properties of CVS decorators:
-CVSDecoratorPreferencesPage.generalTabFolder=&General
-CVSDecoratorPreferencesPage.newResources=Indicate is &new resource
-CVSDecoratorPreferencesPage.synchronizeTabFolder=S&ynchronize View
-CVSDecoratorPreferencesPage.synchronizeDescription=Set the properties of CVS decorators for the Synchronize view:
-CVSDecoratorPreferencesPage.showSyncInfoInLabel=Show all synchronization information in a resource's text label
-
-CVSFilePropertiesPage.ignored=The file is ignored by CVS.
-CVSFilePropertiesPage.notManaged=The file is not managed by CVS.
-CVSFilePropertiesPage.isAdded=This file has been added to CVS control but has not been committed
-CVSFilePropertiesPage.baseRevision=Base revision:
-CVSFilePropertiesPage.baseTimestamp=Base timestamp:
-CVSFilePropertiesPage.dirty=Dirty:
-CVSFilePropertiesPage.modified=Modified:
-CVSFilePropertiesPage.keywordMode=Keyword mode:
-CVSFilePropertiesPage.tag=Tag:
-CVSFilePropertiesPage.none=HEAD
-CVSFilePropertiesPage.version={0} (Version)
-CVSFilePropertiesPage.branch={0} (Branch)
-CVSFilePropertiesPage.date={0} (Date)
-CVSFilePropertiesPage.error=An error occurred while creating this page.
-CVSFilePropertiesPage.permissions=Permissions:
-CVSFilePropertiesPage.notAvailable=Not Available
-
-CVSFolderPropertiesPage.ignored=The folder is ignored by CVS.
-CVSFolderPropertiesPage.notManaged=The folder is not managed by CVS.
-CVSFolderPropertiesPage.notCVSFolder=This folder has lost its CVS sharing information.
-CVSFolderPropertiesPage.root=Repository root:
-CVSFolderPropertiesPage.repository=Repository path:
-CVSFolderPropertiesPage.static=Static:
-CVSFolderPropertiesPage.disconnect=&Disconnect...
-CVSFolderPropertiesPage.disconnectTitle=Disconnect folder?
-CVSFolderPropertiesPage.disconnectQuestion=Disconnecting the folder from CVS control will delete the CVS synchronization information for the folder. Are you sure you want to disconnect?
-
-CVSLocalCompareEditorInput.title=CVS Compare [{0}]
-
-CVSOperationCancelledException.operationCancelled=Operation Cancelled
-
-CVSPropertiesPage.connectionType=&Connection type:
-CVSPropertiesPage.user=&User:
-CVSPropertiesPage.password=&Password:
-CVSPropertiesPage.host=&Host:
-CVSPropertiesPage.port=Port:
-CVSPropertiesPage.path=Repository p&ath:
-CVSPropertiesPage.module=Module:
-CVSPropertiesPage.defaultPort=Default
-CVSPropertiesPage.tag=Tag:
-CVSPropertiesPage.update=Change &Tag...
-CVSPropertiesPage.virtualModule=<no corresponding remote folder>
-
-CVSPreferencePage.description=General CVS settings:
-CVSPreferencePage.debugProtocol=&Display detailed protocol output to stdout (for debugging purposes)
-CVSPreferencePage.pruneEmptyDirectories=&Prune empty directories
-CVSPreferencePage.timeoutValue=&Communication timeout (in seconds):
-CVSPreferencePage.quietness=&Quietness level:
-CVSPreferencePage.notquiet=Verbose
-CVSPreferencePage.somewhatquiet=Somewhat quiet
-CVSPreferencePage.reallyquiet=Very quiet
-CVSPreferencePage.silentWarningTitle="Very Quiet" mode is dangerous
-CVSPreferencePage.silentWarningMessage= In "Very Quiet" mode, some cvs servers may not communicate important information about errors that have occurred. You may want to consider using "Somewhat quiet" mode instead.
-CVSPreferencePage.considerContentsInCompare=Con&sider file contents in comparisons
-CVSPreferencePage.showAddRemoveMarkers=Show deleted file &markers
-CVSPreferencePage.replaceUnmanaged=&Delete unmanaged resources on replace
-CVSPreferencePage.defaultTextKSubst=Default &keyword substitution:
-CVSPreferencePage.compressionLevel=Compression &level:
-CVSPreferencePage.level0=0 (disabled)
-CVSPreferencePage.level1=1 (lowest compression)
-CVSPreferencePage.level2=2
-CVSPreferencePage.level3=3
-CVSPreferencePage.level4=4
-CVSPreferencePage.level5=5
-CVSPreferencePage.level6=6
-CVSPreferencePage.level7=7
-CVSPreferencePage.level8=8
-CVSPreferencePage.level9=9 (highest compression)
-CVSPreferencePage.lineend=Con&vert text files to use platform line ending
-CVSPreferencePage.Save_dirty_editors_before_CVS_operations_1=Save dirty editors before CVS operations
-CVSPreferencePage.&Never_2=&Never
-CVSPreferencePage.&Prompt_3=P&rompt
-CVSPreferencePage.Auto-&save_4=&Auto-save
-CVSPreferencePage.repositoriesAreBinary=&Treat all new files as binary
-CVSPreferencePage.determineVersionEnabled=&Validate server version compatibility on first connection
-CVSPreferencePage.confirmMoveTag=Confirm &move tag on tag operation
-CVSPreferencePage.showCompareMergeInSync=Show revision &comparisons in a dialog
-
-CVSRemoteFilePropertySource.name=Name
-CVSRemoteFilePropertySource.revision=Revision
-CVSRemoteFilePropertySource.date=Date
-CVSRemoteFilePropertySource.author=Author
-CVSRemoteFilePropertySource.comment=Comment
-CVSRemoteFilePropertySource.tag=Tag
-
-CVSRemoteFolderPropertySource.name=Name
-CVSRemoteFolderPropertySource.tag=Tag
-CVSRemoteFolderPropertySource.none=(none)
-
-CVSRepositoryLocationPropertySource.default=Default
-CVSRepositoryLocationPropertySource.host=Host
-CVSRepositoryLocationPropertySource.user=User
-CVSRepositoryLocationPropertySource.port=Port
-CVSRepositoryLocationPropertySource.root=Root
-CVSRepositoryLocationPropertySource.method=Connection Method
-
-CVSSyncCompareInput.confirmMergeMessageTitle=Information
-CVSSyncCompareInput.confirmMergeMessage=Your changes have been saved. When you are finished, \
- select 'Mark as Merged' to make this file an outgoing change.
-CVSSyncCompareInput.projectDeleted=Project ''{0}'' has been deleted locally and cannot be synchronized.
-CVSSyncCompareInput.filteringOutgoingChanges=Accumulating resources with outgoing changes
-
-CVSSyncSet.conflicts={0} conflicts,
-CVSSyncSet.incomings={0} incoming change(s),
-CVSSyncSet.noConflicts=No conflicts,
-CVSSyncSet.noIncomings=no incoming changes,
-CVSSyncSet.noOutgoings=no outgoing changes,
-CVSSyncSet.outgoings={0} outgoing change(s),
-CVSSyncSet.noNew=no new resources.
-CVSParticipant.0=Remote File ({0} - {1})
-CVSParticipant.1=Common Ancestor ({0} - {1})
-CVSParticipant.2=C&VS
-CVSSyncSet.new={0} new resource(s).
-
-CVSUIPlugin.refreshTitle=Refresh Resource?
-CVSUIPlugin.refreshQuestion={0} Would you like to refresh resource ''{1}''?
-CVSUIPlugin.refreshMultipleQuestion={0} Would you like to refresh the selected resources?
-
-CVSAction.disabledTitle=Information
-CVSAction.disabledMessage=The chosen operation is not enabled.
-CVSAction.refreshTitle=Refresh Project?
-CVSAction.refreshQuestion={0} Would you like to refresh project ''{1}''?
-CVSAction.refreshMultipleQuestion={0} Would you like to refresh the projects of the selected resources?
-
-CommitAction.commitFailed=Problems encountered performing commit
-
-CommitSyncAction.questionRelease=You have changes that conflict with the server. Release those changes?
-CommitSyncAction.titleRelease=Confirm Overwrite
-CommitSyncAction.releaseAll=Release all changes, overriding any conflicting changes on the server.
-CommitSyncAction.releasePart=Only release the changes that don't conflict with changes on the server.
-CommitSyncAction.cancelRelease=Cancel the release operation.
-CommitSyncAction.errorCommitting=An error occurred while committing changes.
-
-CompareWithRemoteAction.compare=Error Comparing with Latest
-CompareWithRemoteAction.noRemote=No Remote Resource
-CompareWithRemoteAction.noRemoteLong=The selected resource has no remote resource to compare with.
-CompareWithRemoteAction.fetching=Comparing with latest from repository...
-
-CompareWithRevisionAction.compare=Error Comparing with Revision
-CompareWithRevisionAction.noRevisions=No Revisions
-CompareWithRevisionAction.noRevisionsLong=The selected resource has no revisions to compare with.
-CompareWithRevisionAction.fetching=Fetching revisions from repository...
-
-CompareWithTagAction.message=Compare With Branch or Version
-CompareWithTagAction.replace=Error Comparing With Branch or Version
-CompareWithTagAction.noRemote=No Remote Resource
-CompareWithTagAction.noRemoteLong=The selected tag has no remote resource to compare with.
-CompareWithTagAction.fetching=Fetching resources with tag {0}...
-
-CompareEditorInput.fileProgress=Comparing CVS file: {0}
-
-ConfigurationWizardAutoconnectPage.description=Your project already has CVS/ directories. It was probably previously shared, or checked out using another tool. It will be automatically shared using the following information.
-ConfigurationWizardAutoconnectPage.user=User:
-ConfigurationWizardAutoconnectPage.host=Host:
-ConfigurationWizardAutoconnectPage.port=Port:
-ConfigurationWizardAutoconnectPage.default=Default
-ConfigurationWizardAutoconnectPage.connectionType=Connection type:
-ConfigurationWizardAutoconnectPage.repositoryPath=Repository path:
-ConfigurationWizardAutoconnectPage.module=Module:
-ConfigurationWizardAutoconnectPage.validate=&Validate Connection on Finish
-ConfigurationWizardAutoconnectPage.noSyncInfo=Could not get folder information
-ConfigurationWizardAutoconnectPage.noCVSDirectory=Could not find CVS/ directory
-
-RepositorySelectionPage.description=This wizard will help you to share your files with the CVS repository for the first time. Your project will automatically be imported into the CVS repository, and the Synchronize view will open to allow you to commit your resources.
-RepositorySelectionPage.useExisting=&Use existing repository location:
-RepositorySelectionPage.useNew=&Create a new repository location
-
-ConfigurationWizardMainPage.connection=&Connection type:
-ConfigurationWizardMainPage.userName=&User:
-ConfigurationWizardMainPage.password=&Password:
-ConfigurationWizardMainPage.host=&Host:
-ConfigurationWizardMainPage.0=Location already exists.
-ConfigurationWizardMainPage.5=The host name must not start or end with a space
-ConfigurationWizardMainPage.1=User Name Required
-ConfigurationWizardMainPage.2=Host Required
-ConfigurationWizardMainPage.3=Port Required
-ConfigurationWizardMainPage.4=Repository Path Required
-ConfigurationWizardMainPage.useDefaultPort=Use Default P&ort
-ConfigurationWizardMainPage.usePort=Use Por&t:
-ConfigurationWizardMainPage.repositoryPath=&Repository path:
-ConfigurationWizardMainPage.invalidUserName=Invalid User Name
-ConfigurationWizardMainPage.invalidHostName=Invalid Host Name
-ConfigurationWizardMainPage.invalidPort=Invalid Port
-ConfigurationWizardMainPage.invalidPathWithSpaces=The repository path cannot have segments with leading or trailing spaces
-ConfigurationWizardMainPage.invalidPathWithSlashes=The repository path cannot contain a double slash (//)
-ConfigurationWizardMainPage.useNTFormat=Use NT path names for specifying CVSNT repository paths (e.g. C:\\cvs\\root)
-
-Console.copy=Copy
-Console.selectAll=Select All
-Console.clearOutput=Clear Output
-Console.resultServerError={0} {1}
-Console.resultWarnings={0} {1}
-Console.resultException=failed due to an internal error {0}
-Console.resultAborted=operation canceled {0}
-Console.resultOk=ok {0}
-Console.resultTimeFormat='(took 'm:ss.SSS')'
-Console.couldNotFormatTime=An error occurred formatting the output time for the CVS console.
-Console.preExecutionDelimiter=***
-Console.postExecutionDelimiter=***
-Console.info=Info: {0}
-Console.warning=Warning: {0}
-Console.error=Error: {0}
-
-AddToBranchAction.enterTag=Enter Branch Tag
-AddToBranchAction.enterTagLong=Enter the name of the branch:
-
-DiffAction.diff=Diff
-
-FixTypeAction.fix=Fix Types
-
-GenerateCVSDiff.title=Create Patch
-GenerateCVSDiff.pageTitle=Run and save CVS diff results in a file
-GenerateCVSDiff.pageDescription=The results of the CVS diff command can be used as an input file for the Apply Patch wizard.
-GenerateCVSDiff.overwriteTitle=Confirm Overwrite
-GenerateCVSDiff.overwriteMsg=A file with that name already exists. Overwrite?
-GenerateCVSDiff.error=Error running the CVS diff command
-GenerateCVSDiff.working=Running CVS diff...
-GenerateCVSDiff.noDiffsFoundMsg=No differences found.
-GenerateCVSDiff.noDiffsFoundTitle=CVS diff
-GenerateCVSDiff.1=Read-only file
-GenerateCVSDiff.2=The specified file is read-only and cannot be overwritten.
-GenerateCVSDiff.3=Can't write directory
-GenerateCVSDiff.4=You don't have permission to create a file in this directory.
-
-GetSyncAction.questionCatchup=You have local changes which you are about to overwrite. Should the conflicting changes be added?
-GetSyncAction.titleCatchup=Catch up Over Conflicts?
-GetSyncAction.catchupAll=Catch up to all incoming changes, overriding any conflicting local changes.
-GetSyncAction.catchupPart=Only catch up to the changes that don't conflict with local changes.
-GetSyncAction.cancelCatchup=Cancel the catch up operation.
-UpdateSyncAction.errorUpdating=An error occurred while updating changes.
-
-HistoryFilterDialog.title = Filter Resource History
-HistoryFilterDialog.showMatching = Show entries matching:
-HistoryFilterDialog.matchingAny = a&ny of the provided criteria
-HistoryFilterDialog.matchingAll = a&ll of the provided criteria
-HistoryFilterDialog.author = &Author:
-HistoryFilterDialog.comment = &Comment containing:
-HistoryFilterDialog.fromDate = &From date (M/D/Y) :
-HistoryFilterDialog.toDate = &To date (M/D/Y) :
-
-HistoryView.getAnnotateAction=Show &Annotation
-HistoryView.getContentsAction=&Get Contents
-HistoryView.getRevisionAction=Get Sticky &Revision
-HistoryView.tagWithExistingAction=&Tag with Existing...
-HistoryView.copy=&Copy
-HistoryView.revision=Revision
-HistoryView.tags=Tags
-HistoryView.date=Date
-HistoryView.author=Author
-HistoryView.comment=Comment
-HistoryView.refreshLabel=&Refresh View
-HistoryView.refresh=Refresh View
-HistoryView.linkWithLabel=Link with Editor
-HistoryView.selectAll=Select &All
-HistoryView.showComment=Show Comment Viewer
-HistoryView.showTags=Show Tag Viewer
-HistoryView.title=CVS Resource History
-HistoryView.titleWithArgument=CVS Resource History ({0})
-HistoryView.overwriteTitle=Overwrite local changes?
-HistoryView.overwriteMsg=You have local changes. Do you want to overwrite them?
-HistoryView.fetchHistoryJob=Fetching CVS revision history
-HistoryView.fetchHistoryJobFile=Fetching CVS revision history for: {0}
-HistoryView.errorFetchingEntries=Error fetching entries for {0}
-
-IgnoreAction.ignore=Error Ignoring Resource
-
-MergeAction.saveChangesTitle=Save Changes
-MergeAction.saveChanges=You have unsaved changes that will be saved before the action is performed.
-
-MergeEditorInput.title=Merge {0} with {1}
-
-MergeWizard.title=Merge
-MergeWizard.0=Select the merge points
-MergeWizard.1=Specify the branch or version to be merged and the common base version.
-MergeWizardPage.0=Preview the merge in the &synchronize view
-MergeWizardPage.1=Perform the merge into the local &workspace
-MergeWizardPage.2=&Branch or version to be merged (end tag):
-MergeWizardPage.3=Br&owse...
-MergeWizardPage.4=Choose End Tag
-MergeWizardPage.5=&Select end tag
-MergeWizardPage.6=Common base &version (start tag):
-MergeWizardPage.7=Bro&wse...
-MergeWizardPage.8=Choose Start Tag
-MergeWizardPage.9=&Select start tag
-MergeWizardPage.10=The specified end tag is not known to exist. Either enter a different tag or refresh the known tags.
-MergeWizardPage.11=The specified start tag is not known to exist. Either enter a different tag or refresh the known tags.
-MergeWizardPage.12=The start and end tags cannot be the same.
-MergeWizardPage.13=A start tag is required for previewing a merge in the synchronize view.
-MergeWizard.preparing=Preparing merge wizard
-MergeWizard.preparingStart=Fetching tags for start page
-MergeWizard.preparingEnd=Fetching tags for end page
-MergeWizardEndPage.branches=Branches
-
-ModuleSelectionPage.moduleIsProject=Use &project name as module name
-ModuleSelectionPage.specifyModule=Use &specified module name:
-
-MoveTagAction.errorMessage=Error Tagging
-MoveTagAction.title=Tag with Existing Tag
-MoveTagAction.message=&Select the tag to be moved
-
-NewLocationWizard.title=Add CVS Repository
-NewLocationWizard.heading=Add a new CVS Repository
-NewLocationWizard.description=Add a new CVS Repository to the CVS Repositories view
-NewLocationWizard.validationFailedText=Error validating location: "{0}"\n\nKeep location anyway?
-NewLocationWizard.validationFailedTitle=Unable to Validate
-NewLocationWizard.exception=Unable to create repository location
-
-OpenLogEntryAction.deletedTitle=Resource is Deleted
-OpenLogEntryAction.deleted=The selected revision represents a deletion. It cannot be opened.
-
-ReleaseCommentDialog.title=Commit
-ReleaseCommentDialog.choosePrevious=Choose a &previously entered comment:
-ReleaseCommentDialog.enterComment=Edit the commit &comment:
-ReleaseCommentDialog.unaddedResources=Checked resources will be &added to CVS version control.
-ReleaseCommentDialog.selectAll=&Select All
-ReleaseCommentDialog.deselectAll=D&eselect All
-ReleaseCommentDialog.clearTextArea=&Reset Comment
-
-RemoteFolderElement.nameAndTag={0} {1}
-RemoteFolderElement.fetchingRemoteChildren=Fetching remote CVS children for ''{0}''...
-
-RemoveRootAction.removeRoot=Error Discarding Location
-
-ReplaceWithTagAction.message=Replace with Branch or Version
-ReplaceWithTagAction.replace=Error Replacing With Tag
-ReplaceWithTagAction.replacing=Replacing with tag {0}
-ReplaceWithTagAction.mixingTags=You are mixing tags within a project. This may cause confusion \
- when synchronizing with the repository. Synchronize uses the tag information associated with \
- each resource to determine the remote resource with which the local resource is compared. \
- For example, with version tags, the state of the tagged resources never change so you will \
- not see changes made to the resources in HEAD (or other branches). Do you wish to continue?
-
-ReplaceWithRemoteAction.replacing=Replacing
-ReplaceWithRemoteAction.problemMessage=Error Replacing With Latest From Repository
-
-ReplaceWithAction.confirmOverwrite=Confirm Overwrite
-ReplaceWithAction.localChanges={0} has local changes which you are about to overwrite. Do you wish to overwrite?
-ReplaceWithAction.calculatingDirtyResources=Finding outgoing changes...
-
-ReplaceWithLatestAction.multipleTags=&Latest from Repository
-ReplaceWithLatestAction.multipleVersions=&Versions from Repository
-ReplaceWithLatestAction.multipleBranches=&Latest from Branches
-ReplaceWithLatestAction.singleVersion=&Version {0}
-ReplaceWithLatestAction.singleBranch=&Latest from Branch {0}
-ReplaceWithLatestAction.singleHEAD=&Latest from {0}
-
-RepositoryDialog.getRepository=Select a repository
-RepositoryDialog.description=Select a repository to connect your project to
-
-RepositoryManager.getting=Getting
-RepositoryManager.committing=Committing
-RepositoryManager.updating=Updating
-RepositoryManager.deleting=Deleting
-RepositoryManager.adding=Adding
-RepositoryManager.rename=An IO Exception occurred while renaming the state file
-RepositoryManager.save=An IO Exception occurred while saving the state file
-RepositoryManager.ioException=An IO Exception occurred while reading the state file
-RepositoryManager.parsingProblem=An error occurred parsing file ''{0}''.
-RepositoryManager.fetchingRemoteFolders=Fetching remote CVS folders for ''{0}''...
-
-RepositoriesView.refresh=&Refresh View
-RepositoriesView.refreshTooltip=Refresh View
-RepositoriesView.new=&Repository Location...
-RepositoriesView.newSubmenu=&New
-RepositoriesView.newAnonCVS=&Anonymous Repository Location to dev.eclipse.org...
-RepositoriesView.newWorkingSet=Select Working Set...
-RepositoriesView.deselectWorkingSet=Deselect Working Set
-RepositoriesView.editWorkingSet=Edit Active Working Set...
-RepositoriesView.workingSetMenuItem={0} {1}
-RepositoriesView.collapseAll=Collapse All
-RepositoriesView.collapseAllTooltip=Collapse All
-RepositoriesView.NItemsSelected={0} items selected
-RepositoriesView.OneItemSelected=1 item selected
-RepositoriesView.ResourceInRepository={0} in {1}
-RepositoriesView.CannotGetRevision=Cannot get revision
-RemoteViewPart.workingSetToolTip=Working Set: {0}
-
-ResourcePropertiesPage.status=Status
-ResourcePropertiesPage.notManaged=Not managed by CVS
-ResourcePropertiesPage.versioned=versioned
-ResourcePropertiesPage.notVersioned=not versioned
-ResourcePropertiesPage.state=State
-ResourcePropertiesPage.checkedOut=Checked Out
-ResourcePropertiesPage.checkedIn=Checked In
-#ResourcePropertiesPage.baseRevision=Base Revision
-#ResourcePropertiesPage.none=none
-ResourcePropertiesPage.error=Error
-
-KSubstWizard.title=Set Keyword Substitution
-KSubstWizard.working=Setting keyword substitution mode...
-KSubstWizard.problemsMessage=Problems encountered setting keyword substitution
-KSubstWizard.errorTitle=Errors Occurred
-KSubstWizard.warningTitle=Warnings occurred
-
-KSubstWizardSharedFilesPage.pageTitle=Include versioned files
-KSubstWizardSharedFilesPage.pageDescription=\
- Choose to include or exclude files that are already in the repository
-KSubstWizardSharedFilesPage.contents=\
- Since the keyword substitution mode attribute is not version controlled, the \
- change will be reflected immediately on all branches and in all revisions of \
- any affected files that are already shared in the repository. You should inform \
- all developers that they must delete and check out fresh copies of project containing the affected \
- files before committing new changes to the repository. You may also experience \
- side-effects working with earlier revisions of these files.
-KSubstWizardSharedFilesPage.includeSharedFiles=&Include files that are already shared in the repository.
-KSubstWizardSharedFilesPage.sharedFilesViewer.title=&The following files were selected and are already shared in the repository:
-
-KSubstWizardDirtyFilesPage.pageTitle=Include files with outgoing changes
-KSubstWizardDirtyFilesPage.pageDescription=\
- Choose to include or exclude files with outgoing changes
-KSubstWizardDirtyFilesPage.contents=\
- This operation may commit changes to files without first providing a chance to resolve \
- conflicts.
-KSubstWizardDirtyFilesPage.includeDirtyFiles=&Include files that have outgoing changes.
-KSubstWizardDirtyFilesPage.dirtyFilesViewer.title=&The following files were selected and have outgoing changes.
-
-KSubstWizardSelectionPage.pageTitle=Select Keyword Substitution Mode
-KSubstWizardSelectionPage.pageDescription=\
- Choose the desired keyword substitution mode for the selected files.
-KSubstWizardSelectionPage.automaticButton=&Automatic
-KSubstWizardSelectionPage.automaticLabel=\
- Automatically chooses ''{0}'' or ''{1}'' \
- for each file according to the Team file extension preferences.
-KSubstWizardSelectionPage.binaryButton=&Binary (-kb)
-KSubstWizardSelectionPage.binaryLabel=\
- Binary files are stored in the repository without alteration.\n\
- CVS does not directly support conflict resolution for binary files.
-KSubstWizardSelectionPage.textButton=A&SCII without keyword substitution (-ko)
-KSubstWizardSelectionPage.textLabel=\
- End of lines are replaced with the appropriate convention for the client system.\n\
- CVS supports conflict resolution and differencing of ASCII files with single line granularity.
-KSubstWizardSelectionPage.textWithSubstitutionsButton=ASCII with &keyword substitution
-KSubstWizardSelectionPage.textWithSubstitutionsLabel=\
- End of lines are replaced with the appropriate convention for the client system.\n\
- ASCII files may contain keywords that are expanded by the CVS server during file transfers.\n\
- Please consult the CVS documentation for a description of the various supported keywords and modes.
-
-KSubstWizardCommitCommentPage.pageTitle=Enter Commit Comment
-KSubstWizardCommitCommentPage.pageDescription=\
- Enter the commit comment to be used for the selected files when they are committed.
-
-KSubstWizardSummaryPage.pageTitle=Summary
-KSubstWizardSummaryPage.pageDescription=\
- Summary of keyword substitution changes to be performed.
-KSubstWizardSummaryPage.contents=\
- Click on \'Finish\' to change the keyword substitution mode of the checked files indicated below.\n\
- You can change the mode on a per file basis by clicking in the corresponding cell.\n\
- Note: Files that are not checked, or that already have the indicated mode will not be affected in any way.
-KSubstWizardSummaryPage.showUnaffectedFiles=&Show files that already have the requested keyword substitution mode.
-KSubstWizardSummaryPage.summaryViewer.title=&The following checked files will have their keyword substitution mode changed to the indicated value.
-KSubstWizardSummaryPage.summaryViewer.fileHeader=File Location
-KSubstWizardSummaryPage.summaryViewer.ksubstHeader=Keyword Substitution Mode
-
-SharingWizard.autoConnectTitle=Connect Project to Repository
-SharingWizard.autoConnectOneOTitle=Connect Project from Eclipse 1.0 to Repository
-SharingWizard.autoConnectTitleDescription=Project is already configured with CVS repository information.
-SharingWizard.couldNotImport=Remote Project Exists
-SharingWizard.couldNotImportLong=Module ''{0}'' already exists remotely. Would you like to synchronize your local project with the existing remote module?
-SharingWizard.selectTagTitle=Select Tag
-SharingWizard.selectTag=&Select the tag to synchronize with:
-SharingWizard.description=Configure a Project to Use CVS
-SharingWizard.importTitle=Share Project with CVS Repository
-SharingWizard.importTitleDescription=Select an existing repository location or create a new location.
-SharingWizard.title=Share Project
-SharingWizard.heading=Configure a Project to Use CVS
-SharingWizard.enterInformation=Enter Repository Location Information
-SharingWizard.enterInformationDescription=Define the location and protocol required to connect with an existing CVS repository.
-SharingWizard.enterModuleName=Enter Module Name
-SharingWizard.enterModuleNameDescription=Select the name of the module in the CVS repository.
-SharingWizard.validationFailedText={0}. Set project sharing anyway?
-SharingWizard.validationFailedTitle=Unable to Validate
-
-SharingWizardFinishPage.message=The wizard has all the information necessary to share your project with the CVS repository. When you click \"Finish\", the wizard will import your project into the repository and open the Synchronize view to allow you to commit your resources.
-
-ShowHistoryAction.showHistory=Error occurred performing Show History
-ShowHistoryAction.noHistory=No History Available
-ShowHistoryAction.noHistoryLong=No resource history available for selected resources.
-
-SyncAction.sync=Synchronize
-SyncAction.workingSetName=Latest CVS Synchronize
-SyncAction.noChangesTitle=No Changes
-SyncAction.noChangesMessage=There are no changes between the workspace resource and the remote.
-
-TagAction.tagErrorTitle=Tagging Error
-TagAction.tagWarningTitle=Tagging Warning
-TagAction.tagProblemsMessage=Problems reported tagging the resource.
-TagAction.tagProblemsMessageMultiple=Problems tagging the resources. {0} project(s) successfully tagged and {1} project(s) with errors.
-TagAction.tagResources=Tag Resources
-TagRefreshButtonArea.0=No Tags Found
-TagRefreshButtonArea.1=Perform Deep Search
-TagRefreshButtonArea.2=Configure Manually
-TagRefreshButtonArea.3=Cancel
-TagRefreshButtonArea.4=Tags were not found for {0} using the auto-refresh files and a shallow cvs log operation. You can choose to search using a deep cvs log operation, to manually configure the tags or to cancel.
-TagRefreshButtonArea.5=Refreshing tags
-TagAction.enterTag=&Please enter a version tag:
-TagAction.moveTag=&Move tag if it already exists
-TagRootElement.0=Dates
-TagAction.moveTagConfirmTitle=Confirm Move Existing Tag
-TagAction.moveTagConfirmMessage=If the tag {0} is already used in this project, it will be moved to the selected revisions. Are you sure you want to perform the tag operation?
-TagAction.uncommittedChangesTitle=Confirm Uncommitted Changes
-TagAction.uncommittedChanges=You are tagging ''{0}'' that has uncommitted changes. These changes are not in the repository and will not be included in the version you are creating. Do you still want to tag this resource?
-TagAction.tagAlreadyExists=Version tag already exists.
-TagAction.existingVersions=Existing Versions
-
-TagInRepositoryAction.tagProblemsMessage=Problems reported tagging the resource.
-TagInRepositoryAction.tagProblemsMessageMultiple=Problems tagging the resources. {0} resource(s) successfully tagged and {1} resource(s) with errors.
-
-UpdateAction.update=Problems encountered performing update
-UpdateAction.updating=Updating...
-UpdateAction.promptForUpdateSeveral=Are you sure you want to update {0} resources?
-UpdateAction.promptForUpdateOne=Are you sure you want to update {0} resource?
-UpdateAction.promptForUpdateTitle=Confirm Update
-
-UpdateWizard.title=Update
-UpdateWizard.0=Select Tag
-UpdateWizard.1=Select the tag for the update
-UpdateWizard.updatePage=Update Options
-UpdateWizardPage.description=Select other options for the update
-
-UserValidationDialog.required=Password Required
-UserValidationDialog.labelUser={0}
-UserValidationDialog.labelPassword={1}
-UserValidationDialog.password=&Password:
-UserValidationDialog.user=&User name:
-
-KeyboradInteractiveDialog.message=Keyboard Interactive authentication for {0}
-KeyboardInteractiveDialog.labelRepository=Enter values for the following repository: {0}
-
-VersionsElement.versions=Versions
-
-WorkbenchUserAuthenticator.cancelled=Operation cancelled because login cancelled
-WorkbenchUserAuthenticator.errorFlushing=Error occurred while flushing password for {0}
-WorkbenchUserAuthenticator.errorSaving=Error occurred while saving password for {0}
-
-Unmanage.unmanaging=Disconnecting from CVS...
-Unmanage.unmanage=Disconnect from CVS
-Unmanage.title=Confirm Disconnect from CVS
-Unmanage.titleN=Confirm Multiple Project Disconnect from CVS
-Unmanage.message=Are you sure you want to disconnect CVS from ''{0}''?
-Unmanage.messageN=Are you sure you want to disconnect CVS from these {0} projects?
-Unmanage.option1=Do not delete the CVS meta information (e.g. CVS sub-directories).
-Unmanage.option2=Also delete the CVS meta information from the file system.
-Unmanage.unmanagingError=Errors occurred while disconnecting
-
-Unmanage.message=Are you sure you want to disconnect CVS from ''{0}''?
-Unmanage.messageN=Are you sure you want to disconnect CVS from these {0} projects?
-
-Save_To_Clipboard_2=&Save to clipboard
-Save_In_File_System_3=Sa&ve in file system
-Browse..._4=Br&owse...
-Save_Patch_As_5=Save Patch As
-patch.txt_6=patch.txt
-Save_In_Workspace_7=Save in &workspace
-Select_a_folder_then_type_in_the_file_name__8=Select a fol&der then type in the file name:
-Fi&le_name__9=Fi&le name:
-Do_not_recurse_into_sub-folders_10=&Recurse into sub-folders
-Do_not_include_new_files_in_patch_11=&Include new files in patch
-Diff_output_format_12=Diff output format
-Unified_(format_required_by_Compare_With_Patch_feature)_13=&Unified (format required by the Apply Patch wizard)
-Context_14=&Context
-Standard_15=&Standard
-Advanced_options_19=Advanced options
-Configure_the_options_used_for_the_CVS_diff_command_20=Configure the options used for the CVS diff command
-
-After_configuring_the_project__1=After configuring the project:
-Open_the_Synchronize_view_on_the_project_2=Open the Synchronize view on the project
-Automatically_import_the_local_resources_into_the_repository_3=Automatically import the local resources into the repository
-Run_update_4=Run update
-Do_nothing_5=Do nothing
-Validate_Connection_on_Finish_7=Validate Location on Finish
-
-TagSelectionDialog.Select_a_Tag_1=&Select a branch or version
-TagSelectionDialog.recurseOption=Recurse into sub-&folders
-TagSelectionDialog.0=&Add Date...
-TagSelectionDialog.1=&Remove
-TagSelectionArea.0=&Matching tags:
-TagSelectionArea.1={0}:
-TagSelectionArea.2={0} (? = any character, * = any String):
-TagSelectionArea.3=Select a &tag
-TagSelectionWizardPage.0=&Use the tag currently associated with the workspace resources
-TagSelectionWizardPage.1=&Select the tag from the following list
-
-UpdateSyncAction.Conflicting_changes_found_1=Conflicting changes found
-UpdateSyncAction.You_have_local_changes_you_are_about_to_overwrite_2=You have local changes you are about to overwrite
-UpdateSyncAction.Only_update_resources_that_can_be_automatically_merged_3=Only update resources that can be automatically merged
-UpdateSyncAction.Update_all_resources,_overwriting_local_changes_with_remote_contents_4=Update all resources, overwriting local changes with remote contents
-UpdateSyncAction.Overwrite_local_changes__5=Overwrite local changes?
-UpdateSyncAction.You_have_local_changes_you_are_about_to_overwrite._Do_you_wish_to_continue__6=You have local changes you are about to overwrite. Do you wish to continue?
-
-CVSDecoratorPreferencePage.1=T&ext
-Example__1=&Preview
-Text_Labels_12=&Formats
-Select_the_format_for_file,_folders,_and_project_text_labels__13=Select the format for file, folders, and project text labels:
-&File_Format__14=File For&mat:
-Add_&Variables_15=Add &Variables...
-F&older_Format__16=F&older Format:
-Add_Varia&bles_17=Add Varia&bles...
-&Project_Format__18=&Project Format:
-Add_Variable&s_19=Add Variable&s...
-&Label_decoration_for_outgoing__20=Di&rty flag:
-Label_decorat&ion_for_added__22=Added f&lag:
-Icon_Overlays_24=&Icons
-Sho&w_outgoing_25=Indicate is o&utgoing
-Show_has_&remote_26=Indicate &has remote
-S&how_is_added_27=Indi&cate is added
-&Compute_deep_outgoing_state_for_folders_(disabling_this_will_improve_decorator_performance)_28=&Compute deep outgoing state for folders (disabling this will improve decorator performance)
-Select_the_&variables_to_add_to_the_decoration_format__30=Select the &variables to add to the decoration format:
-Add_Variables_31=Add Variables
-name_of_the_resource_being_decorated_34=name of the resource being decorated
-the_tag_applied_to_the_resource_(version,_branch,_or_date)_35=the tag applied to the resource (version, branch, or date)
-the_repository_location__s_hostname_36=the repository location\'s hostname
-the_connection_method_(e.g._pserver,_ssh)_37=the connection method (e.g. pserver, ssh)
-user_name_for_the_connection_38=user name for the connection
-repository_home_directory_on_server_39=repository home directory on server
-root_relative_directory_40=root relative directory
-flag_indicating_that_the_folder_has_a_child_resource_with_outgoing_changes_41=flag indicating that the folder has a child resource with outgoing changes
-name_of_the_resource_being_decorated_42=name of the resource being decorated
-the_tag_applied_to_the_resource_43=the tag applied to the resource
-keyword_substitution_rule_for_the_resource_44=keyword subsitution rule for the resource
-last_revision_loaded_into_workspace_45=last revision loaded into workspace
-flag_indicating_that_the_file_has_outgoing_changes_46=flag indicating that the file has outgoing changes
-flag_indicating_that_the_file_has_been_added_to_the_server_47=flag indicating that the file has been added to the server
-
-ExtMethodPreferencePage_message=These variables define the external connection program to use with the \'ext\' connection method. These values should be the same as the \'ext\' CVS command-line environment variable settings.
-ExtMethodPreferencePage_CVS_RSH=CVS_&RSH:
-ExtMethodPreferencePage_Browse=&Browse...
-ExtMethodPreferencePage.0=Use an &external program to connect
-ExtMethodPreferencePage.2=Choosing to use another connection method allows the meta information in CVS projects to be compatible with external CVS tools while using a custom connection method.
-ExtMethodPreferencePage.1=Use another &connection method type to connect
-ExtMethodPreferencePage_Details=Select a program or script
-ExtMethodPreferencePage_CVS_RSH_Parameters=&Parameters:
-ExtMethodPreferencePage_Add_Variable=&Add Variable...
-ExtMethodPreferencePage_CVS_SERVER__7=CVS_&SERVER:
-UpdateMergeActionProblems_merging_remote_resources_into_workspace_1=Problems merging remote resources into workspace
-UpdateMergeActionProblems_merging_remote_resources_into_workspace_2=Problems merging remote resources into workspace
-
-TagConfigurationDialog.1=Configure Branches and Versions for {0}
-TagConfigurationDialog.4=Configure tags you will see in the workbench.
-TagConfigurationDialog.5=&Browse files for tags:
-TagConfigurationDialog.6=&New tags found in the selected files:
-TagConfigurationDialog.7=Remembered &tags for these projects:
-TagConfigurationDialog.8=&Add Checked Tags
-TagConfigurationDialog.9=&Remove
-TagConfigurationDialog.0=Add &Date...
-TagConfigurationDialog.10=Re&move All
-TagConfigurationDialog.11=&List of files to be automatically examined when refreshing tags:
-TagConfigurationDialog.12=A&dd Selected Files
-TagConfigurationDialog.13=Rem&ove
-TagConfigurationDialog.14=Error fetching tags from remote CVS files
-TagConfigurationDialog.20=&Refresh from Repository
-TagConfigurationDialog.21=&Configure Tags...
-TagConfigurationDialog.22=Updating Tags
-
-ChangeListener.Deleting_CVS_folders_1=Deleting CVS folders
-ChangeListener.Folders_cannot_be_deleted_from_a_CVS_server_from_the_client._To_delete_the_folder_2=Folders cannot be deleted from a CVS server from the client. To delete the folder
-ChangeListener.Do_not_ask_me_about_this_again_3=Do not ask me about this again
-ConfigureTagsFromRepoViewConfigure_Tag_Error_1=Configure Tag Error
-RemoteRootAction.label=Discard location
-RemoteLogOperation.0=Fetching log information from {0}
-RemoteLogOperation.1=Fetching log information
-RemoveDateTagAction.0=&Remove
-RemoteRootAction.Unable_to_Discard_Location_1=Unable to Discard Location
-RemoteRootAction.Projects_in_the_local_workspace_are_shared_with__2=Projects in the local workspace are shared with {0}. This location cannot be discarded until all local projects are disconnected from it.
-RemoveRootAction.removeRoot_3=RemoveRootAction.removeRoot
-RemoteRootAction.The_projects_that_are_shared_with_the_above_repository_are__4=The projects that are shared with the above repository are:
-
-BranchCategory.Branches_1=Branches
-GroupedByVersionCategory.Versions_1=Versions
-VersionCategory.Versions_1=Versions
-ModulesCategory.label=Modules
-HistoryView.[...]_4=[...]
-
-CVSProjectPropertiesPage.connectionType=Connection type:
-CVSProjectPropertiesPage.user=User:
-CVSProjectPropertiesPage.Select_a_Repository_1=Select a Repository
-CVSProjectPropertiesPage.Select_a_CVS_repository_location_to_share_the_project_with__2=Select a compatible CVS repository location to share the project with:
-CVSProjectPropertiesPage.Change_Sharing_5=&Change Sharing...
-CVSProjectPropertiesPage.fetchAbsentDirectoriesOnUpdate=&Fetch absent or new directories when updating
-CVSProjectPropertiesPage.configureForWatchEdit=Enable watch/edit for this project
-CVSProjectPropertiesPage.progressTaskName=Updating project's CVS properties
-CVSProjectPropertiesPage.setReadOnly=Setting all files read-only
-CVSProjectPropertiesPage.clearReadOnly=Setting all files writable
-CVSRepositoryPropertiesPage.Confirm_Project_Sharing_Changes_1=Confirm Project Sharing Changes
-CVSRepositoryPropertiesPage.There_are_projects_in_the_workspace_shared_with_this_repository_2=There are projects in the workspace shared with this repository. The projects will be updated with the new information that you have entered
-CVSRepositoryPropertiesPage.sharedProject=The projects that are shared with {0} are:
-CVSRepositoryPropertiesPage.useDefaultProgramName=Expect the &default program name "cvs" in text message prefixes from this server
-CVSRepositoryPropertiesPage.useProgramName=Expect a custom &program name:
-CVSRepositoryPropertiesPage.useLocationAsLabel=Use the &repository identification string as the label
-CVSRepositoryPropertiesPage.useCustomLabel=Use a custom &label:
-
-CVSProjectSetSerializer.Confirm_Overwrite_Project_8=Confirm Overwrite Project
-CVSProjectSetSerializer.The_project_{0}_already_exists._Do_you_wish_to_overwrite_it__9=The project {0} already exists. Do you wish to overwrite it?
-
-IgnoreResourcesDialog.titleSingle=Add {0} to .cvsignore
-IgnoreResourcesDialog.titleMany=Add {0} resources to .cvsignore
-IgnoreResourcesDialog.prompt=Select what to add to the .cvsignore file(s):
-IgnoreResourcesDialog.addNameEntryButton=Resource(s) by name
-IgnoreResourcesDialog.addNameEntryExample=Examples: file1.so, file2.so, .rcfile, bin
-IgnoreResourcesDialog.addExtensionEntryButton=Wildcard extension
-IgnoreResourcesDialog.addExtensionEntryExample=Examples: *.so, *.rcfile, bin
-IgnoreResourcesDialog.addCustomEntryButton=Custom pattern
-IgnoreResourcesDialog.addCustomEntryExample=The wildcard characters ''*'' and ''?'' are permitted.
-IgnoreResourcesDialog.patternMustNotBeEmpty=Pattern must not be empty.
-IgnoreResourcesDialog.patternDoesNotMatchFile=Pattern does not match all selected resources: e.g. {0}
-
-ContentAction.Confirm_Long_Operation_1=Confirm Long Operation
-ContentAction.Changing_this_setting_will_involve_contacting_the_server_and_may_be_long-running_2=Changing this setting will involve contacting the server and may be long-running
-
-CVSProjectPropertiesPage.You_can_change_the_sharing_of_this_project_to_another_repository_location._However,_this_is_only_possible_if_the_new_location_is___compatible___(on_the_same_host_with_the_same_repository_path)._1=You can change the sharing of this project to another repository location. However, this is only possible if the new location is \"compatible\" (on the same host with the same repository path).
-
-ConfigurationWizardMainPage.Location_1=Location
-ConfigurationWizardMainPage.Authentication_2=Authentication
-ConfigurationWizardMainPage.Connection_3=Connection
-AlternateUserValidationDialog.Enter_Password_2=Enter Password
-AlternateUserValidationDialog.OK_6=OK
-AlternateUserValidationDialog.Cancel_7=Cancel
-AlternateUserValidationDialog.message=Enter the password for {0}:
-WorkbenchUserAuthenticator.The_operation_was_canceled_by_the_user_1=The operation was canceled by the user
-CVSCatchupReleaseViewer.No_workspace_file_1=No workspace file
-CVSPreferencesPage.Timeout_must_not_be_negative_1=Timeout must not be negative
-CVSPreferencesPage.Timeout_must_be_a_number_2=Timeout must be a number
-CVSCatchupReleaseViewer.Select_&Outgoing_Additions_1=Select New Reso&urces
-ForceCommitSyncAction.Outgoing_Changes_Not_Added_1=Outgoing Changes Not Added
-ForceCommitSyncAction.You_have_chosen_to_commit_new_resources_which_have_not_been_added_to_version_control._Do_you_wish_to_add_them_to_version_control_now__2=You have chosen to commit new resources which have not been added to version control. Do you wish to add them to version control now?
-
-WorkingSetSelectionArea.workingSetOther=&Other...
-ListSelectionArea.selectAll=&Select All
-ListSelectionArea.deselectAll=&Deselect All
-
-RestoreFromRepositoryWizard.fileSelectionPageTitle=Restore from Repository
-RestoreFromRepositoryWizard.fileSelectionPageDescription=Select the revision of each file that should be restored.
-RestoreFromRepositoryFileSelectionPage.fileSelectionPaneTitle={0} - Select file to be restored:
-RestoreFromRepositoryFileSelectionPage.revisionSelectionPaneTitle={0} - Check revision to be restored:
-RestoreFromRepositoryFileSelectionPage.fileToRestore={0} ({1} to be restored)
-RestoreFromRepositoryFileSelectionPage.fileContentPaneTitle={0} {1} in ''{2}''
-RestoreFromRepositoryFileSelectionPage.emptyRevisionPane=Remote revisions of selected file:
-RestoreFromRepositoryFileSelectionPage.fileExists=File ''{0}'' already exists locally.
-RestoreFromRepositoryFileSelectionPage.revisionIsDeletion=Revision {0} of {1} is the deletion and can not be restored. Select another revision of this file.
-RestoreFromRepositoryAction.noFilesTitle=No Deleted Files Found
-RestoreFromRepositoryAction.noFilesMessage=There were no deleted files found on the repository in folder ''{0}''.
-
-RepositoryRoot.folderInfoMissing=Local folder ''{0}'' is not properly mapped to a remote folder.
-
-RepositoriesViewContentHandler.unmatchedTag=No matching end tag found for tag ''{0}'' while reading repositories View configuration file.
-RepositoriesViewContentHandler.missingAttribute=Required attribute ''{1}'' missing from tag ''{0}'' while reading repositories View configuration file.
-RepositoriesViewContentHandler.errorCreatingRoot=An error occurred trying to create repository ''{0}''.
-
-CVSWorkingSetFolderSelectionPage.projectSelectionPageTitle=CVS Working Set
-CVSWorkingSetFolderSelectionPage.projectSelectionPageDescription=Enter a working set name and select the working set folders.
-CVSWorkingSetFolderSelectionPage.name=&Working set name:
-CVSWorkingSetFolderSelectionPage.treeLabel=Working &set contents:
-CVSWorkingSetFolderSelectionPage.refresh=&Refresh Contents
-CVSWorkingSetFolderSelectionPage.invalidWorkingSetName=The name must contain only letters and digits.
-CVSWorkingSetFolderSelectionPage.duplicateWorkingSetName=A working set of the specific name already exists.
-CVSWorkingSetFolderSelectionPage.mustSelectFolder=At least one folder must be checked.
-
-WorkingSetSelectionDialog.title= Select CVS Working Set
-WorkingSetSelectionDialog.title.multiSelect= Select CVS Working Sets
-WorkingSetSelectionDialog.message= &Select a CVS working set:
-WorkingSetSelectionDialog.message.multiSelect= &Select CVS working sets:
-WorkingSetSelectionDialog.detailsButton.label= &Edit...
-WorkingSetSelectionDialog.newButton.label= &New...
-WorkingSetSelectionDialog.removeButton.label= &Remove
-
-RefreshTagsAction.title=Refresh Branch and Version Tags?
-RefreshTagsAction.message=Repository ''{0}'' has {1} projects to refresh. Continue?
-
-WatchEditPreferencePage.description=Settings for CVS Watch/Edit.
-WatchEditPreferencePage.checkoutReadOnly=&Configure projects to use Watch/Edit on checkout
-WatchEditPreferencePage.validateEditSaveAction=When read-only files are modified in an editor
-WatchEditPreferencePage.edit=Send a CVS &edit notification to the server
-WatchEditPreferencePage.highjack=Edit the file &without informing the server
-WatchEditPreferencePage.editPrompt=Before a CVS edit notification is sent to the server
-WatchEditPreferencePage.neverPrompt=&Never prompt
-WatchEditPreferencePage.alwaysPrompt=Always &prompt
-WatchEditPreferencePage.onlyPrompt=&Only prompt if there are other editors
-
-Uneditaction.confirmMessage=Overwrite local changes to edited files?
-Uneditaction.confirmTitle=Confirm Unedit
-
-FileModificationValidator.promptTitle=CVS Edit Files?
-FileModificationValidator.promptMessage=There are read-only files being modified. Should a 'cvs edit' be performed?
-FileModificationValidator.vetoMessage=User vetoed file modification
-
-RefreshRemoteProjectWizard.title=Refresh Branches
-RefreshRemoteProjectWizard.0=Tags not found for some modules
-RefreshRemoteProjectWizard.1=Search Deeply
-RefreshRemoteProjectWizard.2=Skip
-RefreshRemoteProjectWizard.3=Tags were not found on module {0} using the auto-refresh files and a shallow cvs log operation. You can choose to search this module using a deep cvs log operation or skip it.
-RefreshRemoteProjectWizard.4=Tags were not found on {0} modules using the auto-refresh files and a shallow cvs log operation. You can choose to search these module using a deep cvs log operation or skip them.
-RefreshRemoteProjectSelectionPage.pageTitle=Select Projects
-RefreshRemoteProjectSelectionPage.pageDescription=Select the remote projects whose tags should be refreshed.
-RefreshRemoteProjectSelectionPage.selectRemoteProjects=This wizard helps discover the tags associated with one or more remote projects. &Check the projects whose tags you wish to refresh.
-RefreshRemoteProjectSelectionPage.noWorkingSet=Do not &use a working set
-RefreshRemoteProjectSelectionPage.workingSet=Select a &working set (matching projects will be checked):
-
-EditorsView.file=File name
-EditorsView.user=User name
-EditorsView.date=Date
-EditorsView.computer=Computer name
-
-EditorsDialog.title=Editors
-EditorsDialog.question=The resource already has editors. Do you still want to edit the resource and send a CVS edit notification to server?
-EditorsAction.classNotInitialized={0} not initialized
-
-TargetLocationSelectionDialog.projectNameLabel=&Project Name:
-TargetLocationSelectionDialog.useDefaultLabel=Use default &workspace location
-TargetLocationSelectionDialog.locationLabel=&Location:
-TargetLocationSelectionDialog.parentDirectoryLabel=&Directory:
-TargetLocationSelectionDialog.browseLabel=&Browse...
-TargetLocationSelectionDialog.messageForSingle=Select the parent directory for project {0}.
-TargetLocationSelectionDialog.messageForMulti=Select the parent directory for the {0} projects.
-TagetLocationSelectionDialog.locationEmpty=Project contents directory must be specified.
-TagetLocationSelectionDialog.invalidLocation=Invalid location path.
-TagetLocationSelectionDialog.alreadyExists=Project {0} already exists.
-
-SynchronizeProjectsDialog.title=Synchronize CVS Projects
-SynchronizeProjectsDialog.selectProjects=Projects to be synchronized
-SynchronizeProjectsDialog.syncOutgoingChanges=Only synchronize projects with outgoing &changes
-SynchronizeProjectsDialog.allSharedProjects=Include &all projects shared with CVS
-SynchronizeProjectsDialog.sharedWorkingSetProjects=Include &working set resources shared with CVS:
-
-RemoteFileEditorInput.fullPathAndRevision={0} {1}
-
-CheckoutOperation.thisResourceExists=The resource ''{0}'' already exists in the workspace and will be deleted. Proceed with the check out of ''{1}''?
-CheckoutOperation.thisExternalFileExists=The folder ''{0}'' exists in the local file system and will be deleted. Proceed with the check out of ''{1}''?
-CheckoutOperation.confirmOverwrite=Confirm Overwrite
-CheckoutOperation.scrubbingProject=Scrubbing project ''{0}''.
-CheckoutOperation.refreshingProject=Configuring project ''{0}''.
-
-CheckoutSingleProjectOperation.taskname=Checking out ''{0}'' from CVS
-CheckoutMultipleProjectsOperation.taskName=Checking out {0} folders from CVS
-
-CheckoutIntoOperation.taskname=Checking out {0} folders from CVS into ''{1}''
-CheckoutIntoOperation.targetIsFile=Folder ''{0}'' cannot be checked out because file ''{1}'' is in the way.
-CheckoutIntoOperation.targetIsFolder=Folder ''{0}'' cannot be checked out because folder ''{1}'' is in the way.
-CheckoutIntoOperation.targetIsPrunedFolder=Folder ''{0}'' cannot be checked out because it conflicts with the pruned folder ''{1}''.
-CheckoutIntoOperation.mappingAlreadyExists=Cannot checkout remote folder ''{0}'' into ''{1}'' because local folder ''{2}'' is already mapped to remote folder ''{0}''.
-CheckoutIntoOperation.cancelled=Checkout of ''{1}'' cancelled by user.
-CheckoutIntoOperation.overwriteMessage=Folder ''{0}'' already exists and will be deleted. Continue?
-
-AddToWorkspace.taskName1=Checking out ''{0}'' from CVS
-AddToWorkspace.taskNameN=Checking out {0} folders from CVS
-
-CheckoutAsAction.checkoutFailed=Problems encountered performing checkout
-
-CheckoutAsAction.enterProjectTitle=Check Out {0} As...
-CheckoutAsAction.enterLocationTitle=Check Out {0} Projects As...
-CheckoutAsAction.taskname=Checking out "{0}" from CVS as "{1}"
-CheckoutAsAction.multiCheckout=Checking out {0} projects from CVS
-
-CheckoutAsWizard.title=Check Out As
-CheckoutAsWizard.error=Problems encountered performing checkout
-CheckoutAsMainPage.title=Check Out As
-CheckoutAsMainPage.description=Select the method of check out
-CheckoutAsMainPage.singleFolder=Choose how to check out folder ''{0}''
-CheckoutAsMainPage.asConfiguredProject=Check out as a project &configured using the New Project Wizard
-CheckoutAsMainPage.asSimpleProject=Check out as a &project in the workspace
-CheckoutAsMainPage.projectNameLabel=&Project Name:
-CheckoutAsMainPage.multipleFolders=Choose how to check out the {0} folders
-CheckoutAsMainPage.asProjects=Check out into the &workspace as projects
-CheckoutAsMainPage.intoProject=Check out &into an existing project
-
-CheckoutAsLocationSelectionPage.title=Check Out As
-CheckoutAsLocationSelectionPage.description=Select the project location
-CheckoutAsLocationSelectionPage.useDefaultLabel=Use default &workspace location
-CheckoutAsLocationSelectionPage.locationLabel=&Location:
-CheckoutAsLocationSelectionPage.parentDirectoryLabel=&Directory:
-CheckoutAsLocationSelectionPage.browseLabel=&Browse...
-CheckoutAsLocationSelectionPage.locationEmpty=Project contents directory must be specified.
-CheckoutAsLocationSelectionPage.invalidLocation=Invalid location path.
-CheckoutAsLocationSelectionPage.messageForSingle=Select the parent directory for project {0}.
-CheckoutAsLocationSelectionPage.messageForMulti=Select the parent directory for the {0} projects.
-
-CheckoutAsProjectSelectionPage.title=Check Out Into
-CheckoutAsProjectSelectionPage.description=Select the local folder that is the target of the checkout operation.
-CheckoutAsProjectSelectionPage.name=Target folder &name:
-CheckoutAsProjectSelectionPage.treeLabel=&Parent of target folder:
-CheckoutAsProjectSelectionPage.showLabel=&Filter project list:
-CheckoutAsProjectSelectionPage.recurse=&Checkout subfolders
-CheckoutAsProjectSelectionPage.showAll=Show all valid target projects
-CheckoutAsProjectSelectionPage.showUnshared=Show unshared projects
-CheckoutAsProjectSelectionPage.showSameRepo=Show projects shared with the same repository
-CheckoutAsProjectSelectionPage.invalidFolderName=''{0}'' is not a valid folder name
-
-TargetLocationSelectionDialog.projectNameLabel=&Project Name:
-TargetLocationSelectionDialog.useDefaultLabel=Use default &workspace location
-TargetLocationSelectionDialog.locationLabel=&Location:
-TargetLocationSelectionDialog.parentDirectoryLabel=&Directory:
-TargetLocationSelectionDialog.browseLabel=&Browse...
-TargetLocationSelectionDialog.messageForSingle=Select the parent directory for project {0}.
-TargetLocationSelectionDialog.messageForMulti=Select the parent directory for the {0} projects.
-TagetLocationSelectionDialog.locationEmpty=Project contents directory must be specified.
-TagetLocationSelectionDialog.invalidLocation=Invalid location path.
-TagetLocationSelectionDialog.alreadyExists=Project {0} already exists.
-CheckoutIntoWizard.title=Checkout Into
-CheckoutIntoWizard.projectSelectionPageTitle=Select local folder
-CheckoutIntoWizard.projectSelectionPageDescription=Select the local folder that is the target of the checkout operation.
-CheckoutIntoWizard.error=Checkout Error
-
-WorkspaceChangeSetCapability.1=New Set
-OpenCommitSetAction.20=Open Change in Compare Editor
-OpenCommitSetAction.21=Could not determine the repository location of the selected resources
-WorkspaceChangeSetCapability.2=New Change Set
-WorkspaceChangeSetCapability.3=Enter the name and comment for the new change set
-CVSChangeSetCollector.4=Retrieving revision histories
-CVSChangeSetCollector.0=Unassigned Remote Changes
-WorkspaceChangeSetCapability.7=Edit Change Set Comment
-WorkspaceChangeSetCapability.8=Edit the name and comment for the change set
-
-CheckoutIntoWizard.thisResourceExists=The resource ''{0}'' already exists in the workspace. Overwrite?
-CheckoutIntoWizard.confirmOverwrite=Confirm Overwrite
-CheckoutIntoWizard.mappingAlreadyExists=Cannot add remote folder ''{0}'' to project ''{1}'' as ''{2}'' because local folder ''{3}'' is already mapped to that folder.
-CheckoutIntoProjectSelectionPage.description=Choose the name and parent folder where ''{0}'' should be checked out to.
-CheckoutIntoProjectSelectionPage.name=Target folder &name:
-CheckoutIntoProjectSelectionPage.treeLabel=&Parent of target folder:
-CheckoutIntoProjectSelectionPage.showLabel=&Filter project list:
-CheckoutIntoProjectSelectionPage.showAll=Show all valid target projects
-CheckoutIntoProjectSelectionPage.showUnshared=Show unshared projects
-CheckoutIntoProjectSelectionPage.showSameRepo=Show projects shared with the same repository
-CheckoutIntoProjectSelectionPage.recurse=&Checkout subfolders
-CheckoutIntoProjectSelectionPage.invalidFolderName=''{0}'' is not a valid folder name
-
-HasProjectMetaFile.taskName=Looking for a remote meta file
-TagFromWorkspace.taskName=Tagging from workspace
-TagFromRepository.taskName=Tagging from repository
-UpdateOnlyMergeable.taskName=Updating mergeable changes
-UpdateDialog.overwriteTitle=Overwrite Local Changes?
-UpdateDialog.overwriteMessage=Do you want to overwrite local changes?
-ReplaceOperation.taskName=CVS Replace
-UpdateOperation.taskName=CVS Update
-
-SafeUpdateAction.warnFilesWithConflictsTitle=Non-mergeable files
-SafeUpdateAction.warnFilesWithConflictsDescription=Some conflicting files cannot be merged automatically with the update action. They contain conflicting changes that will have to be merged manually. Use the Synchronize View to find the conflicts then merge the changes in a compare editor.
-
-SafeUpdateAction.warnFilesWithConflictsTitle=Non-mergeable files
-SafeUpdateAction.warnFilesWithConflictsDescription=Some conflicting files cannot be merged automatically with the update action. They contain conflicting changes that will have to be merged manually. Use the Synchronize View to find the conflicts then merge the changes in a compare editor.
-
-Error.unableToShowSyncView=Error opening Synchronize View. Please ensure that the Team plugin is installed correctly.
-ShowAnnotationAction.1=Unexpected response from CVS Server: {0}
-ShowAnnotationAction.2=Annotate Binary File?
-ShowAnnotationAction.3=File {0} is marked as a binary file. The CVS annotation operation only works properly for files that contain text. Do you wish to continue?
-
-UpdateAction.jobName=CVS Update
-MergeUpdateAction.jobName=CVS Merge
-MergeUpdateAction.invalidSubscriber=Invalid subscriber: {0}
-CommitAction.jobName=CVS Commit
-OverrideAndUpdateAction.jobName=Performing CVS Override and Update on {0} resources
-WorkInProgressPreferencePage.0=CVS Work In Progress
-WorkInProgressPreferencePage.1=Preferences for enabling features that are not complete:
-WorkInProgressPreferencePage.7=Switch to the associated perspective after a show annotations operation is complete:
-WorkInProgressPreferencePage.8=Al&ways
-WorkInProgressPreferencePage.2=N&ever
-WorkInProgressPreferencePage.3=&Prompt
-WorkInProgressPreferencePage.4=Associated perspective for the show annotations operation:
-WorkInProgressPreferencePage.5=Pe&rspective:
-WorkInProgressPreferencePage.6=None
-
-
-
-CheckoutProjectOperation.8=Checking out ''{0}'' into project ''{1}''
-CheckoutProjectOperation.9=Checking out ''{0}'' into {1} projects
-CheckoutProjectOperation.0=Checkout of remote folder {0} cancelled by user
-CVSOperation.0=Errors occured in {0} of {1} operations.
-CVSOperation.1=Show CVS Console
-CVSOperation.2=Show CVS Console
-CVSModelElement.0=Error
-CVSModelElement.1=Error fetching resource list from repository.
-CVSDecorator.exceptionMessage=Errors occured while applying CVS decorations to resources.
-FetchMembersOperation.0=Fetching members of {0}
-
-RemoteRevisionQuickDiffProvider.readingFile=Error reading remote file
-RemoteRevisionQuickDiffProvider.closingFile=Error closing remote file
-RemoteRevisionQuickDiffProvider.fetchingFile=CVS QuickDiff: fetching remote contents
-RemoteCompareOperation.0=Comparing tags {0} and {1} of {2}
-
-WorkspaceToolbarCommitAction.label=Commit
-WorkspaceToolbarCommitAction.tooltip=Commit All Outgoing Changes...
-WorkspaceToolbarCommitAction.description=Commit All Outgoing Changes...
-WorkspaceToolbarCommitAction.image=checkin_action.gif
-
-WorkspaceToolbarUpdateAction.label=Update
-WorkspaceToolbarUpdateAction.tooltip=Update All Incoming Changes...
-WorkspaceToolbarUpdateAction.description=Update All Incoming Changes...
-WorkspaceToolbarUpdateAction.image=checkout_action.gif
-
-SharingWizardIgnore.label=Ignore
-SharingWizardIgnore.tooltip=Ignore Selected Resources...
-SharingWizardIgnore.description=Ignore Selected Resources...
-SharingWizardIgnore.image=ignorefiles.gif
-
-ConsoleRemoveAction.label=Close CVS Console
-ConsoleRemoveAction.tooltip=Close CVS console
-ConsoleRemoveAction.image=participant_rem.gif
-
-WorkspaceUpdateAction.label=&Update
-WorkspaceUpdateAction.tooltip=Perform an update on the selected resources
-WorkspaceUpdateAction.helpContextId=org.eclipse.team.cvs.ui.workspace_update_action
-
-OverrideAndUpdateAction.label=O&verride and Update
-OverrideAndUpdateAction.tooltip=Perform an override and update on the selected resources. This will make the local contents equal to the remote ignoring any local changes.
-OverrideAndUpdateAction.helpContextId=org.eclipse.team.cvs.ui.workspace_overupdate_action
-
-RefreshDirtyStateAction.label=C&lean Timestamps
-RefreshDirtyStateOperation.0=Problems encountered cleaning timestamps
-RefreshDirtyStateOperation.1=CVS Clean Timestamps
-RefreshDirtyStateAction.tooltip=Reset the dirty state of out-of-sync files whose contents match the server contents
-RefreshDirtyStateAction.helpContextId=org.eclipse.team.cvs.ui.workspace_refresh_dirty_state_action_context
-
-WorkspaceCommitAction.label=&Commit...
-WorkspaceCommitAction.tooltip=Perform a commit on the selected resources
-WorkspaceCommitAction.helpContextId="org.eclipse.team.cvs.ui.workspace_commit_action
-
-OverrideAndCommitAction.label=Override and Comm&it...
-OverrideAndCommitAction.tooltip=Perform an override and commit on the selected resources. This will make the remote contents equal to the local ignoring any remote changes.
-OverrideAndCommitAction.helpContextId=org.eclipse.team.cvs.ui.workspace_overcommit_action
-
-ConfirmMergedAction.label=&Mark as Merged
-ConfirmMergedAction.tooltip=Mark the conflict as merged by upgrading the base to match the remote
-ConfirmMergedAction.helpContextId=org.eclipse.team.cvs.ui.workspace_confirm_merged_action
-
-BranchAction.label=&Branch...
-BranchAction.tooltip=Branch
-
-IgnoreAction.label=A&dd to .cvsignore...
-IgnoreAction.0=Ignoring selected resources for project {0}
-IgnoreAction.1=Ignoring Resources
-IgnoreAction.tooltip=Ignore the Selected Resources when Synchronizing
-
-ShowResourceInHistoryAction.label=Show in Resource &History
-ShowResourceInHistoryAction.tooltip=Show in Resource History
-
-ShowAnnotationAction.label=Show &Annotation
-ShowAnnotationAction.tooltip=Show Annotation
-
-GenerateDiffFileAction.label=Create &Patch...
-GenerateDiffFileOperation.0=The file could not be written. Possible reasons are the directory is write-protected or not enough disk space is available.
-GenerateDiffFileOperation.1=The file could not be written due to an I/O error.
-GenerateDiffFileOperation.2=An I/O error occured.
-GenerateDiffFileWizard.0=Please enter a valid location.
-GenerateDiffFileWizard.2=Please enter a file name.
-GenerateDiffFileWizard.3=The specified directory does not exist.
-GenerateDiffFileWizard.4=Please select a location in the workspace.
-GenerateDiffFileWizard.5=Please enter a valid filename.
-GenerateDiffFileAction.tooltip=Compare your workspace contents with the server and generate a diff file that can be used as a patch file.
-
-MergeUpdateAction.label=&Update
-MergeUpdateAction.tooltip=Perform an update merge on the selected resources
-MergeUpdateAction.helpContextId=org.eclipse.team.cvs.ui.merge_update_action
-
-CompareRevertAction.label=&Override and Update
-CompareRevertAction.tooltip=Revert the local file contents to match that of their corresponding remotes
-CompareRevertAction.helpContextId=org.eclipse.team.cvs.ui.compare_revert_action
-
-SharingCommitAction.label=Commit
-SharingCommitAction.tooltip=Commit All Changes...
-SharingCommitAction.description=Commit All Changes...
-SharingCommitAction.image=checkin_action.gif
-
-MergeSynchronizeParticipant.8=Missing id initializing cvs merge participant
-MergeSynchronizeParticipant.9=Unable to initialize cvs merge subscriber
-MergeSynchronizeParticipant.10=Missing root nodes in cvs merge subscriber memento: {0}
-MergeSynchronizeParticipant.11=Root resource in cvs merge subscriber is no longer in workspace, ignoring: {0}
-MergeSynchronizeParticipant.12=Missing root resources for cvs merge subscriber: {0}
-DisconnectOperation.0=Disconnecting
-DisconnectOperation.1=Disconnecting {0}
-SubscriberConfirmMergedAction.0=Synchronization information is missing for resource {0}
-SubscriberConfirmMergedAction.jobName=Performing a CVS Mark as Merged operation on {0} resources.
-CVSSubscriberAction.0=Invalid attemp to make unsupervised resource {0} in-sync.
-ReleaseCommentDialog.6=Review resources that will be committed:
-ReconcileProjectOperation.0=Reconciling project {0} with remote folder {1}
-CheckoutToRemoteFolderOperation.0=Downloading folder {0}
-CVSRepositoryPropertiesPage.21=Use this location's connection information for all connections
-CVSRepositoryPropertiesPage.22=Use the following locations for read and write access
-CVSRepositoryPropertiesPage.23=Read:
-CVSRepositoryPropertiesPage.24=Write:
-CVSRepositoryPropertiesPage.0=Confirm Host or Path Change
-CVSRepositoryPropertiesPage.1=You have chosen to change the host name or repository root path for this location. You should ensure that this new information still identifies the same repository.
-CompareRevertAction.0=Reverting {0} resources
-CompareParticipant.0={0} ({1})
-ComparePreferencePage.0=Options for CVS comparisons:
-ComparePreferencePage.1=Show the &file author in compare editors
-ComparePreferencePage.2=Automatically enable co&mmit set grouping in CVS synchronizations
-FileModificationValidator.3=Perform Edit?
-FileModificationValidator.4=A CVS edit notification is required to be sent to the server in order to allow editing of one or more selected files. Continue?
-CVSSynchronizeViewPage.0=Show incoming grouped by comment
-CVSSynchronizeWizard.0=Unknown
-Participant.comparing=Comparing
-Participant.merging=Merging
-Participant.synchronizing=Synchronizing
-
-Participant.comparingDetail=Comparing {0} with {1}
-Participant.mergingDetail=Merging {0}
-Participant.synchronizingDetail=Synchronizing {0}
-
-CompareWithRevisionAction.4=Compare With Revision
-ReplaceWithRevisionAction.0=&Replace
-ReplaceWithRevisionAction.1=Replace With Revision
-
-ConsolePreferencesPage.4=&Show CVS console automatically when command is run
-ConsolePreferencesPage.5=&Limit console output
-ConsolePreferencesPage.6=&Fixed width console
-ConsolePreferencesPage.7=Character &width:
-ConsolePreferencesPage.8=&Console &buffer size (characters):
-ConsolePreferencesPage.9=CVS Console Settings:
-
-SharingWizard.23=Share Project Resources
-SharingWizard.24=Review and commit resources to the repository. Use the context menu to perform additional operations on the resources.
-SharingWizard.25=Module ''{0}'' exists on the server. Select the tag to synchronize with.
-SharingWizardSyncPage.0=Sharing
-ReconcileProjectOperation.1=Local resource {0} is a file while the corresponding remote {1} is a folder
-ReconcileProjectOperation.2=Local resource {0} is a folder while the corresponding remote {1} is a file
-ShareProjectOperation.0=Sharing project {0} as {1}
-SharingWizard.26=Keep Sharing?
-SharingWizard.27=Project {0} has been mapped to a remote module. Should this mapping be kept?
-SharingWizardSyncPage.3=The resources of project {0} are in-sync with the repository.
-SharingWizardSyncPage.4=An error has occurred populating this view.
-SharingWizardSyncPage.5=Show Errors
-SharingWizardSyncPage.8=Errors Occurred
-SharingWizardSyncPage.9=The following errors occurred.
-SharingWizardSyncPage.10=Commit Changes?
-SharingWizardSyncPage.11=There are still uncommitted changes that have not been shared. Should these changes be committed?
-ShareProjectOperation.1=Calculating synchronization states
-CVSProjectPropertiesPage.31=Show only compatible repository locations
-CVSProjectPropertiesPage.32=Confirm
-CVSProjectPropertiesPage.33=The selected repository location may not be compatible with the current location. Are you sure you want to change sharing to the new location?
-RepositoryEncodingPropertyPage.2=Identify the file system encoding used by the server where the repository is located. Setting this will allow file names and commit comments to be properly translated between the client and server in cases where the server encoding differs from the client.
-RepositoryEncodingPropertyPage.3=Server Encoding
-RepositoryEncodingPropertyPage.0=Cannot Change Encoding
-RepositoryEncodingPropertyPage.1=Location {0} no longer exists.
-RepositoryEncodingPropertyPage.4=Note: this setting does not apply to file content encodings. File content encodings can be set on the Workbench/Editors preference page and on the Info property page of a project.
-CheckoutWizard.7=Checkout Project from CVS Repsitory
-CheckoutWizard.8=This wizard allows you to checkout projects from a CVS Repository.
-CheckoutWizard.0=Checkout from CVS
-CheckoutWizard.10=Select Module
-CheckoutWizard.11=Select the module to be checked out from CVS
-ModuleSelectionPage.2=Use an existing &module (this will allow you to browse the modules in the repository)
-CheckoutAsWizard.3=Select Tag
-CheckoutAsWizard.4=Choose the tag to check out from
-CheckoutAsMainPage.10=(Only available when the .project file does not exist in the repository)
-CVSTeamProvider.updatingFile=Updating {0}
-CVSTeamProvider.makeBranch=Creating branch
-CVSTeamProvider.folderInfo=Updating folder synchronization information for project {0}
-CVSTeamProvider.updatingFolder=Updating {0}
-AddOperation.0=Adding {0}
-BranchOperation.0=Branching
-BranchOperation.1=Branching {0}
-CommitOperation.0=Committing {0}
-CommitSetDialog.0=&Name:
-CommitSetDialog.2=Use the &title as the commit comment
-CommitSetDialog.3=Enter a commit &comment
-UpdateOperation.0=Updating {0}
-ReplaceOperation.0=Replacing {0}
-TagOperation.0=Tagging {0}
-RemoteAnnotationStorage.1=As error occurred computing the content type of remote resource {0}
-DateTagCategory.0=Dates
-DateTagDialog.0=Date (M/D/Y):
-DateTagDialog.1=Include time component in tag
-DateTagDialog.2=Time (HH:MM:SS):
-DateTagDialog.3=Time is local
-DateTagDialog.4=Time is in universal time coordinates (UTC)
-DateTagDialog.5=Create Date Tag
-WorkbenchPreference.defaultEncoding = Defaul&t ({0})
-WorkbenchPreference.otherEncoding = &Other:
-WorkbenchPreference.unsupportedEncoding = The selected encoding is not supported.
-
-LogEntryCacheUpdateHandler.0=Errors have occured while maintaining the log entry cache.
-LogEntryCacheUpdateHandler.1=Updating revision histories
-LogEntryCacheUpdateHandler.2=Could not fetch revision histories due to an internal timeout.
-MultiFolderTagSource.0={0} folders
-LocalProjectTagSource.0={0} Projects
-AnnotateView.0=Could not find an appropriate editor
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/AllRootsElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/AllRootsElement.java
deleted file mode 100644
index 20226e3de..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/AllRootsElement.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * AllRootsElement is the model element for the repositories view.
- * Its children are the array of all known repository roots.
- */
-public class AllRootsElement extends CVSModelElement implements IAdaptable {
- public ImageDescriptor getImageDescriptor(Object object) {
- return null;
- }
- public Object[] fetchChildren(Object o, IProgressMonitor monitor) {
- return CVSUIPlugin.getPlugin().getRepositoryManager().getKnownRepositoryRoots();
- }
- public String getLabel(Object o) {
- return null;
- }
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
- }
- public Object getParent(Object o) {
- return null;
- }
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/BranchCategory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/BranchCategory.java
deleted file mode 100644
index df0bff51d..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/BranchCategory.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-/**
- * BranchCategory is the model element for the branches category
- * for a particular repository in the repositories view. Its children
- * are the array of all known branch tags, other than HEAD, for the
- * given repository.
- */
-public class BranchCategory extends TagCategory {
-
- public BranchCategory(ICVSRepositoryLocation repository) {
- super(repository);
- }
-
- protected CVSTag[] getTags(IProgressMonitor monitor) throws CVSException {
- return CVSUIPlugin.getPlugin().getRepositoryManager().getKnownTags(repository, getWorkingSet(), CVSTag.BRANCH, monitor);
- }
-
- /**
- * Returns an image descriptor to be used for displaying an object in the workbench.
- * Returns null if there is no appropriate image.
- *
- * @param object The object to get an image descriptor for.
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_BRANCHES_CATEGORY);
- }
-
- /**
- * Returns the name of this element. This will typically
- * be used to assign a label to this object when displayed
- * in the UI. Returns an empty string if there is no appropriate
- * name for this object.
- *
- * @param object The object to get a label for.
- */
- public String getLabel(Object o) {
- return Policy.bind("BranchCategory.Branches_1"); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java
deleted file mode 100644
index 03745ed11..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryRoot;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
-import org.eclipse.ui.views.properties.IPropertySource;
-
-public class CVSAdapterFactory implements IAdapterFactory {
- private Object fileAdapter = new RemoteFileElement();
- private Object folderAdapter = new RemoteFolderElement();
- private Object rootAdapter = new CVSRepositoryRootElement();
-
- // Property cache
- private Object cachedPropertyObject = null;
- private Object cachedPropertyValue = null;
-
- /** (Non-javadoc)
- * Method declared on IAdapterFactory.
- */
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (IWorkbenchAdapter.class == adapterType) {
- return getWorkbenchAdapter(adaptableObject);
- }
-
- if(IDeferredWorkbenchAdapter.class == adapterType) {
- Object o = getWorkbenchAdapter(adaptableObject);
- if(o != null && o instanceof IDeferredWorkbenchAdapter) {
- return o;
- }
- return null;
- }
-
- if (IPropertySource.class == adapterType) {
- return getPropertySource(adaptableObject);
- }
- return null;
- }
-
- protected Object getWorkbenchAdapter(Object o) {
- if (o instanceof ICVSRemoteFile) {
- return fileAdapter;
- } else if (o instanceof ICVSRepositoryLocation) {
- return rootAdapter;
- } else if (o instanceof RepositoryRoot) {
- return rootAdapter;
- } else if (o instanceof ICVSRemoteFolder) {
- return folderAdapter;
- }
- return null;
- }
-
- /** (Non-javadoc)
- * Method declared on IAdapterFactory.
- */
- public Class[] getAdapterList() {
- return new Class[] {IWorkbenchAdapter.class, IPropertySource.class, IDeferredWorkbenchAdapter.class};
- }
- /**
- * Returns the property source for the given object. Caches
- * the result because the property sheet is extremely inefficient,
- * it asks for the source seven times in a row.
- */
- public Object getPropertySource(Object adaptableObject) {
- if (adaptableObject == cachedPropertyObject) {
- return cachedPropertyValue;
- }
- cachedPropertyObject = adaptableObject;
- if (adaptableObject instanceof ICVSRemoteFile) {
- cachedPropertyValue = new CVSRemoteFilePropertySource((ICVSRemoteFile)adaptableObject);
- } else if (adaptableObject instanceof ICVSRemoteFolder) {
- cachedPropertyValue = new CVSRemoteFolderPropertySource((ICVSRemoteFolder)adaptableObject);
- } else if (adaptableObject instanceof ICVSRepositoryLocation) {
- cachedPropertyValue = new CVSRepositoryLocationPropertySource((ICVSRepositoryLocation)adaptableObject);
- } else if (adaptableObject instanceof RepositoryRoot) {
- cachedPropertyValue = new CVSRepositoryLocationPropertySource(((RepositoryRoot)adaptableObject).getRoot());
- } else {
- cachedPropertyValue = null;
- }
- return cachedPropertyValue;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSModelElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSModelElement.java
deleted file mode 100644
index 6a8475dd2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSModelElement.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
-import org.eclipse.ui.progress.IElementCollector;
-
-public abstract class CVSModelElement implements IWorkbenchAdapter, IAdaptable {
-
- private IRunnableContext runnableContext;
- private IWorkingSet workingSet;
-
- public IWorkingSet getWorkingSet() {
- return workingSet;
- }
-
- public void setWorkingSet(IWorkingSet workingSet) {
- this.workingSet = workingSet;
- }
-
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class)
- return this;
- if ((adapter == IDeferredWorkbenchAdapter.class) && this instanceof IDeferredWorkbenchAdapter)
- return this;
- return null;
- }
-
- /**
- * Returns the runnableContext.
- * @return ITeamRunnableContext
- */
- public IRunnableContext getRunnableContext() {
- if (runnableContext == null) {
- return PlatformUI.getWorkbench().getProgressService();
- }
- return runnableContext;
- }
-
- /**
- * Sets the runnableContext.
- * @param runnableContext The runnableContext to set
- */
- public void setRunnableContext(IRunnableContext runnableContext) {
- this.runnableContext = runnableContext;
- }
-
- public Object[] getChildren(Object o) {
- return getChildren(o, true);
- }
-
- /**
- * Gets the children of the receiver by invoking the <code>internalGetChildren</code>.
- * A appropriate progress indicator will be used if requested.
- */
- protected Object[] getChildren(final Object o, boolean needsProgress) {
- try {
- if (needsProgress) {
- final Object[][] result = new Object[1][];
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- result[0] = CVSModelElement.this.fetchChildren(o, monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- };
- getRunnableContext().run(true /*fork*/, true /*cancelable*/, runnable);
- return result[0];
- } else {
- return fetchChildren(o, null);
- }
- } catch (InterruptedException e) {
- } catch (InvocationTargetException e) {
- handle(e);
- } catch (TeamException e) {
- handle(e);
- }
- return new Object[0];
- }
-
- abstract protected Object[] fetchChildren(Object o, IProgressMonitor monitor) throws TeamException;
-
- /**
- * Handle an exception that occurred in CVS model elements by displaying an error dialog.
- * @param title the title of the error dialog
- * @param description the description to be displayed
- * @param e the exception that occurred
- */
- protected void handle(final String title, final String description, final Throwable e) {
- CVSUIPlugin.openError(null, title, description, e, CVSUIPlugin.LOG_NONTEAM_EXCEPTIONS | CVSUIPlugin.PERFORM_SYNC_EXEC);
- }
-
- /**
- * Helper methed error handler that displayes a generic dialog title and message when displaying an error to the user.
- * @param t the exception that occurred.
- */
- protected void handle(Throwable t) {
- handle(Policy.bind("CVSModelElement.0"), Policy.bind("CVSModelElement.1"), t); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Handle an exception that occurred while fetching the children for a deferred workbench adapter.
- * @param collector the collector for the adapter
- * @param e the exception that occurred
- */
- protected void handle(IElementCollector collector, Throwable t) {
- // TODO: For now, just display a dialog (see bug 65008 and 65741)
- handle(t);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFilePropertySource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFilePropertySource.java
deleted file mode 100644
index 4067cea15..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFilePropertySource.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ILogEntry;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-
-public class CVSRemoteFilePropertySource implements IPropertySource {
- ICVSRemoteFile file;
- ILogEntry entry;
- boolean initialized;
-
- // Property Descriptors
- static protected IPropertyDescriptor[] propertyDescriptors = new IPropertyDescriptor[5];
- {
- PropertyDescriptor descriptor;
- String category = Policy.bind("cvs"); //$NON-NLS-1$
-
- // resource name
- descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_NAME, Policy.bind("CVSRemoteFilePropertySource.name")); //$NON-NLS-1$
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(category);
- propertyDescriptors[0] = descriptor;
- // revision
- descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_REVISION, Policy.bind("CVSRemoteFilePropertySource.revision")); //$NON-NLS-1$
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(category);
- propertyDescriptors[1] = descriptor;
- // date
- descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_DATE, Policy.bind("CVSRemoteFilePropertySource.date")); //$NON-NLS-1$
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(category);
- propertyDescriptors[2] = descriptor;
- // author
- descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_AUTHOR, Policy.bind("CVSRemoteFilePropertySource.author")); //$NON-NLS-1$
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(category);
- propertyDescriptors[3] = descriptor;
- // comment
- descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_COMMENT, Policy.bind("CVSRemoteFilePropertySource.comment")); //$NON-NLS-1$
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(category);
- propertyDescriptors[4] = descriptor;
- }
-
- /**
- * Create a PropertySource and store its file
- */
- public CVSRemoteFilePropertySource(ICVSRemoteFile file) {
- this.file = file;
- }
-
- /**
- * Do nothing because properties are read only.
- */
- public Object getEditableValue() {
- return this;
- }
-
- /**
- * Return the Property Descriptors for the receiver.
- */
- public IPropertyDescriptor[] getPropertyDescriptors() {
- return propertyDescriptors;
- }
-
- /*
- * @see IPropertySource#getPropertyValue(Object)
- */
- public Object getPropertyValue(Object id) {
- if (!initialized) {
- initialize();
- initialized = true;
- }
- if (id.equals(ICVSUIConstants.PROP_NAME)) {
- return file.getName();
- }
- if (entry != null) {
- if (id.equals(ICVSUIConstants.PROP_REVISION)) {
- return entry.getRevision();
- }
- if (id.equals(ICVSUIConstants.PROP_DATE)) {
- return entry.getDate();
- }
- if (id.equals(ICVSUIConstants.PROP_AUTHOR)) {
- return entry.getAuthor();
- }
- if (id.equals(ICVSUIConstants.PROP_COMMENT)) {
- return entry.getComment();
- }
- }
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Answer true if the value of the specified property
- * for this object has been changed from the default.
- */
- public boolean isPropertySet(Object property) {
- return false;
- }
- /**
- * Reset the specified property's value to its default value.
- * Do nothing because properties are read only.
- *
- * @param property The property to reset.
- */
- public void resetPropertyValue(Object property) {
- }
- /**
- * Do nothing because properties are read only.
- */
- public void setPropertyValue(Object name, Object value) {
- }
-
- private void initialize() {
- try {
- CVSUIPlugin.runWithProgress(null, true /*cancelable*/, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ILogEntry[] entries = file.getLogEntries(monitor);
- String revision = file.getRevision();
- for (int i = 0; i < entries.length; i++) {
- if (entries[i].getRevision().equals(revision)) {
- entry = entries[i];
- return;
- }
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InterruptedException e) { // ignore cancellation
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(null, null, null, e);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFolderPropertySource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFolderPropertySource.java
deleted file mode 100644
index 618d69ec3..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFolderPropertySource.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-
-public class CVSRemoteFolderPropertySource implements IPropertySource {
- ICVSRemoteFolder folder;
-
- // Property Descriptors
- static protected IPropertyDescriptor[] propertyDescriptors = new IPropertyDescriptor[2];
- {
- PropertyDescriptor descriptor;
- String category = Policy.bind("cvs"); //$NON-NLS-1$
-
- // resource name
- descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_NAME, Policy.bind("CVSRemoteFolderPropertySource.name")); //$NON-NLS-1$
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(category);
- propertyDescriptors[0] = descriptor;
- // tag
- descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_TAG, Policy.bind("CVSRemoteFolderPropertySource.tag")); //$NON-NLS-1$
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(category);
- propertyDescriptors[1] = descriptor;
- }
-
- /**
- * Create a PropertySource and store its file
- */
- public CVSRemoteFolderPropertySource(ICVSRemoteFolder folder) {
- this.folder = folder;
- }
-
- /**
- * Do nothing because properties are read only.
- */
- public Object getEditableValue() {
- return this;
- }
-
- /**
- * Return the Property Descriptors for the receiver.
- */
- public IPropertyDescriptor[] getPropertyDescriptors() {
- return propertyDescriptors;
- }
-
- /*
- * @see IPropertySource#getPropertyValue(Object)
- */
- public Object getPropertyValue(Object id) {
- if (id.equals(ICVSUIConstants.PROP_NAME)) {
- return folder.getName();
- }
- if (id.equals(ICVSUIConstants.PROP_TAG)) {
- CVSTag tag = folder.getTag();
- if (tag == null) {
- return Policy.bind("CVSRemoteFolderPropertySource.none"); //$NON-NLS-1$
- }
- return tag.getName();
- }
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Answer true if the value of the specified property
- * for this object has been changed from the default.
- */
- public boolean isPropertySet(Object property) {
- return false;
- }
- /**
- * Reset the specified property's value to its default value.
- * Do nothing because properties are read only.
- *
- * @param property The property to reset.
- */
- public void resetPropertyValue(Object property) {
- }
- /**
- * Do nothing because properties are read only.
- */
- public void setPropertyValue(Object name, Object value) {
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRepositoryLocationPropertySource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRepositoryLocationPropertySource.java
deleted file mode 100644
index e4c45de8a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRepositoryLocationPropertySource.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-
-public class CVSRepositoryLocationPropertySource implements IPropertySource {
- ICVSRepositoryLocation location;
-
- // Property Descriptors
- static protected IPropertyDescriptor[] propertyDescriptors = new IPropertyDescriptor[5];
- {
- PropertyDescriptor descriptor;
- String category = Policy.bind("cvs"); //$NON-NLS-1$
-
- // host
- descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_HOST, Policy.bind("CVSRepositoryLocationPropertySource.host")); //$NON-NLS-1$
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(category);
- propertyDescriptors[0] = descriptor;
- // user
- descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_USER, Policy.bind("CVSRepositoryLocationPropertySource.user")); //$NON-NLS-1$
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(category);
- propertyDescriptors[1] = descriptor;
- // port
- descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_PORT, Policy.bind("CVSRepositoryLocationPropertySource.port")); //$NON-NLS-1$
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(category);
- propertyDescriptors[2] = descriptor;
- // root
- descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_ROOT, Policy.bind("CVSRepositoryLocationPropertySource.root")); //$NON-NLS-1$
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(category);
- propertyDescriptors[3] = descriptor;
- // method
- descriptor = new PropertyDescriptor(ICVSUIConstants.PROP_METHOD, Policy.bind("CVSRepositoryLocationPropertySource.method")); //$NON-NLS-1$
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(category);
- propertyDescriptors[4] = descriptor;
- }
-
- /**
- * Create a PropertySource and store its file
- */
- public CVSRepositoryLocationPropertySource(ICVSRepositoryLocation location) {
- this.location = location;
- }
-
- /**
- * Do nothing because properties are read only.
- */
- public Object getEditableValue() {
- return this;
- }
-
- /**
- * Return the Property Descriptors for the receiver.
- */
- public IPropertyDescriptor[] getPropertyDescriptors() {
- return propertyDescriptors;
- }
-
- /*
- * @see IPropertySource#getPropertyValue(Object)
- */
- public Object getPropertyValue(Object id) {
- if (id.equals(ICVSUIConstants.PROP_HOST)) {
- return location.getHost();
- }
- if (id.equals(ICVSUIConstants.PROP_USER)) {
- return location.getUsername();
- }
- if (id.equals(ICVSUIConstants.PROP_METHOD)) {
- return location.getMethod().getName();
- }
- if (id.equals(ICVSUIConstants.PROP_ROOT)) {
- return location.getRootDirectory();
- }
- if (id.equals(ICVSUIConstants.PROP_PORT)) {
- int port = location.getPort();
- if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT) {
- return Policy.bind("CVSRepositoryLocationPropertySource.default"); //$NON-NLS-1$
- }
- return "" + port; //$NON-NLS-1$
- }
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Answer true if the value of the specified property
- * for this object has been changed from the default.
- */
- public boolean isPropertySet(Object property) {
- return false;
- }
- /**
- * Reset the specified property's value to its default value.
- * Do nothing because properties are read only.
- *
- * @param property The property to reset.
- */
- public void resetPropertyValue(Object property) {
- }
- /**
- * Do nothing because properties are read only.
- */
- public void setPropertyValue(Object name, Object value) {
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRepositoryRootElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRepositoryRootElement.java
deleted file mode 100644
index 6a36ee995..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRepositoryRootElement.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryRoot;
-
-/**
- * RemoteRootElement is the model element for a repository that
- * appears in the repositories view. Its children are:
- * a) HEAD
- * b) Branch tags category
- * c) Version tags category
- */
-public class CVSRepositoryRootElement extends CVSModelElement {
- public ImageDescriptor getImageDescriptor(Object object) {
- if (object instanceof ICVSRepositoryLocation || object instanceof RepositoryRoot) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_REPOSITORY);
- }
- return null;
- }
- public String getLabel(Object o) {
- if (o instanceof ICVSRepositoryLocation) {
- ICVSRepositoryLocation root = (ICVSRepositoryLocation)o;
- o = CVSUIPlugin.getPlugin().getRepositoryManager().getRepositoryRootFor(root);
- if (o == null) {
- return root.getLocation();
- }
- }
- if (o instanceof RepositoryRoot) {
- RepositoryRoot root = (RepositoryRoot)o;
- String name = root.getName();
- if (name == null)
- return root.getRoot().getLocation();
- else
- return name;
- }
- return null;
- }
- public Object getParent(Object o) {
- return null;
- }
- public Object[] fetchChildren(Object o, IProgressMonitor monitor) {
- ICVSRepositoryLocation location = null;
- if (o instanceof ICVSRepositoryLocation) {
- location = (ICVSRepositoryLocation)o;
- }
- if (o instanceof RepositoryRoot) {
- RepositoryRoot root = (RepositoryRoot)o;
- location = root.getRoot();
- }
- if (location == null) return null;
- return new Object[] {
- new CVSTagElement(CVSTag.DEFAULT, location),
- new BranchCategory(location),
- new VersionCategory(location),
- new DateTagCategory(location)
- };
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSResourceElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSResourceElement.java
deleted file mode 100644
index 6bf857197..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSResourceElement.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-public abstract class CVSResourceElement extends CVSModelElement implements IAdaptable {
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
- }
- /**
- * Initial implementation: return the resource's name
- */
- public String getLabel(Object o) {
- if (!(o instanceof ICVSResource)) return null;
- return ((ICVSResource)o).getName();
- }
- /**
- * Return null.
- */
- public Object getParent(Object o) {
- if (!(o instanceof ICVSResource)) return null;
- return null;
- }
-
- abstract public ICVSResource getCVSResource();
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSTagElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSTagElement.java
deleted file mode 100644
index dddebca71..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSTagElement.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-import java.lang.reflect.InvocationTargetException;
-import java.text.SimpleDateFormat;
-import java.util.*;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFolder;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.FetchMembersOperation;
-import org.eclipse.team.internal.ccvs.ui.operations.FetchMembersOperation.RemoteFolderFilter;
-import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
-import org.eclipse.ui.progress.IElementCollector;
-
-public class CVSTagElement extends CVSModelElement implements IDeferredWorkbenchAdapter {
- CVSTag tag;
- ICVSRepositoryLocation root;
-
- private static final String REPO_VIEW_LONG_FORAMT = "dd MMM yyyy HH:mm:ss"; //$NON-NLS-1$
- private static final String REPO_VIEW_SHORT_FORMAT = "dd MMM yyyy"; //$NON-NLS-1$
- private static final String TIME_ONLY_COLUMN_FORMAT = "HH:mm:ss"; //$NON-NLS-1$
- private static SimpleDateFormat localLongFormat = new SimpleDateFormat(REPO_VIEW_LONG_FORAMT,Locale.getDefault());
- private static SimpleDateFormat localShortFormat = new SimpleDateFormat(REPO_VIEW_SHORT_FORMAT,Locale.getDefault());
- private static SimpleDateFormat timeColumnFormat = new SimpleDateFormat(TIME_ONLY_COLUMN_FORMAT, Locale.getDefault());
-
- static synchronized public String toDisplayString(Date date){
- String localTime = timeColumnFormat.format(date);
- timeColumnFormat.setTimeZone(TimeZone.getDefault());
- if(localTime.equals("00:00:00")){ //$NON-NLS-1$
- return localShortFormat.format(date);
- }
- return localLongFormat.format(date);
- }
-
- public CVSTagElement(CVSTag tag, ICVSRepositoryLocation root) {
- this.tag = tag;
- this.root = root;
- }
-
- public ICVSRepositoryLocation getRoot() {
- return root;
- }
-
- public CVSTag getTag() {
- return tag;
- }
-
- public boolean equals(Object o) {
- if (!(o instanceof CVSTagElement))
- return false;
- CVSTagElement t = (CVSTagElement) o;
- if (!tag.equals(t.tag))
- return false;
- return root.equals(t.root);
- }
-
- public int hashCode() {
- return root.hashCode() ^ tag.hashCode();
- }
-
- public ImageDescriptor getImageDescriptor(Object object) {
- if (!(object instanceof CVSTagElement))
- return null;
- if (tag.getType() == CVSTag.BRANCH || tag.getType() == CVSTag.HEAD) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(
- ICVSUIConstants.IMG_TAG);
- } else if (tag.getType() == CVSTag.VERSION) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(
- ICVSUIConstants.IMG_PROJECT_VERSION);
- } else {
- // This could be a Date tag
- return CVSUIPlugin.getPlugin().getImageDescriptor(
- ICVSUIConstants.IMG_DATE);
- }
- }
- public String getLabel(Object o) {
- if (!(o instanceof CVSTagElement))
- return null;
- CVSTag aTag = ((CVSTagElement) o).tag;
- if(aTag.getType() == CVSTag.DATE){
- Date date = tag.asDate();
- if (date != null){
- return toDisplayString(date);
- }
- }
- return aTag.getName();
- }
-
- public String toString() {
- return tag.getName();
- }
-
- public Object getParent(Object o) {
- if (!(o instanceof CVSTagElement))
- return null;
- return ((CVSTagElement) o).root;
- }
-
- protected Object[] fetchChildren(Object o, IProgressMonitor monitor) throws TeamException {
- ICVSRemoteResource[] children = CVSUIPlugin.getPlugin().getRepositoryManager().getFoldersForTag(root, tag, monitor);
- if (getWorkingSet() != null)
- children = CVSUIPlugin.getPlugin().getRepositoryManager().filterResources(getWorkingSet(), children);
- return children;
- }
-
- public void fetchDeferredChildren(Object o, IElementCollector collector, IProgressMonitor monitor) {
- if (tag.getType() == CVSTag.HEAD || tag.getType() == CVSTag.DATE) {
- try {
- monitor = Policy.monitorFor(monitor);
- RemoteFolder folder = new RemoteFolder(null, root, ICVSRemoteFolder.REPOSITORY_ROOT_FOLDER_NAME, tag);
- monitor.beginTask(Policy.bind("RemoteFolderElement.fetchingRemoteChildren", root.toString()), 100); //$NON-NLS-1$
- FetchMembersOperation operation = new FetchMembersOperation(null, folder, collector);
- operation.setFilter(new RemoteFolderFilter() {
- public ICVSRemoteResource[] filter(ICVSRemoteResource[] folders) {
- return CVSUIPlugin.getPlugin().getRepositoryManager().filterResources(getWorkingSet(), folders);
- }
- });
- operation.run(Policy.subMonitorFor(monitor, 100));
- } catch (final InvocationTargetException e) {
- handle(collector, e);
- } catch (InterruptedException e) {
- // Cancelled by the user;
- } finally {
- monitor.done();
- }
- } else {
- try {
- collector.add(fetchChildren(o, monitor), monitor);
- } catch (TeamException e) {
- handle(collector, e);
- }
- }
- }
-
- public ISchedulingRule getRule(Object element) {
- return new RepositoryLocationSchedulingRule(root); //$NON-NLS-1$
- }
-
- public boolean isContainer() {
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/DateTagCategory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/DateTagCategory.java
deleted file mode 100644
index ec08b51f2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/DateTagCategory.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-/**
- * The DateTagCategory is the parent of all the date tags in the repositories view.
- */
-public class DateTagCategory extends TagCategory {
-
- public DateTagCategory(ICVSRepositoryLocation repository) {
- super(repository);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.model.TagCategory#getTags(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected CVSTag[] getTags(IProgressMonitor monitor) throws CVSException {
- return CVSUIPlugin.getPlugin().getRepositoryManager().getRepositoryRootFor(repository).getDateTags();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_DATES_CATEGORY);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
- */
- public String getLabel(Object o) {
- return Policy.bind("DateTagCategory.0"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.model.TagCategory#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- if (adapter.equals(ICVSRepositoryLocation.class)) {
- return getRepository(null);
- }
- return super.getAdapter(adapter);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/GroupedByVersionCategory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/GroupedByVersionCategory.java
deleted file mode 100644
index b44805524..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/GroupedByVersionCategory.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFolder;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-public class GroupedByVersionCategory extends CVSModelElement implements IAdaptable {
- private ICVSRepositoryLocation repository;
-
- /**
- * ProjectVersionsCategory constructor.
- */
- public GroupedByVersionCategory(ICVSRepositoryLocation repo) {
- super();
- this.repository = repo;
- }
-
- /**
- * Returns an object which is an instance of the given class
- * associated with this object. Returns <code>null</code> if
- * no such object can be found.
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
- }
-
- /**
- * Returns the children of this object. When this object
- * is displayed in a tree, the returned objects will be this
- * element's children. Returns an empty enumeration if this
- * object has no children.
- *
- * XXX This method looks wrong to me somehow
- */
- public Object[] fetchChildren(Object o, IProgressMonitor monitor) {
- //String -> CTags[]
- Map mappings = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownProjectsAndVersions(repository);
- Map remoteVersionModules = new HashMap();
- for (Iterator it = mappings.keySet().iterator(); it.hasNext();) {
- String project = (String) it.next();
- CVSTag[] versions = (CVSTag[])((HashSet)mappings.get(project)).toArray(new CVSTag[0]);
- for (int i = 0; i < versions.length; i++) {
- CVSTag tag = versions[i];
- RemoteVersionModule module = (RemoteVersionModule)remoteVersionModules.get(tag);
- if(module==null) {
- module = new RemoteVersionModule(tag, this);
- remoteVersionModules.put(tag, module);
- }
- module.addProject(new RemoteFolder(null, repository, project, tag));
- }
- }
- return (RemoteVersionModule[])remoteVersionModules.values().toArray(new RemoteVersionModule[0]);
- }
-
- /**
- * Returns an image descriptor to be used for displaying an object in the workbench.
- * Returns null if there is no appropriate image.
- *
- * @param object The object to get an image descriptor for.
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_VERSIONS_CATEGORY);
- }
-
- /**
- * Returns the name of this element. This will typically
- * be used to assign a label to this object when displayed
- * in the UI. Returns an empty string if there is no appropriate
- * name for this object.
- *
- * @param object The object to get a label for.
- */
- public String getLabel(Object o) {
- return Policy.bind("GroupedByVersionCategory.Versions_1"); //$NON-NLS-1$
- }
-
- /**
- * Returns the logical parent of the given object in its tree.
- * Returns null if there is no parent, or if this object doesn't
- * belong to a tree.
- *
- * @param object The object to get the parent for.
- */
- public Object getParent(Object o) {
- return repository;
- }
-
- /**
- * Return the repository the given element belongs to.
- */
- public ICVSRepositoryLocation getRepository(Object o) {
- return repository;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/ModulesCategory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/ModulesCategory.java
deleted file mode 100644
index b50274e0b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/ModulesCategory.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * ModulesCategory is the model element for the mdoules category
- * for a particular repository. Its children are the array of all
- * modules defined in the CVSROOT/Modules file
- */
-public class ModulesCategory extends CVSModelElement implements IAdaptable {
- private ICVSRepositoryLocation repository;
-
- public ModulesCategory(ICVSRepositoryLocation repository) {
- super();
- this.repository = repository;
- }
-
- /**
- * Returns an object which is an instance of the given class
- * associated with this object. Returns <code>null</code> if
- * no such object can be found.
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
- }
-
- /**
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
- */
- public Object[] fetchChildren(Object o, IProgressMonitor monitor) throws TeamException {
- return repository.members(CVSTag.DEFAULT, true /* module definitions */, monitor);
- }
-
- /**
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_PROJECT_VERSION);
- }
-
- /**
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
- */
- public String getLabel(Object o) {
- return Policy.bind("ModulesCategory.label"); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
- */
- public Object getParent(Object o) {
- return repository;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.model.CVSModelElement#isRemoteElement()
- */
- public boolean isRemoteElement() {
- return true;
- }
-
- /**
- * Returns the repository.
- * @return ICVSRepositoryLocation
- */
- public ICVSRepositoryLocation getRepository() {
- return repository;
- }
-
- public String toString() {
- return getRepository().toString() + " (modules)"; //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteContentProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteContentProvider.java
deleted file mode 100644
index ed617d0b7..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteContentProvider.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteResource;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryRoot;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.progress.DeferredTreeContentManager;
-
-/**
- * Extension to the generic workbench content provider mechanism
- * to lazily determine whether an element has children. That is,
- * children for an element aren't fetched until the user clicks
- * on the tree expansion box.
- */
-public class RemoteContentProvider extends WorkbenchContentProvider {
-
- IWorkingSet workingSet;
- DeferredTreeContentManager manager;
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (viewer instanceof AbstractTreeViewer) {
- manager = new DeferredTreeContentManager(this, (AbstractTreeViewer) viewer);
- }
- super.inputChanged(viewer, oldInput, newInput);
- }
-
- public boolean hasChildren(Object element) {
- // the + box will always appear, but then disappear
- // if not needed after you first click on it.
- if (element instanceof ICVSRemoteResource) {
- if (element instanceof ICVSRemoteFolder) {
- return ((ICVSRemoteFolder) element).isExpandable();
- }
- return ((ICVSRemoteResource) element).isContainer();
- } else if (element instanceof CVSResourceElement) {
- ICVSResource r = ((CVSResourceElement) element).getCVSResource();
- if (r instanceof RemoteResource) {
- return r.isFolder();
- }
- } else if (element instanceof VersionCategory) {
- return true;
- } else if (element instanceof BranchCategory) {
- return true;
- } else if (element instanceof ModulesCategory) {
- return true;
- } else if (element instanceof CVSTagElement) {
- return true;
- } else if (element instanceof RemoteModule) {
- return true;
- }
- if (manager != null) {
- if (manager.isDeferredAdapter(element))
- return manager.mayHaveChildren(element);
- }
-
- return super.hasChildren(element);
- }
-
- /**
- * Sets the workingSet.
- * @param workingSet The workingSet to set
- */
- public void setWorkingSet(IWorkingSet workingSet) {
- this.workingSet = workingSet;
- }
-
- /**
- * Returns the workingSet.
- * @return IWorkingSet
- */
- public IWorkingSet getWorkingSet() {
- return workingSet;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.WorkbenchContentProvider#getChildren(java.lang.Object)
- */
- public Object[] getChildren(Object element) {
- if (manager != null) {
- Object[] children = manager.getChildren(element);
- if (children != null) {
- // This will be a placeholder to indicate
- // that the real children are being fetched
- return children;
- }
- }
- Object[] children = super.getChildren(element);
- for (int i = 0; i < children.length; i++) {
- Object object = children[i];
- if (object instanceof CVSModelElement)
- ((CVSModelElement)object).setWorkingSet(getWorkingSet());
- }
- return children;
- }
-
- public void cancelJobs(RepositoryRoot[] roots) {
- if (manager != null) {
- for (int i = 0; i < roots.length; i++) {
- RepositoryRoot root = roots[i];
- cancelJobs(root.getRoot());
- }
- }
- }
-
- /**
- * Cancel any jobs that are fetching content from the given location.
- * @param location
- */
- public void cancelJobs(ICVSRepositoryLocation location) {
- if (manager != null) {
- manager.cancel(location);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteFileElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteFileElement.java
deleted file mode 100644
index 5c20e22fb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteFileElement.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.PlatformUI;
-
-public class RemoteFileElement extends RemoteResourceElement {
- /**
- * Initial implementation: return null;
- */
- public Object[] fetchChildren(Object o, IProgressMonitor monitor) {
- return new Object[0];
- }
- /**
- * Initial implementation: return null.
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- if (!(object instanceof ICVSRemoteFile)) return null;
- return PlatformUI.getWorkbench().getEditorRegistry().getImageDescriptor(((ICVSRemoteFile)object).getName());
- }
- /**
- * Initial implementation: return the file's name and version
- */
- public String getLabel(Object o) {
- if (!(o instanceof ICVSRemoteFile)) return null;
- ICVSRemoteFile file = (ICVSRemoteFile)o;
- try {
- return Policy.bind("nameAndRevision", file.getName(), file.getRevision()); //$NON-NLS-1$
- } catch (TeamException e) {
- handle(null, null, e);
- return null;
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteFolderElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteFolderElement.java
deleted file mode 100644
index d999ff0ae..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteFolderElement.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui.model;
-import java.lang.reflect.InvocationTargetException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.FetchMembersOperation;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
-import org.eclipse.ui.progress.IElementCollector;
-
-public class RemoteFolderElement extends RemoteResourceElement implements IDeferredWorkbenchAdapter {
-
- /**
- * Overridden to append the version name to remote folders which
- * have version tags and are top-level folders.
- */
- public String getLabel(Object o) {
- if (!(o instanceof ICVSRemoteFolder))
- return null;
- ICVSRemoteFolder folder = (ICVSRemoteFolder) o;
- CVSTag tag = folder.getTag();
- if (tag != null && tag.getType() != CVSTag.HEAD) {
- if (folder.getRemoteParent() == null) {
- return Policy.bind("RemoteFolderElement.nameAndTag", folder.getName(), tag.getName()); //$NON-NLS-1$
- }
- }
- return folder.getName();
- }
-
- public ImageDescriptor getImageDescriptor(Object object) {
- if (!(object instanceof ICVSRemoteFolder))
- return null;
- ICVSRemoteFolder folder = (ICVSRemoteFolder) object;
- if (folder.isDefinedModule()) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_MODULE);
- }
- return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
- }
-
- public Object[] fetchChildren(Object o, IProgressMonitor monitor) throws TeamException {
- if (!(o instanceof ICVSRemoteFolder))
- return new Object[0];
- return ((ICVSRemoteFolder) o).members(monitor);
- }
-
- public void fetchDeferredChildren(Object o, IElementCollector collector, IProgressMonitor monitor) {
- // If it's not a folder, return an empty array
- if (!(o instanceof ICVSRemoteFolder)) {
- collector.add(new Object[0], monitor);
- }
- try {
- monitor = Policy.monitorFor(monitor);
- monitor.beginTask(Policy.bind("RemoteFolderElement.fetchingRemoteChildren", getLabel(o)), 100); //$NON-NLS-1$
- FetchMembersOperation operation = new FetchMembersOperation(null, (ICVSRemoteFolder)o, collector);
- operation.run(Policy.subMonitorFor(monitor, 100));
- } catch (InvocationTargetException e) {
- handle(collector, e);
- } catch (InterruptedException e) {
- // Cancelled by the user;
- } finally {
- monitor.done();
- }
- }
-
- public ISchedulingRule getRule(Object element) {
- ICVSRepositoryLocation location = getRepositoryLocation(element);
- return new RepositoryLocationSchedulingRule(location); //$NON-NLS-1$
- }
-
- private ICVSRepositoryLocation getRepositoryLocation(Object o) {
- if (!(o instanceof ICVSRemoteFolder))
- return null;
- return ((ICVSRemoteFolder)o).getRepository();
- }
-
- public boolean isContainer() {
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteModule.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteModule.java
deleted file mode 100644
index ffa796cbc..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteModule.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
-import org.eclipse.ui.progress.IElementCollector;
-
-/**
- * This class represents an IProject resource in a repository. The children of a
- * RemoteModule are its versions. A RemoteModule is a child of the
- * VersionsCategory.
- */
-public class RemoteModule extends CVSModelElement implements IAdaptable,
- IDeferredWorkbenchAdapter {
- ICVSRemoteFolder folder;
-
- VersionCategory parent;
-
- /**
- * RemoteProject constructor.
- */
- public RemoteModule(ICVSRemoteFolder folder, VersionCategory parent) {
- this.folder = folder;
- this.parent = parent;
- }
-
- /**
- * Returns an object which is an instance of the given class associated with
- * this object. Returns <code>null</code> if no such object can be found.
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class)
- return this;
- if (adapter == IDeferredWorkbenchAdapter.class)
- return this;
- return null;
- }
-
- /**
- * Returns an image to be used for displaying an object in the desktop.
- *
- * @param object The object to get an image for.
- * @param owner The viewer that the image will be used in. The image will be
- * disposed when this viewer is closed. If the owner is null, a
- * new image is returned, and the caller is responsible for
- * disposing it.
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(
- ICVSUIConstants.IMG_PROJECT_VERSION);
- }
-
- /**
- * Returns the name of this element. This will typically be used to assign a
- * label to this object when displayed in the UI.
- */
- public String getLabel(Object o) {
- return folder.getName();
- }
-
- /**
- * Returns the logical parent of the given object in its tree.
- */
- public Object getParent(Object o) {
- return parent;
- }
-
- /**
- * Return the repository the given element belongs to.
- */
- public ICVSRepositoryLocation getRepository(Object o) {
- return folder.getRepository();
- }
-
- /**
- * (Non-javadoc) For debugging purposes only.
- */
- public String toString() {
- return "RemoteModule(" + folder.getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public ICVSRemoteResource getCVSResource() {
- return folder;
- }
-
- /**
- * Returns the children of this object. When this object is displayed in a
- * tree, the returned objects will be this element's children. Returns an
- * empty enumeration if this object has no children. The children of the
- * RemoteModule are the versions for that module.
- *
- * @see org.eclipse.team.internal.ccvs.ui.model.CVSModelElement#internalGetChildren(java.lang.Object,
- * org.eclipse.core.runtime.IProgressMonitor)
- */
- public Object[] fetchChildren(Object o, IProgressMonitor monitor)
- throws TeamException {
- RepositoryManager manager = CVSUIPlugin.getPlugin()
- .getRepositoryManager();
- try {
- manager.refreshDefinedTags(folder, false /* recurse */, false /* notify */, monitor);
- } catch (TeamException e) {
- // continue
- }
- CVSTag[] tags = CVSUIPlugin.getPlugin().getRepositoryManager()
- .getKnownTags(folder, CVSTag.VERSION);
- Object[] versions = new Object[tags.length];
- for (int i = 0; i < versions.length; i++) {
- versions[i] = folder.forTag(tags[i]);
- }
- return versions;
- }
-
- public void fetchDeferredChildren(Object o, IElementCollector collector,
- IProgressMonitor monitor) {
- try {
- collector.add(fetchChildren(o, monitor), monitor);
- } catch (TeamException e) {
- handle(collector, e);
- }
- }
-
- public boolean isContainer() {
- return true;
- }
-
- public ISchedulingRule getRule(Object element) {
- return new RepositoryLocationSchedulingRule(folder.getRepository()); //$NON-NLS-1$
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteProjectsElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteProjectsElement.java
deleted file mode 100644
index 3f75d89c0..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteProjectsElement.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-
-/**
- * This model element provides the remote projects for a given repository and
- * tag.
- */
-public class RemoteProjectsElement extends CVSTagElement {
-
- /**
- * Constructor for RemoteProjectsElement.
- */
- public RemoteProjectsElement() {
- super(CVSTag.DEFAULT, null);
- }
-
- /**
- * Constructor for RemoteProjectsElement.
- */
- public RemoteProjectsElement(ICVSRepositoryLocation root) {
- super(CVSTag.DEFAULT, root);
- }
-
- /**
- * Sets the root.
- * @param root The root to set
- */
- public void setRoot(ICVSRepositoryLocation root) {
- this.root = root;
- }
-
- /**
- * Sets the tag.
- * @param tag The tag to set
- */
- public void setTag(CVSTag tag) {
- this.tag = tag;
- }
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object o) {
- if (!(o instanceof RemoteProjectsElement)) return false;
- RemoteProjectsElement element = (RemoteProjectsElement)o;
- if (root == null) {
- return element.root == null && tag.equals(element.tag);
- }
- return super.equals(o);
- }
-
- /**
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
- */
- public Object getParent(Object o) {
- return null;
- }
-
- /**
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- if (root == null) return tag.hashCode();
- return super.hashCode();
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.model.CVSModelElement#internalGetChildren(java.lang.Object, org.eclipse.core.runtime.IProgressMonitor)
- */
- public Object[] fetchChildren(Object o, IProgressMonitor monitor) throws TeamException {
- if (root == null) return new Object[0];
- return super.fetchChildren(o, monitor);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteResourceElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteResourceElement.java
deleted file mode 100644
index c70214163..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteResourceElement.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-
-public abstract class RemoteResourceElement extends CVSModelElement {
- /**
- * Initial implementation: return the resource's name
- */
- public String getLabel(Object o) {
- if (!(o instanceof ICVSRemoteResource)) return null;
- return ((ICVSRemoteResource)o).getName();
- }
- /**
- * Return null.
- */
- public Object getParent(Object o) {
- if (!(o instanceof ICVSRemoteResource)) return null;
- ICVSRemoteResource rr = (ICVSRemoteResource)o;
- return rr.getParent();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteVersionModule.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteVersionModule.java
deleted file mode 100644
index d81650861..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteVersionModule.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * This class represents an IProject resource in a repository. The
- * children of a RemoteModule are its versions. A RemoteModule is
- * a child of the VersionsCategory.
- */
-public class RemoteVersionModule extends CVSModelElement implements IAdaptable {
- CVSTag tag;
- List projects = new ArrayList();
- GroupedByVersionCategory parent;
-
- /**
- * RemoteProject constructor.
- */
- public RemoteVersionModule(CVSTag tag, GroupedByVersionCategory parent) {
- this.tag = tag;
- this.parent = parent;
- }
-
- /**
- * Returns an object which is an instance of the given class
- * associated with this object. Returns <code>null</code> if
- * no such object can be found.
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
- }
-
- public void addProject(ICVSRemoteFolder project) {
- projects.add(project);
- }
-
- /**
- * Returns the children of this object. When this object
- * is displayed in a tree, the returned objects will be this
- * element's children. Returns an empty enumeration if this
- * object has no children. The children of the RemoteModule
- * are the versions for that module.
- */
- public Object[] fetchChildren(Object o, IProgressMonitor monitor) {
- return (ICVSRemoteFolder[]) projects.toArray(new ICVSRemoteFolder[projects.size()]);
- }
-
- /**
- * Returns an image to be used for displaying an object in the desktop.
- * @param object The object to get an image for.
- * @param owner The viewer that the image will be used in. The image will
- * be disposed when this viewer is closed. If the owner is null, a new
- * image is returned, and the caller is responsible for disposing it.
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_PROJECT_VERSION);
- }
-
- /**
- * Returns the name of this element. This will typically
- * be used to assign a label to this object when displayed
- * in the UI.
- */
- public String getLabel(Object o) {
- return tag.getName();
- }
-
- /**
- * Returns the logical parent of the given object in its tree.
- */
- public Object getParent(Object o) {
- return parent;
- }
-
-
- /** (Non-javadoc)
- * For debugging purposes only.
- */
- public String toString() {
- return "RemoteVersionModule(" + tag.getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RepositoryLocationSchedulingRule.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RepositoryLocationSchedulingRule.java
deleted file mode 100644
index 94228114f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RepositoryLocationSchedulingRule.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-
-/**
- * A simple job scheduling rule for serializing jobs for an ICVSRepositoryLocation
- */
-public class RepositoryLocationSchedulingRule implements ISchedulingRule {
- ICVSRepositoryLocation location;
- public RepositoryLocationSchedulingRule(ICVSRepositoryLocation location) {
- this.location = location;
- }
- public boolean isConflicting(ISchedulingRule rule) {
- if(rule instanceof RepositoryLocationSchedulingRule) {
- return ((RepositoryLocationSchedulingRule)rule).location.equals(location);
- }
- return false;
- }
- public boolean contains(ISchedulingRule rule) {
- return isConflicting(rule);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/TagCategory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/TagCategory.java
deleted file mode 100644
index 666dd0978..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/TagCategory.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * This class provides common behavior between the branch and date tag categories
- */
-public abstract class TagCategory extends CVSModelElement {
- protected ICVSRepositoryLocation repository;
-
- public TagCategory(ICVSRepositoryLocation repository) {
- this.repository = repository;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.model.CVSModelElement#fetchChildren(java.lang.Object, org.eclipse.core.runtime.IProgressMonitor)
- */
- public Object[] fetchChildren(Object o, IProgressMonitor monitor) throws CVSException {
- CVSTag[] tags = getTags(monitor);
- CVSTagElement[] elements = new CVSTagElement[tags.length];
- for (int i = 0; i < tags.length; i++) {
- elements[i] = new CVSTagElement(tags[i], repository);
- }
- return elements;
- }
-
- /**
- * Return the tags that are to be displyed as children of this category
- * @param monitor
- * @return
- */
- protected abstract CVSTag[] getTags(IProgressMonitor monitor) throws CVSException;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
- */
- public Object getParent(Object o) {
- return repository;
- }
-
- /**
- * Return the repository the given element belongs to.
- */
- public ICVSRepositoryLocation getRepository(Object o) {
- return repository;
- }
-
- /**
- * Returns an object which is an instance of the given class
- * associated with this object. Returns <code>null</code> if
- * no such object can be found.
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/VersionCategory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/VersionCategory.java
deleted file mode 100644
index f629351da..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/VersionCategory.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
-import org.eclipse.ui.progress.IElementCollector;
-
-public class VersionCategory extends CVSModelElement implements IAdaptable,
- IDeferredWorkbenchAdapter {
- private ICVSRepositoryLocation repository;
-
- /**
- * ProjectVersionsCategory constructor.
- */
- public VersionCategory(ICVSRepositoryLocation repo) {
- super();
- this.repository = repo;
- }
-
- /**
- * Returns an object which is an instance of the given class associated with
- * this object. Returns <code>null</code> if no such object can be found.
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class)
- return this;
- if (adapter == IDeferredWorkbenchAdapter.class)
- return this;
- return null;
- }
-
- /**
- * Returns the children of this object. When this object is displayed in a
- * tree, the returned objects will be this element's children. Returns an
- * empty enumeration if this object has no children.
- */
- public Object[] fetchChildren(Object o, IProgressMonitor monitor)
- throws TeamException {
- if (CVSUIPlugin.getPlugin().getRepositoryManager()
- .isDisplayingProjectVersions(repository)) {
- return getProjectVersionChildren(o, monitor);
- } else {
- return getVersionTagChildren(o, monitor);
- }
- }
-
- /*
- * Return the children as a list of versions whose children are projects
- */
- private Object[] getVersionTagChildren(Object o, IProgressMonitor monitor)
- throws CVSException {
- CVSTag[] tags = CVSUIPlugin.getPlugin().getRepositoryManager()
- .getKnownTags(repository, getWorkingSet(), CVSTag.VERSION, monitor);
- CVSTagElement[] versionElements = new CVSTagElement[tags.length];
- for (int i = 0; i < tags.length; i++) {
- versionElements[i] = new CVSTagElement(tags[i], repository);
- }
- return versionElements;
- }
-
- /*
- * Return the children as a list of projects whose children ar project
- * versions
- */
- private Object[] getProjectVersionChildren(Object o,
- IProgressMonitor monitor) throws TeamException {
-
- ICVSRemoteResource[] resources = CVSUIPlugin.getPlugin()
- .getRepositoryManager().getFoldersForTag(repository,
- CVSTag.DEFAULT, monitor);
- if (getWorkingSet() != null)
- resources = CVSUIPlugin.getPlugin().getRepositoryManager()
- .filterResources(getWorkingSet(), resources);
- Object[] modules = new Object[resources.length];
- for (int i = 0; i < resources.length; i++) {
- modules[i] = new RemoteModule((ICVSRemoteFolder) resources[i],
- VersionCategory.this);
- }
- return modules;
- }
-
- /**
- * Returns an image descriptor to be used for displaying an object in the
- * workbench. Returns null if there is no appropriate image.
- *
- * @param object The object to get an image descriptor for.
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(
- ICVSUIConstants.IMG_VERSIONS_CATEGORY);
- }
-
- /**
- * Returns the name of this element. This will typically be used to assign a
- * label to this object when displayed in the UI. Returns an empty string if
- * there is no appropriate name for this object.
- *
- * @param object The object to get a label for.
- */
- public String getLabel(Object o) {
- return Policy.bind("VersionCategory.Versions_1"); //$NON-NLS-1$
- }
-
- /**
- * Returns the logical parent of the given object in its tree. Returns null
- * if there is no parent, or if this object doesn't belong to a tree.
- *
- * @param object The object to get the parent for.
- */
- public Object getParent(Object o) {
- return repository;
- }
-
- /**
- * Return the repository the given element belongs to.
- */
- public ICVSRepositoryLocation getRepository(Object o) {
- return repository;
- }
-
- public void fetchDeferredChildren(Object o, IElementCollector collector,
- IProgressMonitor monitor) {
- try {
- collector.add(fetchChildren(o, monitor), monitor);
- } catch (TeamException e) {
- handle(collector, e);
- }
- }
-
- public boolean isContainer() {
- return true;
- }
-
- public ISchedulingRule getRule(Object element) {
- return new RepositoryLocationSchedulingRule(repository); //$NON-NLS-1$
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/AddOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/AddOperation.java
deleted file mode 100644
index 6164e3cd5..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/AddOperation.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Session;
-import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Performs a "cvs add"
- */
-public class AddOperation extends RepositoryProviderOperation {
-
- public AddOperation(IWorkbenchPart part, IResource[] resources) {
- super(part, resources);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(CVSTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws CVSException, InterruptedException {
- add(provider, resources, IResource.DEPTH_INFINITE, monitor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return Policy.bind("AddAction.adding"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
- */
- protected String getTaskName(CVSTeamProvider provider) {
- return Policy.bind("AddOperation.0", provider.getProject().getName()); //$NON-NLS-1$
- }
-
- /*
- * Add the given resources to the project.
- * <p>
- * The sematics follow that of CVS in the sense that any folders
- * being added are created remotely as a result of this operation
- * while files are created remotely on the next commit.
- * </p>
- * <p>
- * This method uses the team file type registry to determine the type
- * of added files. If the extension of the file is not in the registry,
- * the file is assumed to be binary.
- * </p>
- * <p>
- * NOTE: for now we do three operations: one each for folders, text files and binary files.
- * We should optimize this when time permits to either use one operations or defer server
- * contact until the next commit.
- * </p>
- *
- * <p>
- * There are special semantics for adding the project itself to the repo. In this case, the project
- * must be included in the resources array.
- * </p>
- */
- private void add(CVSTeamProvider provider, IResource[] resources, int depth, IProgressMonitor progress) throws CVSException {
-
- // Visit the children of the resources using the depth in order to
- // determine which folders, text files and binary files need to be added
- // A TreeSet is needed for the folders so they are in the right order (i.e. parents created before children)
- final SortedSet folders = new TreeSet();
- // Sets are required for the files to ensure that files will not appear twice if there parent was added as well
- // and the depth isn't zero
- final Map /* from KSubstOption to Set */ files = new HashMap();
- final CVSException[] eHolder = new CVSException[1];
- for (int i=0; i<resources.length; i++) {
-
- final IResource currentResource = resources[i];
-
- try {
- // Auto-add parents if they are not already managed
- IContainer parent = currentResource.getParent();
- ICVSResource cvsParentResource = CVSWorkspaceRoot.getCVSResourceFor(parent);
- while (parent.getType() != IResource.ROOT && parent.getType() != IResource.PROJECT && ! isManaged(cvsParentResource)) {
- folders.add(cvsParentResource);
- parent = parent.getParent();
- cvsParentResource = cvsParentResource.getParent();
- }
-
- // Auto-add children
- final TeamException[] exception = new TeamException[] { null };
- currentResource.accept(new IResourceVisitor() {
- public boolean visit(IResource resource) {
- try {
- ICVSResource mResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- // Add the resource is its not already managed and it was either
- // added explicitly (is equal currentResource) or is not ignored
- if (! isManaged(mResource) && (currentResource.equals(resource) || ! mResource.isIgnored())) {
- if (resource.getType() == IResource.FILE) {
- KSubstOption ksubst = KSubstOption.fromFile((IFile) resource);
- Set set = (Set) files.get(ksubst);
- if (set == null) {
- set = new HashSet();
- files.put(ksubst, set);
- }
- set.add(mResource);
- } else {
- folders.add(mResource);
- }
- }
- // Always return true and let the depth determine if children are visited
- return true;
- } catch (CVSException e) {
- exception[0] = e;
- return false;
- }
- }
- }, depth, false);
- if (exception[0] != null) {
- throw exception[0];
- }
- } catch (CoreException e) {
- throw new CVSException(new Status(IStatus.ERROR, CVSProviderPlugin.ID, TeamException.UNABLE, Policy.bind("CVSTeamProvider.visitError", new Object[] {resources[i].getFullPath()}), e)); //$NON-NLS-1$
- }
- }
- // If an exception occured during the visit, throw it here
- if (eHolder[0] != null)
- throw eHolder[0];
-
- // Add the folders, followed by files!
- progress.beginTask(null, files.size() * 10 + (folders.isEmpty() ? 0 : 10));
- try {
- if (!folders.isEmpty()) {
- Session session = new Session(getRemoteLocation(provider), getLocalRoot(provider), true /* output to console */);
- session.open(Policy.subMonitorFor(progress, 2), true /* open for modification */);
- try {
- IStatus status = Command.ADD.execute(
- session,
- Command.NO_GLOBAL_OPTIONS,
- Command.NO_LOCAL_OPTIONS,
- (ICVSResource[])folders.toArray(new ICVSResource[folders.size()]),
- null,
- Policy.subMonitorFor(progress, 8));
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- throw new CVSServerException(status);
- }
- } finally {
- session.close();
- }
- }
- for (Iterator it = files.entrySet().iterator(); it.hasNext();) {
- Map.Entry entry = (Map.Entry) it.next();
- final KSubstOption ksubst = (KSubstOption) entry.getKey();
- final Set set = (Set) entry.getValue();
- Session session = new Session(getRemoteLocation(provider), getLocalRoot(provider), true /* output to console */);
- session.open(Policy.subMonitorFor(progress, 2), true /* open for modification */);
- try {
- IStatus status = Command.ADD.execute(
- session,
- Command.NO_GLOBAL_OPTIONS,
- new LocalOption[] { ksubst },
- (ICVSResource[])set.toArray(new ICVSResource[set.size()]),
- null,
- Policy.subMonitorFor(progress, 8));
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- throw new CVSServerException(status);
- }
- } finally {
- session.close();
- }
- }
- } finally {
- progress.done();
- }
- }
-
- /*
- * Consider a folder managed only if it's also a CVS folder
- */
- private boolean isManaged(ICVSResource cvsResource) throws CVSException {
- return cvsResource.isManaged() && (!cvsResource.isFolder() || ((ICVSFolder)cvsResource).isCVSFolder());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getErrorMessage(org.eclipse.core.runtime.IStatus[], int)
- */
- protected String getErrorMessage(IStatus[] failures, int totalOperations) {
- return Policy.bind("AddAction.addFailed"); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java
deleted file mode 100644
index a64454789..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.ICVSResourceVisitor;
-import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Session;
-import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.team.internal.ccvs.ui.tags.BranchPromptDialog;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Perform a CVS branch operaiton
- */
-public class BranchOperation extends RepositoryProviderOperation {
-
- private boolean update;
- private CVSTag rootVersionTag;
- private CVSTag branchTag;
-
- public BranchOperation(IWorkbenchPart part, IResource[] resources) {
- super(part, resources);
- }
-
- public void setTags(CVSTag rootVersionTag, CVSTag branchTag, boolean updateToBranch) {
- this.rootVersionTag = rootVersionTag;
- this.branchTag = branchTag;
- this.update = updateToBranch;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#shouldRun()
- */
- protected boolean shouldRun() {
- IResource[] resources = getResources();
- boolean allSticky = areAllResourcesSticky(resources);
- final BranchPromptDialog dialog = new BranchPromptDialog(getShell(),
- Policy.bind("BranchWizard.title"), //$NON-NLS-1$
- getResources(),
- allSticky,
- calculateInitialVersionName(resources,allSticky));
- if (dialog.open() != InputDialog.OK) return false;
-
- // Capture the dialog info in local variables
- final String tagString = dialog.getBranchTagName();
- update = dialog.getUpdate();
- final String versionString = dialog.getVersionTagName();
- rootVersionTag = (versionString == null) ? null : new CVSTag(versionString, CVSTag.VERSION);
- branchTag = new CVSTag(tagString, CVSTag.BRANCH);
-
- // For non-projects determine if the tag being loaded is the same as the resource's parent
- // If it's not, warn the user that they will be mixing tags
- if (update) {
- try {
- if(!CVSAction.checkForMixingTags(getShell(), resources, branchTag)) {
- return false;
- }
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
- return super.shouldRun();
- }
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(CVSTeamProvider provider, IResource[] providerResources, IProgressMonitor monitor) throws CVSException, InterruptedException {
- try {
- monitor.beginTask(null, 100);
- makeBranch(provider, providerResources, rootVersionTag, branchTag, update, Policy.subMonitorFor(monitor, 90));
- updateRememberedTags(providerResources);
- if (update) {
- updateWorkspaceSubscriber(provider, getCVSArguments(providerResources), Policy.subMonitorFor(monitor, 10));
- }
- collectStatus(Status.OK_STATUS);
- } catch (TeamException e) {
- // Accumulate the status which will be displayed by CVSAction#endOperation(IAction)
- collectStatus(e.getStatus());
- } finally {
- monitor.done();
- }
- }
-
- private void makeBranch(CVSTeamProvider provider, IResource[] resources, final CVSTag versionTag, final CVSTag branchTag, boolean moveToBranch, IProgressMonitor monitor) throws TeamException {
-
- // Determine the total amount of work
- int totalWork = (versionTag!= null ? 60 : 40) + (moveToBranch ? 20 : 0);
- monitor.beginTask(Policy.bind("CVSTeamProvider.makeBranch"), totalWork); //$NON-NLS-1$
- try {
- // Build the arguments list
- final ICVSResource[] arguments = getCVSArguments(resources);
-
- // Tag the remote resources
- IStatus status = null;
- if (versionTag != null) {
- // Version using a custom tag command that skips added but not commited reesources
- Session session = new Session(getRemoteLocation(provider), getLocalRoot(provider), true /* output to console */);
- session.open(Policy.subMonitorFor(monitor, 5), true /* open for modification */);
- try {
- status = Command.CUSTOM_TAG.execute(
- session,
- Command.NO_GLOBAL_OPTIONS,
- Command.NO_LOCAL_OPTIONS,
- versionTag,
- arguments,
- null,
- Policy.subMonitorFor(monitor, 35));
- } finally {
- session.close();
- }
- if (status.isOK()) {
- // Branch using the tag
- session = new Session(getRemoteLocation(provider), getLocalRoot(provider), true /* output to console */);
- session.open(Policy.subMonitorFor(monitor, 5), true /* open for modification */);
- try {
- status = Command.CUSTOM_TAG.execute(
- session,
- Command.NO_GLOBAL_OPTIONS,
- Command.NO_LOCAL_OPTIONS,
- branchTag,
- arguments,
- null,
- Policy.subMonitorFor(monitor, 15));
- } finally {
- session.close();
- }
- }
- } else {
- // Just branch using tag
- Session session = new Session(getRemoteLocation(provider), getLocalRoot(provider), true /* output to console */);
- session.open(Policy.subMonitorFor(monitor, 5), true /* open for modification */);
- try {
- status = Command.CUSTOM_TAG.execute(
- session,
- Command.NO_GLOBAL_OPTIONS,
- Command.NO_LOCAL_OPTIONS,
- branchTag,
- arguments,
- null,
- Policy.subMonitorFor(monitor, 35));
- } finally {
- session.close();
- }
-
- }
- if ( ! status.isOK()) {
- throw new CVSServerException(status);
- }
-
- // Set the tag of the local resources to the branch tag (The update command will not
- // properly update "cvs added" and "cvs removed" resources so a custom visitor is used
- if (moveToBranch) {
- setTag(provider, resources, branchTag, Policy.subMonitorFor(monitor, 20));
- }
- } finally {
- monitor.done();
- }
- }
-
- /*
- * This method sets the tag for a project.
- * It expects to be passed an InfiniteSubProgressMonitor
- */
- private void setTag(final CVSTeamProvider provider, final IResource[] resources, final CVSTag tag, IProgressMonitor monitor) throws TeamException {
-
- getLocalRoot(provider).run(new ICVSRunnable() {
- public void run(IProgressMonitor progress) throws CVSException {
- try {
- // 512 ticks gives us a maximum of 2048 which seems reasonable for folders and files in a project
- progress.beginTask(null, 100);
- final IProgressMonitor monitor = Policy.infiniteSubMonitorFor(progress, 100);
- monitor.beginTask(Policy.bind("CVSTeamProvider.folderInfo", provider.getProject().getName()), 512); //$NON-NLS-1$
-
- // Visit all the children folders in order to set the root in the folder sync info
- for (int i = 0; i < resources.length; i++) {
- CVSWorkspaceRoot.getCVSResourceFor(resources[i]).accept(new ICVSResourceVisitor() {
- public void visitFile(ICVSFile file) throws CVSException {
- monitor.worked(1);
- //ResourceSyncInfo info = file.getSyncInfo();
- byte[] syncBytes = file.getSyncBytes();
- if (syncBytes != null) {
- monitor.subTask(Policy.bind("CVSTeamProvider.updatingFile", file.getName())); //$NON-NLS-1$
- file.setSyncBytes(ResourceSyncInfo.setTag(syncBytes, tag), ICVSFile.UNKNOWN);
- }
- }
- public void visitFolder(ICVSFolder folder) throws CVSException {
- monitor.worked(1);
- FolderSyncInfo info = folder.getFolderSyncInfo();
- if (info != null) {
- monitor.subTask(Policy.bind("CVSTeamProvider.updatingFolder", info.getRepository())); //$NON-NLS-1$
- folder.setFolderSyncInfo(new FolderSyncInfo(info.getRepository(), info.getRoot(), tag, info.getIsStatic()));
- folder.acceptChildren(this);
- }
- }
- });
- }
- } finally {
- progress.done();
- }
- }
- }, monitor);
- }
-
- private void updateRememberedTags(IResource[] providerResources) throws CVSException {
- if (rootVersionTag != null || update) {
- for (int i = 0; i < providerResources.length; i++) {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(providerResources[i]);
- RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
-
- if (rootVersionTag != null) {
- manager.addTags(cvsResource, new CVSTag[] { rootVersionTag });
- }
- if (update) {
- manager.addTags(cvsResource, new CVSTag[] { branchTag });
- }
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return Policy.bind("BranchOperation.0"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
- */
- protected String getTaskName(CVSTeamProvider provider) {
- return Policy.bind("BranchOperation.1", provider.getProject().getName()); //$NON-NLS-1$
- }
-
- /**
- * Answers <code>true</code> if all resources in the array have a sticky tag
- */
- private boolean areAllResourcesSticky(IResource[] resources) {
- for (int i = 0; i < resources.length; i++) {
- if(!hasStickyTag(resources[i])) return false;
- }
- return true;
- }
-
- /**
- * Answers <code>true</code> if the resource has a sticky tag
- */
- private boolean hasStickyTag(IResource resource) {
- try {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- CVSTag tag;
- if(cvsResource.isFolder()) {
- FolderSyncInfo folderInfo = ((ICVSFolder)cvsResource).getFolderSyncInfo();
- tag = folderInfo.getTag();
- } else {
- ResourceSyncInfo info = cvsResource.getSyncInfo();
- tag = info.getTag();
- }
- if(tag!=null) {
- int tagType = tag.getType();
- if(tagType==CVSTag.VERSION) {
- return true;
- }
- }
- } catch(CVSException e) {
- CVSUIPlugin.log(e);
- return false;
- }
- return false;
- }
-
- private String calculateInitialVersionName(IResource[] resources, boolean allSticky) {
- String versionName = ""; //$NON-NLS-1$
- try {
- if(allSticky) {
- IResource stickyResource = resources[0];
- if(stickyResource.getType()==IResource.FILE) {
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)stickyResource);
- versionName = cvsFile.getSyncInfo().getTag().getName();
- } else {
- ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor((IContainer)stickyResource);
- versionName = cvsFolder.getFolderSyncInfo().getTag().getName();
- }
- }
- } catch(CVSException e) {
- CVSUIPlugin.log(e);
- versionName = ""; //$NON-NLS-1$
- }
- return versionName;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSOperation.java
deleted file mode 100644
index 3d33624ef..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CVSOperation.java
+++ /dev/null
@@ -1,366 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSStatus;
-import org.eclipse.team.internal.ccvs.core.util.Assert;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.console.CVSOutputConsole;
-import org.eclipse.team.ui.TeamOperation;
-import org.eclipse.ui.IWorkbenchPart;
-
-
-/**
- * This class is the abstract superclass for CVS operations. It provides
- * error handling, prompting and other UI.
- */
-public abstract class CVSOperation extends TeamOperation {
-
- private int statusCount;
-
- private boolean involvesMultipleResources = false;
-
- private List errors = new ArrayList(); // of IStatus
-
- protected static final IStatus OK = Status.OK_STATUS; //$NON-NLS-1$
-
- private Shell shell;
-
- // instance variable used to indicate behavior while prompting for overwrite
- private boolean confirmOverwrite = true;
-
- protected CVSOperation(IWorkbenchPart part) {
- super(part);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.TeamOperation#getJobName()
- */
- protected String getJobName() {
- return getTaskName();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#getOperationIcon()
- */
- protected URL getOperationIcon() {
- URL url = null;
- try {
- URL baseURL = CVSUIPlugin.getPlugin().getBundle().getEntry("/"); //$NON-NLS-1$
- return new URL(baseURL, ICVSUIConstants.ICON_PATH + ICVSUIConstants.IMG_CVS_PERSPECTIVE);
- } catch (MalformedURLException e) {
- return null;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- public final void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- startOperation();
- try {
- monitor = Policy.monitorFor(monitor);
- monitor.beginTask(null, 100);
- monitor.setTaskName(getTaskName());
- execute(Policy.subMonitorFor(monitor, 100));
- endOperation();
- } catch (CVSException e) {
- // TODO: errors may not be empty (i.e. endOperation has not been executed)
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
-
- protected void startOperation() {
- statusCount = 0;
- resetErrors();
- confirmOverwrite = true;
- }
-
- protected void endOperation() throws CVSException {
- handleErrors((IStatus[]) errors.toArray(new IStatus[errors.size()]));
- }
-
- /**
- * Subclasses must override this method to perform the operation.
- * Clients should never call this method directly.
- *
- * @param monitor
- * @throws CVSException
- * @throws InterruptedException
- */
- protected abstract void execute(IProgressMonitor monitor) throws CVSException, InterruptedException;
-
- protected void addError(IStatus status) {
- if (status.isOK()) return;
- if (isLastError(status)) return;
- errors.add(status);
- }
-
- protected void collectStatus(IStatus status) {
- if (isLastError(status)) return;
- statusCount++;
- if (!status.isOK()) addError(status);
- }
-
- protected void resetErrors() {
- errors.clear();
- statusCount = 0;
- }
-
- /**
- * Get the last error taht occured. This can be useful when a method
- * has a return type but wants to signal an error. The method in question
- * can add the error using <code>addError(IStatus)</code> and return null.
- * The caller can then query the error using this method. Also, <code>addError(IStatus)</code>
- * will not add the error if it is already on the end of the list (using identity comparison)
- * which allows the caller to still perform a <code>collectStatus(IStatus)</code>
- * to get a valid operation count.
- * @return
- */
- protected IStatus getLastError() {
- Assert.isTrue(errors.size() > 0);
- IStatus status = (IStatus)errors.get(errors.size() - 1);
- return status;
- }
-
- private boolean isLastError(IStatus status) {
- return (errors.size() > 0 && getLastError() == status);
- }
-
- /**
- * Throw an exception that contains the given error status
- * @param errors the errors that occurred during the operation
- * @throws CVSException an exception that wraps the errors
- */
- protected void asException(IStatus[] errors) throws CVSException {
- if (errors.length == 0) return;
- if (errors.length == 1 && statusCount == 1) {
- throw new CVSException(errors[0]);
- }
- MultiStatus result = new MultiStatus(CVSUIPlugin.ID, 0, getErrorMessage(errors, statusCount), null);
- for (int i = 0; i < errors.length; i++) {
- IStatus s = errors[i];
- if (s.isMultiStatus()) {
- result.add(new CVSStatus(s.getSeverity(), s.getMessage(), s.getException()));
- result.addAll(s);
- } else {
- result.add(s);
- }
- }
- throw new CVSException(result);
- }
-
- /**
- * Handle the errors that occured during an operation.
- * The default is to throw an exception containing an status
- * that are reportable (determined using <code>isReportableError</code>).
- * @param errors the errors that occurred during the operation.
- * Subclasses may override.
- * @throws CVSException an exception if appropriate
- */
- protected void handleErrors(IStatus[] errors) throws CVSException {
- // We are only concerned with reportable errors.
- // Others will appear in the console
- List serverErrors = new ArrayList();
- for (int i = 0; i < errors.length; i++) {
- IStatus status = errors[i];
- if (isReportableError(status)) {
- serverErrors.add(status);
- } else if (status.isMultiStatus()) {
- IStatus[] children = status.getChildren();
- for (int j = 0; j < children.length; j++) {
- IStatus child = children[j];
- if (isReportableError(child)) {
- serverErrors.add(status);
- break;
- }
- }
- }
- }
- if (!serverErrors.isEmpty())
- asException((IStatus[]) serverErrors.toArray(new IStatus[serverErrors.size()]));
- }
-
- /**
- * Return whether the given status is reportable. By default,
- * only server errors are reportable. Subclasses may override.
- * @param status an error status
- * @return whether the status is reportable or should be ignored
- */
- protected boolean isReportableError(IStatus status) {
- return status.getCode() == CVSStatus.SERVER_ERROR;
- }
-
- protected String getErrorMessage(IStatus[] failures, int totalOperations) {
- return Policy.bind("CVSOperation.0", String.valueOf(failures.length), String.valueOf(totalOperations)); //$NON-NLS-1$
- }
-
- /**
- * This method prompts the user to overwrite an existing resource. It uses the
- * <code>involvesMultipleResources</code> to determine what buttons to show.
- * @param project
- * @return
- */
- protected boolean promptToOverwrite(final String title, final String msg) {
- if (!confirmOverwrite) {
- return true;
- }
- final String buttons[];
- if (involvesMultipleResources()) {
- buttons = new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.YES_TO_ALL_LABEL,
- IDialogConstants.NO_LABEL,
- IDialogConstants.CANCEL_LABEL};
- } else {
- buttons = new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL};
- }
- final Shell displayShell = getShell();
- if (displayShell == null) {
- // We couldn't get a shell (perhaps due to shutdown)
- return false;
- }
-
- // run in syncExec because callback is from an operation,
- // which is probably not running in the UI thread.
- final int[] code = new int[] {0};
- displayShell.getDisplay().syncExec(
- new Runnable() {
- public void run() {
- MessageDialog dialog =
- new MessageDialog(displayShell, title, null, msg, MessageDialog.QUESTION, buttons, 0);
- dialog.open();
- code[0] = dialog.getReturnCode();
- }
- });
- if (involvesMultipleResources()) {
- switch (code[0]) {
- case 0://Yes
- return true;
- case 1://Yes to all
- confirmOverwrite = false;
- return true;
- case 2://No
- return false;
- case 3://Cancel
- default:
- throw new OperationCanceledException();
- }
- } else {
- return code[0] == 0;
- }
- }
-
- /**
- * This method is used by <code>promptToOverwrite</code> to determine which
- * buttons to show in the prompter.
- *
- * @return
- */
- protected boolean involvesMultipleResources() {
- return involvesMultipleResources;
- }
-
- public void setInvolvesMultipleResources(boolean b) {
- involvesMultipleResources = b;
- }
-
- /**
- * Return the string that is to be used as the task name for the operation
- *
- * @param remoteFolders
- * @return
- */
- protected abstract String getTaskName();
-
- /**
- * Return true if any of the accumulated status have a severity of ERROR
- * @return
- */
- protected boolean errorsOccurred() {
- for (Iterator iter = errors.iterator(); iter.hasNext();) {
- IStatus status = (IStatus) iter.next();
- if (status.getSeverity() == IStatus.ERROR) return true;
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.TeamOperation#getShell()
- */
- protected Shell getShell() {
- // Use the shell assigned to the operation if possible
- if (shell != null && !shell.isDisposed()) {
- return shell;
- }
- return super.getShell();
- }
-
- /**
- * Set the shell to be used by the operation. This only needs
- * to be done if the operation does not have a workbench part.
- * For example, if the operation is being run in a wizard.
- * @param shell The shell to set.
- */
- public void setShell(Shell shell) {
- this.shell = shell;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#canRunAsJob()
- */
- protected boolean canRunAsJob() {
- // Put CVS jobs in the background by default.
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#isSameFamilyAs(org.eclipse.team.ui.TeamOperation)
- */
- protected boolean isSameFamilyAs(TeamOperation operation) {
- // Trat all CVS operations as a single family
- return operation instanceof CVSOperation;
- }
-
- /*
- * Action to show the console that can be used by subclasses
- * that wish to link the progress service to the console
- */
- protected IAction getShowConsoleAction() {
- // Show the console as the goto action
- return new Action(Policy.bind("CVSOperation.1")) { //$NON-NLS-1$
- public void run() {
- CVSOutputConsole console = CVSUIPlugin.getPlugin().getConsole();
- if (console != null)
- console.show(true);
- }
- public String getToolTipText() {
- return Policy.bind("CVSOperation.2"); //$NON-NLS-1$
- }
- };
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutIntoOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutIntoOperation.java
deleted file mode 100644
index 6a3433720..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutIntoOperation.java
+++ /dev/null
@@ -1,442 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * This method checks out one or more remote folders from the same repository
- * into an existing project or folder in the workspace. The target project
- * must either be shared with the same repository or it must not be shared
- * with any repository
- */
-public class CheckoutIntoOperation extends CheckoutOperation {
-
- private boolean recursive;
- private ICVSFolder localFolder;
- private String localFolderName;
-
- /**
- * Constructor which takes a set of remote folders and the local folder into which the folders should be
- * loaded.
- */
- public CheckoutIntoOperation(IWorkbenchPart part, ICVSRemoteFolder[] remoteFolders, IContainer localFolder, boolean recursive) {
- super(part, remoteFolders);
- this.recursive = recursive;
- this.localFolder = CVSWorkspaceRoot.getCVSFolderFor(localFolder);
- }
-
- /**
- * Constructor which takes a single remote folder and the target local folder.
- */
- public CheckoutIntoOperation(IWorkbenchPart part, ICVSRemoteFolder remoteFolder, IContainer localFolder, boolean recursive) {
- this(part, new ICVSRemoteFolder[] { remoteFolder }, localFolder.getParent(), recursive);
- this.localFolderName = localFolder.getName();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CheckoutOperation#getTaskName()
- */
- protected String getTaskName() {
- ICVSRemoteFolder[] remoteFolders = getRemoteFolders();
- String localFolderName = ""; //$NON-NLS-1$
- try {
- localFolderName = getLocalFolder().getIResource().getFullPath().toString();
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- return Policy.bind("CheckoutIntoOperation.taskname", new Integer(remoteFolders.length).toString(), localFolderName); //$NON-NLS-1$
- }
-
- /**
- * @return
- */
- public ICVSFolder getLocalFolder() {
- return localFolder;
- }
-
- /**
- * @return
- */
- public boolean isRecursive() {
- return recursive;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CheckoutOperation#checkout(org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus checkout(final ICVSRemoteFolder folder, IProgressMonitor monitor) throws CVSException {
- final IStatus[] result = new IStatus[] { null };
- try {
- // Wrap in a workspace runnable to avoid auto-build.
- // This is necessary because CVS has a POST_BUILD
- // listener that will clear the sync info from
- // orphaned (i.e. unmanaged) subtrees and we will
- // purposely create some which we subsequently manage
- // from their parent (see manageFolders())
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- result[0] = checkout(folder, getLocalFolder(), isRecursive(), monitor);
- }
- }, getSchedulingRule(), 0, monitor);
- } catch (CoreException e) {
- result[0] = CVSException.wrapException(e).getStatus();
- }
- return result[0];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CheckoutOperation#checkout(org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void checkout(final ICVSRemoteFolder[] folders, IProgressMonitor monitor) throws CVSException {
- // Batch sync info changes with the CVS synchronizer to optimize cache writing
- EclipseSynchronizer.getInstance().run(getSchedulingRule(), new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- monitor.beginTask(null, 100);
- try {
- // Obtain a scheduling rule on the projects were about to overwrite
- CheckoutIntoOperation.super.checkout(folders, Policy.subMonitorFor(monitor, 90));
- refreshRoot(getLocalRoot(getLocalFolder()), Policy.subMonitorFor(monitor, 10));
- } finally {
- monitor.done();
- }
- }
- }, Policy.monitorFor(monitor));
- }
-
- /*
- * Prepare the local folders to receive the remote folders. If localFolderName is not null, then
- * if will be the only target folder of the checkout. Otherwise, the remote folder
- * could expand to multiple local folders witinb the given parent folder.
- */
- private ICVSFolder[] prepareLocalFolders(Session session, ICVSRemoteFolder remoteFolder, ICVSFolder parentFolder, String localFolderName, IProgressMonitor monitor) throws CVSException {
- Set targetFolderSet = new HashSet();
- monitor.beginTask(null, 30);
- if (localFolderName == null) {
-
- // Determine which local folders will be afected
- IStatus status = Request.EXPAND_MODULES.execute(session, new String[] { remoteFolder.getRepositoryRelativePath()}, Policy.subMonitorFor(monitor, 10));
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- addError(status);
- return null;
- }
-
- // Convert the module expansions to target folders
- String[] expansions = session.getModuleExpansions();
- for (int j = 0; j < expansions.length; j++) {
- String childPath = new Path(null, expansions[j]).segment(0);
- ICVSResource resource = parentFolder.getChild(childPath);
- if (resource != null && !resource.isFolder()) {
- // The target folder conflicts with an existing file
- addError(new CVSStatus(IStatus.ERROR, Policy.bind("CheckoutIntoOperation.targetIsFile", remoteFolder.getName(), resource.getIResource().getFullPath().toString()))); //$NON-NLS-1$
- return null;
- }
- targetFolderSet.add(parentFolder.getFolder(childPath));
- }
-
- } else {
- targetFolderSet.add(parentFolder.getFolder(localFolderName));
- }
-
- final ICVSFolder[] targetFolders = (ICVSFolder[]) targetFolderSet.toArray(new ICVSFolder[targetFolderSet.size()]);
-
- // Ensure that the checkout will not conflict with existing resources
- IStatus status = validateTargetFolders(remoteFolder, targetFolders, Policy.subMonitorFor(monitor, 10));
- if (!status.isOK()) {
- addError(status);
- return null;
- }
-
- // Prepare the target projects to receive resources
- status = scrubFolders(remoteFolder, targetFolders, Policy.subMonitorFor(monitor, 10));
- // return the target projects if the scrub succeeded
- if (status.isOK()) {
- return targetFolders;
- } else {
- addError(status);
- return null;
- }
- }
-
- /*
- * Ensure that the new folders will not conflict with existing folders (even those that are pruned).
- */
- private IStatus validateTargetFolders(ICVSRemoteFolder remoteFolder, ICVSFolder[] targetFolders, IProgressMonitor monitor) throws CVSException {
- for (int i = 0; i < targetFolders.length; i++) {
- ICVSFolder targetFolder = targetFolders[i];
- FolderSyncInfo localInfo = targetFolder.getFolderSyncInfo();
- FolderSyncInfo remoteInfo = remoteFolder.getFolderSyncInfo();
-
- if (!remoteInfo.isSameMapping(localInfo)) {
- if (localInfo != null ) {
- if (isRemoteChildOfParent(targetFolder)) {
- // if the local folder is child of it's parent remotely (i.e. path of child is parent/child)
- // then the remote cannot be loaded.
- String message;
- if (targetFolder.exists()) {
- message = Policy.bind("CheckoutIntoOperation.targetIsFolder", remoteFolder.getName(), targetFolder.getIResource().getFullPath().toString()); //$NON-NLS-1$
- } else {
- message = Policy.bind("CheckoutIntoOperation.targetIsPrunedFolder", remoteFolder.getName(), targetFolder.getFolderSyncInfo().getRepository()); //$NON-NLS-1$
- }
- return new CVSStatus(IStatus.ERROR, message);
- }
- }
- // Verify that no other folders in the local workspace are mapped to the remote folder
- IStatus status = validateUniqueMapping(remoteFolder, targetFolder, Policy.subMonitorFor(monitor, 10));
- if (!status.isOK()) return status;
- }
- }
- return OK;
- }
-
- /*
- * Return true if the given local folder is a direct descendant of it's local parent in
- * the repository as well
- */
- private boolean isRemoteChildOfParent(ICVSFolder targetFolder) throws CVSException {
- FolderSyncInfo localInfo = targetFolder.getFolderSyncInfo();
- if (localInfo == null) return false;
- FolderSyncInfo parentInfo = targetFolder.getParent().getFolderSyncInfo();
- if (parentInfo == null) return false;
- IPath childPath = new Path(null, localInfo.getRepository());
- IPath parentPath = new Path(null, parentInfo.getRepository());
- return parentPath.isPrefixOf(childPath);
- }
-
- /**
- * @param targetFolder
- * @return
- */
- private IContainer getLocalRoot(ICVSFolder targetFolder) throws CVSException {
- return targetFolder.getIResource().getProject();
- }
-
- /*
- * Ensure that there is no equivalent mapping alreay in the local workspace
- */
- private IStatus validateUniqueMapping(final ICVSRemoteFolder remoteFolder, final ICVSFolder targetFolder, IProgressMonitor iProgressMonitor) throws CVSException {
-
- final IContainer root = getLocalRoot(targetFolder);
- final FolderSyncInfo remoteInfo = remoteFolder.getFolderSyncInfo();
- if (remoteInfo.equals(FolderSyncInfo.VIRTUAL_DIRECTORY)) {
- // We can't really check the mapping ahead of time
- // so we'll let the operation continue
- return OK;
- }
- ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor(root);
- try {
- cvsFolder.accept(new ICVSResourceVisitor() {
- public void visitFile(ICVSFile file) throws CVSException {
- // do nothing
- }
- public void visitFolder(ICVSFolder folder) throws CVSException {
- if (!folder.isCVSFolder()) return;
- IResource resource = folder.getIResource();
- if (resource == null) return;
- FolderSyncInfo info = folder.getFolderSyncInfo();
- if (info.isSameMapping(remoteInfo)) {
- throw new CVSException(Policy.bind("CheckoutIntoOperation.mappingAlreadyExists", //$NON-NLS-1$
- new Object[] {
- remoteFolder.getName(),
- targetFolder.getIResource().getFullPath().toString(),
- resource.getFullPath().toString()
- }));
- }
- folder.acceptChildren(this);
- }
- });
- } catch (CVSException e) {
- return e.getStatus();
- }
- return OK;
- }
-
- /*
- * Purge the local contents of the given folders
- */
- private IStatus scrubFolders(ICVSRemoteFolder remoteFolder, ICVSFolder[] targetFolders, IProgressMonitor monitor) throws CVSException {
- monitor.beginTask(null, 100 * targetFolders.length);
-
- // Prompt first before any work is done
- if (targetFolders.length > 1) {
- setInvolvesMultipleResources(true);
- }
- for (int i=0;i<targetFolders.length;i++) {
- ICVSFolder targetFolder = targetFolders[i];
- if (needsPromptForOverwrite(targetFolder, Policy.subMonitorFor(monitor, 50)) && !promptToOverwrite(targetFolder)) {
- return new CVSStatus(IStatus.INFO, Policy.bind("CheckoutIntoOperation.cancelled", remoteFolder.getName())); //$NON-NLS-1$
- }
- }
-
- for (int i = 0; i < targetFolders.length; i++) {
- IStatus status = scrubFolder(targetFolders[i], Policy.subMonitorFor(monitor, 50));
- if (!status.isOK()) return status;
- }
- monitor.done();
- return OK;
- }
-
- private boolean needsPromptForOverwrite(ICVSFolder targetFolder, IProgressMonitor monitor) throws CVSException {
- return targetFolder.isModified(monitor);
- }
-
- private boolean promptToOverwrite(ICVSFolder folder) {
- return promptToOverwrite(
- Policy.bind("CheckoutOperation.confirmOverwrite"), //$NON-NLS-1$
- Policy.bind("CheckoutIntoOperation.overwriteMessage", folder.getName())); //$NON-NLS-1$
- }
-
- private IStatus scrubFolder(ICVSFolder folder, IProgressMonitor monitor) throws CVSException {
- if (folder.exists() || folder.isCVSFolder()) {
- // Unmanage first so we don't get outgoing deletions
- folder.unmanage(Policy.subMonitorFor(monitor, 50));
- if (folder.exists()) folder.delete();
- }
- return OK;
- }
-
- /* private */ IStatus checkout(final ICVSRemoteFolder remoteFolder, ICVSFolder parentFolder, boolean recurse, IProgressMonitor monitor) throws CVSException {
- // Open a connection session to the repository
- monitor.beginTask(null, 100);
- ICVSRepositoryLocation repository = remoteFolder.getRepository();
- Session session = new Session(repository, parentFolder);
- try {
- session.open(Policy.subMonitorFor(monitor, 5), false /* read-only */);
-
- // Determine which local folders will be affected
- String localName = localFolderName;
- if (localName == null) {
- IPath path = new Path(null, remoteFolder.getRepositoryRelativePath());
- if (path.segmentCount() > 1) {
- localName = path.lastSegment();
- }
- }
- ICVSFolder[] targetFolders = prepareLocalFolders(session, remoteFolder, parentFolder, localName, Policy.subMonitorFor(monitor, 5));
- if (targetFolders == null) {
- // an error occured and has been added to the operation's error list
- return getLastError();
- }
-
- // Add recurse option
- List localOptions = new ArrayList();
- if (!recurse)
- localOptions.add(Update.DO_NOT_RECURSE);
- if (localName != null) {
- localOptions.add(Checkout.makeDirectoryNameOption(localName));
- }
-
- // Prune empty directories if pruning enabled
- if (CVSProviderPlugin.getPlugin().getPruneEmptyDirectories())
- localOptions.add(Checkout.PRUNE_EMPTY_DIRECTORIES);
- // Add the options related to the CVSTag
- CVSTag tag = remoteFolder.getTag();
- if (tag == null) {
- // A null tag in a remote resource indicates HEAD
- tag = CVSTag.DEFAULT;
- }
- localOptions.add(Update.makeTagOption(tag));
-
- // Perform the checkout
- IStatus status = Command.CHECKOUT.execute(session,
- Command.NO_GLOBAL_OPTIONS,
- (LocalOption[])localOptions.toArray(new LocalOption[localOptions.size()]),
- new String[] { remoteFolder.getRepositoryRelativePath() },
- null,
- Policy.subMonitorFor(monitor, 80));
- if (!status.isOK()) {
- return status;
- }
-
- manageFolders(targetFolders, repository.getLocation());
-
- return OK;
-
- } finally {
- session.close();
- }
- }
-
- private void manageFolders(ICVSFolder[] targetFolders, String root) throws CVSException {
- for (int i = 0; i < targetFolders.length; i++) {
- manageFolder(targetFolders[i], root);
- }
- }
-
- private static void manageFolder(ICVSFolder folder, String root) throws CVSException {
- // Ensure that the parent is a CVS folder
- ICVSFolder parent = folder.getParent();
- if (!parent.isCVSFolder()) {
- parent.setFolderSyncInfo(new FolderSyncInfo(FolderSyncInfo.VIRTUAL_DIRECTORY, root, CVSTag.DEFAULT, true));
- IResource resource = parent.getIResource();
- if (resource.getType() != IResource.PROJECT) {
- manageFolder(parent, root);
- }
- }
- // reset the folder sync info so it will be managed by it's parent
- folder.setFolderSyncInfo(folder.getFolderSyncInfo());
- }
-
- /*
- * Bring the provided projects into the workspace
- */
- private static void refreshRoot(IContainer root, IProgressMonitor monitor) throws CVSException {
- try {
- IProject project = root.getProject();
- CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId());
- if (provider == null) {
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(project);
- if (folder.isCVSFolder()) {
- // Register the project with Team
- RepositoryProvider.map(project, CVSProviderPlugin.getTypeId());
-
- // TODO: This should be somewhere else
- provider = (CVSTeamProvider)RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId());
- provider.setWatchEditEnabled(CVSProviderPlugin.getPlugin().isWatchEditEnabled());
- }
- }
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- }
- }
-
- public String getName() {
- return getTaskName();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getSchedulingRule()
- */
- protected ISchedulingRule getSchedulingRule() {
- try {
- // Use the project of the target folder as the scheduling rule
- return getLocalFolder().getIResource().getProject();
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- return null;
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutMultipleProjectsOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutMultipleProjectsOperation.java
deleted file mode 100644
index 54abf5a03..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutMultipleProjectsOperation.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.*;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * This operation checks out a multiple remote folders into the workspace.
- * Each one will become a new project (overwritting any exsiting projects
- * with the same name).
- */
-public class CheckoutMultipleProjectsOperation extends CheckoutProjectOperation {
-
- boolean hasTargetLocation;
-
- public CheckoutMultipleProjectsOperation(IWorkbenchPart part, ICVSRemoteFolder[] remoteFolders, String targetLocation) {
- super(part, remoteFolders, targetLocation);
- hasTargetLocation = targetLocation != null;
- setInvolvesMultipleResources(remoteFolders.length > 1);
- }
-
- /**
- * Return the target location where the given project should be located or
- * null if the default location should be used.
- *
- * @param project
- */
- protected IPath getTargetLocationFor(IProject project) {
- IPath targetLocation = super.getTargetLocationFor(project);
- if (targetLocation == null) return null;
- return targetLocation.append(project.getName());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CheckoutOperation#checkout(org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus checkout(ICVSRemoteFolder folder, IProgressMonitor monitor) throws CVSException {
- return checkout(folder, null, monitor);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutOperation.java
deleted file mode 100644
index 761169a42..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutOperation.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-
-public abstract class CheckoutOperation extends RemoteOperation {
-
- public CheckoutOperation(IWorkbenchPart part, ICVSRemoteFolder[] remoteFolders) {
- super(part, remoteFolders);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
- ICVSRemoteFolder[] folders = getRemoteFolders();
- checkout(folders, monitor);
- }
-
- /**
- * This method invokes <code>checkout(ICVSRemoteFolder, IProgressMonitor)</code>
- * for each remote folder of the operation.
- * @param folders the remote folders for the operation
- * @param monitor the progress monitor
- * @throws CVSException if an error occured that should prevent the remaining
- * folders from being checked out
- */
- protected void checkout(ICVSRemoteFolder[] folders, IProgressMonitor monitor) throws CVSException {
- monitor.beginTask(null, folders.length * 100);
- for (int i = 0; i < folders.length; i++) {
- ICVSRemoteFolder folder = folders[i];
- IStatus result = checkout(folder, Policy.subMonitorFor(monitor, 100));
- collectStatus(result);
- Policy.checkCanceled(monitor);
- }
- monitor.done();
- }
-
- protected ICVSRemoteFolder[] getRemoteFolders() {
- return (ICVSRemoteFolder[])getRemoteResources();
- }
-
- /**
- * Checkout the selected remote folders in a form appropriate for the operation subclass.
- * @param folders
- * @param monitor
- */
- protected abstract IStatus checkout(ICVSRemoteFolder folder, IProgressMonitor monitor) throws CVSException;
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#canRunAsJob()
- */
- public boolean canRunAsJob() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#isKeepOneProgressServiceEntry()
- */
- public boolean isKeepOneProgressServiceEntry() {
- // Keep the last repository provider operation in the progress service
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#getGotoAction()
- */
- protected IAction getGotoAction() {
- return getShowConsoleAction();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java
deleted file mode 100644
index 3fc09d18d..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java
+++ /dev/null
@@ -1,481 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.MultiRule;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-/**
- * This class acts as an abstract class for checkout operations.
- * It provides a few common methods.
- */
-public abstract class CheckoutProjectOperation extends CheckoutOperation {
-
- private String targetLocation;
-
- public CheckoutProjectOperation(IWorkbenchPart part, ICVSRemoteFolder[] remoteFolders, String targetLocation) {
- super(part, remoteFolders);
- this.targetLocation = targetLocation;
- }
-
- /**
- * Create and open the project, using a custom location if there is one.
- *
- * @param project
- * @param monitor
- * @throws CVSException
- */
- protected void createAndOpenProject(IProject project, IProgressMonitor monitor) throws CVSException {
- try {
- monitor.beginTask(null, 5);
- IProjectDescription desc = getDescriptionFor(project);
- if (project.exists()) {
- if (desc != null) {
- project.move(desc, true, Policy.subMonitorFor(monitor, 3));
- }
- } else {
- if (desc == null) {
- // create in default location
- project.create(Policy.subMonitorFor(monitor, 3));
- } else {
- // create in some other location
- project.create(desc, Policy.subMonitorFor(monitor, 3));
- }
- }
- if (!project.isOpen()) {
- project.open(Policy.subMonitorFor(monitor, 2));
- }
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- } finally {
- monitor.done();
- }
- }
-
- protected IProjectDescription getDescriptionFor(IProject project) {
- if (targetLocation == null) return null;
- String projectName = project.getName();
- IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(projectName);
- description.setLocation(getTargetLocationFor(project));
- return description;
- }
-
- /**
- * Return the target location where the given project should be located or
- * null if the default location should be used.
- *
- * @param project
- */
- protected IPath getTargetLocationFor(IProject project) {
- if (targetLocation == null) return null;
- return new Path(targetLocation);
- }
-
- protected String getRemoteModuleName(ICVSRemoteFolder resource) {
- String moduleName;
- if (resource.isDefinedModule()) {
- moduleName = resource.getName();
- } else {
- moduleName = resource.getRepositoryRelativePath();
- }
- return moduleName;
- }
-
- protected IStatus checkout(final ICVSRemoteFolder resource, IProject project, IProgressMonitor pm) throws CVSException {
- // Get the location and the workspace root
- ICVSFolder root = CVSWorkspaceRoot.getCVSFolderFor(ResourcesPlugin.getWorkspace().getRoot());
- ICVSRepositoryLocation repository = resource.getRepository();
- // Open a connection session to the repository
- final Session session = new Session(repository, root);
- pm.beginTask(null, 100);
- Policy.checkCanceled(pm);
- session.open(Policy.subMonitorFor(pm, 5), false /* read-only */);
- try {
-
- // Check to see if the entire repo is being checked out.
- if (project == null && resource.getName().equals(".")) { //$NON-NLS-1$
- // No project was specified but we need on for this to work
- String name = new Path(null, resource.getRepository().getRootDirectory()).lastSegment();
- project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
- }
-
- // Determine the local target projects (either the project provider or the module expansions)
- // Note: Module expansions can be run over the same connection as a checkout
- final IProject[] targetProjects = determineProjects(session, resource, project, Policy.subMonitorFor(pm, 5));
- if (targetProjects == null) {
- // An error occurred and was recorded so return it
- return getLastError();
- } else if (targetProjects.length == 0) {
- return OK;
- }
-
- final boolean sendModuleName = project != null;
- final IStatus[] result = new IStatus[] { null };
- ISchedulingRule schedulingRule = getSchedulingRule(targetProjects);
- if (schedulingRule instanceof IResource && ((IResource)schedulingRule).getType() == IResource.ROOT) {
- // One of the projects is mapped to a provider that locks the workspace.
- // Just return the workspace root rule
- try {
- Platform.getJobManager().beginRule(schedulingRule, pm);
- result[0] = performCheckout(session, resource, targetProjects, sendModuleName, Policy.subMonitorFor(pm, 90));
- } finally {
- Platform.getJobManager().endRule(schedulingRule);
- }
- } else {
- EclipseSynchronizer.getInstance().run(schedulingRule, new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- result[0] = performCheckout(session, resource, targetProjects, sendModuleName, monitor);
- }
- }, Policy.subMonitorFor(pm, 90));
- }
- return result[0];
- } catch (CVSException e) {
- // An exception occurred either during the module-expansion or checkout
- // Since we were able to make a connection, return the status so the
- // checkout of any other modules can proceed
- return e.getStatus();
- } finally {
- session.close();
- pm.done();
- }
- }
-
- private ISchedulingRule getSchedulingRule(IProject[] projects) {
- if (projects.length == 1) {
- return ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(projects[0]);
- } else {
- Set rules = new HashSet();
- for (int i = 0; i < projects.length; i++) {
- ISchedulingRule modifyRule = ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(projects[i]);
- if (modifyRule instanceof IResource && ((IResource)modifyRule).getType() == IResource.ROOT) {
- // One of the projects is mapped to a provider that locks the workspace.
- // Just return the workspace root rule
- return modifyRule;
- }
- rules.add(modifyRule);
- }
- return new MultiRule((ISchedulingRule[]) rules.toArray(new ISchedulingRule[rules.size()]));
- }
- }
-
- /* private */ IStatus performCheckout(Session session, ICVSRemoteFolder resource, IProject[] targetProjects, boolean sendModuleName, IProgressMonitor pm) throws CVSException {
- // Set the task name of the progress monitor to let the user know
- // which project we're on. Don't use subTask since that will be
- // changed when the checkout command is run.
- String taskName;
- if (targetProjects.length == 1) {
- taskName = Policy.bind("CheckoutProjectOperation.8", resource.getName(), targetProjects[0].getName()); //$NON-NLS-1$
- } else {
- taskName = Policy.bind("CheckoutProjectOperation.9", resource.getName(), String.valueOf(targetProjects.length)); //$NON-NLS-1$
- }
- pm.beginTask(taskName, 100);
- pm.setTaskName(taskName);
- Policy.checkCanceled(pm);
- try {
- // Scrub the local contents if requested
- if (performScrubProjects()) {
- IStatus result = scrubProjects(resource, targetProjects, Policy.subMonitorFor(pm, 9));
- if (!result.isOK()) {
- return result;
- }
- }
-
- // Determine if t
- // in which case we'll use -d to flatten the directory structure.
- // Only flatten the directory structure if the folder is not a root folder
- IProject project = null;
- if (targetProjects.length == 1) {
- if (sendModuleName) {
- project = targetProjects[0];
- } else if (targetProjects[0].getName().equals(resource.getName())) {
- // The target project has the same name as the remote folder.
- // If the repository relative path has multiple segments
- // we will want to flatten the directory structure
- String path = resource.getRepositoryRelativePath();
- if (!path.equals(FolderSyncInfo.VIRTUAL_DIRECTORY)
- && new Path(null, path).segmentCount() > 1) {
- project = targetProjects[0];
- }
- }
- }
-
- try {
- // Build the local options
- List localOptions = new ArrayList();
- // Add the option to load into the target project if one was supplied
- if (project != null) {
- localOptions.add(Checkout.makeDirectoryNameOption(project.getName()));
- }
- // Prune empty directories if pruning enabled
- if (CVSProviderPlugin.getPlugin().getPruneEmptyDirectories())
- localOptions.add(Checkout.PRUNE_EMPTY_DIRECTORIES);
- // Add the options related to the CVSTag
- CVSTag tag = resource.getTag();
- if (tag == null) {
- // A null tag in a remote resource indicates HEAD
- tag = CVSTag.DEFAULT;
- }
- localOptions.add(Update.makeTagOption(tag));
-
- // Perform the checkout
- IStatus status = Command.CHECKOUT.execute(session,
- Command.NO_GLOBAL_OPTIONS,
- (LocalOption[])localOptions.toArray(new LocalOption[localOptions.size()]),
- new String[]{getRemoteModuleName(resource)},
- null,
- Policy.subMonitorFor(pm, 90));
- return status;
- } finally {
- // Map the projects if they have CVS meta infomation even if a failure occurred
- refreshProjects(targetProjects, Policy.subMonitorFor(pm, 1));
- }
- } finally {
- pm.done();
- }
- }
-
- /*
- * Determine the workspace project(s) that will be affected by the checkout.
- * If project is not null, then it will be the only target project of the checkout.
- * Otherwise, the remote folder could expand to multiple projects.
- *
- * If the remote resource is a folder which is not a root folder (i.e. a/b/c),
- * then the target project will be the last segment (i.e. c).
- */
- private IProject[] determineProjects(Session session, final ICVSRemoteFolder remoteFolder, IProject project, IProgressMonitor pm) throws CVSException {
-
- Set targetProjectSet = new HashSet();
- String moduleName = getRemoteModuleName(remoteFolder);
- if (project == null) {
-
- // Fetch the module expansions
- Policy.checkCanceled(pm);
- IStatus status = Request.EXPAND_MODULES.execute(session, new String[] {moduleName}, pm);
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- collectStatus(status);
- return null;
- }
-
- // Convert the module expansions to local projects
- String[] expansions = session.getModuleExpansions();
- if (expansions.length == 1 && expansions[0].equals(moduleName)) {
- // For a remote folder, use the last segment as the project to be created
- String lastSegment = new Path(null, expansions[0]).lastSegment();
- targetProjectSet.add(ResourcesPlugin.getWorkspace().getRoot().getProject(lastSegment));
- } else {
- for (int j = 0; j < expansions.length; j++) {
- targetProjectSet.add(ResourcesPlugin.getWorkspace().getRoot().getProject(new Path(null, expansions[j]).segment(0)));
- }
- }
-
- } else {
- targetProjectSet.add(project);
- }
-
- // Return the local projects affected by the checkout
- IProject[] targetProjects = (IProject[]) targetProjectSet.toArray(new IProject[targetProjectSet.size()]);
- return targetProjects;
- }
-
- /**
- * Return true if the target projects should be scrubbed before the checkout occurs.
- * Default is to scrub the projects. Can be overridden by subclasses.
- */
- protected boolean performScrubProjects() {
- return true;
- }
-
- /*
- * This method is invoked to scrub the local projects that are the check out target of
- * a single remote module.
- */
- private IStatus scrubProjects(ICVSRemoteFolder remoteFolder, IProject[] projects, IProgressMonitor monitor) throws CVSException {
- if (projects == null) {
- monitor.done();
- return OK;
- }
- // Prompt first before any work is done
- if (projects.length > 1) {
- setInvolvesMultipleResources(true);
- }
- for (int i=0;i<projects.length;i++) {
- IProject project = projects[i];
- Policy.checkCanceled(monitor);
- if (needsPromptForOverwrite(project) && !promptToOverwrite(remoteFolder, project)) {
- // User said no to this project but not no to all
- return new CVSStatus(IStatus.INFO, CVSStatus.CANCEL, Policy.bind("CheckoutProjectOperation.0", remoteFolder.getRepositoryRelativePath())); //$NON-NLS-1$
- }
- }
- // Create the projects and remove any previous content
- monitor.beginTask(null, projects.length * 100); //$NON-NLS-1$
- for (int i=0;i<projects.length;i++) {
- IProject project = projects[i];
- createAndOpenProject(project, Policy.subMonitorFor(monitor, 10));
- scrubProject(project, Policy.subMonitorFor(monitor, 90));
- }
- monitor.done();
- return OK;
- }
-
- private void scrubProject(IProject project, IProgressMonitor monitor) throws CVSException {
- try {
- // unmap the project from any previous repository provider
- if (RepositoryProvider.getProvider(project) != null)
- RepositoryProvider.unmap(project);
- // We do not want to delete the project to avoid a project deletion delta
- // We do not want to delete the .project to avoid core exceptions
- IResource[] children = project.members(IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS);
- Policy.checkCanceled(monitor);
- monitor.beginTask(null, 100 + children.length * 100);
- monitor.subTask(Policy.bind("CheckoutOperation.scrubbingProject", project.getName())); //$NON-NLS-1$
- try {
- for (int j = 0; j < children.length; j++) {
- if ( ! children[j].getName().equals(".project")) {//$NON-NLS-1$
- children[j].delete(true /*force*/, Policy.subMonitorFor(monitor, 100));
- }
- }
- // Make sure there is no sync info cached for the project since
- // a reader thread may have caused it to be loaded since the unmap.
- EclipseSynchronizer.getInstance().flush(project, true, Policy.subMonitorFor(monitor, 100));
- } finally {
- monitor.done();
- }
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- }
- }
-
- protected boolean needsPromptForOverwrite(IProject project) {
-
- // First, check the description location
- IProjectDescription desc = getDescriptionFor(project);
- if (desc != null) {
- File localLocation = desc.getLocation().toFile();
- if (localLocation.exists()) return true;
- }
-
- // Next, check if the resource itself exists
- if (project.exists()) return true;
-
- // Finally, check if the location in the workspace exists;
- File localLocation = getFileLocation(project);
- if (localLocation.exists()) return true;
-
- // The target doesn't exist
- return false;
- }
-
- protected File getFileLocation(IProject project) {
- return new File(project.getParent().getLocation().toFile(), project.getName());
- }
-
- private boolean promptToOverwrite(ICVSRemoteFolder remoteFolder, IProject project) {
- // First, if the project exists in the workspace, prompt
- if (project.exists()) {
- if (!promptToOverwrite(
- Policy.bind("CheckoutOperation.confirmOverwrite"), //$NON-NLS-1$
- Policy.bind("CheckoutOperation.thisResourceExists", project.getName(), getRemoteModuleName(remoteFolder)))) { //$NON-NLS-1$
- return false;
- }
- }
- // Even if the project exists, check the target location
- IPath path = getTargetLocationFor(project);
- File localLocation = null;
- if (path == null) {
- try {
- // There is no custom location. However, still prompt
- // if the project directory in the workspace directory
- // would be overwritten.
- if (!project.exists() || !project.isOpen() || project.getDescription().getLocation() != null) {
- localLocation = getFileLocation(project);
- }
- } catch (CoreException e) {
- CVSUIPlugin.log(e);
- }
- } else {
- localLocation = path.toFile();
- }
- if (localLocation != null && localLocation.exists()) {
- try {
- return (promptToOverwrite(
- Policy.bind("CheckoutOperation.confirmOverwrite"), //$NON-NLS-1$
- Policy.bind("CheckoutOperation.thisExternalFileExists", localLocation.getCanonicalPath(), getRemoteModuleName(remoteFolder)))); //$NON-NLS-1$
- } catch (IOException e) {
- CVSUIPlugin.log(CVSException.wrapException(e));
- }
- }
- return true;
- }
-
- protected String getOverwritePromptMessage(ICVSRemoteFolder remoteFolder, IProject project) {
- if(project.exists()) {
- return Policy.bind("CheckoutOperation.thisResourceExists", project.getName(), getRemoteModuleName(remoteFolder));//$NON-NLS-1$
- } else {
- return Policy.bind("CheckoutOperation.thisExternalFileExists", project.getName(), getRemoteModuleName(remoteFolder));//$NON-NLS-1$
- }
- }
-
- /*
- * Bring the provied projects into the workspace
- */
- private void refreshProjects(IProject[] projects, IProgressMonitor monitor) throws CVSException {
- monitor.beginTask(null, projects.length * 100);
- try {
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
- // Register the project with Team
- try {
- monitor.subTask(Policy.bind("CheckoutOperation.refreshingProject", project.getName())); //$NON-NLS-1$
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(project);
- if (folder.isCVSFolder()) {
- RepositoryProvider.map(project, CVSProviderPlugin.getTypeId());
- }
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- }
- CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId());
- if (provider != null) {
- provider.setWatchEditEnabled(CVSProviderPlugin.getPlugin().isWatchEditEnabled());
- }
- }
- } finally {
- monitor.done();
- }
- }
-
- protected String getTaskName() {
- ICVSRemoteFolder[] remoteFolders = getRemoteFolders();
- if (remoteFolders.length == 1) {
- return Policy.bind("CheckoutSingleProjectOperation.taskname", remoteFolders[0].getName()); //$NON-NLS-1$
- } else {
- return Policy.bind("CheckoutMultipleProjectsOperation.taskName", new Integer(remoteFolders.length).toString()); //$NON-NLS-1$
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutSingleProjectOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutSingleProjectOperation.java
deleted file mode 100644
index d9db4191b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutSingleProjectOperation.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * This operation checks out a single remote folder into the workspace as
- * a project.
- */
-public class CheckoutSingleProjectOperation extends CheckoutProjectOperation {
-
- private boolean preconfigured;
- private IProject targetProject;
-
- public CheckoutSingleProjectOperation(IWorkbenchPart part, ICVSRemoteFolder remoteFolder, IProject targetProject, String targetLocation, boolean preconfigured) {
- super(part, new ICVSRemoteFolder[] { remoteFolder }, targetLocation);
- this.targetProject = targetProject;
- this.preconfigured = preconfigured;
- }
-
- private boolean isPreconfigured() {
- return preconfigured;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CheckoutOperation#needsPromptForOverwrite(org.eclipse.core.resources.IProject)
- */
- public boolean needsPromptForOverwrite(IProject project) {
- // No need to prompt if the project was preconfigured
- if (isPreconfigured()) return false;
- return super.needsPromptForOverwrite(project);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CheckoutProjectOperation#performScrubProjects()
- */
- protected boolean performScrubProjects() {
- // Do not scrub the projects if they were preconfigured.
- return !isPreconfigured();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CheckoutOperation#checkout(org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus checkout(ICVSRemoteFolder folder, IProgressMonitor monitor) throws CVSException {
- return checkout(folder, targetProject, monitor);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutToRemoteFolderOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutToRemoteFolderOperation.java
deleted file mode 100644
index 9d3690a48..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutToRemoteFolderOperation.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFile;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFolderSandbox;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Checkout a remote folder into a sandbox that is contained within remote folder handles and
- * the file contents cache.
- */
-public class CheckoutToRemoteFolderOperation extends CheckoutOperation {
-
- RemoteFolderSandbox sandbox;
-
- /**
- * This class overrides the "Created" handler in order to configure the remote file
- * to recieve and cache the contents
- */
- public class CreatedResponseHandler extends UpdatedHandler {
- public CreatedResponseHandler() {
- super(UpdatedHandler.HANDLE_CREATED);
- }
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.UpdatedHandler#receiveTargetFile(org.eclipse.team.internal.ccvs.core.client.Session, org.eclipse.team.internal.ccvs.core.ICVSFile, java.lang.String, java.util.Date, boolean, boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void receiveTargetFile(
- Session session,
- ICVSFile mFile,
- String entryLine,
- Date modTime,
- boolean binary,
- boolean readOnly,
- boolean executable,
- IProgressMonitor monitor)
- throws CVSException {
-
- if (mFile instanceof RemoteFile) {
- try {
- ((RemoteFile)mFile).aboutToReceiveContents(entryLine.getBytes());
- super.receiveTargetFile(
- session,
- mFile,
- entryLine,
- modTime,
- binary,
- readOnly,
- executable,
- monitor);
- } finally {
- ((RemoteFile)mFile).doneReceivingContents();
- }
- } else {
- super.receiveTargetFile(
- session,
- mFile,
- entryLine,
- modTime,
- binary,
- readOnly,
- executable,
- monitor);
- }
- }
- }
-
- public class SandboxCheckout extends Checkout {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.Command#commandFinished(org.eclipse.team.internal.ccvs.core.client.Session, org.eclipse.team.internal.ccvs.core.client.Command.GlobalOption[], org.eclipse.team.internal.ccvs.core.client.Command.LocalOption[], org.eclipse.team.internal.ccvs.core.ICVSResource[], org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IStatus)
- */
- protected IStatus commandFinished(
- Session session,
- GlobalOption[] globalOptions,
- LocalOption[] localOptions,
- ICVSResource[] resources,
- IProgressMonitor monitor,
- IStatus status)
- throws CVSException {
-
- // Don't do anything (i.e. don't prune)
- return status;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.Command#doExecute(org.eclipse.team.internal.ccvs.core.client.Session, org.eclipse.team.internal.ccvs.core.client.Command.GlobalOption[], org.eclipse.team.internal.ccvs.core.client.Command.LocalOption[], java.lang.String[], org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus doExecute(
- Session session,
- GlobalOption[] globalOptions,
- LocalOption[] localOptions,
- String[] arguments,
- ICommandOutputListener listener,
- IProgressMonitor monitor)
- throws CVSException {
-
- ResponseHandler newCreated = new CreatedResponseHandler();
- ResponseHandler oldCreated = session.getResponseHandler(newCreated.getResponseID());
- session.registerResponseHandler(newCreated);
- try {
- return super.doExecute(
- session,
- globalOptions,
- localOptions,
- arguments,
- listener,
- monitor);
- } finally {
- session.registerResponseHandler(oldCreated);
- }
- }
-
-}
- public static ICVSRemoteFolder checkoutRemoteFolder(IWorkbenchPart part, ICVSRemoteFolder folder, IProgressMonitor monitor) throws CVSException, InvocationTargetException, InterruptedException {
- CheckoutToRemoteFolderOperation op = new CheckoutToRemoteFolderOperation(part, folder);
- op.run(monitor);
- return op.getResultingFolder();
- }
- public CheckoutToRemoteFolderOperation(IWorkbenchPart part, ICVSRemoteFolder remoteFolder) {
- super(part, new ICVSRemoteFolder[] { remoteFolder });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CheckoutOperation#checkout(org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus checkout(
- ICVSRemoteFolder folder,
- IProgressMonitor monitor)
- throws CVSException {
-
- IPath sandboxPath = new Path(null, folder.getRepositoryRelativePath()).removeLastSegments(1);
- String pathString;
- if (sandboxPath.isEmpty()) {
- pathString = ICVSRemoteFolder.REPOSITORY_ROOT_FOLDER_NAME;
- } else {
- pathString = sandboxPath.toString();
- }
- sandbox = new RemoteFolderSandbox(null, folder.getRepository(), pathString, folder.getTag());
- return checkout(folder, sandbox, monitor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return Policy.bind("CheckoutToRemoteFolderOperation.0", getRemoteFolders()[0].getName()); //$NON-NLS-1$
- }
-
- protected IStatus checkout(final ICVSRemoteFolder resource, final ICVSFolder sandbox, IProgressMonitor pm) throws CVSException {
- // Get the location and the workspace root
- ICVSRepositoryLocation repository = resource.getRepository();
- // Open a connection session to the repository
- final Session session = new Session(repository, sandbox);
- pm.beginTask(null, 100);
- Policy.checkCanceled(pm);
- session.open(Policy.subMonitorFor(pm, 5), false /* read-only */);
- try {
- // Build the local options
- List localOptions = new ArrayList();
- // Add the options related to the CVSTag
- CVSTag tag = resource.getTag();
- if (tag == null) {
- // A null tag in a remote resource indicates HEAD
- tag = CVSTag.DEFAULT;
- }
- localOptions.add(Update.makeTagOption(tag));
- localOptions.add(Checkout.makeDirectoryNameOption(resource.getName()));
-
- // Perform the checkout
- IStatus status = new SandboxCheckout().execute(session,
- Command.NO_GLOBAL_OPTIONS,
- (LocalOption[])localOptions.toArray(new LocalOption[localOptions.size()]),
- new String[]{resource.getRepositoryRelativePath()},
- null,
- Policy.subMonitorFor(pm, 90));
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- // Any created projects will exist but will not be mapped to CVS
- return status;
- }
- return OK;
- } catch (CVSException e) {
- // An exception occurred either during the module-expansion or checkout
- // Since we were able to make a connection, return the status so the
- // checkout of any other modules can proceed
- return e.getStatus();
- } finally {
- session.close();
- pm.done();
- }
- }
-
- public ICVSRemoteFolder getResultingFolder() throws CVSException {
- return (ICVSRemoteFolder)sandbox.getFolder(getRemoteFolders()[0].getName());
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitOperation.java
deleted file mode 100644
index 6a641b5f2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitOperation.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.runtime.*;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Perform a "cvs commit"
- */
-public class CommitOperation extends SingleCommandOperation {
-
- public CommitOperation(IWorkbenchPart part, IResource[] resources, LocalOption[] options) {
- super(part, resources, options);
- }
-
- /**
- * Perform prompting for unadded resources and comment
- * @param monitor a progess monitor
- * @return <code>true</code> if execution should continue
- */
- public boolean performPrompting(IProgressMonitor monitor) throws CVSException, InvocationTargetException, InterruptedException {
- monitor.beginTask(null, 20);
- IResource[] resourcesToBeAdded = promptForResourcesToBeAdded(Policy.subMonitorFor(monitor, 10));
- if (resourcesToBeAdded == null) return false;
- String comment = promptForComment(getResources());
- if (comment == null) return false;
- addLocalOption(Commit.makeArgumentOption(Command.MESSAGE_OPTION, comment));
- if (resourcesToBeAdded.length > 0) {
- new AddOperation(getPart(), resourcesToBeAdded)
- .run(Policy.subMonitorFor(monitor, 10));
- }
- setResources(getSharedResources(getResources()));
- monitor.done();
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
- // Ensure that a comment has been provided
- if (!Command.MESSAGE_OPTION.isElementOf(getLocalOptions())) {
- String comment = promptForComment(getResources());
- if (comment == null) return;
- addLocalOption(Commit.makeArgumentOption(Command.MESSAGE_OPTION, comment));
- }
- super.execute(monitor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.SingleCommandOperation#executeCommand(org.eclipse.team.internal.ccvs.core.client.Session, org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.team.internal.ccvs.core.ICVSResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus executeCommand(Session session, CVSTeamProvider provider, ICVSResource[] resources, IProgressMonitor monitor) throws CVSException, InterruptedException {
- return Command.COMMIT.execute(session,
- Command.NO_GLOBAL_OPTIONS,
- getLocalOptions(),
- resources,
- null,
- monitor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return Policy.bind("RepositoryManager.committing"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
- */
- protected String getTaskName(CVSTeamProvider provider) {
- return Policy.bind("CommitOperation.0", provider.getProject().getName()); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getErrorMessage(org.eclipse.core.runtime.IStatus[], int)
- */
- protected String getErrorMessage(IStatus[] failures, int totalOperations) {
- return Policy.bind("CommitAction.commitFailed"); //$NON-NLS-1$
- }
-
- private IResource[] getUnaddedResources(IResource[] resources, IProgressMonitor iProgressMonitor) throws CVSException {
- final List unadded = new ArrayList();
- final CVSException[] exception = new CVSException[] { null };
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- // visit each resource deeply
- try {
- resource.accept(new IResourceVisitor() {
- public boolean visit(IResource resource) throws CoreException {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- // skip ignored resources and their children
- try {
- if (cvsResource.isIgnored())
- return false;
- // visit the children of shared resources
- if (cvsResource.isManaged())
- return true;
- if (cvsResource.isFolder() && ((ICVSFolder)cvsResource).isCVSFolder())
- return true;
- } catch (CVSException e) {
- exception[0] = e;
- }
- // don't add folders to avoid comitting empty folders
- if (resource.getType() == IResource.FOLDER)
- return true;
- // file is unshared so record it
- unadded.add(resource);
- // no need to go into children because add is deep
- return false;
- }
- });
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- }
- if (exception[0] != null) throw exception[0];
- }
- return (IResource[]) unadded.toArray(new IResource[unadded.size()]);
- }
-
- protected IResource[] promptForResourcesToBeAdded(IProgressMonitor monitor) throws CVSException {
- IResource[] unadded = getUnaddedResources(getResources(), monitor);
- RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- return manager.promptForResourcesToBeAdded(getShell(), unadded);
- }
-
- protected String promptForComment(IResource[] resourcesToCommit) {
- RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- return manager.promptForComment(getShell(), resourcesToCommit, null);
- }
-
- /*
- * Return all resources in the provided collection that are shared with a repo
- * @param resources
- * @return IResource[]
- */
- private IResource[] getSharedResources(IResource[] resources) throws CVSException {
- List shared = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if (cvsResource.isManaged()
- || (cvsResource.isFolder() && ((ICVSFolder)cvsResource).isCVSFolder())) {
- shared.add(resource);
- }
- }
- return (IResource[]) shared.toArray(new IResource[shared.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.SingleCommandOperation#isServerModificationOperation()
- */
- protected boolean isServerModificationOperation() {
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DisconnectOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DisconnectOperation.java
deleted file mode 100644
index c32e8abaa..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DisconnectOperation.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Disconnect the given projects from CVS control
- */
-public class DisconnectOperation extends RepositoryProviderOperation {
-
- private boolean unmanage;
-
- public DisconnectOperation(IWorkbenchPart part, IProject[] projects, boolean unmanage) {
- super(part, projects);
- this.unmanage = unmanage;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(
- CVSTeamProvider provider,
- IResource[] resources,
- IProgressMonitor monitor)
- throws CVSException, InterruptedException {
-
- // This method will be invoked for each provider being disconnected
- IProject project = provider.getProject();
- try {
- RepositoryProvider.unmap(project);
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- }
- if (unmanage) {
- ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor(project);
- cvsFolder.unmanage(monitor);
- EclipseSynchronizer.getInstance().deconfigure(project, monitor);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return Policy.bind("DisconnectOperation.0"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
- */
- protected String getTaskName(CVSTeamProvider provider) {
- return Policy.bind("DisconnectOperation.1", provider.getProject().getName()); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#canRunAsJob()
- */
- public boolean canRunAsJob() {
- // Do not run in the background
- return false;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FetchMembersOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FetchMembersOperation.java
deleted file mode 100644
index d7a4cd68a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FetchMembersOperation.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFolder;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFolderMemberFetcher;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.progress.IElementCollector;
-
-/**
- * Fetch the members of a remote folder in the background, passing incremental
- * results through an IElementCollector.
- */
-public class FetchMembersOperation extends RemoteOperation {
-
- /* internal uzse only */ IElementCollector collector;
- /* internal uzse only */ RemoteFolderFilter filter = new RemoteFolderFilter();
-
- public static class RemoteFolderFilter {
- public ICVSRemoteResource[] filter(ICVSRemoteResource[] resource) {
- return resource;
- }
- }
-
- public class InternalRemoteFolderMemberFetcher extends RemoteFolderMemberFetcher {
- long sendIncrement = 100;
- List unsent = new ArrayList();
- long intervalStart;
- protected InternalRemoteFolderMemberFetcher(RemoteFolder parentFolder, CVSTag tag) {
- super(parentFolder, tag);
- }
- protected void parentDoesNotExist() {
- super.parentDoesNotExist();
- // Indicate that there are no children
- collector.add(new Object[0], getProgressMonitor());
- }
- protected RemoteFolder recordFolder(String name) {
- RemoteFolder folder = super.recordFolder(name);
- unsent.add(folder);
- if (isTimeToSend()) {
- sendFolders();
- }
- return folder;
- }
- private boolean isTimeToSend() {
- long currentTime = System.currentTimeMillis();
- return ((currentTime - intervalStart) > sendIncrement) || unsent.size() > sendIncrement;
- }
- protected IStatus performUpdate(IProgressMonitor progress, CVSTag tag) throws CVSException {
- intervalStart = System.currentTimeMillis();
- IStatus status = super.performUpdate(progress, tag);
- sendFolders();
- return status;
- }
- protected void updateFileRevisions(ICVSFile[] files, IProgressMonitor monitor) throws CVSException {
- super.updateFileRevisions(files, monitor);
- sendFiles();
- }
- private void sendFolders() {
- updateParentFolderChildren();
- collector.add(filter.filter((ICVSRemoteFolder[]) unsent.toArray(new ICVSRemoteFolder[unsent.size()])), getProgressMonitor());
- unsent.clear();
- intervalStart = System.currentTimeMillis();
- }
- private void sendFiles() {
- collector.add(getFiles(), getProgressMonitor());
- unsent.clear();
- }
- private IProgressMonitor getProgressMonitor() {
- return null;
- }
- }
-
- public FetchMembersOperation(IWorkbenchPart part, ICVSRemoteFolder folder, IElementCollector collector) {
- super(part, new ICVSRemoteResource[] { folder });
- this.collector = collector;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
- ICVSRemoteFolder remote = getRemoteFolder();
- if (remote.getClass().equals(RemoteFolder.class)) {
- monitor = Policy.monitorFor(monitor);
- boolean isRoot = remote.getName().equals(ICVSRemoteFolder.REPOSITORY_ROOT_FOLDER_NAME);
- monitor.beginTask(null, 100 + (isRoot ? 30 : 0));
- RemoteFolderMemberFetcher fetcher = new InternalRemoteFolderMemberFetcher((RemoteFolder)remote, remote.getTag());
- fetcher.fetchMembers(Policy.subMonitorFor(monitor, 100));
- if (isRoot) {
- ICVSRemoteResource[] modules = CVSUIPlugin.getPlugin()
- .getRepositoryManager()
- .getRepositoryRootFor(remote.getRepository())
- .getDefinedModules(remote.getTag(), Policy.subMonitorFor(monitor, 25));
- collector.add(filter.filter(modules), Policy.subMonitorFor(monitor, 5));
- }
- } else {
- monitor = Policy.monitorFor(monitor);
- try {
- monitor.beginTask(null, 100);
- ICVSRemoteResource[] children = remote.members(Policy.subMonitorFor(monitor, 95));
- collector.add(children, Policy.subMonitorFor(monitor, 5));
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- } finally {
- monitor.done();
- }
- }
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return Policy.bind("FetchMembersOperation.0", getRemoteFolder().getName()); //$NON-NLS-1$
- }
-
- private ICVSRemoteFolder getRemoteFolder() {
- return (ICVSRemoteFolder)getRemoteResources()[0];
- }
-
- public RemoteFolderFilter getFilter() {
- return filter;
- }
-
- public void setFilter(RemoteFolderFilter filter) {
- this.filter = filter;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/HasProjectMetaFileOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/HasProjectMetaFileOperation.java
deleted file mode 100644
index 00a0cf363..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/HasProjectMetaFileOperation.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Operation which checks for the existance of the .project file
- * in a remote folder. The operation can be run using the <code>hasMetaFile</code>
- * static method of by executing the operation and then checking <code>metaFileExists</code>
- */
-public class HasProjectMetaFileOperation extends CVSOperation {
-
- private ICVSRemoteFolder remoteFolder;
- private boolean metaFileExists;
-
- public static boolean hasMetaFile(IWorkbenchPart part, ICVSRemoteFolder remoteFolder) throws InvocationTargetException, InterruptedException {
- HasProjectMetaFileOperation op = new HasProjectMetaFileOperation(part, remoteFolder);
- op.run();
- return op.metaFileExists();
- }
-
- public HasProjectMetaFileOperation(IWorkbenchPart part, ICVSRemoteFolder remoteFolder) {
- super(part);
- this.remoteFolder = remoteFolder;
- }
-
- /*
- * Return true if the provided remote folder contains a valid meta-file
- * (i.e. .project file).
- */
- private boolean hasMetaFile(ICVSRemoteFolder folder, IProgressMonitor monitor) throws CVSException {
-
- // make a copy of the folder so that we will not effect the original folder when we refetch the members
- // TODO: this is a strange thing to need to do. We shold fix this.
- folder = (ICVSRemoteFolder)folder.forTag(remoteFolder.getTag());
-
- try {
- folder.members(monitor);
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- }
- // Check for the existance of the .project file
- try {
- folder.getFile(".project"); //$NON-NLS-1$
- return true;
- } catch (TeamException e) {
- // We couldn't retrieve the meta file so assume it doesn't exist
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
- metaFileExists = hasMetaFile(remoteFolder, monitor);
- }
-
- /**
- * Return true if the meta file exists remotely. This method should only be invoked
- * after the operation has been executed;
- * @return
- */
- public boolean metaFileExists() {
- return metaFileExists;
- }
-
- protected String getTaskName() {
- return Policy.bind("HasProjectMetaFile.taskName"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#canRunAsJob()
- */
- public boolean canRunAsJob() {
- // This operation should never be run in the background.
- return false;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ITagOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ITagOperation.java
deleted file mode 100644
index 493126987..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ITagOperation.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
-
-public interface ITagOperation {
- public abstract CVSTag getTag();
- public abstract void setTag(CVSTag tag);
- public abstract void run() throws InvocationTargetException, InterruptedException;
- public abstract ICVSResource[] getCVSResources();
- public abstract void moveTag();
- public abstract void recurse();
- public abstract TagSource getTagSource();
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/OverrideAndUpdateOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/OverrideAndUpdateOperation.java
deleted file mode 100644
index c5bb066f3..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/OverrideAndUpdateOperation.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.*;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * A specialized Replace operation that will update managed resources and
- * unmanaged resources that are conflicting additions (so that the remote is fetched)
- */
-public class OverrideAndUpdateOperation extends ReplaceOperation {
-
- private IResource[] conflictingAdditions;
-
- public OverrideAndUpdateOperation(IWorkbenchPart part, IResource[] allResources, IResource[] conflictingAdditions, CVSTag tag, boolean recurse) {
- super(part, allResources, tag, recurse);
- this.conflictingAdditions = conflictingAdditions;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ReplaceOperation#getResourcesToUpdate(org.eclipse.team.internal.ccvs.core.ICVSResource[])
- */
- protected ICVSResource[] getResourcesToUpdate(ICVSResource[] resources) throws CVSException {
- // Add the conflicting additions to the list of resources to update
- Set update = new HashSet();
- ICVSResource[] conflicts = getCVSArguments(conflictingAdditions);
- update.addAll(Arrays.asList(conflicts));
- update.addAll(Arrays.asList(super.getResourcesToUpdate(resources)));
- return (ICVSResource[]) update.toArray(new ICVSResource[update.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#updateWorkspaceSubscriber(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.team.internal.ccvs.core.ICVSResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void updateWorkspaceSubscriber(CVSTeamProvider provider, ICVSResource[] resources, IProgressMonitor monitor) {
- // No need to update the workspace subscriber since we know this operation will do it properly by itself
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReconcileProjectOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReconcileProjectOperation.java
deleted file mode 100644
index 875b30376..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReconcileProjectOperation.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Date;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.SyncInfoFilter.ContentComparisonSyncInfoFilter;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.MutableResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-/**
- * Reconcile an existing unshared local project with an existing remote folder.
- */
-public class ReconcileProjectOperation extends ShareProjectOperation {
-
- private ICVSRemoteFolder folder;
- private ContentComparisonSyncInfoFilter contentCompare = new ContentComparisonSyncInfoFilter(false);
- private CVSWorkspaceSubscriber subscriber = CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber();
-
- public ReconcileProjectOperation(Shell shell, IProject project, ICVSRemoteFolder folder) {
- super(shell, folder.getRepository(), project, folder.getRepositoryRelativePath());
- this.folder = folder;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return Policy.bind("ReconcileProjectOperation.0", getProject().getName(), folder.getRepositoryRelativePath()); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ShareProjectOperation#createRemoteFolder(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected ICVSRemoteFolder createRemoteFolder(IProgressMonitor monitor) throws CVSException {
- // The folder already exists so just return the handle
- return folder;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ShareProjectOperation#mapProjectToRemoteFolder(org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void mapProjectToRemoteFolder(ICVSRemoteFolder remote, IProgressMonitor monitor) throws TeamException {
- // Map the project
- monitor.beginTask(null, 100);
- super.mapProjectToRemoteFolder(remote, Policy.subMonitorFor(monitor, 10));
- // Reconcile the sync info
- reconcileSyncInfo(Policy.subMonitorFor(monitor, 90));
- monitor.done();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void reconcileSyncInfo(IProgressMonitor monitor) throws CVSException {
- try {
- monitor.beginTask(null, 100);
- // Fetch the entire remote tree
- ICVSRemoteFolder remote = CheckoutToRemoteFolderOperation.checkoutRemoteFolder(getPart(), folder, Policy.subMonitorFor(monitor, 80));
- // Traverse the tree and populate the workspace base or remote
- // with the sync info depending on file contents
- populateWorkspace(remote, Policy.subMonitorFor(monitor, 20));
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- } catch (InterruptedException e) {
- throw new OperationCanceledException();
- } finally {
- monitor.done();
- }
-
- }
-
- private void populateWorkspace(final ICVSRemoteFolder remote, IProgressMonitor monitor) throws CVSException {
- CVSWorkspaceRoot.getCVSFolderFor(getProject()).run(new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- populateWorkspace(getProject(), remote, monitor);
- }
- }, monitor);
-
- }
-
- /* private */ void populateWorkspace(IResource resource, ICVSRemoteResource remote, IProgressMonitor monitor) throws CVSException {
- try {
- if (resource.getType() == IResource.FILE) {
- if (remote.isContainer()) {
- CVSUIPlugin.log(IStatus.ERROR, Policy.bind("ReconcileProjectOperation.1", resource.getFullPath().toString(), remote.getRepositoryRelativePath()), null); //$NON-NLS-1$
- } else {
- IFile file = (IFile)resource;
- IResourceVariant variant = (IResourceVariant)remote;
- if (file.exists()
- && variant != null
- && contentCompare.compareContents(file, variant, monitor)) {
- // The contents are the same so populate the local workspace
- // with the remote sync info and make the file in-sync
- makeInSync(file, remote, monitor);
- } else {
- // Would like to put the bytes in the remote but this
- // is complicated due to subscriber events.
- // We'll refresh the subcriber at the end.
- }
- }
- } else {
- if (!remote.isContainer()) {
- CVSUIPlugin.log(IStatus.ERROR, Policy.bind("ReconcileProjectOperation.2", resource.getFullPath().toString(), remote.getRepositoryRelativePath()), null); //$NON-NLS-1$
- } else {
- // Map the local folder to the remote folder.
- // (Note that this will make phantoms for non-exisiting local folders)
- ICVSFolder folder = (ICVSFolder)CVSWorkspaceRoot.getCVSResourceFor(resource);
- folder.setFolderSyncInfo(((ICVSFolder)remote).getFolderSyncInfo());
- // Traverse the children of the remote
- // (The members were prefetched).
- ICVSRemoteResource[] members = remote.members(monitor);
- for (int i = 0; i < members.length; i++) {
- ICVSRemoteResource member = members[i];
- populateWorkspace(getLocalChild((IContainer)resource, member), member, monitor);
- }
- }
- }
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- }
- }
-
- /*
- * Get the local resource handle for corresponding to the remote resource
- */
- private IResource getLocalChild(IContainer parent, ICVSRemoteResource member) {
- IResource resource = parent.findMember(member.getName());
- if (resource == null) {
- if (member.isContainer()) {
- resource = parent.getFolder(new Path(null, member.getName()));
- } else {
- resource = parent.getFile(new Path(null, member.getName()));
- }
- }
- return resource;
- }
-
- /*
- * Make the file in-sync with its corresponding remote.
- */
- private void makeInSync(IFile file, ICVSRemoteResource remote, IProgressMonitor monitor) throws CVSException {
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor(file);
- ResourceSyncInfo info = remote.getSyncInfo();
- Date modTime = info.getTimeStamp();
- if (modTime != null) {
- cvsFile.setTimeStamp(modTime);
- }
- modTime = cvsFile.getTimeStamp();
- MutableResourceSyncInfo newInfoWithTimestamp = info.cloneMutable();
- newInfoWithTimestamp.setTimeStamp(modTime);
- cvsFile.setSyncInfo(newInfoWithTimestamp, ICVSFile.CLEAN);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteCompareOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteCompareOperation.java
deleted file mode 100644
index 3c5fb84ff..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteCompareOperation.java
+++ /dev/null
@@ -1,381 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.*;
-
-import org.eclipse.compare.CompareUI;
-import org.eclipse.core.runtime.*;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.client.listeners.RDiffSummaryListener;
-import org.eclipse.team.internal.ccvs.core.resources.*;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.Assert;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Compare the two versions of given remote folders obtained from the two tags specified.
- */
-public class RemoteCompareOperation extends RemoteOperation {
-
- private CompareTreeBuilder builder;
- private CVSTag left, right;
-
- /**
- * Helper class for builder and comparing the resource trees
- */
- public static class CompareTreeBuilder implements RDiffSummaryListener.IFileDiffListener {
- private ICVSRepositoryLocation location;
- private RemoteFolderTree leftTree, rightTree;
- private CVSTag left, right;
-
- public CompareTreeBuilder(ICVSRepositoryLocation location, CVSTag left, CVSTag right) {
- this.left = left;
- this.right = right;
- this.location = location;
- reset();
- }
-
- public RemoteFolderTree getLeftTree() {
- return leftTree;
- }
- public RemoteFolderTree getRightTree() {
- return rightTree;
- }
-
- /**
- * Reset the builder to prepare for a new build
- */
- public void reset() {
- leftTree = new RemoteFolderTree(null, location, ICVSRemoteFolder.REPOSITORY_ROOT_FOLDER_NAME, left);
- leftTree.setChildren(new ICVSRemoteResource[0]);
- rightTree = new RemoteFolderTree(null, location, ICVSRemoteFolder.REPOSITORY_ROOT_FOLDER_NAME, right);
- rightTree.setChildren(new ICVSRemoteResource[0]);
- }
-
- /**
- * Cache the contents for the files that are about to be compares
- * @throws CVSException
- */
- public void cacheContents(IProgressMonitor monitor) throws CVSException {
- String[] overlappingFilePaths = getOverlappingFilePaths();
- if (overlappingFilePaths.length > 0) {
- monitor.beginTask(null, 100);
- fetchFileContents(leftTree, overlappingFilePaths, Policy.subMonitorFor(monitor, 50));
- fetchFileContents(rightTree, overlappingFilePaths, Policy.subMonitorFor(monitor, 50));
- monitor.done();
- }
- }
-
- /**
- * Open the comparison in a compare editor
- */
- public void openCompareEditor(final IWorkbenchPage page, final String title, final String toolTip) {
- if (leftTree == null || rightTree == null) return;
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- CompareUI.openCompareEditorOnPage(
- new CVSCompareEditorInput(title, toolTip, new ResourceEditionNode(leftTree), new ResourceEditionNode(rightTree)), page);
- }
- });
- }
-
- /**
- * Add the predecessor to the left tree and the remote to the right tree.
- * @param predecessor
- * @param remote
- */
- public void addToTrees(ICVSRemoteFile predecessor, ICVSRemoteFile remote) {
- if (remote != null) {
- try {
- Path filePath = new Path(null, remote.getRepositoryRelativePath());
- addFile(rightTree, right, filePath, remote.getRevision());
- getFolder(leftTree, left, filePath.removeLastSegments(1), Path.EMPTY);
- } catch (TeamException e) {
- CVSUIPlugin.log(e);
- }
- }
- if (predecessor != null) {
- try {
- Path filePath = new Path(null, predecessor.getRepositoryRelativePath());
- addFile(leftTree, left, filePath, predecessor.getRevision());
- getFolder(rightTree, right, filePath.removeLastSegments(1), Path.EMPTY);
- } catch (TeamException e) {
- CVSUIPlugin.log(e);
- }
- }
- }
-
- private void addFile(RemoteFolderTree tree, CVSTag tag, Path filePath, String revision) throws CVSException {
- RemoteFolderTree parent = (RemoteFolderTree)getFolder(tree, tag, filePath.removeLastSegments(1), Path.EMPTY);
- String name = filePath.lastSegment();
- ICVSRemoteFile file = new RemoteFile(parent, 0, name, revision, null, getTag(revision, tag));
- addChild(parent, file);
- }
-
- private CVSTag getTag(String revision, CVSTag tag) {
- if (tag == null) {
- tag = new CVSTag(revision, CVSTag.VERSION);
- }
- return tag;
- }
-
- /*
- * Get the folder at the given path in the given tree, creating any missing folders as needed.
- */
- private ICVSRemoteFolder getFolder(RemoteFolderTree tree, CVSTag tag, IPath remoteFolderPath, IPath parentPath) throws CVSException {
- if (remoteFolderPath.segmentCount() == 0) return tree;
- String name = remoteFolderPath.segment(0);
- ICVSResource child;
- IPath childPath = parentPath.append(name);
- if (tree.childExists(name)) {
- child = tree.getChild(name);
- } else {
- child = new RemoteFolderTree(tree, tree.getRepository(), childPath.toString(), tag);
- ((RemoteFolderTree)child).setChildren(new ICVSRemoteResource[0]);
- addChild(tree, (ICVSRemoteResource)child);
- }
- return getFolder((RemoteFolderTree)child, tag, remoteFolderPath.removeFirstSegments(1), childPath);
- }
-
- private void addChild(RemoteFolderTree tree, ICVSRemoteResource resource) {
- ICVSRemoteResource[] children = tree.getChildren();
- ICVSRemoteResource[] newChildren;
- if (children == null) {
- newChildren = new ICVSRemoteResource[] { resource };
- } else {
- newChildren = new ICVSRemoteResource[children.length + 1];
- System.arraycopy(children, 0, newChildren, 0, children.length);
- newChildren[children.length] = resource;
- }
- tree.setChildren(newChildren);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.listeners.RDiffSummaryListener.IFileDiffListener#fileDiff(java.lang.String, java.lang.String, java.lang.String)
- */
- public void fileDiff(String remoteFilePath, String leftRevision, String rightRevision) {
- try {
- addFile(rightTree, right, new Path(null, remoteFilePath), rightRevision);
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- try {
- addFile(leftTree, left, new Path(null, remoteFilePath), leftRevision);
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.listeners.RDiffSummaryListener.IFileDiffListener#newFile(java.lang.String, java.lang.String)
- */
- public void newFile(String remoteFilePath, String rightRevision) {
- try {
- addFile(rightTree, right, new Path(null, remoteFilePath), rightRevision);
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.listeners.RDiffSummaryListener.IFileDiffListener#deletedFile(java.lang.String)
- */
- public void deletedFile(String remoteFilePath, String leftRevision) {
- // The leftRevision may be null in which case the tag is used
- try {
- addFile(leftTree, left, new Path(null, remoteFilePath), leftRevision);
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.listeners.RDiffSummaryListener.IFileDiffListener#directory(java.lang.String)
- */
- public void directory(String remoteFolderPath) {
- try {
- getFolder(leftTree, left, new Path(null, remoteFolderPath), Path.EMPTY);
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- try {
- getFolder(rightTree, right, new Path(null, remoteFolderPath), Path.EMPTY);
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
-
- private String[] getOverlappingFilePaths() {
- String[] leftFiles = getFilePaths(leftTree);
- String[] rightFiles = getFilePaths(rightTree);
- Set set = new HashSet();
- for (int i = 0; i < rightFiles.length; i++) {
- String rightFile = rightFiles[i];
- for (int j = 0; j < leftFiles.length; j++) {
- String leftFile = leftFiles[j];
- if (leftFile.equals(rightFile)) {
- set.add(leftFile);
- }
- }
- }
- return (String[]) set.toArray(new String[set.size()]);
- }
-
- private void fetchFileContents(RemoteFolderTree tree, String[] overlappingFilePaths, IProgressMonitor monitor) throws CVSException {
- FileContentCachingService.fetchFileContents(tree, overlappingFilePaths, monitor);
- }
-
- private String[] getFilePaths(RemoteFolderTree tree) {
- ICVSRemoteResource[] children = tree.getChildren();
- List result = new ArrayList();
- for (int i = 0; i < children.length; i++) {
- ICVSRemoteResource resource = children[i];
- if (resource.isContainer()) {
- result.addAll(Arrays.asList(getFilePaths((RemoteFolderTree)resource)));
- } else {
- result.add(resource.getRepositoryRelativePath());
- }
- }
- return (String[]) result.toArray(new String[result.size()]);
- }
- }
-
- public static CVSTag getTag(ICVSRemoteResource resource) throws CVSException {
- CVSTag tag = null;
- try {
- if (resource.isContainer()) {
- tag = ((ICVSRemoteFolder)resource).getTag();
- } else {
- ICVSRemoteFile file = (ICVSRemoteFile)resource;
- String revision = file.getRevision();
- if (revision.equals(ResourceSyncInfo.ADDED_REVISION)) {
- ResourceSyncInfo info =file.getSyncInfo();
- if (info != null) tag = info.getTag();
- } else {
- tag = new CVSTag(revision, CVSTag.VERSION);
- }
- }
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- }
- if (tag == null) tag = CVSTag.DEFAULT;
- return tag;
- }
-
- /**
- * Compare two versions of the given remote resource.
- * @param shell
- * @param remoteResource the resource whose tags are being compared
- * @param left the earlier tag (not null)
- * @param right the later tag (not null)
- */
- public RemoteCompareOperation(IWorkbenchPart part, ICVSRemoteResource remoteResource, CVSTag tag) {
- super(part, new ICVSRemoteResource[] {remoteResource});
- Assert.isNotNull(tag);
- this.right = tag;
- try {
- this.left = getTag(remoteResource);
- } catch (CVSException e) {
- // This shouldn't happen but log it just in case
- CVSProviderPlugin.log(e);
- }
- if (this.left == null) {
- this.left = CVSTag.DEFAULT;
- }
- builder = new CompareTreeBuilder(remoteResource.getRepository(), left, right);
- }
-
- /*
- * This command only supports the use of a single resource
- */
- private ICVSRemoteResource getRemoteResource() {
- return getRemoteResources()[0];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(IProgressMonitor monitor) throws CVSException {
- boolean fetchContents = CVSUIPlugin.getPlugin().getPluginPreferences().getBoolean(ICVSUIConstants.PREF_CONSIDER_CONTENTS);
- monitor.beginTask(getTaskName(), 50 + (fetchContents ? 100 : 0));
- try {
- ICVSRemoteResource resource = getRemoteResource();
- IStatus status = buildTrees(resource, Policy.subMonitorFor(monitor, 50));
- if (status.isOK() && fetchContents) {
- builder.cacheContents(Policy.subMonitorFor(monitor, 100));
- }
- collectStatus(status);
- openCompareEditor(builder);
- } finally {
- monitor.done();
- }
- }
-
- /**
- * This method is here to allow subclasses to override
- */
- protected void openCompareEditor(CompareTreeBuilder builder) {
- builder.openCompareEditor(getTargetPage(), null, null);
- }
-
- /*
- * Build the two trees uses the reponses from "cvs rdiff -s ...".
- */
- private IStatus buildTrees(ICVSRemoteResource resource, IProgressMonitor monitor) throws CVSException {
- // Initialize the resulting trees
- builder.reset();
- Command.QuietOption oldOption= CVSProviderPlugin.getPlugin().getQuietness();
- Session session = new Session(resource.getRepository(), builder.getLeftTree(), false);
- try {
- monitor.beginTask(getTaskName(), 100);
- CVSProviderPlugin.getPlugin().setQuietness(Command.VERBOSE);
- session.open(Policy.subMonitorFor(monitor, 10));
- IStatus status = Command.RDIFF.execute(session,
- Command.NO_GLOBAL_OPTIONS,
- getLocalOptions(),
- new ICVSResource[] { resource },
- new RDiffSummaryListener(builder),
- Policy.subMonitorFor(monitor, 90));
- return status;
- } finally {
- try {
- session.close();
- } finally {
- CVSProviderPlugin.getPlugin().setQuietness(oldOption);
- }
- monitor.done();
- }
- }
-
- private LocalOption[] getLocalOptions() {
- return new LocalOption[] {RDiff.SUMMARY, RDiff.makeTagOption(left), RDiff.makeTagOption(right)};
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return Policy.bind("RemoteCompareOperation.0", new Object[] {left.getName(), right.getName(), getRemoteResource().getRepositoryRelativePath()}); //$NON-NLS-1$
- }
-
- protected IWorkbenchPage getTargetPage() {
- return TeamUIPlugin.getActivePage();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteLogOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteLogOperation.java
deleted file mode 100644
index b2ad792ce..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteLogOperation.java
+++ /dev/null
@@ -1,282 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.*;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.*;
-import org.eclipse.team.internal.ccvs.core.client.listeners.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.util.Util;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Performs an rlog on the resources and caches the results.
- */
-public class RemoteLogOperation extends RepositoryLocationOperation {
-
- private RLog rlog = new RLog();
- private CVSTag tag1;
- private CVSTag tag2;
- private LogEntryCache entryCache;
-
- /**
- * A log entry cache that can be shared by multiple instances of the
- * remote log operation.
- */
- public static class LogEntryCache implements ILogEntryListener {
-
- /*
- * Cache of all log entries
- */
- private Map entries = new HashMap(); /* Map String:remoteFilePath->Map (String:revision -> ILogEntry) */
-
- private Map internalGetLogEntries(String path) {
- return (Map)entries.get(path);
- }
-
- /**
- * Return all the log entries at the given path
- * @param path the file path
- * @return the log entries for the file
- */
- public ILogEntry[] getLogEntries(String path) {
- Map map = internalGetLogEntries(path);
- return (ILogEntry[]) map.values().toArray(new ILogEntry[map.values().size()]);
- }
-
- private ILogEntry internalGetLogEntry(String path, String revision) {
- Map fileEntries = internalGetLogEntries(path);
- if (fileEntries != null) {
- return (ILogEntry)fileEntries.get(revision);
- }
- return null;
- }
-
- public String[] getCachedFilePaths() {
- return (String[]) entries.keySet().toArray(new String[entries.size()]);
- }
-
- /**
- * Return the log entry that for the given resource
- * or <code>null</code> if no entry was fetched or the
- * resource is not a file.
- * @param getFullPath(resource) the resource
- * @return the log entry or <code>null</code>
- */
- public synchronized ILogEntry getLogEntry(ICVSRemoteResource resource) {
- if (resource instanceof ICVSRemoteFile) {
- try {
- String path = getFullPath(resource);
- String revision = ((ICVSRemoteFile)resource).getRevision();
- return internalGetLogEntry(path, revision);
- } catch (TeamException e) {
- // Log and return null
- CVSUIPlugin.log(e);
- }
- }
- return null;
- }
-
- /**
- * Return the log entries that were fetched for the given resource
- * or an empty list if no entry was fetched.
- * @param getFullPath(resource) the resource
- * @return the fetched log entries or an empty list is none were found
- */
- public synchronized ILogEntry[] getLogEntries(ICVSRemoteResource resource) {
- Map fileEntries = internalGetLogEntries(getFullPath(resource));
- if (fileEntries != null) {
- return (ILogEntry[]) fileEntries.values().toArray(new ILogEntry[fileEntries.size()]);
- }
- return new ILogEntry[0];
- }
-
- /*
- * Return the full path that uniquely identifies the resource
- * accross repositories. This path include the repository and
- * resource path but does not include the revision so that
- * all log entries for a file can be retrieved.
- */
- private String getFullPath(ICVSRemoteResource resource) {
- return Util.appendPath(resource.getRepository().getLocation(), resource.getRepositoryRelativePath());
- }
-
- public synchronized void clearEntries() {
- entries.clear();
- }
-
- public synchronized ICVSRemoteFile getImmediatePredecessor(ICVSRemoteFile file) throws TeamException {
- ILogEntry[] allLogs = getLogEntries(file);
- String revision = file.getRevision();
- // First decrement the last digit and see if that revision exists
- String predecessorRevision = getPredecessorRevision(revision);
- ICVSRemoteFile predecessor = findRevison(allLogs, predecessorRevision);
- // If nothing was found, try to fond the base of a branch
- if (predecessor == null && isBrancheRevision(revision)) {
- predecessorRevision = getBaseRevision(revision);
- predecessor = findRevison(allLogs, predecessorRevision);
- }
- // If that fails, it is still possible that there is a revision.
- // This can happen if the revision has been manually set.
- if (predecessor == null) {
- // We don't search in this case since this is costly and would be done
- // for any file that is new as well.
- }
- return predecessor;
- }
-
- /*
- * Find the given revision in the list of log entries.
- * Return null if the revision wasn't found.
- */
- private ICVSRemoteFile findRevison(ILogEntry[] allLogs, String predecessorRevision) throws TeamException {
- for (int i = 0; i < allLogs.length; i++) {
- ILogEntry entry = allLogs[i];
- ICVSRemoteFile file = entry.getRemoteFile();
- if (file.getRevision().equals(predecessorRevision)) {
- return file;
- }
- }
- return null;
- }
- /*
- * Decrement the trailing digit by one.
- */
- private String getPredecessorRevision(String revision) {
- int digits[] = Util.convertToDigits(revision);
- digits[digits.length -1]--;
- StringBuffer buffer = new StringBuffer(revision.length());
- for (int i = 0; i < digits.length; i++) {
- buffer.append(Integer.toString(digits[i]));
- if (i < digits.length - 1) {
- buffer.append('.');
- }
- }
- return buffer.toString();
- }
-
- /*
- * Return true if there are more than 2 digits in the revision number
- * (i.e. the revision is on a branch)
- */
- private boolean isBrancheRevision(String revision) {
- return Util.convertToDigits(revision).length > 2;
- }
-
- /*
- * Remove the trailing revision digits such that the
- * returned revision is shorter than the given revision
- * and is an even number of digits long
- */
- private String getBaseRevision(String revision) {
- int digits[] = Util.convertToDigits(revision);
- int length = digits.length - 1;
- if (length % 2 == 1) {
- length--;
- }
- StringBuffer buffer = new StringBuffer(revision.length());
- for (int i = 0; i < length; i++) {
- buffer.append(Integer.toString(digits[i]));
- if (i < length - 1) {
- buffer.append('.');
- }
- }
- return buffer.toString();
- }
- /**
- * Remove any entries for the remote resources
- * @param resource the remote resource
- */
- public synchronized void clearEntries(ICVSRemoteResource resource) {
- String remotePath = getFullPath(resource);
- entries.remove(remotePath);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.core.client.listeners.ILogEntryListener#addEntry(org.eclipse.team.internal.ccvs.core.client.listeners.LogEntry)
- */
- public void handleLogEntryReceived(ILogEntry entry) {
- ICVSRemoteFile file = entry.getRemoteFile();
- String fullPath = getFullPath(file);
- String revision = entry.getRevision();
- Map fileEntries = internalGetLogEntries(fullPath);
- if (fileEntries == null) {
- fileEntries = new HashMap();
- entries.put(fullPath, fileEntries);
- }
- fileEntries.put(revision, entry);
- }
- }
-
- public RemoteLogOperation(IWorkbenchPart part, ICVSRemoteResource[] remoteResources, CVSTag tag1, CVSTag tag2, LogEntryCache cache) {
- super(part, remoteResources);
- this.tag1 = tag1;
- this.tag2 = tag2;
- this.entryCache = cache;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryLocationOperation#execute(org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation, org.eclipse.team.internal.ccvs.core.ICVSRemoteResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(ICVSRepositoryLocation location, ICVSRemoteResource[] remoteResources, IProgressMonitor monitor) throws CVSException {
- monitor.beginTask(Policy.bind("RemoteLogOperation.0", location.getHost()), 100); //$NON-NLS-1$
- Session s = new Session(location, CVSWorkspaceRoot.getCVSFolderFor(ResourcesPlugin.getWorkspace().getRoot()), false /* do not output to console */);
- // Create a log listener that will update the cache as entries are received
- LogListener listener = new LogListener(entryCache);
-
- ICVSRemoteResource[] remotes = remoteResources;
- Command.LocalOption[] localOptions = getLocalOptions(tag1, tag2);
- if(tag1 == null || tag2 == null) {
- // Optimize the cases were we are only fetching the history for a single revision. If it is
- // already cached, don't fetch it again.
- ArrayList unCachedRemotes = new ArrayList();
- for (int i = 0; i < remoteResources.length; i++) {
- ICVSRemoteResource r = remoteResources[i];
- if(entryCache.getLogEntry(r) == null) {
- unCachedRemotes.add(r);
- }
- }
- remotes = (ICVSRemoteResource[]) unCachedRemotes.toArray(new ICVSRemoteResource[unCachedRemotes.size()]);
- }
- if (remotes.length > 0) {
- try {
- s.open(Policy.subMonitorFor(monitor, 10));
- IStatus status = rlog.execute(s, Command.NO_GLOBAL_OPTIONS, localOptions, remotes, listener, Policy.subMonitorFor(monitor, 90));
- collectStatus(status);
- } finally {
- s.close();
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return Policy.bind("RemoteLogOperation.1"); //$NON-NLS-1$
- }
-
- protected Command.LocalOption[] getLocalOptions(CVSTag tag1, CVSTag tag2) {
- if(tag1 != null && tag2 != null) {
- return new Command.LocalOption[] {RLog.NO_TAGS, RLog.ONLY_INCLUDE_CHANGES, RLog.makeTagOption(tag1, tag2)};
- } else {
- return new Command.LocalOption[] {RLog.NO_TAGS, RLog.ONLY_INCLUDE_CHANGES};
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteOperation.java
deleted file mode 100644
index 8e778e947..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteOperation.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.ui.IWorkbenchPart;
-
-public abstract class RemoteOperation extends CVSOperation {
-
- private ICVSRemoteResource[] remoteResources;
-
- protected RemoteOperation(IWorkbenchPart part, ICVSRemoteResource[] remoteResources) {
- super(part);
- this.remoteResources =remoteResources;
- }
-
- protected ICVSRemoteResource[] getRemoteResources() {
- return remoteResources;
- }
-
- public void setRemoteResources(ICVSRemoteResource[] remoteResources) {
- this.remoteResources = remoteResources;
- }
-
- public ICVSResource[] getCVSResources() {
- ICVSResource[] cvsResources = new ICVSResource[remoteResources.length];
- for (int i = 0; i < remoteResources.length; i++) {
- cvsResources[i] = remoteResources[i];
- }
- return cvsResources;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReplaceOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReplaceOperation.java
deleted file mode 100644
index c12f535b3..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReplaceOperation.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.PrepareForReplaceVisitor;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Thsi operation replaces the local resources with their remote contents
- */
-public class ReplaceOperation extends UpdateOperation {
-
- boolean recurse = true;
-
- public ReplaceOperation(IWorkbenchPart part, IResource[] resources, CVSTag tag, boolean recurse) {
- super(part, resources, getReplaceOptions(recurse), tag);
- this.recurse = recurse;
- }
-
- /*
- * Create the local options required to do a replace
- */
- private static LocalOption[] getReplaceOptions(boolean recurse) {
- List options = new ArrayList();
- options.add(Update.IGNORE_LOCAL_CHANGES);
- if(!recurse) {
- options.add(Command.DO_NOT_RECURSE);
- }
- return (LocalOption[]) options.toArray(new LocalOption[options.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return Policy.bind("ReplaceOperation.taskName"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.SingleCommandOperation#executeCommand(org.eclipse.team.internal.ccvs.core.client.Session, org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus executeCommand(
- Session session,
- CVSTeamProvider provider,
- ICVSResource[] resources,
- IProgressMonitor monitor)
- throws CVSException, InterruptedException {
-
- monitor.beginTask(null, 100);
- ICVSResource[] managedResources = getResourcesToUpdate(resources);
- try {
- // Purge any unmanaged or added files
- new PrepareForReplaceVisitor().visitResources(
- provider.getProject(),
- resources,
- "CVSTeamProvider.scrubbingResource", // TODO: This is a key in CVS core! //$NON-NLS-1$
- recurse ? IResource.DEPTH_INFINITE : IResource.DEPTH_ZERO,
- Policy.subMonitorFor(monitor, 30)); //$NON-NLS-1$
-
- // Only perform the remote command if some of the resources being replaced were managed
- IStatus status = OK;
- if (managedResources.length > 0) {
- // Perform an update, ignoring any local file modifications
- status = super.executeCommand(session, provider, managedResources, Policy.subMonitorFor(monitor, 70));
- }
-
- // Prune any empty folders left after the resources were purged.
- // This is done to prune any empty folders that contained only unmanaged resources
- if (status.isOK() && CVSProviderPlugin.getPlugin().getPruneEmptyDirectories()) {
- new PruneFolderVisitor().visit(session, resources);
- }
-
- return status;
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Return the resources that need to be updated from the server.
- * By default, this is all resources that are managed.
- * @param resources all resources being replaced
- * @return resources that ae to be updated from the server
- * @throws CVSException
- */
- protected ICVSResource[] getResourcesToUpdate(ICVSResource[] resources) throws CVSException {
- // Accumulate the managed resources from the list of provided resources
- List managedResources = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- ICVSResource resource = resources[i];
- if ((resource.isFolder() && ((ICVSFolder)resource).isCVSFolder())) {
- managedResources.add(resource);
- } else if (!resource.isFolder()){
- byte[] syncBytes = ((ICVSFile)resource).getSyncBytes();
- if (syncBytes != null && !ResourceSyncInfo.isAddition(syncBytes)) {
- managedResources.add(resource);
- }
- }
- }
- return (ICVSResource[]) managedResources.toArray(new ICVSResource[managedResources.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.UpdateOperation#getUpdateCommand()
- */
- protected Update getUpdateCommand() {
- return Command.REPLACE;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
- */
- protected String getTaskName(CVSTeamProvider provider) {
- return Policy.bind("ReplaceOperation.0", provider.getProject().getName()); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryLocationOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryLocationOperation.java
deleted file mode 100644
index 0da7eaaec..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryLocationOperation.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.*;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Operation that divides the resources by location
- */
-public abstract class RepositoryLocationOperation extends RemoteOperation {
-
- protected RepositoryLocationOperation(IWorkbenchPart part, ICVSRemoteResource[] remoteResources) {
- super(part, remoteResources);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
- Map table = getLocationMapping(getRemoteResources());
- Set keySet = table.keySet();
- monitor.beginTask(null, keySet.size() * 100);
- Iterator iterator = keySet.iterator();
- while (iterator.hasNext()) {
- ICVSRepositoryLocation location = (ICVSRepositoryLocation)iterator.next();
- List list = (List)table.get(location);
- ICVSRemoteResource[] remoteResources = (ICVSRemoteResource[])list.toArray(new ICVSRemoteResource[list.size()]);
- execute(location, remoteResources, Policy.subMonitorFor(monitor, 100));
- }
- }
-
- /**
- * Perform the operation for the given resources found on the
- * given repository.
- * @param location the repository location
- * @param resources the resources of this operation found in the repository
- * @param monitor a progres monitor
- */
- protected abstract void execute(ICVSRepositoryLocation location, ICVSRemoteResource[] resources, IProgressMonitor monitor) throws CVSException;
-
- /*
- * Return a map that maps a location to all the resources
- * from the given list that are located in that repository.
- */
- private Map getLocationMapping(ICVSRemoteResource[] remoteResources) {
- Map locationsMap = new HashMap();
- for (int i = 0; i < remoteResources.length; i++) {
- ICVSRemoteResource resource = remoteResources[i];
- ICVSRepositoryLocation location = resource.getRepository();
- List resources = (List)locationsMap.get(location);
- if (resources == null) {
- resources = new ArrayList();
- locationsMap.put(location, resources);
- }
- resources.add(resource);
- }
- return locationsMap;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryProviderOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryProviderOperation.java
deleted file mode 100644
index cc2e0bf5a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryProviderOperation.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.*;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Session;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Performs a cvs operation on multiple repository providers
- */
-public abstract class RepositoryProviderOperation extends CVSOperation {
-
- private IResource[] resources;
-
- public RepositoryProviderOperation(IWorkbenchPart part, IResource[] resources) {
- super(part);
- this.resources = resources;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
- Map table = getProviderMapping(getResources());
- Set keySet = table.keySet();
- monitor.beginTask(null, keySet.size() * 1000);
- Iterator iterator = keySet.iterator();
- while (iterator.hasNext()) {
- IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1000);
- CVSTeamProvider provider = (CVSTeamProvider)iterator.next();
- List list = (List)table.get(provider);
- IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
- ISchedulingRule rule = getSchedulingRule(provider);
- try {
- Platform.getJobManager().beginRule(rule, monitor);
- monitor.setTaskName(getTaskName(provider));
- execute(provider, providerResources, subMonitor);
- } finally {
- Platform.getJobManager().endRule(rule);
- }
- }
- }
-
- /**
- * Return the taskname to be shown in the progress monitor while operating
- * on the given provider.
- * @param provider the provider being processed
- * @return the taskname to be shown in the progress monitor
- */
- protected abstract String getTaskName(CVSTeamProvider provider);
-
- /**
- * Retgurn the scheduling rule to be obtained before work
- * begins on the given provider. By default, it is the provider's project.
- * This can be changed by subclasses.
- * @param provider
- * @return
- */
- protected ISchedulingRule getSchedulingRule(CVSTeamProvider provider) {
- return provider.getProject();
- }
-
- /*
- * Helper method. Return a Map mapping provider to a list of resources
- * shared with that provider.
- */
- private Map getProviderMapping(IResource[] resources) {
- Map result = new HashMap();
- for (int i = 0; i < resources.length; i++) {
- RepositoryProvider provider = RepositoryProvider.getProvider(resources[i].getProject(), CVSProviderPlugin.getTypeId());
- List list = (List)result.get(provider);
- if (list == null) {
- list = new ArrayList();
- result.put(provider, list);
- }
- list.add(resources[i]);
- }
- return result;
- }
-
- /**
- * Return the resources that the operation is being performed on
- * @return
- */
- protected IResource[] getResources() {
- return resources;
- }
-
- /**
- * Set the resources that the operation is to be performed on
- * @param resources
- */
- protected void setResources(IResource[] resources) {
- this.resources = resources;
- }
-
- /**
- * Execute the operation on the resources for the given provider.
- * @param provider
- * @param providerResources
- * @param subMonitor
- * @throws CVSException
- * @throws InterruptedException
- */
- protected abstract void execute(CVSTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws CVSException, InterruptedException;
-
- protected ICVSResource[] getCVSArguments(IResource[] resources) {
- ICVSResource[] cvsResources = new ICVSResource[resources.length];
- for (int i = 0; i < cvsResources.length; i++) {
- cvsResources[i] = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
- }
- return cvsResources;
- }
-
- /*
- * Get the arguments to be passed to a commit or update
- */
- protected String[] getStringArguments(IResource[] resources) throws CVSException {
- List arguments = new ArrayList(resources.length);
- for (int i=0;i<resources.length;i++) {
- IPath cvsPath = resources[i].getFullPath().removeFirstSegments(1);
- if (cvsPath.segmentCount() == 0) {
- arguments.add(Session.CURRENT_LOCAL_FOLDER);
- } else {
- arguments.add(cvsPath.toString());
- }
- }
- return (String[])arguments.toArray(new String[arguments.size()]);
- }
-
- public ICVSResource[] getCVSResources() {
- ICVSResource[] cvsResources = new ICVSResource[resources.length];
- for (int i = 0; i < resources.length; i++) {
- cvsResources[i] = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
- }
- return cvsResources;
- }
-
- protected ICVSRepositoryLocation getRemoteLocation(CVSTeamProvider provider) throws CVSException {
- CVSWorkspaceRoot workspaceRoot = provider.getCVSWorkspaceRoot();
- return workspaceRoot.getRemoteLocation();
- }
-
- protected ICVSFolder getLocalRoot(CVSTeamProvider provider) throws CVSException {
- CVSWorkspaceRoot workspaceRoot = provider.getCVSWorkspaceRoot();
- return workspaceRoot.getLocalRoot();
- }
-
- /**
- * Update the workspace subscriber for an update operation performed on the
- * given resources. After an update, the remote tree is flushed in order
- * to ensure that stale incoming additions are removed. This need only
- * be done for folders. At the time of writting, all update operations
- * are deep so the flush is deep as well.
- * @param provider the provider (projedct) for all the given resources
- * @param resources the resources that were updated
- * @param monitor a progress monitor
- */
- protected void updateWorkspaceSubscriber(CVSTeamProvider provider, ICVSResource[] resources, IProgressMonitor monitor) {
- CVSWorkspaceSubscriber s = CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber();
- monitor.beginTask(null, 100 * resources.length);
- for (int i = 0; i < resources.length; i++) {
- ICVSResource resource = resources[i];
- if (resource.isFolder()) {
- try {
- s.updateRemote(provider, (ICVSFolder)resource, Policy.subMonitorFor(monitor, 100));
- } catch (TeamException e) {
- // Just log the error and continue
- CVSUIPlugin.log(e);
- }
- } else {
- monitor.worked(100);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#isKeepOneProgressServiceEntry()
- */
- public boolean isKeepOneProgressServiceEntry() {
- // Keep the last repository provider operation in the progress service
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#getGotoAction()
- */
- protected IAction getGotoAction() {
- return getShowConsoleAction();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShareProjectOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShareProjectOperation.java
deleted file mode 100644
index dae747075..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShareProjectOperation.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Session;
-import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFolderTree;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-/**
- * Create a folder and any missing parents in the repository
- */
-public class ShareProjectOperation extends CVSOperation {
-
- private ICVSRepositoryLocation location;
- private IProject project;
- private String moduleName;
- private Shell shell;
-
- public ShareProjectOperation(Shell shell, ICVSRepositoryLocation location, IProject project, String moduleName) {
- super(null);
- this.shell = shell;
- this.moduleName = moduleName;
- this.project = project;
- this.location = location;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
- try {
- monitor.beginTask(getTaskName(), 100);
- // Create the remote module
- final ICVSRemoteFolder remote = createRemoteFolder(Policy.subMonitorFor(monitor, 50));
- // Map the project to the module in a workspace runnable
- final TeamException[] exception = new TeamException[] {null};
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- try {
- mapProjectToRemoteFolder(remote, monitor);
- } catch (TeamException e) {
- exception[0] = e;
- }
- }
- }, ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(project), 0, Policy.subMonitorFor(monitor, 100));
- if (exception[0] != null)
- throw exception[0];
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Create the remote folder to which the project is being mapped
- * (as well as any ancestors) and return it. If the remote folder does not
- * exist remotely, this method will create it.
- * @param monitor a progress monitor
- * @return the existing remote folder to which the project is being mapped
- * @throws CVSException
- */
- protected ICVSRemoteFolder createRemoteFolder(IProgressMonitor monitor) throws CVSException {
- String projectName = project.getName();
- if (moduleName == null)
- moduleName = projectName;
-
- RemoteFolderTree root = new RemoteFolderTree(null, location, Path.EMPTY.toString(), null);
- Path path = new Path(null, moduleName);
-
- try {
- monitor.beginTask(getTaskName(), 100 * path.segmentCount());
- return ensureTreeExists(root, path, monitor);
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Map the project to the remote folder by associating the CVS
- * Repository Provider with the project and, at the very least,
- * assigning the folder sync info for the remote folder as the
- * folder sync info for the project.
- * @param remote the remote folder to which the projetc is being mapped
- * @param monitor a progress monitor
- * @throws CVSException
- */
- protected void mapProjectToRemoteFolder(final ICVSRemoteFolder remote, IProgressMonitor monitor) throws TeamException {
- monitor.beginTask(null, 100);
- purgeAnyCVSFolders();
- // Link the project to the newly created module
- ICVSFolder folder = (ICVSFolder)CVSWorkspaceRoot.getCVSResourceFor(project);
- folder.setFolderSyncInfo(remote.getFolderSyncInfo());
- //Register it with Team. If it already is, no harm done.
- RepositoryProvider.map(project, CVSProviderPlugin.getTypeId());
- monitor.done();
- }
-
- /*
- * Create handles for all the children in the moduleName path
- */
- private RemoteFolderTree createChild(RemoteFolderTree parent, String name, IProgressMonitor monitor) throws CVSException, TeamException {
- RemoteFolderTree child = new RemoteFolderTree(parent, name, location, new Path(null, parent.getRepositoryRelativePath()).append(name).toString(), null);
- parent.setChildren(new ICVSRemoteResource[] { child });
- if (child.exists(Policy.subMonitorFor(monitor, 50))) {
- // The child exists so get the handle that was received from the server
- return (RemoteFolderTree)parent.getFolder(name);
- } else {
- // Create the folder remotely
- createFolder(child, Policy.subMonitorFor(monitor, 50));
- return child;
- }
- }
-
- /*
- * Ensure that all the folders in the tree exist
- */
- private ICVSRemoteFolder ensureTreeExists(RemoteFolderTree folder, IPath path, IProgressMonitor monitor) throws TeamException {
- if (path.isEmpty()) return folder;
- String name = path.segment(0);
- RemoteFolderTree child = createChild(folder, name, monitor);
- return ensureTreeExists(child, path.removeFirstSegments(1), monitor);
- }
-
- private void createFolder(RemoteFolderTree folder, IProgressMonitor monitor) throws TeamException {
- Session s = new Session(location, folder.getParent());
- s.open(monitor, true /* open for modification */);
- try {
- IStatus status = Command.ADD.execute(s,
- Command.NO_GLOBAL_OPTIONS,
- Command.NO_LOCAL_OPTIONS,
- new String[] { folder.getName() },
- null,
- monitor);
- // If we get a warning, the operation most likely failed so check that the status is OK
- if (status.getCode() == CVSStatus.SERVER_ERROR || ! status.isOK()) {
- throw new CVSServerException(status);
- }
- } finally {
- s.close();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return Policy.bind("ShareProjectOperation.0", project.getName(), moduleName); //$NON-NLS-1$
- }
-
- /**
- * @return Returns the project.
- */
- public IProject getProject() {
- return project;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getShell()
- */
- protected Shell getShell() {
- return shell;
- }
-
- /**
- * Method findCommonRootInSubfolders.
- * @return String
- */
- private void purgeAnyCVSFolders() {
- try {
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(project);
- folder.accept(new ICVSResourceVisitor() {
- public void visitFile(ICVSFile file) throws CVSException {
- // nothing to do for files
- }
- public void visitFolder(ICVSFolder folder) throws CVSException {
- if (folder.isCVSFolder()) {
- // for now, just unmanage
- folder.unmanage(null);
- }
- }
- }, true /* recurse */);
- } catch (CVSException e) {
- // log the exception and return null
- CVSUIPlugin.log(e);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java
deleted file mode 100644
index cf33ca6e5..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.io.*;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialogWithToggle;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.client.listeners.AnnotateListener;
-import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.core.TeamPlugin;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.ui.*;
-
-/**
- * An operation to fetch the annotations for a file from the repository and
- * display them in the annotations view.
- */
-public class ShowAnnotationOperation extends CVSOperation {
-
- final private ICVSResource fCVSResource;
- final private String fRevision;
- private final boolean binary;
-
- public ShowAnnotationOperation(IWorkbenchPart part, ICVSResource cvsResource, String revision, boolean binary) {
- super(part);
- fCVSResource= cvsResource;
- fRevision= revision;
- this.binary = binary;
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
-
- monitor.beginTask(null, 100);
-
- // Get the annotations from the repository.
- final AnnotateListener listener= new AnnotateListener();
- fetchAnnotation(listener, fCVSResource, fRevision, Policy.subMonitorFor(monitor, 80));
- try {
- if (hasCharset(fCVSResource, listener.getContents())) {
- listener.setContents(getRemoteContents(fCVSResource, Policy.subMonitorFor(monitor, 20)));
- }
- } catch (CoreException e) {
- // Log and continue, using the original fetched contents
- CVSUIPlugin.log(e);
- }
-
- // Open the view and display it from the UI thread.
- final Display display= getPart().getSite().getShell().getDisplay();
- display.asyncExec(new Runnable() {
- public void run() { showView(listener); }
- });
- monitor.done();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return Policy.bind("ShowAnnotationOperation.taskName"); //$NON-NLS-1$
- }
-
- protected boolean hasCharset(ICVSResource cvsResource, InputStream contents) {
- try {
- return TeamPlugin.getCharset(cvsResource.getName(), contents) != null;
- } catch (IOException e) {
- // Assume that the contents do have a charset
- return true;
- }
- }
-
- /**
- * Shows the view once the background operation is finished. This must be called
- * from the UI thread.
- *
- * @param listener The listener with the results.
- */
- protected void showView(final AnnotateListener listener) {
- final IWorkbench workbench= PlatformUI.getWorkbench();
- final IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
-
- final String defaultPerspectiveID= promptForPerspectiveSwitch();
-
- if (defaultPerspectiveID != null) {
- try {
- workbench.showPerspective(defaultPerspectiveID, window);
- } catch (WorkbenchException e) {
- Utils.handleError(window.getShell(), e, Policy.bind("ShowAnnotationOperation.0"), e.getMessage()); //$NON-NLS-1$
- }
- }
-
- try {
- final AnnotateView view = AnnotateView.openInActivePerspective();
- view.showAnnotations(fCVSResource, listener.getCvsAnnotateBlocks(), listener.getContents());
- } catch (PartInitException e) {
- CVSUIPlugin.log(e);
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
-
-
- private void fetchAnnotation(AnnotateListener listener, ICVSResource cvsResource, String revision, IProgressMonitor monitor) throws CVSException {
-
- monitor = Policy.monitorFor(monitor);
- monitor.beginTask(null, 100);
-
- final ICVSFolder folder = cvsResource.getParent();
- final FolderSyncInfo info = folder.getFolderSyncInfo();
- final ICVSRepositoryLocation location = KnownRepositories.getInstance().getRepository(info.getRoot());
-
- final Session session = new Session(location, folder, true /*output to console*/);
- session.open(Policy.subMonitorFor(monitor, 10), false /* read-only */);
- try {
- final Command.QuietOption quietness = CVSProviderPlugin.getPlugin().getQuietness();
- try {
- CVSProviderPlugin.getPlugin().setQuietness(Command.VERBOSE);
- List localOptions = new ArrayList();
- if (revision != null) {
- localOptions.add(Annotate.makeRevisionOption(revision));
- }
- if (binary) {
- localOptions.add(Annotate.FORCE_BINARY_ANNOTATE);
- }
- final IStatus status = Command.ANNOTATE.execute(session, Command.NO_GLOBAL_OPTIONS, (LocalOption[]) localOptions.toArray(new LocalOption[localOptions.size()]), new ICVSResource[]{cvsResource}, listener, Policy.subMonitorFor(monitor, 90));
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- throw new CVSServerException(status);
- }
- } finally {
- CVSProviderPlugin.getPlugin().setQuietness(quietness);
- monitor.done();
- }
- } finally {
- session.close();
- }
- }
-
- private InputStream getRemoteContents(ICVSResource resource, IProgressMonitor monitor) throws CoreException {
-
- final ICVSRemoteResource remote = CVSWorkspaceRoot.getRemoteResourceFor(resource);
- if (remote == null) {
- return new ByteArrayInputStream(new byte[0]);
- }
- final IStorage storage = ((IResourceVariant)remote).getStorage(monitor);
- if (storage == null) {
- return new ByteArrayInputStream(new byte[0]);
- }
- return storage.getContents();
- }
-
- /**
- * @return The ID of the perspective if the perspective needs to be changed,
- * null otherwise.
- */
- private String promptForPerspectiveSwitch() {
- // check whether we should ask the user.
- final IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- final String option = store.getString(ICVSUIConstants.PREF_CHANGE_PERSPECTIVE_ON_SHOW_ANNOTATIONS);
- final String desiredID = store.getString(ICVSUIConstants.PREF_DEFAULT_PERSPECTIVE_FOR_SHOW_ANNOTATIONS);
-
- if (option.equals(MessageDialogWithToggle.ALWAYS))
- return desiredID; // no, always switch
-
- if (option.equals(MessageDialogWithToggle.NEVER))
- return null; // no, never switch
-
- // Check whether the desired perspective is already active.
- final IPerspectiveRegistry registry= PlatformUI.getWorkbench().getPerspectiveRegistry();
- final IPerspectiveDescriptor desired = registry.findPerspectiveWithId(desiredID);
- final IWorkbenchPage page = CVSUIPlugin.getActivePage();
-
- if (page != null) {
- final IPerspectiveDescriptor current = page.getPerspective();
- if (current != null && current.getId().equals(desiredID)) {
- return null; // it is active, so no prompt and no switch
- }
- }
-
- if (desired != null) {
-
- // Ask the user whether to switch
- final MessageDialogWithToggle m = MessageDialogWithToggle.openYesNoQuestion(
- Utils.getShell(null),
- Policy.bind("ShowAnnotationOperation.1"), //$NON-NLS-1$
- Policy.bind("ShowAnnotationOperation.2", desired.getLabel()), //$NON-NLS-1$
- Policy.bind("ShowAnnotationOperation.4"), //$NON-NLS-1$
- false /* toggle state */,
- store,
- ICVSUIConstants.PREF_CHANGE_PERSPECTIVE_ON_SHOW_ANNOTATIONS);
-
- final int result = m.getReturnCode();
- switch (result) {
- // yes
- case IDialogConstants.YES_ID:
- case IDialogConstants.OK_ID :
- return desiredID;
- // no
- case IDialogConstants.NO_ID :
- return null;
- }
- }
- return null;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SingleCommandOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SingleCommandOperation.java
deleted file mode 100644
index 41b846253..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/SingleCommandOperation.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Session;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-
-public abstract class SingleCommandOperation extends RepositoryProviderOperation {
-
- private LocalOption[] options = Command.NO_LOCAL_OPTIONS;
-
- public SingleCommandOperation(IWorkbenchPart part, IResource[] resources, LocalOption[] options) {
- super(part, resources);
- if (options != null) {
- this.options = options;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(CVSTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws CVSException, InterruptedException {
- monitor.beginTask(null, 100);
- Session session = new Session(getRemoteLocation(provider), getLocalRoot(provider), true /* output to console */);
- session.open(Policy.subMonitorFor(monitor, 10), isServerModificationOperation());
- try {
- // TODO: This does not properly count the number of operations
- // Changing it causes an error in the test cases
- IStatus status = executeCommand(session, provider, getCVSArguments(resources), Policy.subMonitorFor(monitor, 90));
- collectStatus(status);
- } finally {
- session.close();
- }
- }
-
- /**
- * Indicate whether the operation requires write access to the server (i.e.
- * the operation changes state on the server whether it be to commit, tag, admin, etc).
- * @return
- */
- protected boolean isServerModificationOperation() {
- return false;
- }
-
- /**
- * Method overridden by subclasses to issue the command to the CVS repository using the given session.
- */
- protected abstract IStatus executeCommand(Session session, CVSTeamProvider provider, ICVSResource[] resources, IProgressMonitor monitor) throws CVSException, InterruptedException;
-
- protected LocalOption[] getLocalOptions() {
- return options;
- }
-
- protected void setLocalOptions(LocalOption[] options) {
- this.options = options;
- }
-
- protected void addLocalOption(LocalOption option) {
- LocalOption[] newOptions = new LocalOption[options.length + 1];
- System.arraycopy(options, 0, newOptions, 0, options.length);
- newOptions[options.length] = option;
- options = newOptions;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/TagInRepositoryOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/TagInRepositoryOperation.java
deleted file mode 100644
index 083f1db42..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/TagInRepositoryOperation.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.RTag;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.actions.TagAction;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class TagInRepositoryOperation extends RemoteOperation implements ITagOperation {
-
- private Set localOptions = new HashSet();
- private CVSTag tag;
-
- public TagInRepositoryOperation(IWorkbenchPart part, ICVSRemoteResource[] remoteResource) {
- super(part, remoteResource);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
- ICVSRemoteResource[] resources = getRemoteResources();
- monitor.beginTask(null, 1000 * resources.length);
- for (int i = 0; i < resources.length; i++) {
- IStatus status = resources[i].tag(getTag(), getLocalOptions(), new SubProgressMonitor(monitor, 1000));
- collectStatus(status);
- }
- if (!errorsOccurred()) {
- try {
- TagAction.broadcastTagChange(getCVSResources(), getTag());
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- }
- }
- }
-
- /**
- * Override to dislay the number of tag operations that succeeded
- */
- protected String getErrorMessage(IStatus[] problems, int operationCount) {
- if(operationCount == 1) {
- return Policy.bind("TagInRepositoryAction.tagProblemsMessage"); //$NON-NLS-1$
- } else {
- return Policy.bind("TagInRepositoryAction.tagProblemsMessageMultiple", //$NON-NLS-1$
- Integer.toString(operationCount - problems.length), Integer.toString(problems.length));
- }
- }
-
- private LocalOption[] getLocalOptions() {
- return (LocalOption[]) localOptions.toArray(new LocalOption[localOptions.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#getTag()
- */
- public CVSTag getTag() {
- return tag;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#setTag(org.eclipse.team.internal.ccvs.core.CVSTag)
- */
- public void setTag(CVSTag tag) {
- this.tag = tag;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#addLocalOption(org.eclipse.team.internal.ccvs.core.client.Command.LocalOption)
- */
- public void addLocalOption(LocalOption option) {
- localOptions.add(option);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#moveTag()
- */
- public void moveTag() {
- addLocalOption(RTag.FORCE_REASSIGNMENT);
- addLocalOption(RTag.CLEAR_FROM_REMOVED);
- if (tag != null && tag.getType() == CVSTag.BRANCH) {
- addLocalOption(RTag.FORCE_BRANCH_REASSIGNMENT);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#recurse()
- */
- public void recurse() {
- addLocalOption(Command.DO_NOT_RECURSE);
- }
-
- protected String getTaskName() {
- return Policy.bind("TagFromRepository.taskName"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#getTagSource()
- */
- public TagSource getTagSource() {
- return TagSource.create(getCVSResources());
- }
-
- protected boolean isReportableError(IStatus status) {
- return super.isReportableError(status)
- || status.getCode() == CVSStatus.TAG_ALREADY_EXISTS;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/TagOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/TagOperation.java
deleted file mode 100644
index 7d413df58..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/TagOperation.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.actions.TagAction;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class TagOperation extends RepositoryProviderOperation implements ITagOperation {
-
- private Set localOptions = new HashSet();
- private CVSTag tag;
-
- public TagOperation(IWorkbenchPart part, IResource[] resources) {
- super(part, resources);
- }
-
- /**
- * TODO: needed to prevent re-release of releng tool.
- * Shoudl eb able to remove eventually
- */
- public TagOperation(Shell shell, IResource[] resources) {
- super(null, resources);
- }
-
- public CVSTag getTag() {
- return tag;
- }
-
- public void setTag(CVSTag tag) {
- this.tag = tag;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void execute(CVSTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws CVSException, InterruptedException {
- IStatus status = tag(provider, resources, monitor);
- collectStatus(status);
- }
-
- /**
- * Override to dislay the number of tag operations that succeeded
- */
- protected String getErrorMessage(IStatus[] problems, int operationCount) {
- // We accumulated 1 status per resource above.
- if(operationCount == 1) {
- return Policy.bind("TagAction.tagProblemsMessage"); //$NON-NLS-1$
- } else {
- return Policy.bind("TagAction.tagProblemsMessageMultiple", //$NON-NLS-1$
- Integer.toString(operationCount - problems.length), Integer.toString(problems.length));
- }
- }
-
- /**
- * Tag the resources in the CVS repository with the given tag.
- *
- * The returned IStatus will be a status containing any errors or warnings.
- * If the returned IStatus is a multi-status, the code indicates the severity.
- * Possible codes are:
- * CVSStatus.OK - Nothing to report
- * CVSStatus.SERVER_ERROR - The server reported an error
- * any other code - warning messages received from the server
- */
- public IStatus tag(CVSTeamProvider provider, IResource[] resources, IProgressMonitor progress) throws CVSException {
-
- LocalOption[] commandOptions = (LocalOption[])localOptions.toArray(new LocalOption[localOptions.size()]);
-
- // Build the arguments list
- String[] arguments = getStringArguments(resources);
-
- // Execute the command
- CVSWorkspaceRoot root = provider.getCVSWorkspaceRoot();
- Session s = new Session(root.getRemoteLocation(), root.getLocalRoot());
- progress.beginTask(null, 100);
- try {
- // Opening the session takes 20% of the time
- s.open(Policy.subMonitorFor(progress, 20), true /* open for modification */);
- return Command.TAG.execute(s,
- Command.NO_GLOBAL_OPTIONS,
- commandOptions,
- tag,
- arguments,
- null,
- Policy.subMonitorFor(progress, 80));
- } finally {
- s.close();
- progress.done();
- }
- }
-
- public void addLocalOption(LocalOption option) {
- localOptions.add(option);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#moveTag()
- */
- public void moveTag() {
- addLocalOption(Tag.FORCE_REASSIGNMENT);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#recurse()
- */
- public void recurse() {
- addLocalOption(Command.DO_NOT_RECURSE);
- }
-
- protected String getTaskName() {
- return Policy.bind("TagFromWorkspace.taskName"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
- */
- protected String getTaskName(CVSTeamProvider provider) {
- return Policy.bind("TagOperation.0", provider.getProject().getName()); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
- super.execute(monitor);
- if (!errorsOccurred()) {
- try {
- TagAction.broadcastTagChange(getCVSResources(), getTag());
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#getTagSource()
- */
- public TagSource getTagSource() {
- return TagSource.create(getResources());
- }
-
- protected boolean isReportableError(IStatus status) {
- return super.isReportableError(status)
- || status.getCode() == CVSStatus.TAG_ALREADY_EXISTS;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOnlyMergableOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOnlyMergableOperation.java
deleted file mode 100644
index d0fbb2c9b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOnlyMergableOperation.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.*;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * This operation performs an update that will only effect files
- * that have no conflicts or automergable conflicts.
- */
-public class UpdateOnlyMergableOperation extends SingleCommandOperation {
-
- List skippedFiles = new ArrayList();
-
- public UpdateOnlyMergableOperation(IWorkbenchPart part, IResource[] resources, LocalOption[] localOptions) {
- super(part, resources, localOptions);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.SingleCommandOperation#executeCommand(org.eclipse.team.internal.ccvs.core.client.Session, org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus executeCommand(Session session, CVSTeamProvider provider, ICVSResource[] resources, IProgressMonitor monitor) throws CVSException, InterruptedException {
- UpdateMergableOnly update = new UpdateMergableOnly();
- IStatus status = update.execute(
- session,
- Command.NO_GLOBAL_OPTIONS,
- getLocalOptions(),
- resources,
- null,
- monitor);
- if (status.getSeverity() != IStatus.ERROR) {
- addSkippedFiles(update.getSkippedFiles());
- return OK;
- }
- return status;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName()
- */
- protected String getTaskName() {
- return Policy.bind("UpdateOnlyMergeable.taskName"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
- */
- protected String getTaskName(CVSTeamProvider provider) {
- return Policy.bind("UpdateOperation.0", provider.getProject().getName()); //$NON-NLS-1$
- }
-
- protected void addSkippedFiles(IFile[] files) {
- skippedFiles.addAll(Arrays.asList(files));
- }
-
- public IFile[] getSkippedFiles() {
- return (IFile[]) skippedFiles.toArray(new IFile[skippedFiles.size()]);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOperation.java
deleted file mode 100644
index 5e66fd6c8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOperation.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.operations;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSStatus;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Session;
-import org.eclipse.team.internal.ccvs.core.client.Update;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Operation which performs a CVS update
- */
-public class UpdateOperation extends SingleCommandOperation {
-
- CVSTag tag;
-
- /**
- * Create an UpdateOperation that will perform on update on the given resources
- * using the given local option. If a tag is provided, it will be added to the
- * local options using the appropriate argument (-r or -D). If the tag is <code>null</code>
- * then the tag will be omitted from the local options and the tags on the local resources
- * will be used.
- * @param shell
- * @param resources
- * @param options
- * @param tag
- */
- public UpdateOperation(IWorkbenchPart part, IResource[] resources, LocalOption[] options, CVSTag tag) {
- super(part, resources, options);
- this.tag = tag;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.SingleCommandOperation#executeCommand(org.eclipse.team.internal.ccvs.core.client.Session, org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus executeCommand(
- Session session,
- CVSTeamProvider provider,
- ICVSResource[] resources,
- IProgressMonitor monitor)
- throws CVSException, InterruptedException {
-
- // Build the local options
- List localOptions = new ArrayList();
-
- // Use the appropriate tag options
- if (tag != null) {
- localOptions.add(Update.makeTagOption(tag));
- }
-
- // Build the arguments list
- localOptions.addAll(Arrays.asList(getLocalOptions()));
- LocalOption[] commandOptions = (LocalOption[])localOptions.toArray(new LocalOption[localOptions.size()]);
-
- monitor.beginTask(null, 100);
- IStatus execute = getUpdateCommand().execute(
- session,
- Command.NO_GLOBAL_OPTIONS,
- commandOptions,
- resources,
- getCommandOutputListener(),
- Policy.subMonitorFor(monitor, 95));
-
- updateWorkspaceSubscriber(provider, resources, Policy.subMonitorFor(monitor, 5));
- monitor.done();
- return execute;
- }
-
- protected Update getUpdateCommand() {
- return Command.UPDATE;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
- */
- protected String getTaskName() {
- return Policy.bind("UpdateOperation.taskName"); //$NON-NLS-1$;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
- */
- protected String getTaskName(CVSTeamProvider provider) {
- return Policy.bind("UpdateOperation.0", provider.getProject().getName()); //$NON-NLS-1$
- }
-
- /**
- * Return the listener that is used to process E and M messages.
- * The default is <code>null</code>.
- * @return
- */
- protected ICommandOutputListener getCommandOutputListener() {
- return null;
- }
-
- protected boolean isReportableError(IStatus status) {
- return super.isReportableError(status)
- || status.getCode() == CVSStatus.UNMEGERED_BINARY_CONFLICT
- || status.getCode() == CVSStatus.INVALID_LOCAL_RESOURCE_PATH
- || status.getCode() == CVSStatus.RESPONSE_HANDLING_FAILURE;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getErrorMessage(org.eclipse.core.runtime.IStatus[], int)
- */
- protected String getErrorMessage(IStatus[] failures, int totalOperations) {
- return Policy.bind("UpdateAction.update"); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/AddToBranchAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/AddToBranchAction.java
deleted file mode 100644
index be3b44f37..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/AddToBranchAction.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.IInputValidator;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
-
-/**
- * Action to add a root remote folder to a branch
- */
-public class AddToBranchAction extends CVSAction {
-
- IInputValidator validator = new IInputValidator() {
- public String isValid(String newText) {
- IStatus status = CVSTag.validateTagName(newText);
- if (status.isOK()) return null;
- return status.getMessage();
- }
- };
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
- protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- final ICVSRemoteFolder folder = getSelectedRootFolder();
- if (folder == null) return;
- Shell shell = getShell();
- final CVSException[] exception = new CVSException[] { null };
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- InputDialog dialog = new InputDialog(getShell(), Policy.bind("AddToBranchAction.enterTag"), Policy.bind("AddToBranchAction.enterTagLong"), null, validator); //$NON-NLS-1$ //$NON-NLS-2$
- if (dialog.open() == InputDialog.OK) {
- CVSTag tag = new CVSTag(dialog.getValue(), CVSTag.BRANCH);
- try {
- CVSUIPlugin.getPlugin().getRepositoryManager().addTags(folder, new CVSTag[] {tag});
- } catch (CVSException e) {
- exception[0] = e;
- }
- }
- }
- });
- if (exception[0] != null)
- throw new InvocationTargetException(exception[0]);
- }
- }, false, PROGRESS_BUSYCURSOR); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- return getSelectedRootFolder() != null;
- }
-
- protected ICVSRemoteFolder getSelectedRootFolder() {
- ICVSRemoteFolder[] folders = getSelectedRemoteFolders();
- ICVSRemoteFolder selectedFolder = null;
- for (int i = 0; i < folders.length; i++) {
- ICVSRemoteFolder folder = folders[i];
- if (folder.isDefinedModule() || new Path(null, folder.getRepositoryRelativePath()).segmentCount()==1) {
- // only return a folder if one valid one is selected.
- if (selectedFolder != null) return null;
- selectedFolder = folder;
- }
- }
- return selectedFolder;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepoViewAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepoViewAction.java
deleted file mode 100644
index df4f9ccdf..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepoViewAction.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
-import org.eclipse.team.internal.ccvs.ui.model.BranchCategory;
-
-/**
- * Abstract superclass for actions in the repositories view
- */
-public abstract class CVSRepoViewAction extends CVSAction {
-
- /**
- * Returns the selected CVS Repository locations
- */
- protected ICVSRepositoryLocation[] getSelectedRepositoryLocations() {
- ArrayList tags = new ArrayList();
- if (!selection.isEmpty()) {
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object element = elements.next();
- Object adapter = getAdapter(element, ICVSRepositoryLocation.class);
- if (adapter != null) {
- tags.add(adapter);
- } else {
- adapter = getAdapter(element, BranchCategory.class);
- if(adapter != null) {
- tags.add(((BranchCategory)adapter).getRepository(adapter));
- }
- }
- }
- }
- return (ICVSRepositoryLocation[])tags.toArray(new ICVSRepositoryLocation[tags.size()]);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepositoryPropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepositoryPropertiesPage.java
deleted file mode 100644
index f79f1e72d..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CVSRepositoryPropertiesPage.java
+++ /dev/null
@@ -1,595 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-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.*;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.wizards.ConfigurationWizardMainPage;
-import org.eclipse.team.internal.ui.dialogs.DetailsDialogWithProjects;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.dialogs.PropertyPage;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-public class CVSRepositoryPropertiesPage extends PropertyPage {
- private static final String FAKE_PASSWORD = "*********"; //$NON-NLS-1$
- ICVSRepositoryLocation location;
-
- // Widgets
- Text userText;
- Text passwordText;
- Combo methodType;
- Text hostText;
- Text pathText;
- // Port
- private Text portText;
- private Button useDefaultPort;
- private Button useCustomPort;
-
- // Caching password
- private Button allowCachingButton;
- private boolean allowCaching = false;
-
- boolean passwordChanged;
- boolean connectionInfoChanged;
-
- IUserInfo info;
-
- // Label
- private Button useLocationAsLabel;
- private Button useCustomLabel;
- private Text labelText;
-
- /*
- * @see PreferencesPage#createContents
- */
- protected Control createContents(Composite parent) {
- initialize();
-
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- composite.setLayout(layout);
-
- // Repository Label
- // create a composite to ensure the radio buttons come in the correct order
- Composite labelGroup = new Composite(composite, SWT.NONE);
- GridData data = new GridData();
- data.horizontalSpan = 3;
- labelGroup.setLayoutData(data);
- layout = new GridLayout();
- layout.numColumns = 3;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- labelGroup.setLayout(layout);
- Listener labelListener = new Listener() {
- public void handleEvent(Event event) {
- updateWidgetEnablements();
- }
- };
- useLocationAsLabel = createRadioButton(labelGroup, Policy.bind("CVSRepositoryPropertiesPage.useLocationAsLabel"), 3); //$NON-NLS-1$
- useCustomLabel = createRadioButton(labelGroup, Policy.bind("CVSRepositoryPropertiesPage.useCustomLabel"), 1); //$NON-NLS-1$
- useCustomLabel.addListener(SWT.Selection, labelListener);
- labelText = createTextField(labelGroup);
- labelText.addListener(SWT.Modify, labelListener);
-
- // Add some extra space
- createLabel(composite, "", 3); //$NON-NLS-1$
-
- createLabel(composite, Policy.bind("CVSPropertiesPage.connectionType"), 1); //$NON-NLS-1$
- methodType = createCombo(composite);
-
- createLabel(composite, Policy.bind("CVSPropertiesPage.user"), 1); //$NON-NLS-1$
- userText = createTextField(composite);
-
- createLabel(composite, Policy.bind("CVSPropertiesPage.password"), 1); //$NON-NLS-1$
- passwordText = createPasswordField(composite);
-
- createLabel(composite, Policy.bind("CVSPropertiesPage.host"), 1); //$NON-NLS-1$
- hostText = createTextField(composite);
-
- createLabel(composite, Policy.bind("CVSPropertiesPage.path"), 1); //$NON-NLS-1$
- pathText = createTextField(composite);
-
- // Port number
- // create a composite to ensure the radio buttons come in the correct order
- Composite portGroup = new Composite(composite, SWT.NONE);
- data = new GridData();
- data.horizontalSpan = 3;
- portGroup.setLayoutData(data);
- layout = new GridLayout();
- layout.numColumns = 3;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- portGroup.setLayout(layout);
- useDefaultPort = createRadioButton(portGroup, Policy.bind("ConfigurationWizardMainPage.useDefaultPort"), 3); //$NON-NLS-1$
- useCustomPort = createRadioButton(portGroup, Policy.bind("ConfigurationWizardMainPage.usePort"), 1); //$NON-NLS-1$
- portText = createTextField(portGroup);
-
- // Add some extra space
- createLabel(composite, "", 3); //$NON-NLS-1$
-
- allowCachingButton = new Button(composite, SWT.CHECK);
- allowCachingButton.setText(Policy.bind("UserValidationDialog.6")); //$NON-NLS-1$
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- data.horizontalSpan = 3;
- allowCachingButton.setLayoutData(data);
- allowCachingButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- allowCaching = allowCachingButton.getSelection();
- }
- });
-
- Composite warningComposite = new Composite(composite, SWT.NONE);
- layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 0;
- layout.marginHeight = 0;
- warningComposite.setLayout(layout);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 3;
- warningComposite.setLayoutData(data);
- Label warningLabel = new Label(warningComposite, SWT.NONE);
- warningLabel.setImage(Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
- warningLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_BEGINNING));
- Label warningText = new Label(warningComposite, SWT.WRAP);
- warningText.setText(Policy.bind("UserValidationDialog.7")); //$NON-NLS-1$
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = 300;
- warningText.setLayoutData(data);
-
- // Add some extra space
- createLabel(composite, "", 3); //$NON-NLS-1$
-
- initializeValues();
- updateWidgetEnablements();
- Listener connectionInfoChangedListener = new Listener() {
- public void handleEvent(Event event) {
- connectionInfoChanged = true;
- updateWidgetEnablements();
- }
- };
- passwordText.addListener(SWT.Modify, new Listener() {
- public void handleEvent(Event event) {
- passwordChanged = !passwordText.getText().equals(FAKE_PASSWORD);
- }
- });
- userText.addListener(SWT.Modify, connectionInfoChangedListener);
- methodType.addListener(SWT.Modify, connectionInfoChangedListener);
- hostText.addListener(SWT.Modify, connectionInfoChangedListener);
- portText.addListener(SWT.Modify, connectionInfoChangedListener);
- useCustomPort.addListener(SWT.Selection, connectionInfoChangedListener);
- pathText.addListener(SWT.Modify, connectionInfoChangedListener);
-
- WorkbenchHelp.setHelp(getControl(), IHelpContextIds.REPOSITORY_LOCATION_PROPERTY_PAGE);
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- /**
- * Utility method that creates a combo box
- *
- * @param parent the parent for the new label
- * @return the new widget
- */
- protected Combo createCombo(Composite parent) {
- Combo combo = new Combo(parent, SWT.READ_ONLY);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- data.horizontalSpan = 2;
- combo.setLayoutData(data);
- return combo;
- }
- /**
- * Utility method that creates a label instance
- * and sets the default layout data.
- *
- * @param parent the parent for the new label
- * @param text the text for the new label
- * @return the new label
- */
- protected Label createLabel(Composite parent, String text, int span) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = span;
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
- return label;
- }
- /**
- * Create a text field specific for this application
- *
- * @param parent the parent of the new text field
- * @return the new text field
- */
- protected Text createTextField(Composite parent) {
- Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);
- return layoutTextField(text);
- }
- /**
- * Create a password field specific for this application
- *
- * @param parent the parent of the new text field
- * @return the new text field
- */
- protected Text createPasswordField(Composite parent) {
- Text text = new Text(parent, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);
- return layoutTextField(text);
- }
- /**
- * Layout a text or password field specific for this application
- *
- * @param parent the parent of the new text field
- * @return the new text field
- */
- protected Text layoutTextField(Text text) {
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.verticalAlignment = GridData.CENTER;
- data.grabExcessVerticalSpace = false;
- data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- data.horizontalSpan = 2;
- text.setLayoutData(data);
- return text;
- }
-
- /**
- * Utility method to create a radio button
- *
- * @param parent the parent of the radio button
- * @param label the label of the radio button
- * @param span the number of columns to span
- * @return the created radio button
- */
- protected Button createRadioButton(Composite parent, String label, int span) {
- Button button = new Button(parent, SWT.RADIO);
- button.setText(label);
- GridData data = new GridData();
- data.horizontalSpan = span;
- button.setLayoutData(data);
- return button;
- }
- /**
- * Initializes the page
- */
- private void initialize() {
- location = null;
- IAdaptable element = getElement();
- if (element instanceof ICVSRepositoryLocation) {
- location = (ICVSRepositoryLocation)element;
- } else {
- Object adapter = element.getAdapter(ICVSRepositoryLocation.class);
- if (adapter instanceof ICVSRepositoryLocation) {
- location = (ICVSRepositoryLocation)adapter;
- }
- }
- }
- /**
- * Set the initial values of the widgets
- */
- private void initializeValues() {
- passwordChanged = false;
- connectionInfoChanged = false;
-
- IConnectionMethod[] methods = CVSRepositoryLocation.getPluggedInConnectionMethods();
- for (int i = 0; i < methods.length; i++) {
- methodType.add(methods[i].getName());
- }
- String method = location.getMethod().getName();
- methodType.select(methodType.indexOf(method));
- info = location.getUserInfo(true);
- userText.setText(info.getUsername());
- passwordText.setText(FAKE_PASSWORD);
- hostText.setText(location.getHost());
- int port = location.getPort();
- if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT) {
- useDefaultPort.setSelection(true);
- useCustomPort.setSelection(false);
- portText.setEnabled(false);
- } else {
- useDefaultPort.setSelection(false);
- useCustomPort.setSelection(true);
- portText.setText("" + port); //$NON-NLS-1$
- }
- pathText.setText(location.getRootDirectory());
- allowCachingButton.setSelection(location.getUserInfoCached());
-
- // get the repository label
- String label = null;
- RepositoryRoot root = CVSUIPlugin.getPlugin().getRepositoryManager().getRepositoryRootFor(location);
- label = root.getName();
- useLocationAsLabel.setSelection(label == null);
- useCustomLabel.setSelection(!useLocationAsLabel.getSelection());
- if (label == null) {
- label = location.getLocation();
- }
- labelText.setText(label);
- }
-
- private boolean performConnectionInfoChanges() {
- // Set the caching mode of the location
- if (!connectionInfoChanged) {
- location.setAllowCaching(allowCaching);
- if (!passwordChanged) {
- ((CVSRepositoryLocation)location).updateCache();
- }
- }
- // Don't do anything else if there wasn't a password or connection change
- if (!passwordChanged && !connectionInfoChanged) return true;
-
- try {
- // Check if the password was the only thing to change.
- if (passwordChanged && !connectionInfoChanged) {
- CVSRepositoryLocation oldLocation = (CVSRepositoryLocation)location;
- oldLocation.setPassword(getNewPassword());
- if (allowCaching) {
- oldLocation.updateCache();
- }
- passwordChanged = false;
- return true;
- }
-
- // Otherwise change the connection info and the password
- // This operation is done inside a workspace operation in case the sharing
- // info for existing projects is changed
- if (!(location.getHost().equals(hostText.getText()) && location.getRootDirectory().equals(pathText.getText()))) {
- // The host or path has changed
- if (!MessageDialog.openConfirm(getShell(),
- Policy.bind("CVSRepositoryPropertiesPage.0"), //$NON-NLS-1$
- Policy.bind("CVSRepositoryPropertiesPage.1"))) { //$NON-NLS-1$
- return false;
- }
- }
- final boolean[] result = new boolean[] { false };
- final ProgressMonitorDialog progressMonitorDialog = new ProgressMonitorDialog(getShell());
- progressMonitorDialog.run(false, false, new WorkspaceModifyOperation(null) {
- public void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- // Create a new repository location with the new information
- CVSRepositoryLocation newLocation = CVSRepositoryLocation.fromProperties(createProperties());
- location.setAllowCaching(allowCaching);
- try {
- // For each project shared with the old location, set connection info to the new one
- List projects = new ArrayList();
- IProject[] allProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- for (int i = 0; i < allProjects.length; i++) {
- RepositoryProvider teamProvider = RepositoryProvider.getProvider(allProjects[i], CVSProviderPlugin.getTypeId());
- if (teamProvider != null) {
- CVSTeamProvider cvsProvider = (CVSTeamProvider)teamProvider;
- if (cvsProvider.getCVSWorkspaceRoot().getRemoteLocation().equals(location)) {
- projects.add(allProjects[i]);
- }
- }
- }
- if (projects.size() > 0) {
- // To do: warn the user
- DetailsDialogWithProjects dialog = new DetailsDialogWithProjects(
- progressMonitorDialog.getShell(),
- Policy.bind("CVSRepositoryPropertiesPage.Confirm_Project_Sharing_Changes_1"), //$NON-NLS-1$
- Policy.bind("CVSRepositoryPropertiesPage.There_are_projects_in_the_workspace_shared_with_this_repository_2"), //$NON-NLS-1$
- Policy.bind("CVSRepositoryPropertiesPage.sharedProject", location.toString()), //$NON-NLS-1$
- (IProject[]) projects.toArray(new IProject[projects.size()]),
- true,
- DetailsDialogWithProjects.DLG_IMG_WARNING);
- int r = dialog.open();
- if (r != DetailsDialogWithProjects.OK) {
- result[0] = false;
- return;
- }
- monitor.beginTask(null, 1000 * projects.size());
- try {
- Iterator it = projects.iterator();
- while (it.hasNext()) {
- IProject project = (IProject)it.next();
- RepositoryProvider teamProvider = RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId());
- CVSTeamProvider cvsProvider = (CVSTeamProvider)teamProvider;
- cvsProvider.setRemoteRoot(newLocation, Policy.subMonitorFor(monitor, 1000));
- }
- } finally {
- monitor.done();
- }
- }
-
- // Dispose the old repository location
- CVSUIPlugin.getPlugin().getRepositoryManager().replaceRepositoryLocation(location, newLocation);
-
- } finally {
- // Even if we failed, ensure that the new location appears in the repo view.
- newLocation = (CVSRepositoryLocation)KnownRepositories.getInstance().addRepository(newLocation, !KnownRepositories.getInstance().isKnownRepository(newLocation.getLocation()));
- }
-
- // Set the location of the page to the new location in case Apply was chosen
- location = newLocation;
- connectionInfoChanged = false;
- passwordChanged = false;
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- result[0] = true;
- }
- });
- return result[0];
- } catch (InvocationTargetException e) {
- handle(e);
- } catch (InterruptedException e) {
- }
- return false; /* we only get here if an exception occurred */
- }
-
- private void performNonConnectionInfoChanges() {
- recordNewLabel((CVSRepositoryLocation)location);
- }
- /*
- * @see PreferencesPage#performOk
- */
- public boolean performOk() {
- if (performConnectionInfoChanges()) {
- performNonConnectionInfoChanges();
- return true;
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
- */
- protected void performDefaults() {
- super.performDefaults();
- initializeValues();
- }
-
- /**
- * Shows the given errors to the user.
- */
- protected void handle(Throwable e) {
- CVSUIPlugin.openError(getShell(), null, null, e);
- }
-
- /**
- * Updates widget enablements and sets error message if appropriate.
- */
- protected void updateWidgetEnablements() {
- if (useLocationAsLabel.getSelection()) {
- labelText.setEnabled(false);
- } else {
- labelText.setEnabled(true);
- }
- if (useDefaultPort.getSelection()) {
- portText.setEnabled(false);
- } else {
- portText.setEnabled(true);
- }
- validateFields();
- }
-
- private void validateFields() {
- if (labelText.isEnabled()) {
- if (labelText.getText().length() == 0) {
- setValid(false);
- return;
- }
- }
- String user = userText.getText();
- IStatus status = ConfigurationWizardMainPage.validateUserName(user);
- if (!isStatusOK(status)) {
- return;
- }
-
- String host = hostText.getText();
- status = ConfigurationWizardMainPage.validateHost(host);
- if (!isStatusOK(status)) {
- return;
- }
-
- if (portText.isEnabled()) {
- String port = portText.getText();
- status = ConfigurationWizardMainPage.validatePort(port);
- if (!isStatusOK(status)) {
- return;
- }
- }
-
- String pathString = pathText.getText();
- status = ConfigurationWizardMainPage.validatePath(pathString);
- if (!isStatusOK(status)) {
- return;
- }
-
- try {
- CVSRepositoryLocation l = CVSRepositoryLocation.fromProperties(createProperties());
- if (!l.equals(location) && KnownRepositories.getInstance().isKnownRepository(l.getLocation())) {
- setErrorMessage(Policy.bind("ConfigurationWizardMainPage.0")); //$NON-NLS-1$
- setValid(false);
- return;
- }
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- // Let it pass. Creation should fail
- }
-
- setErrorMessage(null);
- setValid(true);
- }
-
- private boolean isStatusOK(IStatus status) {
- if (!status.isOK()) {
- setErrorMessage(status.getMessage());
- setValid(false);
- return false;
- }
- return true;
- }
-
- private void recordNewLabel(CVSRepositoryLocation location) {
- String newLabel = getNewLabel(location);
- if (newLabel == null) {
- String oldLabel = getOldLabel(location);
- if (oldLabel == null || oldLabel.equals(location.getLocation())) {
- return;
- }
- } else if (newLabel.equals(getOldLabel(location))) {
- return;
- }
- CVSUIPlugin.getPlugin().getRepositoryManager().setLabel(location, newLabel);
- }
- private String getOldLabel(CVSRepositoryLocation location) {
- return CVSUIPlugin.getPlugin().getRepositoryManager().getRepositoryRootFor(location).getName();
- }
- private String getNewLabel(CVSRepositoryLocation location) {
- String label = null;
- if (useCustomLabel.getSelection()) {
- label = labelText.getText();
- if (label.equals(location.getLocation())) {
- label = null;
- }
- }
- return label;
- }
- /* internal use only */ String getNewPassword() {
- return passwordText.getText();
- }
-
- private Properties createProperties() {
- Properties result = new Properties();
- result.setProperty("connection", methodType.getText()); //$NON-NLS-1$
- result.setProperty("user", userText.getText()); //$NON-NLS-1$
- if (passwordChanged) {
- result.setProperty("password", passwordText.getText()); //$NON-NLS-1$
- }
- result.setProperty("host", hostText.getText()); //$NON-NLS-1$
- if (useCustomPort.getSelection()) {
- result.setProperty("port", portText.getText()); //$NON-NLS-1$
- }
- result.setProperty("root", pathText.getText()); //$NON-NLS-1$
- return result;
- }
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CommentHistoryContentHandler.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CommentHistoryContentHandler.java
deleted file mode 100644
index f3f3d58f2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CommentHistoryContentHandler.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.util.Vector;
-
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-import org.xml.sax.Attributes;
-
-class CommentHistoryContentHandler extends DefaultHandler {
-
- private StringBuffer buffer;
- private Vector comments;
- public CommentHistoryContentHandler() {
- }
-
- /**
- * @see ContentHandler#characters(char[], int, int)
- */
- public void characters(char[] chars, int startIndex, int length) throws SAXException {
- if (buffer == null) return;
- buffer.append(chars, startIndex, length);
- }
-
- /**
- * @see ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
- */
- public void startElement(
- String namespaceURI,
- String localName,
- String qName,
- Attributes atts)
- throws SAXException {
-
- String elementName = getElementName(namespaceURI, localName, qName);
- if (elementName.equals(RepositoryManager.ELEMENT_COMMIT_COMMENT)) {
- buffer = new StringBuffer();
- return;
- }
- if (elementName.equals(RepositoryManager.ELEMENT_COMMIT_HISTORY)) {
- comments = new Vector(RepositoryManager.MAX_COMMENTS);
- return;
- }
- }
-
- /**
- * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
- */
- public void endElement(String namespaceURI, String localName, String qName) {
- String elementName = getElementName(namespaceURI, localName, qName);
- if (elementName.equals(RepositoryManager.ELEMENT_COMMIT_COMMENT)) {
- comments.add(buffer.toString());
- buffer = null;
- return;
- }
- if (elementName.equals(RepositoryManager.ELEMENT_COMMIT_HISTORY)) {
- RepositoryManager.previousComments = new String[comments.size()];
- comments.copyInto(RepositoryManager.previousComments);
- return;
- }
- }
-
- /*
- * Couldn't figure out from the SAX API exactly when localName vs. qName is used.
- * However, the XML for project sets doesn't use namespaces so either of the two names
- * is fine. Therefore, use whichever one is provided.
- */
- private String getElementName(String namespaceURI, String localName, String qName) {
- if (localName != null && localName.length() > 0) {
- return localName;
- } else {
- return qName;
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CopyRepositoryNameAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CopyRepositoryNameAction.java
deleted file mode 100644
index 50b1cbb54..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CopyRepositoryNameAction.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
-
-public class CopyRepositoryNameAction extends CVSAction {
- protected boolean isEnabled() throws TeamException {
- return true;
- }
- public void execute(IAction action) {
- ICVSRepositoryLocation[] locations = getSelectedRepositories();
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < locations.length; i++) {
- buffer.append(locations[i].getLocation());
- if (i < locations.length - 1) buffer.append("\n"); //$NON-NLS-1$
- }
- copyToClipbard(Display.getDefault(), buffer.toString());
- }
- protected ICVSRepositoryLocation[] getSelectedRepositories() {
- ArrayList repositories = null;
- if (!selection.isEmpty()) {
- repositories = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = getAdapter(elements.next(), ICVSRepositoryLocation.class);
- if (next instanceof ICVSRepositoryLocation) {
- repositories.add(next);
- continue;
- }
- }
- }
- if (repositories != null && !repositories.isEmpty()) {
- ICVSRepositoryLocation[] result = new ICVSRepositoryLocation[repositories.size()];
- repositories.toArray(result);
- return result;
- }
- return new ICVSRepositoryLocation[0];
- }
- private void copyToClipbard(Display display, String str) {
- Clipboard clipboard = new Clipboard(display);
- clipboard.setContents(new String[] { str }, new Transfer[] { TextTransfer.getInstance()});
- clipboard.dispose();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/NewCVSRepositoryAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/NewCVSRepositoryAction.java
deleted file mode 100644
index 172607e6a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/NewCVSRepositoryAction.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.wizards.NewLocationWizard;
-import org.eclipse.ui.IWorkbenchWindow;
-
-/**
- * Called from Welcome page only.
- */
-public class NewCVSRepositoryAction extends Action {
- public void run() {
- Shell shell;
- IWorkbenchWindow window = CVSUIPlugin.getPlugin().getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- shell = window.getShell();
- } else {
- Display display = Display.getCurrent();
- shell = new Shell(display);
- }
- NewLocationWizard wizard = new NewLocationWizard();
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.open();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/NewDateTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/NewDateTagAction.java
deleted file mode 100644
index b536fb34a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/NewDateTagAction.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Date;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.DateTagDialog;
-
-/**
- * Action for creating a CVS Date tag.
- */
-public class NewDateTagAction extends CVSRepoViewAction {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
- protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
- ICVSRepositoryLocation[] locations = getSelectedRepositoryLocations();
- if (locations.length != 1) return;
- CVSTag tag = getDateTag(getShell(), locations[0]);
- CVSUIPlugin.getPlugin().getRepositoryManager().addDateTag(locations[0], tag);
- }
-
- public static CVSTag getDateTag(Shell shell, ICVSRepositoryLocation location) {
- DateTagDialog dialog = new DateTagDialog(shell);
- if (dialog.open() == Window.OK) {
- Date date = dialog.getDate();
- CVSTag tag = new CVSTag(date);
- return tag;
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
- */
- protected boolean isEnabled() {
- ICVSRepositoryLocation[] locations = getSelectedRepositoryLocations();
- if (locations.length != 1) return false;
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectSelectionPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectSelectionPage.java
deleted file mode 100644
index 8dfb75598..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectSelectionPage.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.util.Arrays;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.ListSelectionArea;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.WorkingSetSelectionArea;
-import org.eclipse.team.internal.ccvs.ui.model.RemoteContentProvider;
-import org.eclipse.team.internal.ccvs.ui.wizards.CVSWizardPage;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-/**
- * Page that allows the user to select the remote projects whose tags should be
- * refreshed.
- */
-public class RefreshRemoteProjectSelectionPage extends CVSWizardPage {
-
- private ICVSRemoteResource[] rootFolders;
- private ListSelectionArea listArea;
- private WorkingSetSelectionArea workingSetArea;
- private IWorkingSet workingSet;
- private IDialogSettings settings;
-
- /**
- * Custom input provider which returns the list of root folders
- */
- private class InputElement implements IWorkbenchAdapter, IAdaptable {
- public Object[] getChildren(Object o) {
- return rootFolders;
- }
- public ImageDescriptor getImageDescriptor(Object object) {
- return null;
- }
- public String getLabel(Object o) {
- return null;
- }
- public Object getParent(Object o) {
- return null;
- }
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
- }
- }
-
- /**
- * Constructor for RemoteProjectSelectionPage.
- * @param pageName
- * @param title
- * @param titleImage
- * @param description
- */
- public RefreshRemoteProjectSelectionPage(
- String pageName,
- String title,
- ImageDescriptor titleImage,
- String description,
- IDialogSettings settings,
- ICVSRepositoryLocation root,
- ICVSRemoteResource[] rootFolders) {
- super(pageName, title, titleImage, description);
- this.settings = settings;
- this.rootFolders = rootFolders;
- }
-
- /**
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
-
- final Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout(1, false));
-
- setControl(composite);
-
- // set F1 help
- WorkbenchHelp.setHelp(composite, IHelpContextIds.REFRESH_REMOTE_PROJECT_SELECTION_PAGE);
-
- listArea = new ListSelectionArea(
- new InputElement(),
- new RemoteContentProvider(),
- new WorkbenchLabelProvider(),
- Policy.bind("RefreshRemoteProjectSelectionPage.selectRemoteProjects")); //$NON-NLS-1$
- listArea.createArea(composite);
-
- listArea.addPropertyChangeListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- updateEnablement();
- }
- });
- listArea.getViewer().setSorter(new RepositorySorter());
-
- workingSetArea = new WorkingSetSelectionArea(getShell(), Policy.bind("RefreshRemoteProjectSelectionPage.noWorkingSet"), Policy.bind("RefreshRemoteProjectSelectionPage.workingSet"), settings); //$NON-NLS-1$ //$NON-NLS-2$
- setWorkingSet(workingSet);
- workingSetArea.addPropertyChangeListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- workingSet = (IWorkingSet)event.getNewValue();
- handleWorkingSetChange();
- }
- });
- workingSetArea.createArea(composite);
- Dialog.applyDialogFont(parent);
- }
-
- /**
- * Sets the working set that should be selected in the most recently
- * used working set list.
- *
- * @param workingSet the working set that should be selected.
- * has to exist in the list returned by
- * org.eclipse.ui.IWorkingSetManager#getRecentWorkingSets().
- * Must not be null.
- */
- public void setWorkingSet(IWorkingSet workingSet) {
- this.workingSet = workingSet;
-
- if (workingSetArea != null) {
- workingSetArea.setWorkingSet(workingSet);
- }
- }
-
- private void handleWorkingSetChange() {
- if (workingSet != null) {
- // check any projects in the working set
- listArea.getViewer().setAllChecked(false);
- RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- ICVSRemoteResource[] resources = manager.filterResources(workingSet, rootFolders);
- for (int i = 0; i < resources.length; i++) {
- ICVSRemoteResource resource = resources[i];
- listArea.getViewer().setChecked(resource, true);
- }
- }
- }
-
- private void updateEnablement() {
- boolean atLeastOne = listArea.getViewer().getCheckedElements().length > 0;
- setPageComplete(atLeastOne);
- }
-
- /**
- * Method getSelectedRemoteProject.
- * @return ICVSRemoteResource[]
- */
- public ICVSRemoteResource[] getSelectedRemoteProject() {
- Object[] checked = listArea.getViewer().getCheckedElements();
- return (ICVSRemoteResource[]) Arrays.asList(checked).toArray(new ICVSRemoteResource[checked.length]);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectWizard.java
deleted file mode 100644
index 6f9e95087..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectWizard.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-/**
- * Wizard for refreshing the tags for a CVS repository location
- */
-public class RefreshRemoteProjectWizard extends Wizard {
-
- // The initial size of this wizard.
- private final static int INITIAL_WIDTH = 300;
- private final static int INITIAL_HEIGHT = 350;
-
- private ICVSRepositoryLocation root;
- private ICVSRemoteResource[] rootFolders;
- private RefreshRemoteProjectSelectionPage projectSelectionPage;
- private IDialogSettings settings;
-
- public static boolean execute(Shell shell, final ICVSRepositoryLocation root) {
- final ICVSRemoteResource[][] rootFolders = new ICVSRemoteResource[1][0];
- rootFolders[0] = null;
- try {
- new ProgressMonitorDialog(shell).run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- rootFolders[0] = CVSUIPlugin.getPlugin().getRepositoryManager().getFoldersForTag(root, CVSTag.DEFAULT, monitor);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(shell, null, null, e);
- return false;
- } catch (InterruptedException e) {
- return false;
- }
- RefreshRemoteProjectWizard wizard = new RefreshRemoteProjectWizard(root, rootFolders[0]);
- WizardDialog dialog = new WizardDialog(shell, wizard);
- /**
- * This is the only place where a size hint > 0 is required. The wizard
- * page should in general have hints of 0 (and grab excessive space).
- */
- dialog.setMinimumPageSize(INITIAL_WIDTH, INITIAL_HEIGHT);
- return (dialog.open() == Window.OK);
- }
-
- public RefreshRemoteProjectWizard(ICVSRepositoryLocation root, ICVSRemoteResource[] rootFolders) {
- this.root = root;
- this.rootFolders = rootFolders;
- IDialogSettings workbenchSettings = CVSUIPlugin.getPlugin().getDialogSettings();
- this.settings = workbenchSettings.getSection("RefreshRemoteProjectWizard");//$NON-NLS-1$
- if (settings == null) {
- this.settings = workbenchSettings.addNewSection("RefreshRemoteProjectWizard");//$NON-NLS-1$
- }
- setWindowTitle(Policy.bind("RefreshRemoteProjectWizard.title")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.jface.wizard.IWizard#addPages()
- */
- public void addPages() {
- setNeedsProgressMonitor(true);
- ImageDescriptor substImage = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_NEW_LOCATION);
- projectSelectionPage = new RefreshRemoteProjectSelectionPage(
- "ProjectSelectionPage", //$NON-NLS-1$
- Policy.bind("RefreshRemoteProjectSelectionPage.pageTitle"), //$NON-NLS-1$
- substImage,
- Policy.bind("RefreshRemoteProjectSelectionPage.pageDescription"), //$NON-NLS-1$
- settings, root, rootFolders);
- addPage(projectSelectionPage);
- }
-
- /**
- * @see org.eclipse.jface.wizard.Wizard#performFinish()
- */
- public boolean performFinish() {
- final ICVSRemoteResource[] selectedFolders = projectSelectionPage.getSelectedRemoteProject();
- try {
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- final RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- // Run in the manager to avoid multiple repo view updates
- manager.run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException,InterruptedException {
- monitor.beginTask(null, 100);
- ICVSRemoteResource[] failedFolders = internalRefresh(manager, selectedFolders, false /* recurse */, Policy.subMonitorFor(monitor, 80));
- if (failedFolders.length > 0) {
- // Go deep any any failed folders.
- if (promptForDeepRefresh(failedFolders))
- internalRefresh(manager, failedFolders, true /* recurse */, Policy.subMonitorFor(monitor, 20));
- }
- monitor.done();
- }
- }, monitor);
- }
- });
- return true;
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(getShell(), null, null ,e);
- } catch (InterruptedException e) {
- }
- return false;
- }
-
- /*
- * Refresh the tags of the given resources and return those for which no tags were found.
- */
- private ICVSRemoteResource[] internalRefresh(final RepositoryManager manager, final ICVSRemoteResource[] selectedFolders, final boolean recurse, IProgressMonitor monitor) throws InvocationTargetException {
- List failedFolders = new ArrayList();
- monitor.beginTask(null, 100 * selectedFolders.length);
- try {
- for (int i = 0; i < selectedFolders.length; i++) {
- ICVSRemoteResource resource = selectedFolders[i];
- if (resource instanceof ICVSFolder) {
- CVSTag[] tags = manager.refreshDefinedTags((ICVSFolder)resource, recurse, true /* notify */, Policy.subMonitorFor(monitor, 100));
- if (tags.length == 0) {
- failedFolders.add(resource);
- }
- }
- }
- return (ICVSRemoteResource[]) failedFolders.toArray(new ICVSRemoteResource[failedFolders.size()]);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
-
- private boolean promptForDeepRefresh(final ICVSRemoteResource[] folders) {
- final boolean[] prompt = new boolean[] { false };
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- MessageDialog dialog = new MessageDialog(getShell(), Policy.bind("RefreshRemoteProjectWizard.0"), null, //$NON-NLS-1$
- getNoTagsMessage(folders),
- MessageDialog.INFORMATION,
- new String[] {
- Policy.bind("RefreshRemoteProjectWizard.1"), //$NON-NLS-1$
- Policy.bind("RefreshRemoteProjectWizard.2") //$NON-NLS-1$
- }, 1);
- int code = dialog.open();
- if (code == 0) {
- prompt[0] = true;
- }
-
- }
- });
- return prompt[0];
- }
-
- private String getNoTagsMessage(ICVSRemoteResource[] folders) {
- if (folders.length == 1) {
- return Policy.bind("RefreshRemoteProjectWizard.3", folders[0].getRepositoryRelativePath()); //$NON-NLS-1$
- }
- return Policy.bind("RefreshRemoteProjectWizard.4", Integer.toString(folders.length)); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshTagsAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshTagsAction.java
deleted file mode 100644
index a845aa27c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshTagsAction.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-
-/**
- * Action that refreshs the tags in the CVS repositories view.
- */
-public class RefreshTagsAction extends CVSRepoViewAction {
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
- protected void execute(IAction action) {
- ICVSRepositoryLocation[] locations = getSelectedRepositoryLocations();
- RefreshRemoteProjectWizard.execute(getShell(), locations[0]);
- }
-
- /**
- * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
- */
- protected boolean isEnabled() {
- ICVSRepositoryLocation[] locations = getSelectedRepositoryLocations();
- if (locations.length != 1) return false;
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteProjectsView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteProjectsView.java
deleted file mode 100644
index 84b0a63dc..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteProjectsView.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.model.CVSTagElement;
-import org.eclipse.team.internal.ccvs.ui.model.RemoteProjectsElement;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * This view shows a list of projects stored in a repository that share the same
- * tag
- */
-public class RemoteProjectsView extends RemoteViewPart {
-
- public static final String VIEW_ID = "org.eclipse.team.ccvs.ui.RemoteProjectsView"; //$NON-NLS-1$
-
- private RemoteProjectsElement root;
-
- /**
- * Constructor for RemoteProjectsView.
- * @param partName
- */
- public RemoteProjectsView() {
- super(VIEW_ID);
- }
-
- protected void initializeListeners() {
- // listen for selection changes in the repo view
- getSite().getWorkbenchWindow().getSelectionService().addPostSelectionListener(RepositoriesView.VIEW_ID, this);
- getSite().getWorkbenchWindow().getSelectionService().addPostSelectionListener(RemoteTagsView.VIEW_ID, this);
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
- public void dispose() {
- getSite().getWorkbenchWindow().getSelectionService().removePostSelectionListener(RepositoriesView.VIEW_ID, this);
- getSite().getWorkbenchWindow().getSelectionService().removePostSelectionListener(RemoteTagsView.VIEW_ID, this);
- super.dispose();
- }
-
- /**
- * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- Object[] selected = TeamAction.getSelectedAdaptables(selection, ICVSRepositoryLocation.class);
- if (selected.length != 0) {
- root.setRoot((ICVSRepositoryLocation)selected[0]);
- } else {
- selected = TeamAction.getSelectedAdaptables(selection, CVSTagElement.class);
- if (selected.length != 0) {
- CVSTagElement element = (CVSTagElement)selected[0];
- root.setRoot(element.getRoot());
- root.setTag(element.getTag());
- }
- };
- refreshViewer();
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.repo.RemoteViewPart#getTreeInput()
- */
- protected Object getTreeInput() {
- root = new RemoteProjectsElement();
- return root;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteTagsView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteTagsView.java
deleted file mode 100644
index 9826ee5ce..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteTagsView.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.ui.IWorkbenchPart;
-
-
-/**
- * This view shows the tags for the repository selected in the Repositories view
- */
-public class RemoteTagsView extends RemoteViewPart {
-
- public static final String VIEW_ID = "org.eclipse.team.ccvs.ui.RemoteTagsView"; //$NON-NLS-1$
-
- /**
- * Constructor for RemoteTagsView.
- * @param partName
- */
- public RemoteTagsView() {
- super(VIEW_ID);
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.repo.RemoteViewPart#getTreeInput()
- */
- protected Object getTreeInput() {
- return null;
- }
-
- protected void initializeListeners() {
- // listen for selection changes in the repo view
- getSite().getWorkbenchWindow().getSelectionService().addPostSelectionListener(RepositoriesView.VIEW_ID, this);
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
- public void dispose() {
- getSite().getWorkbenchWindow().getSelectionService().removePostSelectionListener(RepositoriesView.VIEW_ID, this);
- super.dispose();
- }
-
- /**
- * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- Object[] selected = TeamAction.getSelectedAdaptables(selection, ICVSRepositoryLocation.class);
- if (selected.length == 0) {
- getViewer().setInput(null);
- } else {
- getViewer().setInput(selected[0]);
- };
- refreshViewer();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteViewPart.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteViewPart.java
deleted file mode 100644
index 13319967e..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoteViewPart.java
+++ /dev/null
@@ -1,429 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.actions.OpenRemoteFileAction;
-import org.eclipse.team.internal.ccvs.ui.model.RemoteContentProvider;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetManager;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.dialogs.IWorkingSetEditWizard;
-import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.part.DrillDownAdapter;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * This class acts as a superclass to all remote CVS tree views.
- */
-public abstract class RemoteViewPart extends ViewPart implements ISelectionListener {
-
- // The tree viewer
- protected TreeViewer viewer;
-
- // Drill down adapter
- private DrillDownAdapter drillPart;
-
- private Action refreshAction;
- private Action collapseAllAction;
-
- private Action selectWorkingSetAction;
- private Action deselectWorkingSetAction;
- private Action editWorkingSetAction;
- private OpenRemoteFileAction openAction;
-
- private RemoteContentProvider contentProvider;
- private IDialogSettings settings;
- private static final String SELECTED_WORKING_SET = "SelectedWorkingSet"; //$NON-NLS-1$
-
- private class ChangeWorkingSetAction extends Action {
- String name;
- public ChangeWorkingSetAction(String name, int index) {
- super(Policy.bind("RepositoriesView.workingSetMenuItem", new Integer(index).toString(), name)); //$NON-NLS-1$
- this.name = name;
- }
- public void run() {
- IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
- setWorkingSet(manager.getWorkingSet(name), true);
- }
- }
-
- protected RemoteViewPart(String partName) {
- IDialogSettings workbenchSettings = CVSUIPlugin.getPlugin().getDialogSettings();
- settings = workbenchSettings.getSection(partName);
- if (settings == null) {
- settings = workbenchSettings.addNewSection(partName);
- }
- String name = settings.get(SELECTED_WORKING_SET);
- IWorkingSet set = null;
- if (name != null)
- set = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(name);
- setWorkingSet(set, false);
- }
-
- /**
- * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- public void createPartControl(Composite parent) {
- viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- viewer.setContentProvider(getContentProvider());
- viewer.setLabelProvider(new WorkbenchLabelProvider());
- getSite().setSelectionProvider(viewer);
- viewer.setInput(getTreeInput());
- viewer.setSorter(new RepositorySorter());
- viewer.getControl().addKeyListener(getKeyListener());
- drillPart = new DrillDownAdapter(viewer);
-
- contributeActions();
- initializeListeners();
-
- // F1 Help
- String helpID = getHelpContextId();
- if (helpID != null)
- WorkbenchHelp.setHelp(viewer.getControl(), helpID);
- }
-
- /**
- * @see WorkbenchPart#setFocus
- */
- public void setFocus() {
- viewer.getControl().setFocus();
- }
-
- /**
- * Method getHelpContextId should be overridden by subclasses to provide the
- * appropriate help id.
- *
- * @return String
- */
- protected String getHelpContextId() {
- return null;
- }
-
- /**
- * Method getTreeInput.
- * @return Object
- */
- protected abstract Object getTreeInput();
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.repo.RemoteViewPart#getContentProvider()
- */
- protected RemoteContentProvider getContentProvider() {
- if (contentProvider == null) {
- contentProvider = new RemoteContentProvider();
- }
- return contentProvider;
- };
-
- protected KeyAdapter getKeyListener() {
- return new KeyAdapter() {
- public void keyPressed(KeyEvent event) {
- if (event.keyCode == SWT.F5) {
- refreshAction.run();
- }
- }
- };
- }
-
- protected void initializeListeners() {
- // listen for selection changes in the repo view
- getSite().getWorkbenchWindow().getSelectionService().addPostSelectionListener(this);
- }
-
- protected IWorkingSet getWorkingSet() {
- return getContentProvider().getWorkingSet();
- }
-
- protected void setWorkingSet(IWorkingSet workingSet, boolean refreshViewer) {
- if (settings != null) {
- String name = null;
- if (workingSet != null)
- name = workingSet.getName();
- settings.put(SELECTED_WORKING_SET, name);
- }
- getContentProvider().setWorkingSet(workingSet);
- String toolTip;
- if (workingSet == null) {
- toolTip = null;
- } else {
- toolTip = Policy.bind("RemoteViewPart.workingSetToolTip", workingSet.getName()); //$NON-NLS-1$
- }
- setTitleToolTip(toolTip);
- if (refreshViewer) refreshViewer();
- }
-
- /**
- * Contribute actions to the view
- */
- protected void contributeActions() {
-
- final Shell shell = getShell();
-
- // Refresh (toolbar)
- CVSUIPlugin plugin = CVSUIPlugin.getPlugin();
- refreshAction = new Action(Policy.bind("RepositoriesView.refresh"), CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_REFRESH_ENABLED)) { //$NON-NLS-1$
- public void run() {
- refreshAll();
- }
- };
- refreshAction.setToolTipText(Policy.bind("RepositoriesView.refreshTooltip")); //$NON-NLS-1$
- refreshAction.setDisabledImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_REFRESH_DISABLED));
- refreshAction.setHoverImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_REFRESH));
- getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.REFRESH.getId(), refreshAction);
-
- collapseAllAction = new Action(Policy.bind("RepositoriesView.collapseAll"), CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_COLLAPSE_ALL_ENABLED)) { //$NON-NLS-1$
- public void run() {
- collapseAll();
- }
- };
- collapseAllAction.setToolTipText(Policy.bind("RepositoriesView.collapseAllTooltip")); //$NON-NLS-1$
- collapseAllAction.setHoverImageDescriptor(plugin.getImageDescriptor(ICVSUIConstants.IMG_COLLAPSE_ALL));
-
- // Select Working Set (popup)
- selectWorkingSetAction = new Action(Policy.bind("RepositoriesView.newWorkingSet")) { //$NON-NLS-1$
- public void run() {
- IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
- IWorkingSetSelectionDialog dialog = manager.createWorkingSetSelectionDialog(shell, false);
- IWorkingSet workingSet = null;
- if (workingSet != null)
- dialog.setSelection(new IWorkingSet[]{workingSet});
-
- if (dialog.open() == Window.OK) {
- IWorkingSet[] result = dialog.getSelection();
- if (result != null && result.length > 0) {
- setWorkingSet(result[0], true);
- manager.addRecentWorkingSet(result[0]);
- } else {
- setWorkingSet(null, true);
- }
- }
- }
- };
- WorkbenchHelp.setHelp(selectWorkingSetAction, IHelpContextIds.SELECT_WORKING_SET_ACTION);
-
- // Deselect Working Set (popup)
- deselectWorkingSetAction = new Action(Policy.bind("RepositoriesView.deselectWorkingSet")) { //$NON-NLS-1$
- public void run() {
- setWorkingSet(null, true);
- }
- };
- WorkbenchHelp.setHelp(deselectWorkingSetAction, IHelpContextIds.DESELECT_WORKING_SET_ACTION);
-
- // Edit Working Set (popup)
- editWorkingSetAction = new Action(Policy.bind("RepositoriesView.editWorkingSet")) { //$NON-NLS-1$
- public void run() {
- IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
- IWorkingSet workingSet = getWorkingSet();
- if (workingSet == null) {
- setEnabled(false);
- return;
- }
- IWorkingSetEditWizard wizard = manager.createWorkingSetEditWizard(workingSet);
- if (wizard == null) {
- // todo
- String title = Policy.bind("EditWorkingSetAction.error.nowizard.title"); //$NON-NLS-1$
- String message = Policy.bind("EditWorkingSetAction.error.nowizard.message"); //$NON-NLS-1$
- CVSUIPlugin.openError(shell, title, message, null);
- return;
- }
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.create();
- if (dialog.open() == WizardDialog.OK)
- setWorkingSet(wizard.getSelection(), true);
- }
- };
- WorkbenchHelp.setHelp(editWorkingSetAction, IHelpContextIds.EDIT_WORKING_SET_ACTION);
-
- // Create the popup menu
- MenuManager menuMgr = new MenuManager();
- Tree tree = viewer.getTree();
- Menu menu = menuMgr.createContextMenu(tree);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- addWorkbenchActions(manager);
- }
-
- });
- menuMgr.setRemoveAllWhenShown(true);
- tree.setMenu(menu);
- getSite().registerContextMenu(menuMgr, viewer);
-
- // Create the local tool bar
- IActionBars bars = getViewSite().getActionBars();
- IToolBarManager tbm = bars.getToolBarManager();
- drillPart.addNavigationActions(tbm);
- tbm.add(refreshAction);
- tbm.add(new Separator());
- tbm.add(collapseAllAction);
- tbm.update(false);
-
- // Create the open action for double clicks
- openAction = new OpenRemoteFileAction();
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent e) {
- handleDoubleClick(e);
- }
- });
-
- updateWorkingSetMenu();
- bars.updateActionBars();
- }
-
- /**
- * Add the menu actions that were contributed in plugin.xml
- *
- * @param manager
- */
- protected void addWorkbenchActions(IMenuManager manager) {
- // File actions go first (view file)
- manager.add(new Separator(IWorkbenchActionConstants.GROUP_FILE));
- // Misc additions
- manager.add(new Separator("checkoutGroup")); //$NON-NLS-1$
- manager.add(new Separator("tagGroup")); //$NON-NLS-1$
- manager.add(new Separator("miscGroup")); //$NON-NLS-1$
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
-
- manager.add(refreshAction);
- }
-
- /**
- * Method getShell.
- * @return Shell
- */
- protected Shell getShell() {
- return viewer.getTree().getShell();
- }
-
- public void updateWorkingSetMenu() {
- IActionBars bars = getViewSite().getActionBars();
- IMenuManager mgr = bars.getMenuManager();
-
- mgr.removeAll();
-
- mgr.add(selectWorkingSetAction);
- mgr.add(deselectWorkingSetAction);
- deselectWorkingSetAction.setEnabled(getWorkingSet() != null);
- mgr.add(editWorkingSetAction);
- editWorkingSetAction.setEnabled(getWorkingSet() != null);
-
- mgr.add(new Separator());
-
- IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
- IWorkingSet[] workingSets = manager.getWorkingSets();
- for (int i = 0; i < workingSets.length; i++) {
- String name = workingSets[i].getName();
- ChangeWorkingSetAction action = new ChangeWorkingSetAction(name, i + 1);
- mgr.add(action);
- action.setChecked(getWorkingSet() != null && getWorkingSet().getName().equals(name));
- }
-
- bars.updateActionBars();
- }
-
- protected void refreshAll() {
- //CVSUIPlugin.getPlugin().getRepositoryManager().clearCaches();
- refreshViewer();
- }
-
- protected void refreshViewer() {
- if (viewer == null) return;
- ((RemoteContentProvider)viewer.getContentProvider()).cancelJobs(CVSUIPlugin.getPlugin().getRepositoryManager().getKnownRepositoryRoots());
- CVSUIPlugin.getPlugin().getRepositoryManager().purgeCache();
- updateWorkingSetMenu();
- viewer.refresh();
- }
-
- public void collapseAll() {
- if (viewer == null) return;
- viewer.getControl().setRedraw(false);
- viewer.collapseToLevel(viewer.getInput(), TreeViewer.ALL_LEVELS);
- viewer.getControl().setRedraw(true);
- }
- /**
- * The mouse has been double-clicked in the tree, perform appropriate
- * behaviour.
- */
- private void handleDoubleClick(DoubleClickEvent e) {
- // Only act on single selection
- ISelection selection = e.getSelection();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection structured = (IStructuredSelection)selection;
- if (structured.size() == 1) {
- Object first = structured.getFirstElement();
- if (first instanceof ICVSRemoteFile) {
- // It's a file, open it.
- openAction.selectionChanged(null, selection);
- openAction.run(null);
- } else {
- // Try to expand/contract
- viewer.setExpandedState(first, !viewer.getExpandedState(first));
- }
- }
- }
- }
-
- /**
- * Returns the viewer.
- * @return TreeViewer
- */
- protected TreeViewer getViewer() {
- return viewer;
- }
-
- /**
- * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
- public void dispose() {
- getSite().getWorkbenchWindow().getSelectionService().removePostSelectionListener(this);
- super.dispose();
- viewer = null;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoveDateTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoveDateTagAction.java
deleted file mode 100644
index 342491766..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoveDateTagAction.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
-import org.eclipse.team.internal.ccvs.ui.model.CVSTagElement;
-import org.eclipse.ui.actions.SelectionListenerAction;
-
-
-public class RemoveDateTagAction extends SelectionListenerAction {
- private IStructuredSelection selection;
-
- public RemoveDateTagAction() {
- super(Policy.bind("RemoveDateTagAction.0")); //$NON-NLS-1$
- }
-
- public void run() {
- CVSTagElement[] elements = getSelectedCVSTagElements();
- if (elements.length == 0) return;
- for(int i = 0; i < elements.length; i++){
- RepositoryManager mgr = CVSUIPlugin.getPlugin().getRepositoryManager();
- CVSTag tag = elements[i].getTag();
- if(tag.getType() == CVSTag.DATE){
- mgr.removeDateTag(elements[i].getRoot(),tag);
- }
- }
- }
-
- protected boolean updateSelection(IStructuredSelection selection) {
- this.selection = selection;
- boolean b = containsDataTag();
- setEnabled(b);
- return b;
- }
-
- private boolean containsDataTag(){
- CVSTagElement[] elements = getSelectedCVSTagElements();
- if (elements.length > 0){
- for(int i = 0; i < elements.length; i++){
- CVSTag tag = elements[i].getTag();
- if(tag.getType() == CVSTag.DATE){
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Returns the selected CVS date tag elements
- */
- private CVSTagElement[] getSelectedCVSTagElements() {
- ArrayList cvsTagElements = null;
- if (selection!=null && !selection.isEmpty()) {
- cvsTagElements = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = CVSAction.getAdapter(elements.next(), CVSTagElement.class);
- if (next instanceof CVSTagElement) {
- cvsTagElements.add(next);
- }
- }
- }
- if (cvsTagElements != null && !cvsTagElements.isEmpty()) {
- CVSTagElement[] result = new CVSTagElement[cvsTagElements.size()];
- cvsTagElements.toArray(result);
- return result;
- }
- return new CVSTagElement[0];
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoveRootAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoveRootAction.java
deleted file mode 100644
index d5b72d705..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoveRootAction.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
-import org.eclipse.team.internal.ccvs.ui.model.RepositoryLocationSchedulingRule;
-import org.eclipse.team.internal.ui.dialogs.DetailsDialogWithProjects;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.SelectionListenerAction;
-import org.eclipse.ui.progress.IProgressService;
-
-
-/**
- * RemoveRootAction removes a repository
- */
-public class RemoveRootAction extends SelectionListenerAction {
- private IStructuredSelection selection;
- /* internal use only */ Shell shell;
- private RepositoriesView view;
-
- public RemoveRootAction(Shell shell, RepositoriesView view) {
- super(Policy.bind("RemoteRootAction.label")); //$NON-NLS-1$
- this.view = view;
- this.shell = shell;
- }
-
- /**
- * Returns the selected remote files
- */
- protected ICVSRepositoryLocation[] getSelectedRemoteRoots() {
- ArrayList resources = null;
- if (selection!=null && !selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = CVSAction.getAdapter(elements.next(), RepositoryRoot.class);
- if (next instanceof RepositoryRoot) {
- resources.add(((RepositoryRoot)next).getRoot());
- }
- }
- }
- if (resources != null && !resources.isEmpty()) {
- ICVSRepositoryLocation[] result = new ICVSRepositoryLocation[resources.size()];
- resources.toArray(result);
- return result;
- }
- return new ICVSRepositoryLocation[0];
- }
-
- protected String getErrorTitle() {
- return Policy.bind("RemoveRootAction.removeRoot_3"); //$NON-NLS-1$
- }
-
- public void run() {
- ICVSRepositoryLocation[] roots = getSelectedRemoteRoots();
- if (roots.length == 0) return;
- for (int i = 0; i < roots.length; i++) {
- final ICVSRepositoryLocation root = roots[i];
- try {
- // Check if any projects are shared with the repository
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- final ArrayList shared = new ArrayList();
- for (int j = 0; j < projects.length; j++) {
- RepositoryProvider teamProvider = RepositoryProvider.getProvider(projects[j], CVSProviderPlugin.getTypeId());
- if (teamProvider!=null) {
- CVSTeamProvider cvsProvider = (CVSTeamProvider)teamProvider;
- if (cvsProvider.getCVSWorkspaceRoot().getRemoteLocation().equals(roots[i])) {
- shared.add(projects[j]);
- }
- }
- }
-
- // This will notify the RepositoryManager of the removal
- if (!shared.isEmpty()) {
- final String location = roots[i].getLocation();
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- DetailsDialogWithProjects dialog = new DetailsDialogWithProjects(
- shell,
- Policy.bind("RemoteRootAction.Unable_to_Discard_Location_1"), //$NON-NLS-1$
- Policy.bind("RemoteRootAction.Projects_in_the_local_workspace_are_shared_with__2", location), //$NON-NLS-1$
- Policy.bind("RemoteRootAction.The_projects_that_are_shared_with_the_above_repository_are__4"), //$NON-NLS-1$
- (IProject[]) shared.toArray(new IProject[shared.size()]),
- false,
- DetailsDialogWithProjects.DLG_IMG_ERROR);
- dialog.open();
- }
- });
- } else {
- IProgressService manager = PlatformUI.getWorkbench().getProgressService();
- try {
- manager.busyCursorWhile(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- ISchedulingRule rule = new RepositoryLocationSchedulingRule(root);
- try {
- Platform.getJobManager().beginRule(rule, monitor);
- view.getContentProvider().cancelJobs(root);
- KnownRepositories.getInstance().disposeRepository(root);
- } finally {
- Platform.getJobManager().endRule(rule);
- }
-
- }
- });
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } catch (InterruptedException e) {
- // Canceled
- return;
- }
- }
- } catch (CVSException e) {
- CVSUIPlugin.openError(view.getShell(), null, null, e, CVSUIPlugin.PERFORM_SYNC_EXEC | CVSUIPlugin.LOG_TEAM_EXCEPTIONS | CVSUIPlugin.LOG_NONTEAM_EXCEPTIONS);
- }
- }
- }
-
- protected boolean updateSelection(IStructuredSelection selection) {
- this.selection = selection;
- ICVSRepositoryLocation[] roots = getSelectedRemoteRoots();
- boolean b = roots.length > 0;
- setEnabled(b);
- return b;
- }
-
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesView.java
deleted file mode 100644
index 8735040af..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesView.java
+++ /dev/null
@@ -1,327 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-
-import java.util.Properties;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.IRepositoryListener;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.WorkbenchUserAuthenticator;
-import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
-import org.eclipse.team.internal.ccvs.ui.model.AllRootsElement;
-import org.eclipse.team.internal.ccvs.ui.wizards.NewLocationWizard;
-import org.eclipse.team.internal.core.TeamPlugin;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.dialogs.PropertyDialogAction;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * RepositoriesView is a view on a set of known CVS repositories
- * which allows navigation of the structure of the repository and
- * the performing of CVS-specific operations on the repository contents.
- */
-public class RepositoriesView extends RemoteViewPart {
- public static final String VIEW_ID = "org.eclipse.team.ccvs.ui.RepositoriesView"; //$NON-NLS-1$
-
- // The root
- private AllRootsElement root;
-
- // Actions
- private IAction removeAction;
- private Action newAction;
- private Action newAnonAction;
- private PropertyDialogAction propertiesAction;
- private RemoveRootAction removeRootAction;
- private RemoveDateTagAction removeDateTagAction;
-
- IRepositoryListener listener = new IRepositoryListener() {
- public void repositoryAdded(final ICVSRepositoryLocation root) {
- getViewer().getControl().getDisplay().asyncExec(new Runnable() {
- public void run() {
- refreshViewer();
- getViewer().setSelection(new StructuredSelection(root));
- }
- });
- }
- public void repositoryRemoved(ICVSRepositoryLocation root) {
- refresh();
- }
- public void repositoriesChanged(ICVSRepositoryLocation[] roots) {
- refresh();
- }
- private void refresh() {
- Display display = getViewer().getControl().getDisplay();
- display.asyncExec(new Runnable() {
- public void run() {
- RepositoriesView.this.refreshViewer();
- }
- });
- }
- };
-
- /**
- * Constructor for RepositoriesView.
- * @param partName
- */
- public RepositoriesView() {
- super(VIEW_ID);
- }
-
- /**
- * Contribute actions to the view
- */
- protected void contributeActions() {
-
- final Shell shell = getShell();
-
- // Create actions
-
- // New Repository (popup)
- newAction = new Action(Policy.bind("RepositoriesView.new"), CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_NEWLOCATION)) { //$NON-NLS-1$
- public void run() {
- NewLocationWizard wizard = new NewLocationWizard();
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.open();
- }
- };
- WorkbenchHelp.setHelp(newAction, IHelpContextIds.NEW_REPOSITORY_LOCATION_ACTION);
-
- if (includeAnonConnection()) {
- newAnonAction = new Action(Policy.bind("RepositoriesView.newAnonCVS"), CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_NEWLOCATION)) { //$NON-NLS-1$
- public void run() {
- Properties p = new Properties();
- p.setProperty("connection", "pserver"); //$NON-NLS-1$ //$NON-NLS-2$
- p.setProperty("user", "anonymous"); //$NON-NLS-1$ //$NON-NLS-2$
- p.setProperty("host", "dev.eclipse.org"); //$NON-NLS-1$ //$NON-NLS-2$
- p.setProperty("root", "/home/eclipse"); //$NON-NLS-1$ //$NON-NLS-2$
- NewLocationWizard wizard = new NewLocationWizard(p);
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.open();
- }
- };
- WorkbenchHelp.setHelp(newAnonAction, IHelpContextIds.NEW_DEV_ECLIPSE_REPOSITORY_LOCATION_ACTION);
- }
-
- // Properties
- propertiesAction = new PropertyDialogAction(shell, getViewer());
- getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.PROPERTIES.getId(), propertiesAction);
- IStructuredSelection selection = (IStructuredSelection)getViewer().getSelection();
- if (selection.size() == 1 && selection.getFirstElement() instanceof RepositoryRoot) {
- propertiesAction.setEnabled(true);
- } else {
- propertiesAction.setEnabled(false);
- }
- getViewer().addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection ss = (IStructuredSelection)event.getSelection();
- boolean enabled = ss.size() == 1 && ss.getFirstElement() instanceof RepositoryRoot;
- propertiesAction.setEnabled(enabled);
- }
- });
- removeRootAction = new RemoveRootAction(viewer.getControl().getShell(), this);
- removeRootAction.selectionChanged((IStructuredSelection)null);
- removeDateTagAction = new RemoveDateTagAction();
- removeDateTagAction.selectionChanged( (IStructuredSelection)null);
- removeAction = new Action(){
- public void run(){
- if(removeRootAction.isEnabled()){
- removeRootAction.run();
- }
- if(removeDateTagAction.isEnabled()){
- removeDateTagAction.run();
- }
- }
- };
- WorkbenchHelp.setHelp(removeRootAction, IHelpContextIds.REMOVE_REPOSITORY_LOCATION_ACTION);
- IActionBars bars = getViewSite().getActionBars();
- bars.setGlobalActionHandler(ActionFactory.DELETE.getId(), removeAction);
-
- super.contributeActions();
- }
-
- /**
- * Method includeEclipseConnection.
- * @return boolean
- */
- private boolean includeAnonConnection() {
- return System.getProperty("eclipse.cvs.anon") != null; //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.repo.RemoteViewPart#addWorkbenchActions(org.eclipse.jface.action.IMenuManager)
- */
- protected void addWorkbenchActions(IMenuManager manager) {
- // New actions go next
- MenuManager sub = new MenuManager(Policy.bind("RepositoriesView.newSubmenu"), IWorkbenchActionConstants.GROUP_ADD); //$NON-NLS-1$
- manager.add(sub);
- super.addWorkbenchActions(manager);
- IStructuredSelection selection = (IStructuredSelection)getViewer().getSelection();
-
- removeRootAction.selectionChanged(selection);
- removeDateTagAction.selectionChanged(selection);
- if(removeRootAction.isEnabled()) {
- manager.add(removeRootAction);
- }
- if(removeDateTagAction.isEnabled()){
- manager.add(removeDateTagAction);
- }
- if (selection.size() == 1 && selection.getFirstElement() instanceof RepositoryRoot) {
- manager.add(new Separator());
- manager.add(propertiesAction);
- }
- sub.add(newAction);
- if (newAnonAction != null)
- sub.add(newAnonAction);
- sub.add(new Separator("group1")); //$NON-NLS-1$
- }
-
- /*
- * @see WorkbenchPart#createPartControl
- */
- public void createPartControl(Composite parent) {
- super.createPartControl(parent);
- CVSUIPlugin.getPlugin().getRepositoryManager().addRepositoryListener(listener);
- }
-
- /*
- * @see WorkbenchPart#dispose
- */
- public void dispose() {
- CVSUIPlugin.getPlugin().getRepositoryManager().removeRepositoryListener(listener);
- super.dispose();
- }
-
- /**
- * Initialize the repositories and actions
- */
- private void initialize() {
- root = new AllRootsElement();
- }
-
- protected void initializeListeners() {
- super.initializeListeners();
- viewer.addSelectionChangedListener(removeRootAction);
- viewer.addSelectionChangedListener(removeDateTagAction);
- viewer.addSelectionChangedListener(new ISelectionChangedListener(){
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection)event.getSelection();
- handleChange(selection);
- }
- });
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.repo.RemoteViewPart#getTreeInput()
- */
- protected Object getTreeInput() {
- initialize();
- return root;
- }
-
- /**
- * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- String msg = getStatusLineMessage(selection);
- getViewSite().getActionBars().getStatusLineManager().setMessage(msg);
- }
-
- private String getStatusLineMessage(ISelection selection) {
- if (selection==null || selection.isEmpty()) return ""; //$NON-NLS-1$
- if (!(selection instanceof IStructuredSelection)) return ""; //$NON-NLS-1$
- IStructuredSelection s = (IStructuredSelection)selection;
-
- if (s.size() > 1) return Policy.bind("RepositoriesView.NItemsSelected", String.valueOf(s.size())); //$NON-NLS-1$
- Object element = CVSAction.getAdapter(s.getFirstElement(), ICVSResource.class);
- if (element instanceof ICVSRemoteResource) {
- ICVSRemoteResource res = (ICVSRemoteResource)element;
- String name;
- if (res.isContainer()) {
- name = res.getRepositoryRelativePath();
- } else {
- try {
- name = res.getRepositoryRelativePath() + " " + ((ICVSRemoteFile)res).getRevision(); //$NON-NLS-1$
- } catch (TeamException e) {
- TeamPlugin.log(IStatus.ERROR, Policy.bind("RepositoriesView.CannotGetRevision"), e); //$NON-NLS-1$
- name = res.getRepositoryRelativePath();
- }
- }
- return Policy.bind("RepositoriesView.ResourceInRepository", name, res.getRepository().getLocation()); //$NON-NLS-1$
- }
- return Policy.bind("RepositoriesView.OneItemSelected"); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.repo.RemoteViewPart#getHelpContextId()
- */
- protected String getHelpContextId() {
- return IHelpContextIds.REPOSITORIES_VIEW;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.repo.RemoteViewPart#getKeyListener()
- */
- protected KeyAdapter getKeyListener() {
- return new KeyAdapter() {
- public void keyPressed(KeyEvent event) {
- if (event.keyCode == SWT.F5) {
- if (WorkbenchUserAuthenticator.USE_ALTERNATE_PROMPTER) {
- ICVSRepositoryLocation[] locations = KnownRepositories.getInstance().getRepositories();
- for (int i = 0; i < locations.length; i++) {
- locations[i].flushUserInfo();
- }
- } else {
- refreshAll();
- }
- } else if (event.keyCode == SWT.F9 && WorkbenchUserAuthenticator.USE_ALTERNATE_PROMPTER) {
- refreshAll();
- }
- }
- };
- }
-
- private void handleChange(IStructuredSelection selection){
- removeRootAction.updateSelection(selection);
- removeDateTagAction.updateSelection(selection);
- removeAction.setEnabled(removeRootAction.isEnabled() || removeDateTagAction.isEnabled());
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesViewContentHandler.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesViewContentHandler.java
deleted file mode 100644
index 2b78cedc9..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesViewContentHandler.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.util.*;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.xml.sax.*;
-import org.xml.sax.helpers.DefaultHandler;
-
-public class RepositoriesViewContentHandler extends DefaultHandler {
-
- public static final String REPOSITORIES_VIEW_TAG = "repositories-view"; //$NON-NLS-1$
-
- public static final String REPOSITORY_TAG = "repository"; //$NON-NLS-1$
- public static final String WORKING_SET_TAG = "working-set"; //$NON-NLS-1$
- public static final String CURRENT_WORKING_SET_TAG = "current-working-set"; //$NON-NLS-1$
- public static final String MODULE_TAG = "module"; //$NON-NLS-1$
- public static final String TAG_TAG = "tag"; //$NON-NLS-1$
- public static final String AUTO_REFRESH_FILE_TAG = "auto-refresh-file"; //$NON-NLS-1$
- public static final String DATE_TAGS_TAG = "date-tags"; //$NON-NLS-1$
- public static final String DATE_TAG_TAG = "date-tag"; //$NON-NLS-1$
-
- public static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$
- public static final String NAME_ATTRIBUTE = "name"; //$NON-NLS-1$
- public static final String PATH_ATTRIBUTE = "path"; //$NON-NLS-1$
- public static final String FULL_PATH_ATTRIBUTE = "full-path"; //$NON-NLS-1$
- public static final String TYPE_ATTRIBUTE = "type"; //$NON-NLS-1$
- public static final String READ_ID_ATTRIBUTE = "read-id"; //$NON-NLS-1$
- public static final String WRITE_ID_ATTRIBUTE = "write-id"; //$NON-NLS-1$
- public static final String LAST_ACCESS_TIME_ATTRIBUTE = "lastAcessTime"; //$NON-NLS-1$
-
- public static final String[] TAG_TYPES = {"head", "branch", "version", "date"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- public static final String DEFAULT_TAG_TYPE = "version"; //$NON-NLS-1$
- public static final String DEFINED_MODULE_TYPE = "defined"; //$NON-NLS-1$
-
- private RepositoryManager manager;
- private StringBuffer buffer = new StringBuffer();
- private Stack tagStack = new Stack();
- private RepositoryRoot currentRepositoryRoot;
- private String currentRemotePath;
- private List tags;
- private List dateTags;
- private List autoRefreshFiles;
- private boolean ignoreElements;
-
- private long lastAccessTime;
-
- public RepositoriesViewContentHandler(RepositoryManager manager) {
- this.manager = manager;
- }
-
- /**
- * @see ContentHandler#characters(char[], int, int)
- */
- public void characters(char[] chars, int startIndex, int length) throws SAXException {
- buffer.append(chars, startIndex, length);
- }
-
- /**
- * @see ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
- */
- public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
-
- String elementName = getElementName(namespaceURI, localName, qName);
- if (!elementName.equals(tagStack.peek())) {
- throw new SAXException(Policy.bind("RepositoriesViewContentHandler.unmatchedTag", elementName)); //$NON-NLS-1$
- }
-
- if (elementName.equals(REPOSITORIES_VIEW_TAG)) {
- // all done
- } else if (elementName.equals(REPOSITORY_TAG)) {
- if (!ignoreElements) {
- manager.add(currentRepositoryRoot);
- }
- currentRepositoryRoot = null;
- } else if (elementName.equals(WORKING_SET_TAG)) {
- // This tag is no longer used
- ignoreElements = false;
- } else if (elementName.equals(CURRENT_WORKING_SET_TAG)) {
- // This tag is no longer used
- ignoreElements = false;
- } else if (elementName.equals(MODULE_TAG)) {
- if (! ignoreElements && currentRepositoryRoot != null) {
- currentRepositoryRoot.addTags(currentRemotePath,
- (CVSTag[]) tags.toArray(new CVSTag[tags.size()]));
- if (lastAccessTime > 0)
- currentRepositoryRoot.setLastAccessedTime(currentRemotePath, lastAccessTime);
- currentRepositoryRoot.setAutoRefreshFiles(currentRemotePath,
- (String[]) autoRefreshFiles.toArray(new String[autoRefreshFiles.size()]));
- }
- }else if(elementName.equals(DATE_TAG_TAG)){
- if (! ignoreElements && currentRepositoryRoot != null) {
- Iterator iter = dateTags.iterator();
- while(iter.hasNext()){
- CVSTag tag = (CVSTag)iter.next();
- currentRepositoryRoot.addDateTag(tag);
- }
- }
- }
- tagStack.pop();
- }
-
- /**
- * @see ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
- */
- public void startElement(
- String namespaceURI,
- String localName,
- String qName,
- Attributes atts)
- throws SAXException {
-
- String elementName = getElementName(namespaceURI, localName, qName);
- if (elementName.equals(REPOSITORIES_VIEW_TAG)) {
- // just started
- } else if (elementName.equals(REPOSITORY_TAG)) {
- String id = atts.getValue(ID_ATTRIBUTE);
- if (id == null) {
- throw new SAXException(Policy.bind("RepositoriesViewContentHandler.missingAttribute", REPOSITORY_TAG, ID_ATTRIBUTE)); //$NON-NLS-1$
- }
- ICVSRepositoryLocation root;
- try {
- root = KnownRepositories.getInstance().getRepository(id);
- if (!KnownRepositories.getInstance().isKnownRepository(id)) {
- KnownRepositories.getInstance().addRepository(root, false);
- }
- } catch (CVSException e) {
- throw new SAXException(Policy.bind("RepositoriesViewContentHandler.errorCreatingRoot", id), e); //$NON-NLS-1$
- }
- currentRepositoryRoot = new RepositoryRoot(root);
- String name = atts.getValue(NAME_ATTRIBUTE);
- if (name != null) {
- currentRepositoryRoot.setName(name);
- }
- } else if(elementName.equals(DATE_TAGS_TAG)){
- //prepare to collect date tag
- dateTags = new ArrayList();
- } else if (elementName.equals(DATE_TAG_TAG)){
- String name = atts.getValue(NAME_ATTRIBUTE);
- if (name == null) {
- throw new SAXException(Policy.bind("RepositoriesViewContentHandler.missingAttribute", DATE_TAGS_TAG, NAME_ATTRIBUTE)); //$NON-NLS-1$
- }
- dateTags.add(new CVSTag(name, CVSTag.DATE));
- }else if (elementName.equals(WORKING_SET_TAG)) {
- String name = atts.getValue(NAME_ATTRIBUTE);
- if (name == null) {
- throw new SAXException(Policy.bind("RepositoriesViewContentHandler.missingAttribute", WORKING_SET_TAG, NAME_ATTRIBUTE)); //$NON-NLS-1$
- }
- // Ignore any elements until the corresponding end tag is reached
- ignoreElements = true;
- } else if (elementName.equals(MODULE_TAG)) {
- String path = atts.getValue(PATH_ATTRIBUTE);
- if (path == null) {
- throw new SAXException(Policy.bind("RepositoriesViewContentHandler.missingAttribute", MODULE_TAG, PATH_ATTRIBUTE)); //$NON-NLS-1$
- }
- String type = atts.getValue(TYPE_ATTRIBUTE);
- if (type != null && type.equals(DEFINED_MODULE_TYPE)) {
- path = RepositoryRoot.asDefinedModulePath(path);
- }
- long cachedTime = 0;
- String cachedTimeString = atts.getValue(LAST_ACCESS_TIME_ATTRIBUTE);
- if (cachedTimeString != null) {
- try {
- Long time = Long.valueOf(cachedTimeString);
- cachedTime = time.longValue();
- } catch (NumberFormatException e) {
- // Ignore
- }
- }
- startModule(path, cachedTime);
- } else if (elementName.equals(TAG_TAG)) {
- String type = atts.getValue(TYPE_ATTRIBUTE);
- if (type == null) {
- type = DEFAULT_TAG_TYPE;
- }
- String name = atts.getValue(NAME_ATTRIBUTE);
- if (name == null) {
- throw new SAXException(Policy.bind("RepositoriesViewContentHandler.missingAttribute", TAG_TAG, NAME_ATTRIBUTE)); //$NON-NLS-1$
- }
- tags.add(new CVSTag(name, getCVSTagType(type)));
- } else if (elementName.equals(AUTO_REFRESH_FILE_TAG)) {
- String path = atts.getValue(FULL_PATH_ATTRIBUTE);
- if (path == null) {
- // get the old path attribute format which was relative to the module
- path = atts.getValue(PATH_ATTRIBUTE);
- if (path == null) {
- throw new SAXException(Policy.bind("RepositoriesViewContentHandler.missingAttribute", AUTO_REFRESH_FILE_TAG, FULL_PATH_ATTRIBUTE)); //$NON-NLS-1$
- }
- if (RepositoryRoot.isDefinedModuleName(currentRemotePath)) {
- path = null;
- } else {
- path = new Path(null, currentRemotePath).append(path).toString();
- }
- }
- if (path != null) autoRefreshFiles.add(path);
- } else if (elementName.equals(CURRENT_WORKING_SET_TAG)) {
- // Ignore any elements until the corresponding end tag is reached
- ignoreElements = true;
- }
- // empty buffer
- buffer = new StringBuffer();
- tagStack.push(elementName);
- }
-
- private void startModule(String path, long cachedTime) {
- currentRemotePath = path;
- tags = new ArrayList();
- this.lastAccessTime = cachedTime;
- autoRefreshFiles = new ArrayList();
- }
-
- /**
- * Method getCVSTagType.
- * @param type
- */
- public int getCVSTagType(String type) {
- for (int i = 0; i < TAG_TYPES.length; i++) {
- if (TAG_TYPES[i].equals(type))
- return i;
- }
- return CVSTag.VERSION;
- }
-
- /*
- * Couldn't figure out from the SAX API exactly when localName vs. qName is used.
- * However, the XML for project sets doesn't use namespaces so either of the two names
- * is fine. Therefore, use whichever one is provided.
- */
- private String getElementName(String namespaceURI, String localName, String qName) {
- if (localName != null && localName.length() > 0) {
- return localName;
- } else {
- return qName;
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryEncodingPropertyPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryEncodingPropertyPage.java
deleted file mode 100644
index cc893bb7f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryEncodingPropertyPage.java
+++ /dev/null
@@ -1,419 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.CVSStatus;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.ui.dialogs.PropertyPage;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.ide.dialogs.EncodingFieldEditor;
-import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
-
-/**
- * Repository preference page for setting the encoding of the server
- */
-public class RepositoryEncodingPropertyPage extends PropertyPage implements IPropertyChangeListener {
-
- private static final int LABEL_WIDTH_HINT = 400;
-
- private EncodingFieldEditor encoding;
- private ICVSRepositoryLocation location;
-
- public class OSGIPreferenceStore implements IPreferenceStore {
- private Preferences preferences, defaults;
- private boolean dirty;
-
- /**
- * Create a wrapper for the given OSGI preferences node
- * @param preferences an OSGI preferences node
- */
- public OSGIPreferenceStore(Preferences preferences, Preferences defaults) {
- this.preferences = preferences;
- this.defaults = defaults;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#firePropertyChangeEvent(java.lang.String, java.lang.Object, java.lang.Object)
- */
- public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#contains(java.lang.String)
- */
- public boolean contains(String name) {
- try {
- String[] keys = preferences.keys();
- for (int i = 0; i < keys.length; i++) {
- String string = keys[i];
- if (string.equals(name)) {
- return true;
- }
- }
- return false;
- } catch (BackingStoreException e) {
- CVSUIPlugin.log(new CVSStatus(IStatus.ERROR, Policy.bind("internal"), e)); //$NON-NLS-1$
- return false;
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#getBoolean(java.lang.String)
- */
- public boolean getBoolean(String name) {
- return preferences.getBoolean(name, getDefaultBoolean(name));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultBoolean(java.lang.String)
- */
- public boolean getDefaultBoolean(String name) {
- if (defaults != null) {
- return defaults.getBoolean(name, false);
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultDouble(java.lang.String)
- */
- public double getDefaultDouble(String name) {
- if (defaults != null) {
- return defaults.getDouble(name, 0);
- }
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultFloat(java.lang.String)
- */
- public float getDefaultFloat(String name) {
- if (defaults != null) {
- return defaults.getFloat(name, 0);
- }
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultInt(java.lang.String)
- */
- public int getDefaultInt(String name) {
- if (defaults != null) {
- return defaults.getInt(name, 0);
- }
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultLong(java.lang.String)
- */
- public long getDefaultLong(String name) {
- if (defaults != null) {
- return defaults.getLong(name, 0);
- }
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultString(java.lang.String)
- */
- public String getDefaultString(String name) {
- if (defaults != null) {
- return defaults.get(name, null);
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#getDouble(java.lang.String)
- */
- public double getDouble(String name) {
- return preferences.getDouble(name, getDefaultDouble(name));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#getFloat(java.lang.String)
- */
- public float getFloat(String name) {
- return preferences.getFloat(name, getDefaultFloat(name));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#getInt(java.lang.String)
- */
- public int getInt(String name) {
- return preferences.getInt(name, getDefaultInt(name));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#getLong(java.lang.String)
- */
- public long getLong(String name) {
- return preferences.getLong(name, getDefaultLong(name));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#getString(java.lang.String)
- */
- public String getString(String name) {
- return preferences.get(name, getDefaultString(name));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#isDefault(java.lang.String)
- */
- public boolean isDefault(String name) {
- return !contains(name);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#needsSaving()
- */
- public boolean needsSaving() {
- return dirty;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#putValue(java.lang.String, java.lang.String)
- */
- public void putValue(String name, String value) {
- preferences.put(name, value);
- dirty = true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, double)
- */
- public void setDefault(String name, double value) {
- // Defaults cannot be set this way
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, float)
- */
- public void setDefault(String name, float value) {
- // Defaults cannot be set this way
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, int)
- */
- public void setDefault(String name, int value) {
- // Defaults cannot be set this way
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, long)
- */
- public void setDefault(String name, long value) {
- // Defaults cannot be set this way
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, java.lang.String)
- */
- public void setDefault(String name, String defaultObject) {
- // Defaults cannot be set this way
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String, boolean)
- */
- public void setDefault(String name, boolean value) {
- // Defaults cannot be set this way
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setToDefault(java.lang.String)
- */
- public void setToDefault(String name) {
- preferences.remove(name);
- dirty = true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, double)
- */
- public void setValue(String name, double value) {
- preferences.putDouble(name, value);
- dirty = true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, float)
- */
- public void setValue(String name, float value) {
- preferences.putFloat(name, value);
- dirty = true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, int)
- */
- public void setValue(String name, int value) {
- preferences.putInt(name, value);
- dirty = true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, long)
- */
- public void setValue(String name, long value) {
- preferences.putLong(name, value);
- dirty = true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, java.lang.String)
- */
- public void setValue(String name, String value) {
- putValue(name, value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String, boolean)
- */
- public void setValue(String name, boolean value) {
- preferences.putBoolean(name, value);
- dirty = true;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
- */
- protected Control createContents(Composite parent) {
- initialize();
-
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout layout = new GridLayout();
- composite.setLayout(layout);
-
- createWrappingLabel(composite, Policy.bind("RepositoryEncodingPropertyPage.2"), 1); //$NON-NLS-1$
-
- encoding = new EncodingFieldEditor(CVSRepositoryLocation.PREF_SERVER_ENCODING, Policy.bind("RepositoryEncodingPropertyPage.3"), composite); //$NON-NLS-1$
- encoding.setPreferencePage(this);
- encoding.setPreferenceStore(getLocationPreferenceStore());
- encoding.load();
- encoding.setPropertyChangeListener(this);
-
- createWrappingLabel(composite, Policy.bind("RepositoryEncodingPropertyPage.4"), 1); //$NON-NLS-1$
-
- WorkbenchHelp.setHelp(getControl(), IHelpContextIds.REPOSITORY_ENCODING_PROPERTY_PAGE);
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- private IPreferenceStore getLocationPreferenceStore() {
- return new OSGIPreferenceStore(
- ((CVSRepositoryLocation)location).getPreferences(),
- CVSRepositoryLocation.getDefaultPreferences());
- }
-
- private void initialize() {
- location = null;
- IAdaptable element = getElement();
- if (element instanceof ICVSRepositoryLocation) {
- location = (ICVSRepositoryLocation)element;
- } else {
- Object adapter = element.getAdapter(ICVSRepositoryLocation.class);
- if (adapter instanceof ICVSRepositoryLocation) {
- location = (ICVSRepositoryLocation)adapter;
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty() == FieldEditor.IS_VALID) {
- setValid(((Boolean)event.getNewValue()).booleanValue());
- return;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferencePage#performOk()
- */
- public boolean performOk() {
- if (!KnownRepositories.getInstance().isKnownRepository(location.getLocation())) {
- // The location may have been replaced by the main properties page
- MessageDialog.openInformation(getShell(), Policy.bind("RepositoryEncodingPropertyPage.0"), Policy.bind("RepositoryEncodingPropertyPage.1", location.getLocation())); //$NON-NLS-1$ //$NON-NLS-2$
- return true;
- }
- encoding.store();
- try {
- ((CVSRepositoryLocation)location).getPreferences().flush();
- } catch (BackingStoreException e) {
- // Log and ignore
- CVSUIPlugin.log(new CVSStatus(IStatus.ERROR, Policy.bind("internal"), e)); //$NON-NLS-1$
- }
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
- */
- protected void performDefaults() {
- super.performDefaults();
- encoding.loadDefault();
- }
-
- private Label createWrappingLabel(Composite parent, String text, int horizontalSpan) {
- Label label = new Label(parent, SWT.LEFT | SWT.WRAP);
- label.setText(text);
- label.setFont(parent.getFont());
- GridData data = new GridData();
- data.horizontalSpan = horizontalSpan;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.widthHint = LABEL_WIDTH_HINT;
- label.setLayoutData(data);
- return label;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java
deleted file mode 100644
index 1e863e649..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java
+++ /dev/null
@@ -1,813 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-
-import java.io.*;
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-
-import javax.xml.parsers.*;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.IWorkingSet;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * This class is repsible for maintaining the UI's list of known repositories,
- * and a list of known tags within each of those repositories.
- *
- * It also provides a number of useful methods for assisting in repository operations.
- */
-public class RepositoryManager {
- // old state file
- private static final String STATE_FILE = ".repositoryManagerState"; //$NON-NLS-1$
- private static final int STATE_FILE_VERSION_1 = -1;
- // new state file
- private static final String REPOSITORIES_VIEW_FILE = "repositoriesView.xml"; //$NON-NLS-1$
- private static final String COMMENT_HIST_FILE = "commitCommentHistory.xml"; //$NON-NLS-1$
- static final String ELEMENT_COMMIT_COMMENT = "CommitComment"; //$NON-NLS-1$
- static final String ELEMENT_COMMIT_HISTORY = "CommitComments"; //$NON-NLS-1$
-
- private Map repositoryRoots = new HashMap();
-
- List listeners = new ArrayList();
-
- // The previously remembered comment
- static String[] previousComments = new String[0];
-
- public static boolean notifyRepoView = true;
-
- // Cache of changed repository roots
- private int notificationLevel = 0;
- private Map changedRepositories = new HashMap();
-
- static final int MAX_COMMENTS = 10;
-
- /**
- * Answer an array of all known remote roots.
- */
- public ICVSRepositoryLocation[] getKnownRepositoryLocations() {
- return KnownRepositories.getInstance().getRepositories();
- }
-
- /**
- * Method getRepositoryRoots.
- * @param iCVSRepositoryLocations
- * @return RepositoryRoot[]
- */
- private RepositoryRoot[] getRepositoryRoots(ICVSRepositoryLocation[] locations) {
- List roots = new ArrayList();
- for (int i = 0; i < locations.length; i++) {
- ICVSRepositoryLocation location = locations[i];
- RepositoryRoot root = getRepositoryRootFor(location);
- if (root != null)
- roots.add(root);
- }
- return (RepositoryRoot[]) roots.toArray(new RepositoryRoot[roots.size()]);
- }
-
- public RepositoryRoot[] getKnownRepositoryRoots() {
- return getRepositoryRoots(getKnownRepositoryLocations());
- }
-
- /**
- * Get the list of known branch tags for a given remote root.
- */
- public CVSTag[] getKnownTags(ICVSFolder project, int tagType) {
- try {
- CVSTag[] tags = getKnownTags(project);
- Set result = new HashSet();
- for (int i = 0; i < tags.length; i++) {
- CVSTag tag = tags[i];
- if (tag.getType() == tagType)
- result.add(tag);
- }
-
- return (CVSTag[])result.toArray(new CVSTag[result.size()]);
- } catch(CVSException e) {
- CVSUIPlugin.log(e);
- return new CVSTag[0];
- }
- }
-
- /**
- * Get the list of known version tags for a given project.
- */
- public CVSTag[] getKnownTags(ICVSRepositoryLocation location, int tagType) {
- Set result = new HashSet();
- RepositoryRoot root = (RepositoryRoot)repositoryRoots.get(location.getLocation());
- if (root != null) {
- String[] paths = root.getKnownRemotePaths();
- for (int i = 0; i < paths.length; i++) {
- String path = paths[i];
- CVSTag[] tags = root.getAllKnownTags(path);
- for (int j = 0; j < tags.length; j++) {
- CVSTag tag = tags[j];
- if (tag.getType() == tagType)
- result.add(tag);
- }
- }
- }
- return (CVSTag[])result.toArray(new CVSTag[0]);
- }
-
- /**
- * Method getKnownTags.
- * @param repository
- * @param set
- * @param i
- * @param monitor
- * @return CVSTag[]
- */
- public CVSTag[] getKnownTags(ICVSRepositoryLocation repository, IWorkingSet set, int tagType, IProgressMonitor monitor) throws CVSException {
- if (set == null) {
- return getKnownTags(repository, tagType);
- }
- ICVSRemoteResource[] folders = getFoldersForTag(repository, CVSTag.DEFAULT, monitor);
- folders = filterResources(set, folders);
- Set tags = new HashSet();
- for (int i = 0; i < folders.length; i++) {
- ICVSRemoteFolder folder = (ICVSRemoteFolder)folders[i];
- tags.addAll(Arrays.asList(getKnownTags(folder, tagType)));
- }
- return (CVSTag[]) tags.toArray(new CVSTag[tags.size()]);
- }
-
- public CVSTag[] getKnownTags(ICVSFolder project) throws CVSException {
- RepositoryRoot root = getRepositoryRootFor(project);
- String remotePath = RepositoryRoot.getRemotePathFor(project);
- return root.getAllKnownTags(remotePath);
- }
-
- /*
- * XXX I hope this methos is not needed in this form
- */
- public Map getKnownProjectsAndVersions(ICVSRepositoryLocation location) {
- Map knownTags = new HashMap();
- RepositoryRoot root = getRepositoryRootFor(location);
- String[] paths = root.getKnownRemotePaths();
- for (int i = 0; i < paths.length; i++) {
- String path = paths[i];
- Set result = new HashSet();
- result.addAll(Arrays.asList(root.getAllKnownTags(path)));
- knownTags.put(path, result);
- }
- return knownTags;
- }
-
- public ICVSRemoteResource[] getFoldersForTag(ICVSRepositoryLocation location, CVSTag tag, IProgressMonitor monitor) throws CVSException {
- monitor = Policy.monitorFor(monitor);
- try {
- monitor.beginTask(Policy.bind("RepositoryManager.fetchingRemoteFolders", tag.getName()), 100); //$NON-NLS-1$
- if (tag.getType() == CVSTag.HEAD) {
- ICVSRemoteResource[] resources = location.members(tag, false, Policy.subMonitorFor(monitor, 60));
- RepositoryRoot root = getRepositoryRootFor(location);
- ICVSRemoteResource[] modules = root.getDefinedModules(tag, Policy.subMonitorFor(monitor, 40));
- ICVSRemoteResource[] result = new ICVSRemoteResource[resources.length + modules.length];
- System.arraycopy(resources, 0, result, 0, resources.length);
- System.arraycopy(modules, 0, result, resources.length, modules.length);
- return result;
- }
- if (tag.getType() == CVSTag.DATE) {
- ICVSRemoteResource[] resources = location.members(tag, false, Policy.subMonitorFor(monitor, 60));
- RepositoryRoot root = getRepositoryRootFor(location);
- ICVSRemoteResource[] modules = root.getDefinedModules(tag, Policy.subMonitorFor(monitor, 40));
- ICVSRemoteResource[] result = new ICVSRemoteResource[resources.length + modules.length];
- System.arraycopy(resources, 0, result, 0, resources.length);
- System.arraycopy(modules, 0, result, resources.length, modules.length);
- return result;
- }
- Set result = new HashSet();
- // Get the tags for the location
- RepositoryRoot root = getRepositoryRootFor(location);
- String[] paths = root.getKnownRemotePaths();
- for (int i = 0; i < paths.length; i++) {
- String path = paths[i];
- List tags = Arrays.asList(root.getAllKnownTags(path));
- if (tags.contains(tag)) {
- ICVSRemoteFolder remote = root.getRemoteFolder(path, tag, Policy.subMonitorFor(monitor, 100));
- result.add(remote);
- }
- }
- return (ICVSRemoteResource[])result.toArray(new ICVSRemoteResource[result.size()]);
- } finally {
- monitor.done();
- }
- }
-
- /*
- * Fetches tags from auto-refresh files if they exist. Then fetches tags from the user defined auto-refresh file
- * list. The fetched tags are cached in the CVS ui plugin's tag cache.
- */
- public CVSTag[] refreshDefinedTags(ICVSFolder folder, boolean recurse, boolean notify, IProgressMonitor monitor) throws TeamException {
- RepositoryRoot root = getRepositoryRootFor(folder);
- CVSTag[] tags = root.refreshDefinedTags(folder, recurse, monitor);
- if (tags.length > 0 && notify)
- broadcastRepositoryChange(root);
- return tags;
- }
-
- /**
- * A repository root has been added. Notify any listeners.
- */
- public void rootAdded(ICVSRepositoryLocation root) {
- Iterator it = listeners.iterator();
- while (it.hasNext()) {
- IRepositoryListener listener = (IRepositoryListener)it.next();
- listener.repositoryAdded(root);
- }
- }
-
- /**
- * A repository root has been removed.
- * Remove the tags defined for this root and notify any listeners
- */
- public void rootRemoved(ICVSRepositoryLocation root) {
- RepositoryRoot repoRoot = (RepositoryRoot)repositoryRoots.remove(root.getLocation());
- if (repoRoot != null)
- broadcastRepositoryChange(repoRoot);
- }
-
- /**
- * Accept tags for any CVS resource. However, for the time being,
- * the given version tags are added to the list of known tags for the
- * remote ancestor of the resource that is a direct child of the remote root
- */
- public void addTags(ICVSResource resource, CVSTag[] tags) throws CVSException {
- RepositoryRoot root = getRepositoryRootFor(resource);
- // XXX could be a file or folder
- String remotePath = RepositoryRoot.getRemotePathFor(resource);
- root.addTags(remotePath, tags);
- broadcastRepositoryChange(root);
- }
- public void addDateTag(ICVSRepositoryLocation location, CVSTag tag) {
- if(tag == null) return;
- RepositoryRoot root = getRepositoryRootFor(location);
- root.addDateTag(tag);
- broadcastRepositoryChange(root);
- }
- public CVSTag[] getDateTags(ICVSRepositoryLocation location) {
- RepositoryRoot root = getRepositoryRootFor(location);
- return root.getDateTags();
- }
- public void removeDateTag(ICVSRepositoryLocation location, CVSTag tag){
- RepositoryRoot root = getRepositoryRootFor(location);
- root.removeDateTag(tag);
- broadcastRepositoryChange(root);
- }
- public void setAutoRefreshFiles(ICVSFolder project, String[] filePaths) throws CVSException {
- RepositoryRoot root = getRepositoryRootFor(project);
- String remotePath = RepositoryRoot.getRemotePathFor(project);
- root.setAutoRefreshFiles(remotePath, filePaths);
- }
-
- public void removeAutoRefreshFiles(ICVSFolder project, String[] relativeFilePaths) throws CVSException {
- RepositoryRoot root = getRepositoryRootFor(project);
- String remotePath = RepositoryRoot.getRemotePathFor(project);
- Set set = new HashSet();
- set.addAll(Arrays.asList(root.getAutoRefreshFiles(remotePath)));
- set.removeAll(Arrays.asList(relativeFilePaths));
- root.setAutoRefreshFiles(remotePath, (String[]) set.toArray(new String[set.size()]));
- }
-
- public String[] getAutoRefreshFiles(ICVSFolder project) throws CVSException {
- RepositoryRoot root = getRepositoryRootFor(project);
- String remotePath = RepositoryRoot.getRemotePathFor(project);
- return root.getAutoRefreshFiles(remotePath);
- }
-
- /**
- * Remove the given tags from the list of known tags for the
- * given remote root.
- */
- public void removeTags(ICVSFolder project, CVSTag[] tags) throws CVSException {
- RepositoryRoot root = getRepositoryRootFor(project);
- String remotePath = RepositoryRoot.getRemotePathFor(project);
- root.removeTags(remotePath, tags);
- broadcastRepositoryChange(root);
- }
-
- public void startup() {
- loadState();
- loadCommentHistory();
- CVSProviderPlugin.getPlugin().addRepositoryListener(new ICVSListener() {
- public void repositoryAdded(ICVSRepositoryLocation root) {
- rootAdded(root);
- }
- public void repositoryRemoved(ICVSRepositoryLocation root) {
- rootRemoved(root);
- }
- });
- }
-
- public void shutdown() throws TeamException {
- saveState();
- saveCommentHistory();
- }
-
- private void loadState() {
- IPath pluginStateLocation = CVSUIPlugin.getPlugin().getStateLocation().append(REPOSITORIES_VIEW_FILE);
- File file = pluginStateLocation.toFile();
- if (file.exists()) {
- try {
- BufferedInputStream is = new BufferedInputStream(new FileInputStream(file));
- try {
- readState(is);
- } finally {
- is.close();
- }
- } catch (IOException e) {
- CVSUIPlugin.log(Status.ERROR, Policy.bind("RepositoryManager.ioException"), e); //$NON-NLS-1$
- } catch (TeamException e) {
- CVSUIPlugin.log(e);
- }
- } else {
- IPath oldPluginStateLocation = CVSUIPlugin.getPlugin().getStateLocation().append(STATE_FILE);
- file = oldPluginStateLocation.toFile();
- if (file.exists()) {
- try {
- DataInputStream dis = new DataInputStream(new FileInputStream(file));
- try {
- readOldState(dis);
- } finally {
- dis.close();
- }
- saveState();
- file.delete();
- } catch (IOException e) {
- CVSUIPlugin.log(Status.ERROR, Policy.bind("RepositoryManager.ioException"), e); //$NON-NLS-1$
- } catch (TeamException e) {
- CVSUIPlugin.log(e);
- }
- }
- }
- }
- private void loadCommentHistory() {
- IPath pluginStateLocation = CVSUIPlugin.getPlugin().getStateLocation().append(COMMENT_HIST_FILE);
- File file = pluginStateLocation.toFile();
- if (!file.exists()) return;
- try {
- BufferedInputStream is = new BufferedInputStream(new FileInputStream(file));
- try {
- readCommentHistory(is);
- } finally {
- is.close();
- }
- } catch (IOException e) {
- CVSUIPlugin.log(Status.ERROR, Policy.bind("RepositoryManager.ioException"), e); //$NON-NLS-1$
- } catch (TeamException e) {
- CVSUIPlugin.log(e);
- }
- }
-
- protected void saveState() throws TeamException {
- IPath pluginStateLocation = CVSUIPlugin.getPlugin().getStateLocation();
- File tempFile = pluginStateLocation.append(REPOSITORIES_VIEW_FILE + ".tmp").toFile(); //$NON-NLS-1$
- File stateFile = pluginStateLocation.append(REPOSITORIES_VIEW_FILE).toFile();
- try {
- XMLWriter writer = new XMLWriter(new BufferedOutputStream(new FileOutputStream(tempFile)));
- try {
- writeState(writer);
- } finally {
- writer.close();
- }
- if (stateFile.exists()) {
- stateFile.delete();
- }
- boolean renamed = tempFile.renameTo(stateFile);
- if (!renamed) {
- throw new TeamException(new Status(Status.ERROR, CVSUIPlugin.ID, TeamException.UNABLE, Policy.bind("RepositoryManager.rename", tempFile.getAbsolutePath()), null)); //$NON-NLS-1$
- }
- } catch (IOException e) {
- throw new TeamException(new Status(Status.ERROR, CVSUIPlugin.ID, TeamException.UNABLE, Policy.bind("RepositoryManager.save",stateFile.getAbsolutePath()), e)); //$NON-NLS-1$
- }
- }
- private void writeState(XMLWriter writer) {
- writer.startTag(RepositoriesViewContentHandler.REPOSITORIES_VIEW_TAG, null, true);
- // Write the repositories
- Collection repos = Arrays.asList(getKnownRepositoryLocations());
- Iterator it = repos.iterator();
- while (it.hasNext()) {
- CVSRepositoryLocation location = (CVSRepositoryLocation)it.next();
- RepositoryRoot root = getRepositoryRootFor(location);
- root.writeState(writer);
- }
- writer.endTag(RepositoriesViewContentHandler.REPOSITORIES_VIEW_TAG);
- }
-
- private void readState(InputStream stream) throws IOException, TeamException {
- try {
- SAXParserFactory factory = SAXParserFactory.newInstance();
- SAXParser parser = factory.newSAXParser();
- parser.parse(new InputSource(stream), new RepositoriesViewContentHandler(this));
- } catch (SAXException ex) {
- throw new CVSException(Policy.bind("RepositoryManager.parsingProblem", REPOSITORIES_VIEW_FILE), ex); //$NON-NLS-1$
- } catch (ParserConfigurationException ex) {
- throw new CVSException(Policy.bind("RepositoryManager.parsingProblem", REPOSITORIES_VIEW_FILE), ex); //$NON-NLS-1$
- }
- }
- private void readCommentHistory(InputStream stream) throws IOException, TeamException {
- try {
- SAXParserFactory factory = SAXParserFactory.newInstance();
- SAXParser parser = factory.newSAXParser();
- parser.parse(new InputSource(stream), new CommentHistoryContentHandler());
- } catch (SAXException ex) {
- throw new CVSException(Policy.bind("RepositoryManager.parsingProblem", COMMENT_HIST_FILE), ex); //$NON-NLS-1$
- } catch (ParserConfigurationException ex) {
- throw new CVSException(Policy.bind("RepositoryManager.parsingProblem", COMMENT_HIST_FILE), ex); //$NON-NLS-1$
- }
- }
-
- private void readOldState(DataInputStream dis) throws IOException, TeamException {
- int repoSize = dis.readInt();
- boolean version1 = false;
- if (repoSize == STATE_FILE_VERSION_1) {
- version1 = true;
- repoSize = dis.readInt();
- }
- for (int i = 0; i < repoSize; i++) {
- ICVSRepositoryLocation root = KnownRepositories.getInstance().getRepository(dis.readUTF());
- RepositoryRoot repoRoot = getRepositoryRootFor(root);
-
- // read branch tags associated with this root
- int tagsSize = dis.readInt();
- CVSTag[] branchTags = new CVSTag[tagsSize];
- for (int j = 0; j < tagsSize; j++) {
- String tagName = dis.readUTF();
- int tagType = dis.readInt();
- branchTags[j] = new CVSTag(tagName, tagType);
- }
- // Ignore the branch tags since they are handled differently now
- // addBranchTags(root, branchTags);
-
- // read the number of projects for this root that have version tags
- int projSize = dis.readInt();
- if (projSize > 0) {
- for (int j = 0; j < projSize; j++) {
- String name = dis.readUTF();
- Set tagSet = new HashSet();
- int numTags = dis.readInt();
- for (int k = 0; k < numTags; k++) {
- tagSet.add(new CVSTag(dis.readUTF(), CVSTag.VERSION));
- }
- CVSTag[] tags = (CVSTag[]) tagSet.toArray(new CVSTag[tagSet.size()]);
- repoRoot.addTags(name, tags);
- }
- }
- // read the auto refresh filenames for this project
- if (version1) {
- try {
- projSize = dis.readInt();
- if (projSize > 0) {
- for (int j = 0; j < projSize; j++) {
- String name = dis.readUTF();
- Set filenames = new HashSet();
- int numFilenames = dis.readInt();
- for (int k = 0; k < numFilenames; k++) {
- filenames.add(name + "/" + dis.readUTF()); //$NON-NLS-1$
- }
- repoRoot.setAutoRefreshFiles(name, (String[]) filenames.toArray(new String[filenames.size()]));
- }
- }
- } catch (EOFException e) {
- // auto refresh files are not persisted, continue and save them next time.
- }
- }
- broadcastRepositoryChange(repoRoot);
- }
- }
-
- protected void saveCommentHistory() throws TeamException {
- IPath pluginStateLocation = CVSUIPlugin.getPlugin().getStateLocation();
- File tempFile = pluginStateLocation.append(COMMENT_HIST_FILE + ".tmp").toFile(); //$NON-NLS-1$
- File histFile = pluginStateLocation.append(COMMENT_HIST_FILE).toFile();
- try {
- XMLWriter writer = new XMLWriter(new BufferedOutputStream(new FileOutputStream(tempFile)));
- try {
- writeCommentHistory(writer);
- } finally {
- writer.close();
- }
- if (histFile.exists()) {
- histFile.delete();
- }
- boolean renamed = tempFile.renameTo(histFile);
- if (!renamed) {
- throw new TeamException(new Status(Status.ERROR, CVSUIPlugin.ID, TeamException.UNABLE, Policy.bind("RepositoryManager.rename", tempFile.getAbsolutePath()), null)); //$NON-NLS-1$
- }
- } catch (IOException e) {
- throw new TeamException(new Status(Status.ERROR, CVSUIPlugin.ID, TeamException.UNABLE, Policy.bind("RepositoryManager.save",histFile.getAbsolutePath()), e)); //$NON-NLS-1$
- }
- }
- private void writeCommentHistory(XMLWriter writer) {
- writer.startTag(ELEMENT_COMMIT_HISTORY, null, false);
- for (int i=0; i<previousComments.length && i<MAX_COMMENTS; i++)
- writer.printSimpleTag(ELEMENT_COMMIT_COMMENT, previousComments[i]);
- writer.endTag(ELEMENT_COMMIT_HISTORY);
- }
-
- public void addRepositoryListener(IRepositoryListener listener) {
- listeners.add(listener);
- }
-
- public void removeRepositoryListener(IRepositoryListener listener) {
- listeners.remove(listener);
- }
-
- /**
- * Return the entered comment or null if canceled.
- * @param proposedComment
- */
- public String promptForComment(final Shell shell, IResource[] resourcesToCommit, String proposedComment) {
- final int[] result = new int[1];
- final ReleaseCommentDialog dialog = new ReleaseCommentDialog(shell, resourcesToCommit, proposedComment, IResource.DEPTH_INFINITE);
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- result[0] = dialog.open();
- if (result[0] != ReleaseCommentDialog.OK) return;
- }
- });
- if (result[0] != ReleaseCommentDialog.OK) return null;
- return dialog.getComment();
- }
-
- /**
- * Prompt to add all or some of the provided resources to version control.
- * The value null is returned if the dialog is cancelled.
- *
- * @param shell
- * @param unadded
- * @return IResource[]
- */
- public IResource[] promptForResourcesToBeAdded(Shell shell, IResource[] unadded) {
- if (unadded == null) return new IResource[0];
- if (unadded.length == 0) return unadded;
- final IResource[][] result = new IResource[1][0];
- result[0] = null;
- final AddToVersionControlDialog dialog = new AddToVersionControlDialog(shell, unadded);
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- int code = dialog.open();
- if (code == IDialogConstants.YES_ID) {
- result[0] = dialog.getResourcesToAdd();
- } else if(code == IDialogConstants.NO_ID) {
- // allow the commit to continue.
- result[0] = new IResource[0];
- }
- }
- });
- return result[0];
- }
-
- public ICVSRepositoryLocation getRepositoryLocationFor(ICVSResource resource) {
- try {
- return internalGetRepositoryLocationFor(resource);
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- return null;
- }
- }
-
- private ICVSRepositoryLocation internalGetRepositoryLocationFor(ICVSResource resource) throws CVSException {
- ICVSFolder folder;
- if (resource.isFolder()) {
- folder = (ICVSFolder)resource;
- } else {
- folder = resource.getParent();
- }
- if (folder.isCVSFolder()) {
- ICVSRepositoryLocation location = KnownRepositories.getInstance().getRepository(folder.getFolderSyncInfo().getRoot());
- return location;
- }
- // XXX This is asking for trouble
- return null;
- }
-
- private RepositoryRoot getRepositoryRootFor(ICVSResource resource) throws CVSException {
- ICVSRepositoryLocation location = internalGetRepositoryLocationFor(resource);
- if (location == null) return null;
- return getRepositoryRootFor(location);
- }
-
- public RepositoryRoot getRepositoryRootFor(ICVSRepositoryLocation location) {
- RepositoryRoot root = (RepositoryRoot)repositoryRoots.get(location.getLocation());
- if (root == null) {
- root = new RepositoryRoot(location);
- add(root);
- }
- return root;
- }
-
- /**
- * Add the given repository root to the receiver. The provided instance of RepositoryRoot
- * is used to provide extra information about the repository location
- *
- * @param currentRepositoryRoot
- */
- public void add(RepositoryRoot root) {
- repositoryRoots.put(root.getRoot().getLocation(), root);
- broadcastRepositoryChange(root);
- }
-
- private void broadcastRepositoryChange(RepositoryRoot root) {
- if (notificationLevel == 0) {
- broadcastRepositoriesChanged(new ICVSRepositoryLocation[] {root.getRoot()});
- } else {
- changedRepositories.put(root.getRoot().getLocation(), root.getRoot());
- }
- }
-
- private void broadcastRepositoriesChanged(ICVSRepositoryLocation[] roots) {
- if (roots.length == 0) return;
- Iterator it = listeners.iterator();
- while (it.hasNext()) {
- IRepositoryListener listener = (IRepositoryListener)it.next();
- listener.repositoriesChanged(roots);
- }
- }
-
- /**
- * Run the given runnable, waiting until the end to perform a refresh
- *
- * @param runnable
- * @param monitor
- */
- public void run(IRunnableWithProgress runnable, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- notificationLevel++;
- runnable.run(monitor);
- } finally {
- notificationLevel = Math.max(0, notificationLevel - 1);
- if (notificationLevel == 0) {
- try {
- Collection roots = changedRepositories.values();
- broadcastRepositoriesChanged((ICVSRepositoryLocation[]) roots.toArray(new ICVSRepositoryLocation[roots.size()]));
- } finally {
- changedRepositories.clear();
- }
- }
- }
- }
-
- /**
- * Method isDisplayingProjectVersions.
- * @param repository
- * @return boolean
- */
- public boolean isDisplayingProjectVersions(ICVSRepositoryLocation repository) {
- return true;
- }
-
- /**
- * Method filterResources filters the given resources using the given
- * working set.
- *
- * @param current
- * @param resources
- * @return ICVSRemoteResource[]
- */
- public ICVSRemoteResource[] filterResources(IWorkingSet workingSet, ICVSRemoteResource[] resources) {
- if (workingSet == null) return resources;
- // get the projects associated with the working set
- IAdaptable[] adaptables = workingSet.getElements();
- Set projects = new HashSet();
- for (int i = 0; i < adaptables.length; i++) {
- IAdaptable adaptable = adaptables[i];
- Object adapted = adaptable.getAdapter(IResource.class);
- if (adapted != null) {
- // Can this code be generalized?
- IProject project = ((IResource)adapted).getProject();
- projects.add(project);
- }
- }
- List result = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- ICVSRemoteResource resource = resources[i];
- for (Iterator iter = projects.iterator(); iter.hasNext();) {
- IProject project = (IProject) iter.next();
- if (project.getName().equals(resource.getName())) {
- result.add(resource);
- break;
- }
- }
- }
- return (ICVSRemoteResource[]) result.toArray(new ICVSRemoteResource[result.size()]);
- }
-
- /**
- * Method setLabel.
- * @param location
- * @param label
- */
- public void setLabel(CVSRepositoryLocation location, String label) {
- RepositoryRoot root = getRepositoryRootFor(location);
- String oldLabel = root.getName();
- if (oldLabel == null) {
- if (label == null) return;
- root.setName(label);
- } else if (label == null) {
- root.setName(label);
- } else if (label.equals(oldLabel)) {
- return;
- } else {
- root.setName(label);
- }
- broadcastRepositoryChange(root);
- }
-
- /**
- * Replace the old repository location with the new one assuming that they
- * are the same location with different authentication informations
- * @param location
- * @param newLocation
- */
- public void replaceRepositoryLocation(
- final ICVSRepositoryLocation oldLocation,
- final CVSRepositoryLocation newLocation) {
-
- try {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- RepositoryRoot root = getRepositoryRootFor(oldLocation);
- // Disposing of the old location will result in the deletion of the
- // cached root through a listener callback
- KnownRepositories.getInstance().disposeRepository(oldLocation);
-
- // Get the new location from the CVS plugin to ensure we use the
- // instance that will be returned by future calls to getRepository()
- boolean isNew = !KnownRepositories.getInstance().isKnownRepository(newLocation.getLocation());
- root.setRepositoryLocation(
- KnownRepositories.getInstance().addRepository(newLocation, isNew /* broadcast */));
- add(root);
- }
- }, Policy.monitorFor(null));
- } catch (InvocationTargetException e) {
- CVSException.wrapException(e);
- } catch (InterruptedException e) {
- }
- }
-
- /**
- * Purge any cahced information.
- */
- public void purgeCache() {
- for (Iterator iter = repositoryRoots.values().iterator(); iter.hasNext();) {
- RepositoryRoot root = (RepositoryRoot) iter.next();
- root.clearCache();
- }
- }
-
- /**
- * Answer the list of comments that were previously used when committing.
- * @return String[]
- */
- public String[] getPreviousComments() {
- return previousComments;
- }
-
- /**
- * Method addComment.
- * @param string
- */
- public void addComment(String comment) {
- // Only add the comment if its not there already
- if (containsComment(comment)) return;
- // Insert the comment as the first element
- String[] newComments = new String[Math.min(previousComments.length + 1, MAX_COMMENTS)];
- newComments[0] = comment;
- for (int i = 1; i < newComments.length; i++) {
- newComments[i] = previousComments[i-1];
- }
- previousComments = newComments;
- }
-
- private boolean containsComment(String comment) {
- for (int i = 0; i < previousComments.length; i++) {
- if (previousComments[i].equals(comment)) {
- return true;
- }
- }
- return false;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java
deleted file mode 100644
index 01590969b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java
+++ /dev/null
@@ -1,633 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation;
-import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation.LogEntryCache;
-
-public class RepositoryRoot extends PlatformObject {
-
- public static final String[] DEFAULT_AUTO_REFRESH_FILES = { ".project" }; //$NON-NLS-1$ //$NON-NLS-2$
- private static final String DEFINED_MODULE_PREFIX = "module:"; //$NON-NLS-1$
-
- ICVSRepositoryLocation root;
- String name;
- // Map of String (remote folder path) -> TagCacheEntry
- Map versionAndBranchTags = new HashMap();
- // Map of String (remote folder path) -> Set (file paths that are project relative)
- Map autoRefreshFiles = new HashMap();
- // Map of String (module name) -> ICVSRemoteFolder (that is a defined module)
- Map modulesCache;
- Object modulesCacheLock = new Object();
- // Lis of date tags
- List dateTags = new ArrayList();
-
- public static class TagCacheEntry {
- Set tags = new HashSet();
- long lastAccessTime;
- private static final int CACHE_LIFESPAN_IN_DAYS = 7;
- public TagCacheEntry() {
- accessed();
- }
- public boolean isExpired() {
- long currentTime = System.currentTimeMillis();
- long ms = currentTime - lastAccessTime;
- int seconds = (int)ms / 1000;
- int hours = seconds / 60 / 60;
- int days = hours / 24;
- return days > CACHE_LIFESPAN_IN_DAYS;
- }
- public void accessed() {
- lastAccessTime = System.currentTimeMillis();
- }
- }
-
- public RepositoryRoot(ICVSRepositoryLocation root) {
- this.root = root;
- }
-
- /**
- * Returns the name.
- * @return String
- */
- public String getName() {
- return name;
- }
-
- /**
- * Method getRemoteFolder.
- * @param path
- * @param tag
- * @return ICVSRemoteFolder
- */
- public ICVSRemoteFolder getRemoteFolder(String path, CVSTag tag, IProgressMonitor monitor) {
- if (isDefinedModuleName(path)) {
- return getDefinedModule(getDefinedModuleName(path), tag, monitor);
- } else {
- return root.getRemoteFolder(path, tag);
- }
- }
-
- static boolean isDefinedModuleName(String path) {
- return path.startsWith(DEFINED_MODULE_PREFIX);
- }
-
- static String getDefinedModuleName(String path) {
- return path.substring(DEFINED_MODULE_PREFIX.length());
- }
-
- static String asDefinedModulePath(String path) {
- return DEFINED_MODULE_PREFIX + path;
- }
-
- /**
- * Method getDefinedModule.
- * @param path
- * @param tag
- * @param monitor
- * @return ICVSRemoteFolder
- */
- private ICVSRemoteFolder getDefinedModule(String path, CVSTag tag, IProgressMonitor monitor) {
- Map cache = getDefinedModulesCache(tag, monitor);
- ICVSRemoteFolder folder = (ICVSRemoteFolder)cache.get(path);
- if (folder != null) {
- folder = (ICVSRemoteFolder)folder.forTag(tag);
- }
- return folder;
- }
-
- private Map getDefinedModulesCache(CVSTag tag, IProgressMonitor monitor) {
- if (modulesCache == null) {
- try {
- // Fetch the modules before locking the cache (to avoid deadlock)
- ICVSRemoteResource[] folders = root.members(CVSTag.DEFAULT, true, monitor);
- synchronized(modulesCacheLock) {
- modulesCache = new HashMap();
- for (int i = 0; i < folders.length; i++) {
- ICVSRemoteResource resource = folders[i];
- modulesCache.put(resource.getName(), resource);
- }
- }
- } catch (CVSException e) {
- // we could't fetch the modules. Log the problem and continue
- CVSUIPlugin.log(e);
- // Return an empty map but don't save it so the fetching of
- // the modules will occur again
- return new HashMap();
- }
- }
- return modulesCache;
- }
-
- public ICVSRemoteResource[] getDefinedModules(CVSTag tag, IProgressMonitor monitor) {
- Map cache = getDefinedModulesCache(tag, monitor);
- return (ICVSRemoteResource[]) cache.values().toArray(new ICVSRemoteResource[cache.size()]);
- }
-
- public static String getRemotePathFor(ICVSResource resource) throws CVSException {
- if (resource.isFolder()) {
- if (resource instanceof ICVSRemoteFolder) {
- ICVSRemoteFolder remoteFolder = (ICVSRemoteFolder) resource;
- if (remoteFolder.isDefinedModule()) {
- return asDefinedModulePath(remoteFolder.getName());
- }
- }
- FolderSyncInfo info = ((ICVSFolder)resource).getFolderSyncInfo();
- if (info == null)
- throw new CVSException(Policy.bind("RepositoryRoot.folderInfoMissing", resource.getName())); //$NON-NLS-1$
- return info.getRepository();
- } else {
- FolderSyncInfo info = resource.getParent().getFolderSyncInfo();
- if (info == null)
- throw new CVSException(Policy.bind("RepositoryRoot.folderInfoMissing", resource.getParent().getName())); //$NON-NLS-1$
- String path = new Path(null, info.getRepository()).append(resource.getName()).toString();
- return path;
- }
- }
-
- /**
- * Returns the root.
- * @return ICVSRepositoryLocation
- */
- public ICVSRepositoryLocation getRoot() {
- return root;
- }
-
- /**
- * Sets the name.
- * @param name The name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Accept the tags for any remote path that represents a folder. However, for the time being,
- * the given version tags are added to the list of known tags for the
- * remote ancestor of the resource that is a direct child of the remote root.
- *
- * It is the reponsibility of the caller to ensure that the given remote path is valid.
- */
- public void addTags(String remotePath, CVSTag[] tags) {
- addDateTags(tags);
- addVersionAndBranchTags(remotePath, tags);
- }
-
- private void addDateTags(CVSTag[] tags){
- for(int i = 0; i < tags.length; i++){
- if(tags[i].getType() == CVSTag.DATE){
- dateTags.add(tags[i]);
- }
- }
- }
- private void addVersionAndBranchTags(String remotePath, CVSTag[] tags) {
- // Get the name to cache the version tags with
- String name = getCachePathFor(remotePath);
-
- // Make sure there is a table for the ancestor that holds the tags
- TagCacheEntry entry = (TagCacheEntry)versionAndBranchTags.get(name);
- if (entry == null) {
- entry = new TagCacheEntry();
- versionAndBranchTags.put(name, entry);
- } else {
- entry.accessed();
- }
-
- // Store the tag with the appropriate ancestor
- for (int i = 0; i < tags.length; i++) {
- if(tags[i].getType() != CVSTag.DATE){
- entry.tags.add(tags[i]);
- }
- }
- }
-
- /**
- * Add the given date tag to the list of date tags associated with the repository.
- * @param tag a date tag
- */
- public void addDateTag(CVSTag tag) {
- if (!dateTags.contains(tag)) {
- dateTags.add(tag);
- }
- }
- public void removeDateTag(CVSTag tag) {
- if (dateTags.contains(tag)) {
- dateTags.remove(tag);
- }
- }
- /**
- * Return the list of date tags assocaiated with the repository.
- * @return the list of date tags
- */
- public CVSTag[] getDateTags() {
- return (CVSTag[]) dateTags.toArray(new CVSTag[dateTags.size()]);
- }
-
- /**
- * Remove the given tags from the receiver
- * @param remotePath
- * @param tags
- */
- public void removeTags(String remotePath, CVSTag[] tags) {
- removeDateTags(tags);
- removeVersionAndBranchTags(remotePath, tags);
- }
-
- private void removeDateTags(CVSTag[] tags) {
- if(dateTags.isEmpty())return;
- // Store the tag with the appropriate ancestor
- for (int i = 0; i < tags.length; i++) {
- dateTags.remove(tags[i]);
- }
- }
-
- private void removeVersionAndBranchTags(String remotePath, CVSTag[] tags) {
- // Get the name to cache the version tags with
- String name = getCachePathFor(remotePath);
-
- // Make sure there is a table for the ancestor that holds the tags
- TagCacheEntry entry = (TagCacheEntry)versionAndBranchTags.get(name);
- if (entry == null) {
- return;
- }
-
- // Store the tag with the appropriate ancestor
- for (int i = 0; i < tags.length; i++) {
- entry.tags.remove(tags[i]);
- }
- entry.accessed();
- }
-
- /**
- * Returns the absolute paths of the auto refresh files relative to the
- * repository.
- *
- * @return String[]
- */
- public String[] getAutoRefreshFiles(String remotePath) {
- String name = getCachePathFor(remotePath);
- Set files = (Set)autoRefreshFiles.get(name);
- if (files == null || files.isEmpty()) {
- // convert the default relative file paths to full paths
- if (isDefinedModuleName(remotePath)) {
- return new String[0];
- }
- List result = new ArrayList();
- for (int i = 0; i < DEFAULT_AUTO_REFRESH_FILES.length; i++) {
- String relativePath = DEFAULT_AUTO_REFRESH_FILES[i];
- result.add(new Path(null, remotePath).append(relativePath).toString());
- }
- return (String[]) result.toArray(new String[result.size()]);
- } else {
- return (String[]) files.toArray(new String[files.size()]);
- }
- }
-
- /**
- * Sets the auto refresh files for the given remote path to the given
- * string values which are absolute file paths (relative to the receiver).
- *
- * @param autoRefreshFiles The autoRefreshFiles to set
- */
- public void setAutoRefreshFiles(String remotePath, String[] autoRefreshFiles) {
- Set newFiles = new HashSet(Arrays.asList(autoRefreshFiles));
- // Check to see if the auto-refresh files are the default files
- if (autoRefreshFiles.length == DEFAULT_AUTO_REFRESH_FILES.length) {
- boolean isDefault = true;
- for (int i = 0; i < DEFAULT_AUTO_REFRESH_FILES.length; i++) {
- String filePath = DEFAULT_AUTO_REFRESH_FILES[i];
- if (!newFiles.contains(new Path(null, remotePath).append(filePath).toString())) {
- isDefault = false;
- break;
- }
- }
- if (isDefault) {
- this.autoRefreshFiles.remove(getCachePathFor(remotePath));
- return;
- }
- }
- this.autoRefreshFiles.put(getCachePathFor(remotePath), newFiles);
- }
-
- /**
- * Fetches tags from auto-refresh files.
- */
- public CVSTag[] refreshDefinedTags(ICVSFolder folder, boolean recurse, IProgressMonitor monitor) throws TeamException {
- monitor.beginTask(null, 100);
- CVSTag[] tags = null;
- if (!recurse) {
- // Only try the auto-refresh file(s) if we are not recursing into sub-folders
- tags = fetchTagsUsingAutoRefreshFiles(folder, Policy.subMonitorFor(monitor, 50));
- }
- if (tags == null || tags.length == 0) {
- // There we're no tags found on the auto-refresh files or we we're aksed to go deep
- // Try using the log command
- tags = fetchTagsUsingLog(folder, recurse, Policy.subMonitorFor(monitor, 50));
- }
- if (tags != null && tags.length > 0) {
- String remotePath = getRemotePathFor(folder);
- addTags(remotePath, tags);
- }
- monitor.done();
- return tags;
- }
-
- private CVSTag[] fetchTagsUsingLog(ICVSFolder folder, final boolean recurse, IProgressMonitor monitor) throws CVSException {
- LogEntryCache logEntries = new LogEntryCache();
- RemoteLogOperation operation = new RemoteLogOperation(null, new ICVSRemoteResource[] { asRemoteResource(folder) }, null, null, logEntries) {
- protected Command.LocalOption[] getLocalOptions(CVSTag tag1,CVSTag tag2) {
- Command.LocalOption[] options = super.getLocalOptions(tag1, tag2);
- if (recurse)
- return options;
- Command.LocalOption[] newOptions = new Command.LocalOption[options.length + 1];
- System.arraycopy(options, 0, newOptions, 0, options.length);
- newOptions[options.length] = Command.DO_NOT_RECURSE;
- return newOptions;
- }
- };
- try {
- operation.run(monitor);
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } catch (InterruptedException e) {
- // Ignore;
- }
- String[] keys = logEntries.getCachedFilePaths();
- Set tags = new HashSet();
- for (int i = 0; i < keys.length; i++) {
- String key = keys[i];
- ILogEntry[] entries = logEntries.getLogEntries(key);
- for (int j = 0; j < entries.length; j++) {
- ILogEntry entry = entries[j];
- tags.addAll(Arrays.asList(entry.getTags()));
- }
- }
- return (CVSTag[]) tags.toArray(new CVSTag[tags.size()]);
- }
-
- private ICVSRemoteResource asRemoteResource(ICVSFolder folder) throws CVSException {
- if (folder instanceof ICVSRemoteResource) {
- return (ICVSRemoteResource)folder;
- }
- return CVSWorkspaceRoot.getRemoteResourceFor(folder);
- }
-
- /**
- * Fetches tags from auto-refresh files.
- */
- private CVSTag[] fetchTagsUsingAutoRefreshFiles(ICVSFolder folder, IProgressMonitor monitor) throws TeamException {
- String remotePath = getRemotePathFor(folder);
- String[] filesToRefresh = getAutoRefreshFiles(remotePath);
- try {
- monitor.beginTask(null, filesToRefresh.length * 10); //$NON-NLS-1$
- List tags = new ArrayList();
- for (int i = 0; i < filesToRefresh.length; i++) {
- ICVSRemoteFile file = root.getRemoteFile(filesToRefresh[i], CVSTag.DEFAULT);
- try {
- tags.addAll(Arrays.asList(fetchTags(file, Policy.subMonitorFor(monitor, 5))));
- } catch (TeamException e) {
- IStatus status = e.getStatus();
- boolean doesNotExist = false;
- if (status.getCode() == CVSStatus.SERVER_ERROR && status.isMultiStatus()) {
- IStatus[] children = status.getChildren();
- if (children.length == 1 && children[0].getCode() == CVSStatus.DOES_NOT_EXIST) {
- // Don't throw an exception if the file does no exist
- doesNotExist = true;
- }
- }
- if (!doesNotExist) {
- throw e;
- }
- }
- }
- return (CVSTag[]) tags.toArray(new CVSTag[tags.size()]);
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Returns Branch and Version tags for the given files
- */
- private CVSTag[] fetchTags(ICVSRemoteFile file, IProgressMonitor monitor) throws TeamException {
- Set tagSet = new HashSet();
- ILogEntry[] entries = file.getLogEntries(monitor);
- for (int j = 0; j < entries.length; j++) {
- CVSTag[] tags = entries[j].getTags();
- for (int k = 0; k < tags.length; k++) {
- tagSet.add(tags[k]);
- }
- }
- return (CVSTag[])tagSet.toArray(new CVSTag[0]);
- }
-
- /*
- * Return the cache key (path) for the given folder path.
- * This has been changed to cache the tags directly
- * with the folder to better support non-root projects.
- * However, resources in the local workspace use the folder
- * the project is mapped to as the tag source (see TagSource)
- */
- private String getCachePathFor(String remotePath) {
- return remotePath;
- }
-
- /**
- * Write out the state of the receiver as XML on the given XMLWriter.
- *
- * @param writer
- * @throws IOException
- */
- public void writeState(XMLWriter writer) {
-
- HashMap attributes = new HashMap();
-
- attributes.clear();
- attributes.put(RepositoriesViewContentHandler.ID_ATTRIBUTE, root.getLocation());
- if (name != null) {
- attributes.put(RepositoriesViewContentHandler.NAME_ATTRIBUTE, name);
- }
-
- writer.startTag(RepositoriesViewContentHandler.REPOSITORY_TAG, attributes, true);
-
- //put date tag under repository
- if(!dateTags.isEmpty()){
- writer.startTag(RepositoriesViewContentHandler.DATE_TAGS_TAG, attributes, true);
- Iterator iter = dateTags.iterator();
- while(iter.hasNext()){
- CVSTag tag = (CVSTag)iter.next();
- writeATag(writer, attributes, tag, RepositoriesViewContentHandler.DATE_TAG_TAG);
- }
- writer.endTag(RepositoriesViewContentHandler.DATE_TAGS_TAG);
- }
-
- // Gather all the modules that have tags and/or auto-refresh files
- // for each module, write the moduel, tags and auto-refresh files.
- String[] paths = getKnownRemotePaths();
- for (int i = 0; i < paths.length; i++) {
- String path = paths[i];
- attributes.clear();
- String name = path;
- if (isDefinedModuleName(path)) {
- name = getDefinedModuleName(path);
-
- attributes.put(RepositoriesViewContentHandler.TYPE_ATTRIBUTE, RepositoriesViewContentHandler.DEFINED_MODULE_TYPE);
- }
- attributes.put(RepositoriesViewContentHandler.PATH_ATTRIBUTE, name);
- TagCacheEntry entry = (TagCacheEntry)versionAndBranchTags.get(path);
- boolean writeOutTags = entry != null && !entry.isExpired();
- if (writeOutTags)
- attributes.put(RepositoriesViewContentHandler.LAST_ACCESS_TIME_ATTRIBUTE, Long.toString(entry.lastAccessTime));
- writer.startTag(RepositoriesViewContentHandler.MODULE_TAG, attributes, true);
- if (writeOutTags) {
- Iterator tagIt = entry.tags.iterator();
- while (tagIt.hasNext()) {
- CVSTag tag = (CVSTag)tagIt.next();
- writeATag(writer, attributes, tag, RepositoriesViewContentHandler.TAG_TAG);
- }
- }
- Set refreshSet = (Set)autoRefreshFiles.get(path);
- if (refreshSet != null) {
- Iterator filenameIt = refreshSet.iterator();
- while (filenameIt.hasNext()) {
- String filename = (String)filenameIt.next();
- attributes.clear();
- attributes.put(RepositoriesViewContentHandler.FULL_PATH_ATTRIBUTE, filename);
- writer.startAndEndTag(RepositoriesViewContentHandler.AUTO_REFRESH_FILE_TAG, attributes, true);
- }
- }
- writer.endTag(RepositoriesViewContentHandler.MODULE_TAG);
- }
- writer.endTag(RepositoriesViewContentHandler.REPOSITORY_TAG);
- }
-
- private void writeATag(XMLWriter writer, HashMap attributes, CVSTag tag, String s) {
- attributes.clear();
- attributes.put(RepositoriesViewContentHandler.NAME_ATTRIBUTE, tag.getName());
- attributes.put(RepositoriesViewContentHandler.TYPE_ATTRIBUTE, RepositoriesViewContentHandler.TAG_TYPES[tag.getType()]);
- writer.startAndEndTag(s, attributes, true);
- }
-
- /**
- * Method getKnownTags.
- * @param remotePath
- * @return CVSTag[]
- */
- public CVSTag[] getAllKnownTags(String remotePath) {
- TagCacheEntry entry = (TagCacheEntry)versionAndBranchTags.get(getCachePathFor(remotePath));
- if(entry != null){
- entry.accessed();
- CVSTag [] tags1 = (CVSTag[]) entry.tags.toArray(new CVSTag[entry.tags.size()]);
- CVSTag[] tags2 = getDateTags();
- int len = tags1.length + tags2.length;
- CVSTag[] tags = new CVSTag[len];
- for(int i = 0; i < len; i++){
- if(i < tags1.length){
- tags[i] = tags1[i];
- }else{
- tags[i] = tags2[i-tags1.length];
- }
- }
- return tags;
- }
- return getDateTags();
- }
-
- public String[] getKnownRemotePaths() {
- Set paths = new HashSet();
- paths.addAll(versionAndBranchTags.keySet());
- paths.addAll(autoRefreshFiles.keySet());
- return (String[]) paths.toArray(new String[paths.size()]);
- }
- /**
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- if (ICVSRepositoryLocation.class.equals(adapter)) return getRoot();
- return super.getAdapter(adapter);
- }
-
- public ICVSRemoteResource[] filterResources(ICVSRemoteResource[] resource) {
- List result = new ArrayList();
- for (int i = 0; i < resource.length; i++) {
- ICVSRemoteResource remoteResource = resource[i];
- if (remoteResource instanceof ICVSRemoteFolder) {
- ICVSRemoteFolder folder = (ICVSRemoteFolder) remoteResource;
- if (tagIsKnown(remoteResource)) {
- result.add(folder);
- }
- }
- }
- return (ICVSRemoteResource[]) result.toArray(new ICVSRemoteResource[result.size()]);
- }
-
- /**
- * Method tagIsKnown.
- * @param remoteResource
- * @return boolean
- */
- public boolean tagIsKnown(ICVSRemoteResource remoteResource) {
- if (remoteResource instanceof ICVSRemoteFolder) {
- ICVSRemoteFolder folder = (ICVSRemoteFolder) remoteResource;
- String path = getCachePathFor(folder.getRepositoryRelativePath());
- CVSTag[] tags = getAllKnownTags(path);
- CVSTag tag = folder.getTag();
- for (int i = 0; i < tags.length; i++) {
- CVSTag knownTag = tags[i];
- if (knownTag.equals(tag)) return true;
- }
- }
- return false;
- }
-
- /**
- * This method is invoked whenever the refresh button in the
- * RepositoriesView is pressed.
- */
- void clearCache() {
- synchronized(modulesCacheLock) {
- if (modulesCache != null)
- modulesCache = null;
- }
- }
-
- /**
- * Sets the root.
- * @param root The root to set
- */
- void setRepositoryLocation(ICVSRepositoryLocation root) {
- this.root = root;
- }
-
- /*
- * Set the last access time of the cache entry for the given path
- * as it was read from the persitent store.
- */
- /* package */ void setLastAccessedTime(String remotePath, long lastAccessTime) {
- TagCacheEntry entry = (TagCacheEntry)versionAndBranchTags.get(getCachePathFor(remotePath));
- if(entry != null){
- entry.lastAccessTime = lastAccessTime;
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositorySorter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositorySorter.java
deleted file mode 100644
index b5eb52453..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositorySorter.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.repo;
-
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.model.BranchCategory;
-import org.eclipse.team.internal.ccvs.ui.model.CVSTagElement;
-import org.eclipse.team.internal.ccvs.ui.model.DateTagCategory;
-import org.eclipse.team.internal.ccvs.ui.model.RemoteModule;
-import org.eclipse.team.internal.ccvs.ui.model.VersionCategory;
-
-public class RepositorySorter extends ViewerSorter {
- public int category(Object element) {
- if (element instanceof ICVSRemoteFolder) {
- if (((ICVSRemoteFolder)element).isDefinedModule()) {
- return 7;
- }
- return 1;
- }
- if (element instanceof RemoteModule) {
- ICVSRemoteResource resource = ((RemoteModule)element).getCVSResource();
- if (resource instanceof ICVSRemoteFolder) {
- ICVSRemoteFolder folder = (ICVSRemoteFolder) resource;
- if (folder.isDefinedModule()) {
- return 7;
- }
- }
- return 1;
- }
- if (element instanceof ICVSRemoteFile) {
- return 2;
- }
- if (element instanceof CVSTagElement) {
- CVSTagElement tagElement = (CVSTagElement)element;
- if (tagElement.getTag().getType() == CVSTag.HEAD) {
- return 0;
- } else if (tagElement.getTag().getType() == CVSTag.BRANCH) {
- return 4;
- } else if (tagElement.getTag().getType() == CVSTag.VERSION) {
- return 5;
- } else if (tagElement.getTag().getType() == CVSTag.DATE){
- return 6;
- }else{
- return 7;
- }
- }
- if (element instanceof BranchCategory) {
- return 4;
- }
- if (element instanceof VersionCategory) {
- return 5;
- }
- if (element instanceof DateTagCategory){
- return 6;
- }
- return 0;
- }
-
- public int compare(Viewer viewer, Object o1, Object o2) {
- int cat1 = category(o1);
- int cat2 = category(o2);
- if (cat1 != cat2) return cat1 - cat2;
-
- if (o1 instanceof CVSTagElement && o2 instanceof CVSTagElement) {
- CVSTag tag1 = ((CVSTagElement)o1).getTag();
- CVSTag tag2 = ((CVSTagElement)o2).getTag();
- if (tag1.getType() == CVSTag.BRANCH) {
- return tag1.compareTo(tag2);
- } else {
- return -1 * tag1.compareTo(tag2);
- }
- }
-
- // Sort versions in reverse alphabetical order
- if (o1 instanceof ICVSRemoteFolder && o2 instanceof ICVSRemoteFolder) {
- ICVSRemoteFolder f1 = (ICVSRemoteFolder)o1;
- ICVSRemoteFolder f2 = (ICVSRemoteFolder)o2;
- if (f1.getName().equals(f2.getName())) {
- return compare(f1, f2);
- }
- }
-
- if (o1 instanceof ICVSRepositoryLocation && o2 instanceof ICVSRepositoryLocation) {
- return ((ICVSRepositoryLocation)o1).getLocation().compareTo(((ICVSRepositoryLocation)o2).getLocation());
- }
-
- return super.compare(viewer, o1, o2);
- }
-
- /*
- * Compare to remote folders whose names are the same.
- */
- private int compare(ICVSRemoteFolder f1, ICVSRemoteFolder f2) {
- CVSTag tag1 = f1.getTag();
- CVSTag tag2 = f2.getTag();
- if (tag1 == null) return 1;
- if (tag2 == null) return -1;
- return tag2.compareTo(tag1);
- }
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSActionDelegateWrapper.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSActionDelegateWrapper.java
deleted file mode 100644
index 1cff07326..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSActionDelegateWrapper.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.synchronize.ActionDelegateWrapper;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.ui.IActionDelegate;
-
-/**
- * Superclass of CVS participant action delegates that uses the classname as the key
- * to access the text from the resource bundle
- */
-public class CVSActionDelegateWrapper extends ActionDelegateWrapper {
-
- public CVSActionDelegateWrapper(IActionDelegate delegate, ISynchronizePageConfiguration configuration) {
- super(delegate, configuration);
- Utils.initAction(this, getBundleKeyPrefix(), Policy.getBundle());
- }
-
- /**
- * Return the key to the action text in the resource bundle.
- * The default is the class name followed by a dot (.).
- * @return the bundle key prefix
- */
- protected String getBundleKeyPrefix() {
- String name = getDelegate().getClass().getName();
- int lastDot = name.lastIndexOf("."); //$NON-NLS-1$
- if (lastDot == -1) {
- return name;
- }
- return name.substring(lastDot + 1) + "."; //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetActionGroup.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetActionGroup.java
deleted file mode 100644
index 81bf2c347..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetActionGroup.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
-
-/**
- * Action group that is used by CVS Change Set Capabilities
- */
-public class CVSChangeSetActionGroup extends SynchronizePageActionGroup {
-
- private OpenChangeSetAction openCommitSet;
-
- public void initialize(ISynchronizePageConfiguration configuration) {
- super.initialize(configuration);
- openCommitSet = new OpenChangeSetAction(configuration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SynchronizePageActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
- */
- public void fillContextMenu(IMenuManager menu) {
- if (getConfiguration().getParticipant().getChangeSetCapability().enableCheckedInChangeSetsFor(getConfiguration())) {
- appendToGroup(
- menu,
- ISynchronizePageConfiguration.FILE_GROUP,
- openCommitSet);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCapability.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCapability.java
deleted file mode 100644
index b0e57b3eb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCapability.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.ui.synchronize.*;
-
-
-public class CVSChangeSetCapability extends ChangeSetCapability {
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ChangeSetCapability#supportsCheckedInChangeSets()
- */
- public boolean supportsCheckedInChangeSets() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ChangeSetCapability#supportsActiveChangeSets()
- */
- public boolean supportsActiveChangeSets() {
- return getActiveChangeSetManager() != null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ChangeSetCapability#createCheckedInChangeSetCollector(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
- public SyncInfoSetChangeSetCollector createCheckedInChangeSetCollector(ISynchronizePageConfiguration configuration) {
- return new CVSChangeSetCollector(configuration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ChangeSetCapability#getActionGroup()
- */
- public SynchronizePageActionGroup getActionGroup() {
- return new CVSChangeSetActionGroup();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ChangeSetCapability#enableChangeSetsByDefault()
- */
- public boolean enableChangeSetsByDefault() {
- return CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_COMMIT_SET_DEFAULT_ENABLEMENT);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCollector.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCollector.java
deleted file mode 100644
index 3083818a8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCollector.java
+++ /dev/null
@@ -1,441 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.text.DateFormat;
-import java.util.Date;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamStatus;
-import org.eclipse.team.core.subscribers.*;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteResource;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation.LogEntryCache;
-import org.eclipse.team.ui.synchronize.*;
-
-/**
- * Collector that fetches the log for incoming CVS change sets
- */
-public class CVSChangeSetCollector extends SyncInfoSetChangeSetCollector implements LogEntryCacheUpdateHandler.ILogsFetchedListener {
-
- /*
- * Constant used to add the collector to the configuration of a page so
- * it can be accessed by the CVS custom actions
- */
- public static final String CVS_CHECKED_IN_COLLECTOR = CVSUIPlugin.ID + ".CVSCheckedInCollector"; //$NON-NLS-1$
-
- /*
- * Constant used to store the log entry handler in the configuration so it can
- * be kept around over layout changes
- */
- private static final String LOG_ENTRY_HANDLER = CVSUIPlugin.ID + ".LogEntryHandler"; //$NON-NLS-1$
-
- private static final String DEFAULT_INCOMING_SET_NAME = Policy.bind("CVSChangeSetCollector.0"); //$NON-NLS-1$
-
- boolean disposed = false;
-
- private LogEntryCache logEntryCache;
-
- /* *****************************************************************************
- * Special sync info that has its kind already calculated.
- */
- public class CVSUpdatableSyncInfo extends CVSSyncInfo {
- public int kind;
- public CVSUpdatableSyncInfo(int kind, IResource local, IResourceVariant base, IResourceVariant remote, Subscriber s) {
- super(local, base, remote, s);
- this.kind = kind;
- }
-
- protected int calculateKind() throws TeamException {
- return kind;
- }
- }
-
- private class DefaultCheckedInChangeSet extends CheckedInChangeSet {
-
- private Date date = new Date();
-
- public DefaultCheckedInChangeSet(String name) {
- setName(name);
- }
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.CheckedInChangeSet#getAuthor()
- */
- public String getAuthor() {
- return ""; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.CheckedInChangeSet#getDate()
- */
- public Date getDate() {
- return date;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ChangeSet#getComment()
- */
- public String getComment() {
- return ""; //$NON-NLS-1$
- }
-
- }
-
- private class CVSCheckedInChangeSet extends CheckedInChangeSet {
-
- private final ILogEntry entry;
-
- public CVSCheckedInChangeSet(ILogEntry entry) {
- this.entry = entry;
- String date = DateFormat.getDateTimeInstance().format(entry.getDate());
- String comment = HistoryView.flattenText(entry.getComment());
- setName("["+entry.getAuthor()+ "] (" + date +") " + comment); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.CheckedInChangeSet#getAuthor()
- */
- public String getAuthor() {
- return entry.getAuthor();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.CheckedInChangeSet#getDate()
- */
- public Date getDate() {
- return entry.getDate();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ChangeSet#getComment()
- */
- public String getComment() {
- return entry.getComment();
- }
- }
-
- public CVSChangeSetCollector(ISynchronizePageConfiguration configuration) {
- super(configuration);
- configuration.setProperty(CVSChangeSetCollector.CVS_CHECKED_IN_COLLECTOR, this);
- }
-
- public synchronized LogEntryCacheUpdateHandler getLogEntryHandler() {
- LogEntryCacheUpdateHandler handler = (LogEntryCacheUpdateHandler)getConfiguration().getProperty(LOG_ENTRY_HANDLER);
- if (handler == null) {
- handler = initializeLogEntryHandler(getConfiguration());
- }
- handler.setListener(this);
- return handler;
- }
-
- /*
- * Initialize the log entry handler and place it in the configuration
- */
- private LogEntryCacheUpdateHandler initializeLogEntryHandler(ISynchronizePageConfiguration configuration) {
- final LogEntryCacheUpdateHandler logEntryHandler = new LogEntryCacheUpdateHandler(configuration);
- configuration.setProperty(LOG_ENTRY_HANDLER, logEntryHandler);
- // Use an action group to get notified when the configuration is disposed
- configuration.addActionContribution(new SynchronizePageActionGroup() {
- public void dispose() {
- super.dispose();
- LogEntryCacheUpdateHandler handler = (LogEntryCacheUpdateHandler)getConfiguration().getProperty(LOG_ENTRY_HANDLER);
- if (handler != null) {
- handler.shutdown();
- getConfiguration().setProperty(LOG_ENTRY_HANDLER, null);
- }
- }
- });
- return logEntryHandler;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.SyncInfoSetChangeSetCollector#add(org.eclipse.team.core.synchronize.SyncInfo[])
- */
- protected void add(SyncInfo[] infos) {
- LogEntryCacheUpdateHandler handler = getLogEntryHandler();
- if (handler != null)
- try {
- handler.fetch(infos);
- } catch (CVSException e) {
- getConfiguration().getSyncInfoSet().addError(new TeamStatus(IStatus.ERROR, CVSUIPlugin.ID, 0, e.getMessage(), e, null));
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SyncInfoSetChangeSetCollector#reset(org.eclipse.team.core.synchronize.SyncInfoSet)
- */
- public void reset(SyncInfoSet seedSet) {
- // Notify thet handler to stop any fetches in progress
- LogEntryCacheUpdateHandler handler = getLogEntryHandler();
- if (handler != null) {
- handler.stopFetching();
- }
- super.reset(seedSet);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.views.HierarchicalModelProvider#dispose()
- */
- public void dispose() {
- // No longer listen for log entry changes
- // (The handler is disposed with the page)
- disposed = true;
- LogEntryCacheUpdateHandler handler = getLogEntryHandler();
- if (handler != null) handler.setListener(null);
- getConfiguration().setProperty(CVSChangeSetCollector.CVS_CHECKED_IN_COLLECTOR, null);
- logEntryCache = null;
- super.dispose();
- }
-
- /**
- * Fetch the log histories for the remote changes and use this information
- * to add each resource to an appropriate commit set.
- */
- private void handleRemoteChanges(final SyncInfo[] infos, final LogEntryCache logEntries, final IProgressMonitor monitor) {
- performUpdate(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) {
- addLogEntries(infos, logEntries, monitor);
- }
- }, true /* preserver expansion */, monitor);
- }
-
- /*
- * Add the following sync info elements to the viewer. It is assumed that these elements have associated
- * log entries cached in the log operation.
- */
- private void addLogEntries(SyncInfo[] commentInfos, LogEntryCache logs, IProgressMonitor monitor) {
- try {
- monitor.beginTask(null, commentInfos.length * 10);
- if (logs != null) {
- for (int i = 0; i < commentInfos.length; i++) {
- addSyncInfoToCommentNode(commentInfos[i], logs);
- monitor.worked(10);
- }
- }
- } finally {
- monitor.done();
- }
- }
-
- /*
- * Create a node for the given sync info object. The logs should contain the log for this info.
- *
- * @param info the info for which to create a node in the model
- * @param log the cvs log for this node
- */
- private void addSyncInfoToCommentNode(SyncInfo info, LogEntryCache logs) {
- LogEntryCacheUpdateHandler handler = getLogEntryHandler();
- if (handler != null) {
- ICVSRemoteResource remoteResource = handler.getRemoteResource(info);
- if(handler.getSubscriber() instanceof CVSCompareSubscriber && remoteResource != null) {
- addMultipleRevisions(info, logs, remoteResource);
- } else {
- addSingleRevision(info, logs, remoteResource);
- }
- }
- }
-
- /*
- * Add a single log entry to the model.
- *
- * @param info
- * @param logs
- * @param remoteResource
- */
- private void addSingleRevision(SyncInfo info, LogEntryCache logs, ICVSRemoteResource remoteResource) {
- ILogEntry logEntry = logs.getLogEntry(remoteResource);
- if (remoteResource != null && !remoteResource.isFolder()) {
- // For incoming deletions grab the comment for the latest on the same branch
- // which is now in the attic.
- try {
- String remoteRevision = ((ICVSRemoteFile) remoteResource).getRevision();
- if (isDeletedRemotely(info)) {
- ILogEntry[] logEntries = logs.getLogEntries(remoteResource);
- for (int i = 0; i < logEntries.length; i++) {
- ILogEntry entry = logEntries[i];
- String revision = entry.getRevision();
- if (entry.isDeletion() && ResourceSyncInfo.isLaterRevision(revision, remoteRevision)) {
- logEntry = entry;
- }
- }
- }
- } catch (TeamException e) {
- // continue and skip deletion checks
- }
- }
- addRemoteChange(info, remoteResource, logEntry);
- }
-
- /*
- * Add multiple log entries to the model.
- *
- * @param info
- * @param logs
- * @param remoteResource
- */
- private void addMultipleRevisions(SyncInfo info, LogEntryCache logs, ICVSRemoteResource remoteResource) {
- ILogEntry[] logEntries = logs.getLogEntries(remoteResource);
- if(logEntries == null || logEntries.length == 0) {
- // If for some reason we don't have a log entry, try the latest
- // remote.
- addRemoteChange(info, null, null);
- } else {
- for (int i = 0; i < logEntries.length; i++) {
- ILogEntry entry = logEntries[i];
- addRemoteChange(info, remoteResource, entry);
- }
- }
- }
-
- private boolean isDeletedRemotely(SyncInfo info) {
- int kind = info.getKind();
- if(kind == (SyncInfo.INCOMING | SyncInfo.DELETION)) return true;
- if(SyncInfo.getDirection(kind) == SyncInfo.CONFLICTING && info.getRemote() == null) return true;
- return false;
- }
-
- /*
- * Add the remote change to an incoming commit set
- */
- private void addRemoteChange(SyncInfo info, ICVSRemoteResource remoteResource, ILogEntry logEntry) {
- if (disposed) return;
- LogEntryCacheUpdateHandler handler = getLogEntryHandler();
- if(handler != null && remoteResource != null && logEntry != null && handler.isRemoteChange(info)) {
- if(requiresCustomSyncInfo(info, remoteResource, logEntry)) {
- info = new CVSUpdatableSyncInfo(info.getKind(), info.getLocal(), info.getBase(), (RemoteResource)logEntry.getRemoteFile(), ((CVSSyncInfo)info).getSubscriber());
- try {
- info.init();
- } catch (TeamException e) {
- // this shouldn't happen, we've provided our own calculate kind
- }
- }
- // Only add the info if the base and remote differ
- IResourceVariant base = info.getBase();
- IResourceVariant remote = info.getRemote();
- if ((base == null && remote != null) || (remote == null && base != null) || !base.equals(remote)) {
- synchronized(this) {
- ChangeSet set = getChangeSetFor(logEntry);
- if (set == null) {
- set = createChangeSetFor(logEntry);
- add(set);
- }
- set.add(info);
- }
- }
- } else {
- // The info was not retrieved for the remote change for some reason.
- // Add the node to the root
- addToDefaultSet(DEFAULT_INCOMING_SET_NAME, info);
- }
- }
-
- private void addToDefaultSet(String name, SyncInfo info) {
- ChangeSet set;
- synchronized(this) {
- set = getChangeSetFor(name);
- if (set == null) {
- set = createDefaultChangeSet(name);
- add(set);
- }
- set.add(info);
- }
- }
-
- private ChangeSet createDefaultChangeSet(String name) {
- return new DefaultCheckedInChangeSet(name);
- }
-
- private ChangeSet createChangeSetFor(ILogEntry logEntry) {
- return new CVSCheckedInChangeSet(logEntry);
- }
-
- private ChangeSet getChangeSetFor(ILogEntry logEntry) {
- ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
- if (set instanceof CheckedInChangeSet &&
- set.getComment().equals(logEntry.getComment()) &&
- ((CheckedInChangeSet)set).getAuthor().equals(logEntry.getAuthor())) {
- return set;
- }
- }
- return null;
- }
-
- private ChangeSet getChangeSetFor(String name) {
- ChangeSet[] sets = getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
- if (set.getName().equals(name)) {
- return set;
- }
- }
- return null;
- }
-
- private boolean requiresCustomSyncInfo(SyncInfo info, ICVSRemoteResource remoteResource, ILogEntry logEntry) {
- // Only interested in non-deletions
- if (logEntry.isDeletion() || !(info instanceof CVSSyncInfo)) return false;
- // Only require a custom sync info if the remote of the sync info
- // differs from the remote in the log entry
- IResourceVariant remote = info.getRemote();
- if (remote == null) return true;
- return !remote.equals(remoteResource);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SyncInfoSetChangeSetCollector#waitUntilDone(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void waitUntilDone(IProgressMonitor monitor) {
- super.waitUntilDone(monitor);
- monitor.worked(1);
- // wait for the event handler to process changes.
- LogEntryCacheUpdateHandler handler = getLogEntryHandler();
- if (handler != null) {
- while(handler.getEventHandlerJob().getState() != Job.NONE) {
- monitor.worked(1);
- try {
- Thread.sleep(10);
- } catch (InterruptedException e) {
- }
- Policy.checkCanceled(monitor);
- }
- }
- monitor.worked(1);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.LogEntryCacheUpdateHandler.ILogsFetchedListener#logEntriesFetched(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void logEntriesFetched(SyncInfoSet set, LogEntryCache logEntryCache, IProgressMonitor monitor) {
- if (disposed) return;
- // Hold on to the cache so we can use it while commit sets are visible
- this.logEntryCache = logEntryCache;
- handleRemoteChanges(set.getSyncInfos(), logEntryCache, monitor);
- }
-
- public ICVSRemoteFile getImmediatePredecessor(ICVSRemoteFile file) throws TeamException {
- if (logEntryCache != null)
- return logEntryCache.getImmediatePredecessor(file);
- return null;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipant.java
deleted file mode 100644
index b5c1c2456..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipant.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFile;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.ui.synchronize.*;
-
-/**
- * Superclass for all CVS particpants (workspace, merge and compare)
- */
-public class CVSParticipant extends SubscriberParticipant {
-
- private CVSChangeSetCapability capability;
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.subscribers.SubscriberParticipant#initializeConfiguration(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
- protected void initializeConfiguration(ISynchronizePageConfiguration configuration) {
- super.initializeConfiguration(configuration);
- // The decorator adds itself to the configuration
- ILabelDecorator labelDecorator = new CVSParticipantLabelDecorator(configuration);
- configuration.addLabelDecorator(labelDecorator);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SubscriberParticipant#updateLabels(org.eclipse.team.ui.synchronize.ISynchronizeModelElement, org.eclipse.compare.CompareConfiguration, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void prepareCompareInput(ISynchronizeModelElement element, CompareConfiguration config, IProgressMonitor monitor) throws TeamException {
- monitor.beginTask(null, 100);
- deriveBaseContentsFromLocal(element, Policy.subMonitorFor(monitor, 10));
- super.prepareCompareInput(element, config, Policy.subMonitorFor(monitor, 80));
- updateLabelsForCVS(element, config, Policy.subMonitorFor(monitor, 10));
- monitor.done();
- }
-
- /**
- * Helper method for updating compare editor labels
- */
- protected static void updateLabelsForCVS(ISynchronizeModelElement element, CompareConfiguration config, IProgressMonitor monitor) {
- // Add the author to the remote or base
- if (CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_SHOW_AUTHOR_IN_EDITOR)) {
- SyncInfo info = getSyncInfo(element);
- if (info != null) {
- final IResourceVariant remote = info.getRemote();
- final IResourceVariant base = info.getBase();
- String remoteAuthor = null;
- if (remote != null && !remote.isContainer()) {
- try {
- ILogEntry entry = ((ICVSRemoteFile)remote).getLogEntry(monitor);
- remoteAuthor = entry.getAuthor();
- config.setRightLabel(Policy.bind("CVSParticipant.0", remote.getContentIdentifier(), remoteAuthor)); //$NON-NLS-1$
- } catch (TeamException e) {
- CVSUIPlugin.log(e);
- }
- }
- if (base != null && !base.isContainer()) {
- try {
- String baseAuthor;
- if (remoteAuthor != null && remote.getContentIdentifier().equals(base.getContentIdentifier())) {
- baseAuthor = remoteAuthor;
- } else {
- ILogEntry entry = ((ICVSRemoteFile)base).getLogEntry(monitor);
- baseAuthor = entry.getAuthor();
- }
- config.setAncestorLabel(Policy.bind("CVSParticipant.1", base.getContentIdentifier(), baseAuthor)); //$NON-NLS-1$
- } catch (TeamException e) {
- CVSUIPlugin.log(e);
- }
- }
- }
- }
- }
-
- protected static SyncInfo getSyncInfo(ISynchronizeModelElement element) {
- if (element instanceof IAdaptable) {
- return (SyncInfo)((IAdaptable)element).getAdapter(SyncInfo.class);
- }
- return null;
- }
-
- /**
- * If the local is not modified and the base matches the local then
- * cache the local contents as the contents of the base.
- * @param element
- * @throws CoreException
- * @throws TeamException
- */
- public static void deriveBaseContentsFromLocal(ISynchronizeModelElement element, IProgressMonitor monitor) throws TeamException {
- SyncInfo info = getSyncInfo(element);
- if (info == null)
- return;
-
- // We need a base that is a file and a local that is a file
- IResource local = info.getLocal();
- IResourceVariant base = info.getBase();
- if (base == null || base.isContainer() || local.getType() != IResource.FILE || !local.exists())
- return;
-
- // We can only use the local contents for incoming changes.
- // Outgoing or conflicting changes imply that the local has changed
- if ((info.getKind() & SyncInfo.DIRECTION_MASK) != SyncInfo.INCOMING)
- return;
-
- try {
- RemoteFile remoteFile = (RemoteFile)base;
- if (!remoteFile.isContentsCached())
- (remoteFile).setContents((IFile)local, monitor);
- } catch (CoreException e) {
- if (e.getStatus().getCode() == IResourceStatus.RESOURCE_NOT_FOUND) {
- // The file must have just been deleted
- return;
- }
- throw CVSException.wrapException(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#getPreferencePages()
- */
- public PreferencePage[] getPreferencePages() {
- return addCVSPreferencePages(super.getPreferencePages());
- }
-
- public static PreferencePage[] addCVSPreferencePages(PreferencePage[] inheritedPages) {
- PreferencePage[] pages = new PreferencePage[inheritedPages.length + 1];
- for (int i = 0; i < inheritedPages.length; i++) {
- pages[i] = inheritedPages[i];
- }
- pages[pages.length - 1] = new ComparePreferencePage();
- pages[pages.length - 1].setTitle(Policy.bind("CVSParticipant.2")); //$NON-NLS-1$
- return pages;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#getChangeSetCapability()
- */
- public ChangeSetCapability getChangeSetCapability() {
- if (capability == null) {
- capability = createChangeSetCapability();
- }
- return capability;
- }
-
- /**
- * Create the change set capability for this particpant.
- * @return the created capability
- */
- protected CVSChangeSetCapability createChangeSetCapability() {
- return new CVSChangeSetCapability();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#isViewerContributionsSupported()
- */
- protected boolean isViewerContributionsSupported() {
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipantAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipantAction.java
deleted file mode 100644
index c3a034649..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipantAction.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizeModelAction;
-
-/**
- * Superclass of CVS participant actions that uses the classname as the key
- * to access the text from the resource bundle
- */
-public abstract class CVSParticipantAction extends SynchronizeModelAction {
-
- protected CVSParticipantAction(ISynchronizePageConfiguration configuration) {
- super(null, configuration);
- Utils.initAction(this, getBundleKeyPrefix(), Policy.getBundle());
- }
-
- protected CVSParticipantAction(ISynchronizePageConfiguration configuration, ISelectionProvider provider, String bundleKey) {
- super(null, configuration, provider);
- Utils.initAction(this, bundleKey, Policy.getBundle());
- }
-
- /**
- * Return the key to the action text in the resource bundle.
- * The default is the class name followed by a dot (.).
- * @return the bundle key prefix
- */
- protected String getBundleKeyPrefix() {
- String name = getClass().getName();
- int lastDot = name.lastIndexOf("."); //$NON-NLS-1$
- if (lastDot == -1) {
- return name;
- }
- return name.substring(lastDot + 1) + "."; //$NON-NLS-1$
- }
-
- protected boolean needsToSaveDirtyEditors() {
- int option = CVSUIPlugin.getPlugin().getPreferenceStore().getInt(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS);
- return option != ICVSUIConstants.OPTION_NEVER;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#confirmSaveOfDirtyEditor()
- */
- protected boolean confirmSaveOfDirtyEditor() {
- int option = CVSUIPlugin.getPlugin().getPreferenceStore().getInt(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS);
- return option == ICVSUIConstants.OPTION_PROMPT;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipantLabelDecorator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipantLabelDecorator.java
deleted file mode 100644
index 2b749f7e4..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSParticipantLabelDecorator.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSSyncInfo;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFile;
-import org.eclipse.team.internal.ccvs.ui.CVSDecoration;
-import org.eclipse.team.internal.ccvs.ui.CVSLightweightDecorator;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ui.synchronize.SyncInfoModelElement;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-
-
-class CVSParticipantLabelDecorator extends LabelProvider implements IPropertyChangeListener, ILabelDecorator {
- private ISynchronizePageConfiguration configuration;
-
- public CVSParticipantLabelDecorator(ISynchronizePageConfiguration configuration) {
- this.configuration = configuration;
- // Listen for decorator changed to refresh the viewer's labels.
- CVSUIPlugin.addPropertyChangeListener(this);
- TeamUI.addPropertyChangeListener(this);
- }
-
- public String decorateText(String input, Object element) {
- try {
- String text = input;
- if (element instanceof ISynchronizeModelElement) {
- IResource resource = ((ISynchronizeModelElement) element).getResource();
- if (resource != null && resource.getType() != IResource.ROOT) {
- // Prepare the decoration but substitute revision and hide dirty indicator
- CVSDecoration decoration = CVSLightweightDecorator.decorate(resource);
- decoration.setRevision(getRevisionNumber((ISynchronizeModelElement) element));
- decoration.setDirty(false);
- decoration.compute();
- // Update label
- StringBuffer output = new StringBuffer(25);
- if (decoration.getPrefix() != null) {
- output.append(decoration.getPrefix());
- }
- output.append(text);
- if (decoration.getSuffix() != null) {
- output.append(decoration.getSuffix());
- }
- return output.toString();
- }
- }
- return text;
- } catch (CVSException e) {
- return input;
- }
- }
- public Image decorateImage(Image base, Object element) {
- return base;
- }
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- if(property.equals(CVSUIPlugin.P_DECORATORS_CHANGED) || property.equals(TeamUI.GLOBAL_FILE_TYPES_CHANGED)) {
- Viewer viewer = configuration.getPage().getViewer();
- if(viewer instanceof StructuredViewer && !viewer.getControl().isDisposed()) {
- ((StructuredViewer)viewer).refresh(true);
- }
- }
- }
- public void dispose() {
- CVSUIPlugin.removePropertyChangeListener(this);
- TeamUI.removePropertyChangeListener(this);
- }
-
- protected String getRevisionNumber(ISynchronizeModelElement element) {
- if(element instanceof SyncInfoModelElement) {
- SyncInfo info = ((SyncInfoModelElement)element).getSyncInfo();
- if(info != null && info.getLocal().getType() == IResource.FILE && info instanceof CVSSyncInfo) {
- CVSSyncInfo cvsInfo = (CVSSyncInfo)info;
- ICVSRemoteResource remote = (ICVSRemoteResource) cvsInfo.getRemote();
- ICVSRemoteResource local;
- try {
- local = (ICVSRemoteFile) CVSWorkspaceRoot.getRemoteResourceFor(info.getLocal());
- } catch (CVSException e) {
- local = null;
- }
- if(local == null) {
- local = (ICVSRemoteResource)info.getBase();
- }
- StringBuffer revisionString = new StringBuffer();
- String remoteRevision = getRevisionString(remote);
- String localRevision = getRevisionString(local);
- if(localRevision != null) {
- revisionString.append(localRevision);
- }
- if(remoteRevision != null) {
- revisionString.append( (localRevision != null ? " - " : "") + remoteRevision); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return revisionString.toString();
- }
- }
- return null;
- }
-
- private String getRevisionString(ICVSRemoteResource remoteFile) {
- if(remoteFile instanceof RemoteFile) {
- return ((RemoteFile)remoteFile).getRevision();
- }
- return null;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberOperation.java
deleted file mode 100644
index 3b801323c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberOperation.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSSyncInfo;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
-import org.eclipse.team.internal.ccvs.core.client.PruneFolderVisitor;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizeModelOperation;
-
-public abstract class CVSSubscriberOperation extends SynchronizeModelOperation {
-
- protected CVSSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- super(configuration, elements);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- // Divide the sync info by project
- final Map projectSyncInfos = getProjectSyncInfoSetMap();
- monitor.beginTask(null, projectSyncInfos.size() * 100);
- for (Iterator iter = projectSyncInfos.keySet().iterator(); iter.hasNext(); ) {
- final IProject project = (IProject) iter.next();
- try {
- // Pass the scheduling rule to the synchronizer so that sync change events
- // and cache commits to disk are batched
- EclipseSynchronizer.getInstance().run(
- project,
- new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- try {
- CVSSubscriberOperation.this.run((SyncInfoSet)projectSyncInfos.get(project), monitor);
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- }
- }
- }, Policy.subMonitorFor(monitor, 100));
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- monitor.done();
- }
-
- /**
- * Run the operation on the sync info in the given set. The sync info will be all
- * from the same project.
- * @param set the sync info set
- * @param monitor a progress monitor
- */
- protected abstract void run(SyncInfoSet set, IProgressMonitor monitor) throws TeamException;
-
- /*
- * Indicate that the resource is out of sync if the sync state is not IN_SYNC
- * or if the local doesn't exist but the remote does.
- */
- protected boolean isOutOfSync(SyncInfo resource) {
- if (resource == null) return false;
- return (!(resource.getKind() == 0) ||
- (! resource.getLocal().exists() && resource.getRemote() != null));
- }
-
- protected void makeInSync(SyncInfo[] folders, IProgressMonitor monitor) throws TeamException {
- // If a node has a parent that is an incoming folder creation, we have to
- // create that folder locally and set its sync info before we can get the
- // node itself. We must do this for all incoming folder creations (recursively)
- // in the case where there are multiple levels of incoming folder creations.
- monitor.beginTask(null, folders.length);
- for (int i = 0; i < folders.length; i++) {
- SyncInfo resource = folders[i];
- makeInSync(resource);
- monitor.worked(1);
- }
- monitor.done();
- }
-
- protected boolean makeInSync(SyncInfo info) throws TeamException {
- if (isOutOfSync(info)) {
- SyncInfo parent = getParent(info);
- if (parent == null) {
- if (info.getLocal().getType() == IResource.ROOT) {
- // ROOT should be null
- return true;
- } else {
- // No other ancestors should be null. Log the problem.
- CVSUIPlugin.log(IStatus.WARNING, Policy.bind("CVSSubscriberAction.0", info.getLocal().getFullPath().toString()), null); //$NON-NLS-1$
- return false;
- }
- } else {
- if (!makeInSync(parent)) {
- // The failed makeInSync will log any errors
- return false;
- }
- }
- if (info instanceof CVSSyncInfo) {
- CVSSyncInfo cvsInfo= (CVSSyncInfo) info;
- IStatus status = cvsInfo.makeInSync();
- if (status.getSeverity() == IStatus.ERROR) {
- logError(status);
- return false;
- }
- return true;
- }
- return false;
- } else {
- return true;
- }
- }
-
- protected void makeOutgoing(SyncInfo[] folders, IProgressMonitor monitor) throws TeamException {
- // If a node has a parent that is an incoming folder creation, we have to
- // create that folder locally and set its sync info before we can get the
- // node itself. We must do this for all incoming folder creations (recursively)
- // in the case where there are multiple levels of incoming folder creations.
- monitor.beginTask(null, 100 * folders.length);
- for (int i = 0; i < folders.length; i++) {
- SyncInfo info = folders[i];
- makeOutgoing(info, Policy.subMonitorFor(monitor, 100));
- }
- monitor.done();
- }
-
- private void makeOutgoing(SyncInfo info, IProgressMonitor monitor) throws TeamException {
- if (info == null) return;
- if (info instanceof CVSSyncInfo) {
- CVSSyncInfo cvsInfo= (CVSSyncInfo) info;
- IStatus status = cvsInfo.makeOutgoing(monitor);
- if (status.getSeverity() == IStatus.ERROR) {
- logError(status);
- }
- }
- }
-
- /**
- * Log an error associated with an operation.
- * @param status
- */
- protected void logError(IStatus status) {
- CVSUIPlugin.log(status);
- }
-
- /**
- * Handle the exception by showing an error dialog to the user.
- * Sync actions seem to need to be sync-execed to work
- * @param t
- */
- protected void handle(Exception t) {
- CVSUIPlugin.openError(getShell(), getErrorTitle(), null, t, CVSUIPlugin.PERFORM_SYNC_EXEC | CVSUIPlugin.LOG_NONTEAM_EXCEPTIONS);
- }
-
- /**
- * Return the error title that will appear in any error dialogs shown to the user
- * @return
- */
- protected String getErrorTitle() {
- return null;
- }
-
- protected boolean canRunAsJob() {
- return true;
- }
-
- protected void pruneEmptyParents(SyncInfo[] nodes) throws CVSException {
- // TODO: A more explicit tie in to the pruning mechanism would be prefereable.
- // i.e. I don't like referencing the option and visitor directly
- if (!CVSProviderPlugin.getPlugin().getPruneEmptyDirectories()) return;
- ICVSResource[] cvsResources = new ICVSResource[nodes.length];
- for (int i = 0; i < cvsResources.length; i++) {
- cvsResources[i] = CVSWorkspaceRoot.getCVSResourceFor(nodes[i].getLocal());
- }
- new PruneFolderVisitor().visit(
- CVSWorkspaceRoot.getCVSFolderFor(ResourcesPlugin.getWorkspace().getRoot()),
- cvsResources);
- }
-
- public CVSSyncInfo getCVSSyncInfo(SyncInfo info) {
- if (info instanceof CVSSyncInfo) {
- return (CVSSyncInfo)info;
- }
- return null;
- }
-
- protected SyncInfo getParent(SyncInfo info) throws TeamException {
- return ((CVSSyncInfo)info).getSubscriber().getSyncInfo(info.getLocal().getParent());
- }
-
- protected IResource[] getIResourcesFrom(SyncInfo[] nodes) {
- List resources = new ArrayList(nodes.length);
- for (int i = 0; i < nodes.length; i++) {
- resources.add(nodes[i].getLocal());
- }
- return (IResource[]) resources.toArray(new IResource[resources.size()]);
- }
-
- /**
- * Prompt to overwrite those resources that could not be safely updated
- * Note: This method is designed to be overridden by test cases.
- *
- * @return whether to perform the overwrite
- */
- protected boolean promptForOverwrite(final SyncInfoSet syncSet) {
- final int[] result = new int[] {Dialog.CANCEL};
- TeamUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- public void run() {
- UpdateDialog dialog = new UpdateDialog(getShell(), syncSet);
- result[0] = dialog.open();
- }
- });
- return (result[0] == UpdateDialog.YES);
- }
-
- /**
- * Make the contents of the local resource match that of the remote
- * without modifying the sync info of the local resource.
- * If called on a new folder, the sync info will be copied.
- */
- protected void makeRemoteLocal(SyncInfo info, IProgressMonitor monitor) throws TeamException {
- IResourceVariant remote = info.getRemote();
- IResource local = info.getLocal();
- try {
- if(remote==null) {
- if (local.exists()) {
- local.delete(IResource.KEEP_HISTORY, monitor);
- }
- } else {
- if(remote.isContainer()) {
- ensureContainerExists(info);
- } else {
- monitor.beginTask(null, 200);
- try {
- IFile localFile = (IFile)local;
- if(local.exists()) {
- localFile.setContents(remote.getStorage(Policy.subMonitorFor(monitor, 100)).getContents(), false /*don't force*/, true /*keep history*/, Policy.subMonitorFor(monitor, 100));
- } else {
- ensureContainerExists(getParent(info));
- localFile.create(remote.getStorage(Policy.subMonitorFor(monitor, 100)).getContents(), false /*don't force*/, Policy.subMonitorFor(monitor, 100));
- }
- } finally {
- monitor.done();
- }
- }
- }
- } catch(CoreException e) {
- throw new CVSException(Policy.bind("UpdateMergeActionProblems_merging_remote_resources_into_workspace_1"), e); //$NON-NLS-1$
- }
- }
-
- private boolean ensureContainerExists(SyncInfo info) throws TeamException {
- IResource local = info.getLocal();
- // make sure that the parent exists
- if (!local.exists()) {
- if (!ensureContainerExists(getParent(info))) {
- return false;
- }
- }
- // make sure that the folder sync info is set;
- if (isOutOfSync(info)) {
- if (info instanceof CVSSyncInfo) {
- CVSSyncInfo cvsInfo = (CVSSyncInfo)info;
- IStatus status = cvsInfo.makeInSync();
- if (status.getSeverity() == IStatus.ERROR) {
- logError(status);
- return false;
- }
- }
- }
- // create the folder if it doesn't exist
- ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor((IContainer)local);
- if (!cvsFolder.exists()) {
- cvsFolder.mkdir();
- }
- return true;
- }
-
- /*
- * Divide the sync info for the operation by project
- */
- private Map getProjectSyncInfoSetMap() {
- Map map = new HashMap();
- SyncInfoSet all = getSyncInfoSet();
- SyncInfo[] infos = all.getSyncInfos();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- IProject project = info.getLocal().getProject();
- SyncInfoSet set = (SyncInfoSet)map.get(project);
- if (set == null) {
- set = new SyncInfoSet();
- map.put(project, set);
- }
- set.add(info);
- }
- return map;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeWizard.java
deleted file mode 100644
index 38ffdd435..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeWizard.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.wizards.CheckoutWizard;
-import org.eclipse.team.internal.ui.synchronize.SubscriberParticipantWizard;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor;
-import org.eclipse.team.ui.synchronize.ISynchronizeScope;
-import org.eclipse.team.ui.synchronize.SubscriberParticipant;
-
-/**
- * This is the class registered with the org.eclipse.team.ui.synchronizeWizard
- */
-public class CVSSynchronizeWizard extends SubscriberParticipantWizard {
-
- protected IResource[] getRootResources() {
- return CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().roots();
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.SubscriberParticipantWizard#getName()
- */
- protected String getName() {
- ISynchronizeParticipantDescriptor desc = TeamUI.getSynchronizeManager().getParticipantDescriptor(WorkspaceSynchronizeParticipant.ID);
- if(desc != null) {
- return desc.getName();
- } else {
- return Policy.bind("CVSSynchronizeWizard.0"); //$NON-NLS-1$
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.SubscriberParticipantWizard#createParticipant(org.eclipse.core.resources.IResource[])
- */
- protected SubscriberParticipant createParticipant(ISynchronizeScope scope) {
- // First check if there is an existing matching participant
- IResource[] roots = scope.getRoots();
- if (roots == null) {
- roots = CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().roots();
- }
- WorkspaceSynchronizeParticipant participant = (WorkspaceSynchronizeParticipant)SubscriberParticipant.getMatchingParticipant(WorkspaceSynchronizeParticipant.ID, roots);
- // If there isn't, create one and add to the manager
- if (participant == null) {
- return new WorkspaceSynchronizeParticipant(scope);
- } else {
- return participant;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.SubscriberParticipantWizard#getImportWizard()
- */
- protected IWizard getImportWizard() {
- return new CheckoutWizard();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CommitSetDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CommitSetDialog.java
deleted file mode 100644
index 089250d53..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CommitSetDialog.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.subscribers.ActiveChangeSet;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Dialog for creating and editing commit set
- * title and comment
- */
-public class CommitSetDialog extends Dialog {
-
- private final ActiveChangeSet set;
- private CommitCommentArea commitCommentArea;
- private Text nameText;
- private Button useTitleButton;
- private Button enterCommentButton;
- private final String title;
- private final String description;
- private String comment;
-
- public CommitSetDialog(Shell parentShell, ActiveChangeSet set, IResource[] files, String title, String description) {
- super(parentShell);
- this.set = set;
- this.title = title;
- this.description = description;
- if (files == null) {
- files = set.getResources();
- }
-
- int shellStyle = getShellStyle();
- setShellStyle(shellStyle | SWT.RESIZE | SWT.MAX);
- commitCommentArea = new CommitCommentArea();
- // Get a project from which the commit template can be obtained
- if (files.length > 0)
- commitCommentArea.setProject(files[0].getProject());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected Control createDialogArea(Composite parent) {
- getShell().setText(title);
- Composite composite = (Composite)super.createDialogArea(parent);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- createWrappingLabel(composite, description);
- createNameArea(composite);
-
- if (hasCommitTemplate()) {
- if (set.hasComment()) {
- // Only set the comment if the set has a custom comment.
- // Otherwise, the template should be used
- comment = set.getComment();
- commitCommentArea.setProposedComment(comment);
- }
- } else {
- comment = set.getComment();
- commitCommentArea.setProposedComment(comment);
- createOptionsArea(composite);
- }
-
- commitCommentArea.createArea(composite);
- commitCommentArea.addPropertyChangeListener(new IPropertyChangeListener() {
-
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty() == CommitCommentArea.OK_REQUESTED) {
- okPressed();
- } else if (event.getProperty() == CommitCommentArea.COMMENT_MODIFIED) {
- comment = (String)event.getNewValue();
- updateEnablements();
- }
- }
- });
-
- initializeValues();
- updateEnablements();
-
- // set F1 help
- WorkbenchHelp.setHelp(composite, IHelpContextIds.COMMIT_SET_DIALOG);
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- private void createNameArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = 0;
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- layout.numColumns = 2;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- composite.setFont(parent.getFont());
-
- Label label = new Label(composite, SWT.NONE);
- label.setText(Policy.bind("CommitSetDialog.0")); //$NON-NLS-1$
- label.setLayoutData(new GridData(GridData.BEGINNING));
-
- nameText = new Text(composite, SWT.BORDER);
- nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- nameText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- updateEnablements();
- }
- });
- }
-
- private void initializeValues() {
- String initialText = set.getTitle();
- if (initialText == null) initialText = ""; //$NON-NLS-1$
- nameText.setText(initialText);
-
- if (useTitleButton != null) {
- useTitleButton.setSelection(!set.hasComment());
- enterCommentButton.setSelection(set.hasComment());
- }
- }
-
- private void createOptionsArea(Composite composite) {
- useTitleButton = createRadioButton(composite, Policy.bind("CommitSetDialog.2")); //$NON-NLS-1$
- enterCommentButton = createRadioButton(composite, Policy.bind("CommitSetDialog.3")); //$NON-NLS-1$
- SelectionAdapter listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateEnablements();
- }
- };
- useTitleButton.addSelectionListener(listener);
- enterCommentButton.addSelectionListener(listener);
-
- }
-
- private Button createRadioButton(Composite parent, String label) {
- Button button = new Button(parent, SWT.RADIO);
- button.setText(label);
- button.setLayoutData(new GridData());
- return button;
- }
-
- private void updateEnablements() {
- commitCommentArea.setEnabled(isUseCustomComment());
- String name = nameText.getText();
- if (name == null && name.length() == 0) {
- setPageComplete(false);
- return;
- }
- if (isUseCustomComment()) {
- if (comment == null || comment.length() == 0) {
- setPageComplete(false);
- return;
- }
- }
- setPageComplete(true);
- }
-
- final protected void setPageComplete(boolean complete) {
- Button okButton = getButton(IDialogConstants.OK_ID);
- if(okButton != null ) {
- okButton.setEnabled(complete);
- }
- }
-
- private boolean hasCommitTemplate() {
- return commitCommentArea.hasCommitTemplate();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#okPressed()
- */
- protected void okPressed() {
- set.setTitle(nameText.getText());
- if (isUseCustomComment()) {
- // Call getComment so the comment gets saved
- set.setComment(commitCommentArea.getComment());
- } else {
- set.setComment(null);
- }
- super.okPressed();
- }
-
- private boolean isUseCustomComment() {
- return enterCommentButton == null || enterCommentButton.getSelection();
- }
-
- protected Label createWrappingLabel(Composite parent, String text) {
- Label label = new Label(parent, SWT.LEFT | SWT.WRAP);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = 1;
- data.horizontalAlignment = GridData.FILL;
- data.horizontalIndent = 0;
- data.grabExcessHorizontalSpace = true;
- data.widthHint = 200;
- label.setLayoutData(data);
- return label;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createButtonBar(org.eclipse.swt.widgets.Composite)
- */
- protected Control createButtonBar(Composite parent) {
- Control control = super.createButtonBar(parent);
- updateEnablements();
- return control;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipant.java
deleted file mode 100644
index fa088f061..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareParticipant.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.util.Arrays;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
-import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.subscribers.SubscriberChangeSetCollector;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.internal.ccvs.core.CVSCompareSubscriber;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.actions.ShowAnnotationAction;
-import org.eclipse.team.internal.ccvs.ui.actions.ShowResourceInHistoryAction;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.*;
-
-public class CompareParticipant extends CVSParticipant implements IPropertyChangeListener {
-
- public static final String CONTEXT_MENU_CONTRIBUTION_GROUP = "context_group_1"; //$NON-NLS-1$
- public static final String NON_MODAL_CONTEXT_MENU_CONTRIBUTION_GROUP = "context_group_2"; //$NON-NLS-1$
-
- /**
- * Actions for the compare particpant's toolbar
- */
- public class CompareParticipantActionContribution extends SynchronizePageActionGroup {
- public void initialize(ISynchronizePageConfiguration configuration) {
- super.initialize(configuration);
-
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP,
- new CompareRevertAction(configuration));
-
- if (!configuration.getSite().isModal()) {
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- NON_MODAL_CONTEXT_MENU_CONTRIBUTION_GROUP,
- new CVSActionDelegateWrapper(new ShowAnnotationAction(), configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- NON_MODAL_CONTEXT_MENU_CONTRIBUTION_GROUP,
- new CVSActionDelegateWrapper(new ShowResourceInHistoryAction(), configuration));
- }
- }
- }
-
- private SyncInfoFilter contentComparison = new SyncInfoFilter() {
- private SyncInfoFilter contentCompare = new SyncInfoFilter.ContentComparisonSyncInfoFilter();
- public boolean select(SyncInfo info, IProgressMonitor monitor) {
- // Want to select infos whose contents do not match
- return !contentCompare.select(info, monitor);
- }
- };
-
- public CompareParticipant(CVSCompareSubscriber subscriber) {
- setSubscriber(subscriber);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant#setSubscriber(org.eclipse.team.core.subscribers.Subscriber)
- */
- protected void setSubscriber(Subscriber subscriber) {
- super.setSubscriber(subscriber);
- if (CVSUIPlugin.getPlugin().getPluginPreferences().getBoolean(ICVSUIConstants.PREF_CONSIDER_CONTENTS)) {
- setSyncInfoFilter(contentComparison);
- }
- try {
- ISynchronizeParticipantDescriptor descriptor = TeamUI.getSynchronizeManager().getParticipantDescriptor(CVSCompareSubscriber.ID);
- setInitializationData(descriptor);
- CVSCompareSubscriber s = getCVSCompareSubscriber();
- setSecondaryId(s.getId().getLocalName());
- } catch (CoreException e) {
- CVSUIPlugin.log(e);
- }
- CVSUIPlugin.getPlugin().getPluginPreferences().addPropertyChangeListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#getName()
- */
- public String getName() {
- return Policy.bind("CompareParticipant.0", getSubscriber().getName(), Utils.convertSelection(getSubscriber().roots())); //$NON-NLS-1$
- }
-
- /*
- * Returns a merge participant that exist and is configured with the given set of resources, start, and end tags.
- */
- public static CompareParticipant getMatchingParticipant(IResource[] resources, CVSTag tag) {
- ISynchronizeParticipantReference[] refs = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
- for (int i = 0; i < refs.length; i++) {
- ISynchronizeParticipantReference reference = refs[i];
- if (reference.getId().equals(CVSCompareSubscriber.ID)) {
- try {
- CompareParticipant p = (CompareParticipant) reference.getParticipant();
- if (p.matches(resources, tag)) {
- return p;
- }
- } catch (TeamException e) {
- continue;
- }
- }
- }
- return null;
- }
-
- /**
- * Return whether this compare subscriber matches persisly the
- * provided list of resources and the single tag.
- * @param resources the resources
- * @param tag the tag
- * @return whether this compare subscriber matches persisly the
- * provided list of resources and the single tag
- */
- protected boolean matches(IResource[] resources, CVSTag tag) {
- CVSTag existingTag = getCVSCompareSubscriber().getTag();
- // The tag can be null if the compare participant has a different tag for each root
- if (existingTag != null) {
- IResource[] roots = getResources();
- Arrays.sort(resources, Utils.resourceComparator);
- Arrays.sort(roots, Utils.resourceComparator);
- if (Arrays.equals(resources, roots) && existingTag.equals(tag)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Return the subscriber as an instance of CVSCompareSubscriber.
- * @return the subscriber as an instance of CVSCompareSubscriber
- */
- public CVSCompareSubscriber getCVSCompareSubscriber() {
- return (CVSCompareSubscriber)getSubscriber();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.subscribers.SubscriberParticipant#initializeConfiguration(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
- protected void initializeConfiguration(ISynchronizePageConfiguration configuration) {
- super.initializeConfiguration(configuration);
- configuration.addMenuGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP);
- configuration.addMenuGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- NON_MODAL_CONTEXT_MENU_CONTRIBUTION_GROUP);
- configuration.addActionContribution(new CompareParticipantActionContribution());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SubscriberParticipant#dispose()
- */
- public void dispose() {
- super.dispose();
- CVSUIPlugin.getPlugin().getPluginPreferences().removePropertyChangeListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.Preferences.IPropertyChangeListener#propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(ICVSUIConstants.PREF_CONSIDER_CONTENTS)) {
- if (CVSUIPlugin.getPlugin().getPluginPreferences().getBoolean(ICVSUIConstants.PREF_CONSIDER_CONTENTS)) {
- setSyncInfoFilter(contentComparison);
- } else {
- setSyncInfoFilter(new FastSyncInfoFilter());
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SubscriberParticipant#getLongTaskName()
- */
- protected String getLongTaskName() {
- return getName();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SubscriberParticipant#getShortTaskName()
- */
- protected String getShortTaskName() {
- return Policy.bind("Participant.comparing"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSParticipant#createChangeSetCapability()
- */
- protected CVSChangeSetCapability createChangeSetCapability() {
- return new CVSChangeSetCapability() {
- public SubscriberChangeSetCollector getActiveChangeSetManager() {
- return CVSUIPlugin.getPlugin().getChangeSetManager();
- }
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ChangeSetCapability#enableActiveChangeSetsFor(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
- public boolean enableActiveChangeSetsFor(ISynchronizePageConfiguration configuration) {
- return super.enableActiveChangeSetsFor(configuration) ||
- configuration.getComparisonType() == ISynchronizePageConfiguration.TWO_WAY;
- }
- };
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertAction.java
deleted file mode 100644
index 5d60a4cd8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertAction.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizeModelOperation;
-
-/**
- * Action in compare editor that reverts the local contents to match the contents on the server.
- */
-public class CompareRevertAction extends CVSParticipantAction {
-
- public CompareRevertAction(ISynchronizePageConfiguration configuration) {
- super(configuration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.SubscriberAction#getSubscriberOperation(org.eclipse.compare.structuremergeviewer.IDiffElement[])
- */
- protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- return new CompareRevertOperation(configuration, elements);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertOperation.java
deleted file mode 100644
index fb34070b3..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CompareRevertOperation.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-
-
-public class CompareRevertOperation extends CVSSubscriberOperation {
- protected CompareRevertOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- super(configuration, elements);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberAction#getJobName()
- */
- protected String getJobName() {
- SyncInfoSet syncSet = getSyncInfoSet();
- return Policy.bind("CompareRevertAction.0", new Integer(syncSet.size()).toString()); //$NON-NLS-1$
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberAction#run(org.eclipse.team.core.subscribers.MutableSyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void run(SyncInfoSet syncSet, IProgressMonitor monitor) throws TeamException {
- SyncInfo[] changed = syncSet.getSyncInfos();
- if (changed.length == 0) return;
-
- if(! promptForOverwrite(syncSet)) return;
-
- // The list of sync resources to be updated using "cvs update"
- List updateShallow = new ArrayList();
- // A list of sync resource folders which need to be created locally
- // (incoming addition or previously pruned)
- Set parentCreationElements = new HashSet();
-
- for (int i = 0; i < changed.length; i++) {
- SyncInfo changedNode = changed[i];
-
- // Make sure that parent folders exist
- SyncInfo parent = getParent(changedNode);
- if (parent != null && isOutOfSync(parent)) {
- // We need to ensure that parents that are either incoming folder additions
- // or previously pruned folders are recreated.
- parentCreationElements.add(parent);
- }
-
- IResource resource = changedNode.getLocal();
- if (resource.getType() == IResource.FILE) {
- if (changedNode.getLocal().exists()) {
- updateShallow.add(changedNode);
- } else if (changedNode.getRemote() != null) {
- updateShallow.add(changedNode);
- }
- } else {
- // Special handling for folders to support shallow operations on files
- // (i.e. folder operations are performed using the sync info already
- // contained in the sync info.
- if (isOutOfSync(changedNode)) {
- parentCreationElements.add(changedNode);
- }
- }
-
- }
- try {
- monitor.beginTask(null, 100);
-
- if (parentCreationElements.size() > 0) {
- makeInSync((SyncInfo[]) parentCreationElements.toArray(new SyncInfo[parentCreationElements.size()]), Policy.subMonitorFor(monitor, 25));
- }
- if (updateShallow.size() > 0) {
- runUpdate((SyncInfo[])updateShallow.toArray(new SyncInfo[updateShallow.size()]), Policy.subMonitorFor(monitor, 75));
- }
- } finally {
- monitor.done();
- }
- return;
- }
-
- private void runUpdate(SyncInfo[] infos, IProgressMonitor monitor) throws TeamException {
- monitor.beginTask(null, 100 * infos.length);
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- makeRemoteLocal(info, Policy.subMonitorFor(monitor, 100));
- }
- monitor.done();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ConfirmMergedAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ConfirmMergedAction.java
deleted file mode 100644
index 3ceb50829..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ConfirmMergedAction.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizeModelOperation;
-
-public class ConfirmMergedAction extends CVSParticipantAction {
-
- public ConfirmMergedAction(ISynchronizePageConfiguration configuration) {
- super(configuration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.SubscriberAction#getSyncInfoFilter()
- */
- protected FastSyncInfoFilter getSyncInfoFilter() {
- return new SyncInfoDirectionFilter(new int[] {SyncInfo.CONFLICTING});
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.SubscriberAction#getSubscriberOperation(org.eclipse.compare.structuremergeviewer.IDiffElement[])
- */
- protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- return new ConfirmMergedOperation(configuration, elements);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ConfirmMergedOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ConfirmMergedOperation.java
deleted file mode 100644
index 52e245920..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/ConfirmMergedOperation.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSSyncInfo;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-
-/**
- * This action marks the local resource as merged by updating the base
- * resource revision to match the remote resource revision
- */
-public class ConfirmMergedOperation extends CVSSubscriberOperation {
-
- public ConfirmMergedOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- super(configuration, elements);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.TeamOperation#getJobName()
- */
- protected String getJobName() {
- SyncInfoSet syncSet = getSyncInfoSet();
- return Policy.bind("SubscriberConfirmMergedAction.jobName", new Integer(syncSet.size()).toString()); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberOperation#run(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void run(SyncInfoSet syncSet, IProgressMonitor monitor) throws CVSException {
- SyncInfo[] syncResources = syncSet.getSyncInfos();
- monitor.beginTask(null, 100 * syncResources.length);
- try {
- for (int i = 0; i < syncResources.length; i++) {
- SyncInfo info = syncResources[i];
- if (!makeOutgoing(info, Policy.subMonitorFor(monitor, 100))) {
- // Failure was logged in makeOutgoing
- }
- }
- } catch (TeamException e) {
- handle(e);
- } finally {
- monitor.done();
- }
- }
-
- private boolean makeOutgoing(SyncInfo info, IProgressMonitor monitor) throws CVSException, TeamException {
- monitor.beginTask(null, 100);
- try {
- CVSSyncInfo cvsInfo = getCVSSyncInfo(info);
- if (cvsInfo == null) {
- CVSUIPlugin.log(IStatus.ERROR, Policy.bind("SubscriberConfirmMergedAction.0", cvsInfo.getLocal().getFullPath().toString()), null); //$NON-NLS-1$
- return false;
- }
- // Make sure the parent is managed
- ICVSFolder parent = CVSWorkspaceRoot.getCVSFolderFor(cvsInfo.getLocal().getParent());
- if (!parent.isCVSFolder()) {
- // the parents must be made outgoing before the child can
- SyncInfo parentInfo = cvsInfo.getSubscriber().getSyncInfo(parent.getIResource());
- if (!makeOutgoing(parentInfo, Policy.subMonitorFor(monitor, 20))) {
- return false;
- }
- }
- IStatus status = cvsInfo.makeOutgoing(Policy.subMonitorFor(monitor, 80));
- if (status.getSeverity() == IStatus.ERROR) {
- logError(status);
- return false;
- }
- return true;
- } finally {
- monitor.done();
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/LogEntryCacheUpdateHandler.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/LogEntryCacheUpdateHandler.java
deleted file mode 100644
index b25c68d05..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/LogEntryCacheUpdateHandler.java
+++ /dev/null
@@ -1,666 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.lang.ref.SoftReference;
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFile;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.Util;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation;
-import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation.LogEntryCache;
-import org.eclipse.team.internal.core.BackgroundEventHandler;
-import org.eclipse.team.internal.core.subscribers.SubscriberResourceCollector;
-import org.eclipse.team.ui.synchronize.*;
-
-/**
- * This class wraps a LogEntryCache in order to clear entries once they are no longer
- * in the subscriber.
- */
-public class LogEntryCacheUpdateHandler extends BackgroundEventHandler {
-
- private static final int REMOVAL = 1;
- private static final int CHANGE = 2;
- private static final int FETCH_REQUEST = 3;
- private static final int PAUSE = 4;
-
- /*
- * Lock used to ensure that fetches are queued when the job is
- * a non-system job.
- */
- private final Object queueLock = new Object();
-
- /*
- * Exception used to stop processing so the job can be restarted as a non-system job
- */
- private static final OperationCanceledException PAUSE_EXCEPTION = new OperationCanceledException();
-
- /*
- * Contants for configuring how long to wait for the job to be paused
- * when a fetch is required and the job needs to be converted to a non-system
- * job. If the wait time is elapsed, an exception is thrown.
- */
- private static final int WAIT_INCREMENT = 10;
- private static final int MAX_WAIT = 1000;
-
- /*
- * Set that keeps track of all resource for which we haved fetched log entries
- */
- private final SyncInfoTree collectedInfos = new SyncInfoTree();
-
- /*
- * The cache that hold the log entries while the job is running
- */
- //private LogEntryCache logEntriesCache;
-
- /*
- * SoftReference used to hold on to the log entry cache while
- * the job is not running so the cache can be cleared if memory is low.
- */
- private SoftReference cacheReference;
-
- /*
- * Collector that forewards subscriber changes so that
- * stale cache entries can be cleared.
- */
- private final LogEntryResourceCollector collector;
-
- /*
- * The subscriber generating the SyncInfo and log entries
- */
- private final Subscriber subscriber;
-
- /*
- * The accumulated list of updates that need to be dispatched
- * (i.e. the cache should be purged of out-of-date resources).
- * This list is only modified and accessed from the event processing
- * thread.
- */
- private final List updates = new ArrayList();
-
- /*
- * The accumulated list of fetches that have been requested
- */
- private final List fetches = new ArrayList();
- private final ISynchronizePageConfiguration configuration;
-
-
- /*
- * Interface for notifying a single client that the infos have been fetched
- */
- public interface ILogsFetchedListener {
-
- void logEntriesFetched(SyncInfoSet set, LogEntryCache logEntryCache, IProgressMonitor monitor);
-
- }
-
- /*
- * The listener or null if noone is listening
- */
- private ILogsFetchedListener listener;
-
- /*
- * Subscriber resource collector that forwards subscriber changes
- * through the handler so that stale cache entries can be cleared
- */
- private class LogEntryResourceCollector extends SubscriberResourceCollector {
-
- public LogEntryResourceCollector(Subscriber subscriber) {
- super(subscriber);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.SubscriberResourceCollector#remove(org.eclipse.core.resources.IResource)
- */
- protected void remove(IResource resource) {
- queueEvent(new ResourceEvent(resource, REMOVAL, IResource.DEPTH_INFINITE), false /* do not put in on the front of the queue*/);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.SubscriberResourceCollector#change(org.eclipse.core.resources.IResource, int)
- */
- protected void change(IResource resource, int depth) {
- queueEvent(new ResourceEvent(resource, CHANGE, depth), false /* do not put in on the front of the queue*/);
- }
- }
-
- /*
- * Custom event for queue a log entry fetch request
- */
- private class FetchRequest extends Event {
- private final SyncInfo[] infos;
- public FetchRequest(SyncInfo[] infos) {
- super(FETCH_REQUEST);
- this.infos = infos;
- }
- public SyncInfo[] getInfos() {
- return infos;
- }
- }
-
- public LogEntryCacheUpdateHandler(ISynchronizePageConfiguration configuration) {
- super(Policy.bind("LogEntryCacheUpdateHandler.1"), Policy.bind("LogEntryCacheUpdateHandler.0")); //$NON-NLS-1$ //$NON-NLS-2$
- this.configuration = configuration;
- this.subscriber = getSubscriber(configuration);
- cacheReference = new SoftReference(new LogEntryCache());
- collector = new LogEntryResourceCollector(subscriber);
- }
-
- private Subscriber getSubscriber(ISynchronizePageConfiguration configuration) {
- return ((SubscriberParticipant)configuration.getParticipant()).getSubscriber();
- }
-
- public ISynchronizePageConfiguration getConfiguration() {
- return configuration;
- }
-
- public Subscriber getSubscriber() {
- return subscriber;
- }
-
- /**
- * Set the listener that should receive notification when log entries
- * have been fetched and are avalable.
- * @param listener the listener or <code>null</code>
- */
- public void setListener(ILogsFetchedListener listener) {
- this.listener = listener;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.BackgroundEventHandler#getJobFamiliy()
- */
- protected Object getJobFamiliy() {
- return ISynchronizeManager.FAMILY_SYNCHRONIZE_OPERATION;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.BackgroundEventHandler#createEventHandlingJob()
- */
- protected void createEventHandlingJob() {
- super.createEventHandlingJob();
- Job job = getEventHandlerJob();
- job.setSystem(false);
- job.setUser(false);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.BackgroundEventHandler#processEvent(org.eclipse.team.internal.core.BackgroundEventHandler.Event, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void processEvent(Event event, IProgressMonitor monitor) throws CoreException {
- switch (event.getType()) {
- case REMOVAL:
- case CHANGE:
- updates.add(event);
- break;
- case FETCH_REQUEST:
- fetches.add(event);
- break;
- case PAUSE:
- throw PAUSE_EXCEPTION;
- }
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.BackgroundEventHandler#doDispatchEvents(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected boolean doDispatchEvents(IProgressMonitor monitor) throws TeamException {
- boolean dispatched = false;
- monitor.beginTask(null, 50);
- dispatched |= updateCache(Policy.subMonitorFor(monitor, 20));
- dispatched |= processQueuedFetches(Policy.subMonitorFor(monitor, 80));
- monitor.done();
- return dispatched;
- }
-
- /*
- * Remove any stale or unneeded log entries from the cache.
- * Return whether there were any entries to purge.
- */
- private boolean updateCache(IProgressMonitor monitor) {
- if (updates.isEmpty()) return false;
- try {
- collectedInfos.beginInput();
- // Cycle through the update events
- for (Iterator iter = updates.iterator(); iter.hasNext();) {
- Event event = (Event) iter.next();
- Policy.checkCanceled(monitor);
- if (event.getType() == REMOVAL) {
- remove(event.getResource(), ((ResourceEvent)event).getDepth());
- } else if (event.getType() == CHANGE) {
- change(event.getResource(), ((ResourceEvent)event).getDepth());
- }
- // Use the iterator to remove so that updates will not be lost
- // if the job is cancelled and then restarted.
- iter.remove();
- }
- } finally {
- collectedInfos.endInput(monitor);
- }
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.BackgroundEventHandler#shutdown()
- */
- public void shutdown() {
- super.shutdown();
- collector.dispose();
- // Probably not necessary as GC would take care of it but we'll do it anyway
- if (cacheReference != null) {
- LogEntryCache cache = (LogEntryCache)cacheReference.get();
- if (cache != null) {
- cache.clearEntries();
- }
- }
- collectedInfos.clear();
-
- }
-
- private void remove(IResource resource, int depth) {
- collectedInfos.remove(resource, depth);
- }
-
- private void remove(SyncInfo info) {
- if (info != null) {
- collectedInfos.remove(info.getLocal());
- LogEntryCache cache = (LogEntryCache)cacheReference.get();
- if (cache != null)
- cache.clearEntries(getRemoteResource(info));
- }
- }
-
- protected ICVSRemoteResource getRemoteResource(SyncInfo info) {
- try {
- ICVSRemoteResource remote = (ICVSRemoteResource) info.getRemote();
- ICVSRemoteResource local = CVSWorkspaceRoot.getRemoteResourceFor(info.getLocal());
- if(local == null) {
- local = (ICVSRemoteResource)info.getBase();
- }
-
- boolean useRemote = true;
- if (local != null && remote != null) {
- String remoteRevision = getRevisionString(remote);
- String localRevision = getRevisionString(local);
- useRemote = useRemote(localRevision, remoteRevision);
- } else if (remote == null) {
- useRemote = false;
- }
- if (useRemote) {
- return remote;
- } else if (local != null) {
- return local;
- }
- return null;
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- return null;
- }
- }
-
- private boolean useRemote(String localRevision, String remoteRevision) {
- boolean useRemote;
- if (remoteRevision == null && localRevision == null) {
- useRemote = true;
- } else if (localRevision == null) {
- useRemote = true;
- } else if (remoteRevision == null) {
- useRemote = false;
- } else {
- useRemote = ResourceSyncInfo.isLaterRevision(remoteRevision, localRevision);
- }
- return useRemote;
- }
-
- private String getRevisionString(ICVSRemoteResource remoteFile) {
- if(remoteFile instanceof RemoteFile) {
- return ((RemoteFile)remoteFile).getRevision();
- }
- return null;
- }
-
- private void change(IResource resource, int depth) {
- // We only need to remove collected log entries that don't apply
- // any longer. They will be refetched when they are required.
- SyncInfo[] collected = collectedInfos.getSyncInfos(resource, depth);
- change(collected);
- }
-
- private void change(SyncInfo[] collected) {
- Subscriber subscriber = getSubscriber();
- for (int i = 0; i < collected.length; i++) {
- try {
- SyncInfo info = collected[i];
- SyncInfo newInfo = subscriber.getSyncInfo(info.getLocal());
- if (newInfo == null || !newInfo.equals(info)) {
- // The cached log entry no longer applies to the new sync info.
- // It will be refetched when required.
- remove(info);
- }
- } catch (TeamException e) {
- // Log and continue
- CVSUIPlugin.log(e);
- }
- }
- }
-
- /**
- * Queue a request to fetch log entries for the given SyncInfo nodes.
- * The event handler must be a non-system job when revision histories
- * are fetched.
- * @param infos the nodes whose log entries are to be fetched
- */
- public void fetch(SyncInfo[] infos) throws CVSException {
- synchronized(queueLock) {
- Job job = getEventHandlerJob();
- if (job.isSystem() && job.getState() != Job.NONE) {
- // queue an event to pause the processor
- super.queueEvent(new Event(PAUSE), true /* put on the front of the queue */);
- int count = 0;
- while (job.getState() != Job.NONE && count < MAX_WAIT) {
- count += WAIT_INCREMENT;
- try {
- Thread.sleep(WAIT_INCREMENT); // Wait a little while
- } catch (InterruptedException e) {
- // Ignore
- }
- }
- if (job.getState() != Job.NONE) {
- // The job never completed in the time aloted so throw an exception
- throw new CVSException(Policy.bind("LogEntryCacheUpdateHandler.2")); //$NON-NLS-1$
- }
- }
- // Queue the event even if the job didn't stop in the time aloted
- queueEvent(new FetchRequest(infos), false /* don't place at the end */);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.BackgroundEventHandler#queueEvent(org.eclipse.team.internal.core.BackgroundEventHandler.Event, boolean)
- */
- protected void queueEvent(Event event, boolean front) {
- // Override to snure that queues by this handler are serialized
- synchronized(queueLock) {
- Job job = getEventHandlerJob();
- if (job.getState() == Job.NONE) {
- job.setSystem(event.getType() != FETCH_REQUEST);
- }
- super.queueEvent(event, front);
- }
- }
-
- /*
- * Method invoked during event dispatch to fetch log entries
- */
- private boolean processQueuedFetches(IProgressMonitor monitor) {
- if (fetches.isEmpty()) return false;
- try {
- // Now perform the fetching
- Map projectMapping = getFetchesByProject();
- if (projectMapping.isEmpty()) return true;
- LogEntryCache logEntriesCache = (LogEntryCache)cacheReference.get();
- if (logEntriesCache == null) {
- logEntriesCache = new LogEntryCache();
- cacheReference = new SoftReference(logEntriesCache);
- }
- monitor.beginTask(Policy.bind("CVSChangeSetCollector.4"), 100 * projectMapping.size()); //$NON-NLS-1$
- monitor.setTaskName(Policy.bind("CVSChangeSetCollector.4")); //$NON-NLS-1$
- for (Iterator iter = projectMapping.values().iterator(); iter.hasNext();) {
- SyncInfoSet set = (SyncInfoSet) iter.next();
- fetchLogEntries(logEntriesCache, set, Policy.subMonitorFor(monitor, 90));
- fireFetchedNotification(logEntriesCache, set, Policy.subMonitorFor(monitor, 10));
- }
- } finally {
- // Clear the fetches even if we were cancelled.
- // Restarting will need to re-request all infos
- fetches.clear();
- monitor.done();
- }
- return true;
- }
-
- private void fireFetchedNotification(LogEntryCache logEntriesCache, SyncInfoSet set, IProgressMonitor monitor) {
- if (listener != null) {
- listener.logEntriesFetched(set, logEntriesCache, monitor);
- }
- }
-
- /*
- * Return a map of IProject to SyncInfoSet as that is how entries are fetched.
- * The set for each project includes all infos from the original set.
- * This is one so that the completion notification contains all infos
- * including those were a fetch was not required either because the
- * entry was already cached or the resource has no history.
- */
- private Map getFetchesByProject() {
- Map result = new HashMap();
- for (Iterator iter = fetches.iterator(); iter.hasNext();) {
- FetchRequest request = (FetchRequest) iter.next();
- SyncInfo[] infos = request.getInfos();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- IProject project = info.getLocal().getProject();
- SyncInfoSet infoSet = (SyncInfoSet)result.get(project);
- if (infoSet == null) {
- infoSet = new SyncInfoSet();
- result.put(project, infoSet);
- }
- infoSet.add(info);
- }
- }
- return result;
- }
-
- private boolean isFetchRequired(SyncInfo info) {
- // We only need to fetch if we don't have the log entry already
- // and the change is a remote change
- return info.getLocal().getType() == IResource.FILE && !isLogEntryCached(info) && isRemoteChange(info);
-
- }
-
- /*
- * Return whether the given SyncInfo is cached. If there is
- * an info for the resource that does not match the given info,
- * it is removed and false is returned.
- */
- private boolean isLogEntryCached(SyncInfo info) {
- SyncInfo collectedInfo = collectedInfos.getSyncInfo(info.getLocal());
- if (collectedInfo != null && !collectedInfo.equals(info)) {
- remove(collectedInfo);
- collectedInfo = null;
- }
- return collectedInfo != null;
- }
-
- /*
- * Return if this sync info should be considered as part of a remote change
- * meaning that it can be placed inside an incoming commit set (i.e. the
- * set is determined using the comments from the log entry of the file).
- */
- protected boolean isRemoteChange(SyncInfo info) {
- int kind = info.getKind();
- if(info.getLocal().getType() != IResource.FILE) return false;
- if(info.getComparator().isThreeWay()) {
- return (kind & SyncInfo.DIRECTION_MASK) != SyncInfo.OUTGOING;
- }
- // For two-way, the change is only remote if it has a remote or has a base locally
- if (info.getRemote() != null) return true;
- ICVSFile file = CVSWorkspaceRoot.getCVSFileFor((IFile)info.getLocal());
- try {
- return file.getSyncBytes() != null;
- } catch (CVSException e) {
- // Log the error and exclude the file from consideration
- CVSUIPlugin.log(e);
- return false;
- }
- }
-
- /*
- * Fetch the log entries for the info in the given set
- */
- private void fetchLogEntries(LogEntryCache logEntriesCache, SyncInfoSet set, IProgressMonitor monitor) {
- try {
- if (subscriber instanceof CVSCompareSubscriber) {
- CVSCompareSubscriber compareSubscriber = (CVSCompareSubscriber)subscriber;
- fetchLogEntries(logEntriesCache, compareSubscriber, set, monitor);
- } else {
- // Run the log command once with no tags
- fetchLogs(logEntriesCache, set, null, null, monitor);
- }
- } catch (CVSException e) {
- handleException(e);
- } catch (InterruptedException e) {
- throw new OperationCanceledException();
- }
-
- }
-
- private void fetchLogEntries(LogEntryCache logEntriesCache, CVSCompareSubscriber compareSubscriber, SyncInfoSet set, IProgressMonitor monitor) throws CVSException, InterruptedException {
- Map localTagMap = getLocalTagMap(set);
- monitor.beginTask(null, 100 * localTagMap.size());
- for (Iterator iter = localTagMap.keySet().iterator(); iter.hasNext();) {
- CVSTag localTag = (CVSTag) iter.next();
- fetchLogEntries(logEntriesCache, compareSubscriber, set, localTag, Policy.subMonitorFor(monitor, 100));
- }
- Policy.checkCanceled(monitor);
- monitor.done();
- }
-
- /*
- * Return the resources grouped by the tag found in the
- * workspace. The map is CVSTag->SyncInfoSet
- */
- private Map getLocalTagMap(SyncInfoSet set) {
- Map result = new HashMap();
- for (Iterator iter = set.iterator(); iter.hasNext();) {
- SyncInfo info = (SyncInfo) iter.next();
- CVSTag tag = getLocalTag(info);
- SyncInfoSet tagSet = (SyncInfoSet)result.get(tag);
- if (tagSet == null) {
- tagSet = new SyncInfoSet();
- result.put(tag, tagSet);
- }
- tagSet.add(info);
- }
- return result;
- }
-
- private CVSTag getLocalTag(SyncInfo syncInfo) {
- try {
- IResource local = syncInfo.getLocal();
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(local);
- CVSTag tag = null;
- if(cvsResource.isFolder()) {
- FolderSyncInfo info = ((ICVSFolder)cvsResource).getFolderSyncInfo();
- if(info != null) {
- tag = info.getTag();
- }
- if (tag != null && tag.getType() == CVSTag.BRANCH) {
- tag = Util.getAccurateFolderTag(local, tag);
- }
- } else {
- tag = Util.getAccurateFileTag(cvsResource);
- }
- if(tag == null) {
- tag = new CVSTag();
- }
- return tag;
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- return new CVSTag();
- }
- }
-
- private void fetchLogEntries(LogEntryCache logEntriesCache, CVSCompareSubscriber compareSubscriber, SyncInfoSet set, CVSTag localTag, IProgressMonitor monitor) throws CVSException, InterruptedException {
- if (compareSubscriber.isMultipleTagComparison()) {
- Map rootToInfoMap = getRootToInfoMap(compareSubscriber, set);
- monitor.beginTask(null, 100 * rootToInfoMap.size());
- for (Iterator iterator = rootToInfoMap.keySet().iterator(); iterator.hasNext();) {
- IResource root = (IResource) iterator.next();
- Policy.checkCanceled(monitor);
- fetchLogs(logEntriesCache, set, localTag, compareSubscriber.getTag(root), Policy.subMonitorFor(monitor, 100));
- }
- monitor.done();
- } else {
- Policy.checkCanceled(monitor);
- fetchLogs(logEntriesCache, set, localTag, compareSubscriber.getTag(), monitor);
- }
- }
-
- private Map getRootToInfoMap(CVSCompareSubscriber compareSubscriber, SyncInfoSet set) {
- Map rootToInfosMap = new HashMap();
- IResource[] roots = compareSubscriber.roots();
- for (Iterator iter = set.iterator(); iter.hasNext();) {
- SyncInfo info = (SyncInfo) iter.next();
- IPath localPath = info.getLocal().getFullPath();
- for (int j = 0; j < roots.length; j++) {
- IResource resource = roots[j];
- if (resource.getFullPath().isPrefixOf(localPath)) {
- SyncInfoSet infoList = (SyncInfoSet)rootToInfosMap.get(resource);
- if (infoList == null) {
- infoList = new SyncInfoSet();
- rootToInfosMap.put(resource, infoList);
- }
- infoList.add(info);
- break; // out of inner loop
- }
- }
-
- }
- return rootToInfosMap;
- }
-
- private void fetchLogs(LogEntryCache logEntriesCache, SyncInfoSet set, CVSTag localTag, CVSTag remoteTag, IProgressMonitor monitor) throws CVSException, InterruptedException {
- ICVSRemoteResource[] remoteResources = getRemotesToFetch(set.getSyncInfos());
- if (remoteResources.length > 0) {
- RemoteLogOperation logOperation = new RemoteLogOperation(getConfiguration().getSite().getPart(), remoteResources, localTag, remoteTag, logEntriesCache);
- logOperation.execute(monitor);
- }
- }
-
- private ICVSRemoteResource[] getRemotesToFetch(SyncInfo[] infos) {
- List remotes = new ArrayList();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- if (isFetchRequired(info)) {
- ICVSRemoteResource remote = getRemoteResource(info);
- if(remote != null) {
- remotes.add(remote);
- }
- }
- }
- return (ICVSRemoteResource[]) remotes.toArray(new ICVSRemoteResource[remotes.size()]);
- }
-
- /**
- * Stop any current fetch in process.
- */
- public void stopFetching() {
- try {
- getEventHandlerJob().cancel();
- getEventHandlerJob().join();
- } catch (InterruptedException e) {
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java
deleted file mode 100644
index 16ce5a9af..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeSynchronizeParticipant.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.util.*;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.*;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.actions.ShowAnnotationAction;
-import org.eclipse.team.internal.ccvs.ui.actions.ShowResourceInHistoryAction;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.*;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.PartInitException;
-
-public class MergeSynchronizeParticipant extends CVSParticipant {
-
- /**
- * The id of a workspace action group to which additions actions can
- * be added.
- */
- public static final String TOOLBAR_CONTRIBUTION_GROUP = "toolbar_group"; //$NON-NLS-1$
-
- public static final String CONTEXT_MENU_CONTRIBUTION_GROUP = "context_group_1"; //$NON-NLS-1$
- public static final String NON_MODAL_CONTEXT_MENU_CONTRIBUTION_GROUP = "context_group_2"; //$NON-NLS-1$
-
- private final static String CTX_ROOT = "root"; //$NON-NLS-1$
- private final static String CTX_ROOT_PATH = "root_resource"; //$NON-NLS-1$
- private final static String CTX_START_TAG = "start_tag"; //$NON-NLS-1$
- private final static String CTX_START_TAG_TYPE = "start_tag_type"; //$NON-NLS-1$
- private final static String CTX_END_TAG = "end_tag"; //$NON-NLS-1$
- private final static String CTX_END_TAG_TYPE = "end_tag_type"; //$NON-NLS-1$
-
- /**
- * Actions for the merge particpant's toolbar
- */
- public class MergeParticipantActionContribution extends SynchronizePageActionGroup {
- private MergeUpdateAction updateAction;
- public void initialize(ISynchronizePageConfiguration configuration) {
- super.initialize(configuration);
-
- updateAction = new MergeUpdateAction(
- configuration,
- getVisibleRootsSelectionProvider(),
- "WorkspaceToolbarUpdateAction."); //$NON-NLS-1$
- updateAction.setPromptBeforeUpdate(true);
- appendToGroup(
- ISynchronizePageConfiguration.P_TOOLBAR_MENU,
- TOOLBAR_CONTRIBUTION_GROUP,
- updateAction);
-
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP,
- new MergeUpdateAction(configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP,
- new ConfirmMergedAction(configuration));
-
- if (!configuration.getSite().isModal()) {
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- NON_MODAL_CONTEXT_MENU_CONTRIBUTION_GROUP,
- new CVSActionDelegateWrapper(new ShowAnnotationAction(), configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- NON_MODAL_CONTEXT_MENU_CONTRIBUTION_GROUP,
- new CVSActionDelegateWrapper(new ShowResourceInHistoryAction(), configuration));
- }
-
- }
- }
-
- public MergeSynchronizeParticipant() {
- super();
- }
-
- public MergeSynchronizeParticipant(CVSMergeSubscriber subscriber) {
- setSubscriber(subscriber);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.SubscriberParticipant#setSubscriber(org.eclipse.team.core.subscribers.TeamSubscriber)
- */
- public void setSubscriber(Subscriber subscriber) {
- super.setSubscriber(subscriber);
- try {
- ISynchronizeParticipantDescriptor descriptor = TeamUI.getSynchronizeManager().getParticipantDescriptor(CVSMergeSubscriber.ID);
- setInitializationData(descriptor);
- CVSMergeSubscriber s = (CVSMergeSubscriber)getSubscriber();
- setSecondaryId(s.getId().getLocalName());
- } catch (CoreException e) {
- CVSUIPlugin.log(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#init(org.eclipse.ui.IMemento)
- */
- public void init(String secondayId, IMemento memento) throws PartInitException {
- super.init(secondayId, memento);
- if(memento != null) {
- ISynchronizeParticipantDescriptor descriptor = TeamUI.getSynchronizeManager().getParticipantDescriptor(CVSMergeSubscriber.ID);
- String qualifier = descriptor.getId();
- String localname = secondayId;
- if(qualifier == null || localname == null) {
- throw new PartInitException(Policy.bind("MergeSynchronizeParticipant.8")); //$NON-NLS-1$
- }
- try {
- setSubscriber(read(new QualifiedName(qualifier, localname), memento));
- } catch (CVSException e) {
- throw new PartInitException(Policy.bind("MergeSynchronizeParticipant.9"), e); //$NON-NLS-1$
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#init(org.eclipse.ui.IMemento)
- */
- public void saveState(IMemento memento) {
- super.saveState(memento);
- CVSMergeSubscriber s = (CVSMergeSubscriber)getSubscriber();
- write(s, memento);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.AbstractSynchronizeParticipant#dispose()
- */
- public void dispose() {
- super.dispose();
- if(TeamUI.getSynchronizeManager().get(getId(), getSecondaryId()) == null) {
- // If the participant isn't managed by the synchronize manager then we
- // must ensure that the state cached in the synchronizer is flushed.
- flushStateCache();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#getName()
- */
- public String getName() {
- return Policy.bind("CompareParticipant.0", ((CVSMergeSubscriber)getSubscriber()).getName(), Utils.convertSelection(getSubscriber().roots())); //$NON-NLS-1$
- }
-
- /*
- * Returns the start tag for this merge participant. The start tag is actually stored with the subscriber.
- */
- protected CVSTag getStartTag() {
- return ((CVSMergeSubscriber)getSubscriber()).getStartTag();
- }
-
- /*
- * Returns the end tag for this merge participant. The end tag is actually stored with the subscriber.
- */
- protected CVSTag getEndTag() {
- return ((CVSMergeSubscriber)getSubscriber()).getEndTag();
- }
-
- /*
- * Returns a merge participant that exist and is configured with the given set of resources, start, and end tags.
- */
- public static MergeSynchronizeParticipant getMatchingParticipant(IResource[] resources, CVSTag startTag, CVSTag endTag) {
- ISynchronizeParticipantReference[] refs = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
- for (int i = 0; i < refs.length; i++) {
- ISynchronizeParticipantReference reference = refs[i];
- if (reference.getId().equals(CVSMergeSubscriber.ID)) {
- MergeSynchronizeParticipant p;
- try {
- p = (MergeSynchronizeParticipant) reference.getParticipant();
- } catch (TeamException e) {
- continue;
- }
- IResource[] roots = p.getResources();
- Arrays.sort(resources, Utils.resourceComparator);
- Arrays.sort(roots, Utils.resourceComparator);
- if (Arrays.equals(resources, roots) && p.getStartTag().equals(startTag) && p.getEndTag().equals(endTag)) {
- return p;
- }
- }
- }
- return null;
- }
-
- private void write(CVSMergeSubscriber s, IMemento memento) {
- // start and end tags
- CVSTag start = s.getStartTag();
- CVSTag end = s.getEndTag();
- memento.putString(CTX_START_TAG, start.getName());
- memento.putInteger(CTX_START_TAG_TYPE, start.getType());
- memento.putString(CTX_END_TAG, end.getName());
- memento.putInteger(CTX_END_TAG_TYPE, end.getType());
-
- // resource roots
- IResource[] roots = s.roots();
- for (int i = 0; i < roots.length; i++) {
- IResource resource = roots[i];
- IMemento rootNode = memento.createChild(CTX_ROOT);
- rootNode.putString(CTX_ROOT_PATH, resource.getFullPath().toString());
- }
- }
-
- private CVSMergeSubscriber read(QualifiedName id, IMemento memento) throws CVSException {
- CVSTag start = new CVSTag(memento.getString(CTX_START_TAG), memento.getInteger(CTX_START_TAG_TYPE).intValue()); //$NON-NLS-1$ //$NON-NLS-2$
- CVSTag end = new CVSTag(memento.getString(CTX_END_TAG), memento.getInteger(CTX_END_TAG_TYPE).intValue()); //$NON-NLS-1$ //$NON-NLS-2$
-
- IMemento[] rootNodes = memento.getChildren(CTX_ROOT);
- if(rootNodes == null || rootNodes.length == 0) {
- throw new CVSException(Policy.bind("MergeSynchronizeParticipant.10", id.toString())); //$NON-NLS-1$
- }
-
- List resources = new ArrayList();
- for (int i = 0; i < rootNodes.length; i++) {
- IMemento rootNode = rootNodes[i];
- IPath path = new Path(rootNode.getString(CTX_ROOT_PATH)); //$NON-NLS-1$
- IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path, true /* include phantoms */);
- if(resource != null) {
- resources.add(resource);
- } else {
- // log that a resource previously in the merge set is no longer in the workspace
- CVSProviderPlugin.log(CVSStatus.INFO, Policy.bind("MergeSynchronizeParticipant.11", path.toString()), null); //$NON-NLS-1$
- }
- }
- if(resources.isEmpty()) {
- throw new CVSException(Policy.bind("MergeSynchronizeParticipant.12", id.toString())); //$NON-NLS-1$
- }
- IResource[] roots = (IResource[]) resources.toArray(new IResource[resources.size()]);
- return new CVSMergeSubscriber(id, roots, start, end);
- }
-
- private void flushStateCache() {
- ((CVSMergeSubscriber)getSubscriber()).cancel();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.subscribers.SubscriberParticipant#initializeConfiguration(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
- protected void initializeConfiguration(ISynchronizePageConfiguration configuration) {
- super.initializeConfiguration(configuration);
- configuration.addMenuGroup(ISynchronizePageConfiguration.P_TOOLBAR_MENU, TOOLBAR_CONTRIBUTION_GROUP);
- configuration.addMenuGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP);
- configuration.addMenuGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- NON_MODAL_CONTEXT_MENU_CONTRIBUTION_GROUP);
- configuration.setSupportedModes(ISynchronizePageConfiguration.INCOMING_MODE | ISynchronizePageConfiguration.CONFLICTING_MODE);
- configuration.setMode(ISynchronizePageConfiguration.INCOMING_MODE);
- configuration.addActionContribution(new MergeParticipantActionContribution());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SubscriberParticipant#getLongTaskName()
- */
- protected String getLongTaskName() {
- return getName();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SubscriberParticipant#getShortTaskName()
- */
- protected String getShortTaskName() {
- return Policy.bind("Participant.merging"); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java
deleted file mode 100644
index d844a77c6..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.OrSyncInfoFilter;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizeModelOperation;
-
-
-public class MergeUpdateAction extends CVSParticipantAction {
-
- public MergeUpdateAction(ISynchronizePageConfiguration configuration) {
- super(configuration);
- }
-
- public MergeUpdateAction(ISynchronizePageConfiguration configuration, ISelectionProvider provider, String bundleKey) {
- super(configuration, provider, bundleKey);
- }
-
- private boolean promptBeforeUpdate;
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.SubscriberAction#getSyncInfoFilter()
- */
- protected FastSyncInfoFilter getSyncInfoFilter() {
- // Update works for all incoming and conflicting nodes
- return new OrSyncInfoFilter(new FastSyncInfoFilter[] {
- new SyncInfoDirectionFilter(SyncInfo.INCOMING),
- new SyncInfoDirectionFilter(SyncInfo.CONFLICTING)
- });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.SubscriberAction#getSubscriberOperation(org.eclipse.compare.structuremergeviewer.IDiffElement[])
- */
- protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- return new MergeUpdateOperation(configuration, elements, promptBeforeUpdate);
- }
-
- public void setPromptBeforeUpdate(boolean prompt) {
- promptBeforeUpdate = prompt;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateOperation.java
deleted file mode 100644
index 3bc038108..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateOperation.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSMergeSubscriber;
-import org.eclipse.team.internal.ccvs.core.CVSSyncInfo;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Update;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-
-/**
- * This action performs a "cvs update -j start -j end ..." to merge changes
- * into the local workspace.
- */
-public class MergeUpdateOperation extends SafeUpdateOperation {
-
- Subscriber currentSubcriber = null;
-
- protected MergeUpdateOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements, boolean promptBeforeUpdate) {
- super(configuration, elements, promptBeforeUpdate);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberAction#getJobName(org.eclipse.team.ui.sync.SyncInfoSet)
- */
- protected String getJobName() {
- SyncInfoSet syncSet = getSyncInfoSet();
- return Policy.bind("MergeUpdateAction.jobName", new Integer(syncSet.size()).toString()); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateOperation#getOverwriteLocalChanges()
- */
- protected boolean getOverwriteLocalChanges() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateOperation#updated(org.eclipse.core.resources.IResource[])
- */
- protected void updated(IResource[] resources) throws TeamException {
- // Mark all succesfully updated resources as merged
- if(resources.length > 0 && currentSubcriber != null) {
- ((CVSMergeSubscriber)currentSubcriber).merged(resources);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateOperation#runUpdateDeletions(org.eclipse.team.core.synchronize.SyncInfo[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void runUpdateDeletions(SyncInfo[] nodes, IProgressMonitor monitor) throws TeamException {
- // When merging, update deletions become outgoing deletions so just delete
- // the files locally without unmanaging (so the sync info is kept to
- // indicate an outgoing deletion
- try {
- monitor.beginTask(null, 100 * nodes.length);
- for (int i = 0; i < nodes.length; i++) {
- IResource resource = nodes[i].getLocal();
- if (resource.getType() == IResource.FILE) {
- ((IFile)resource).delete(false /* force */, true /* keep local history */, Policy.subMonitorFor(monitor, 100));
- }
- }
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- } finally {
- monitor.done();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateOperation#runSafeUpdate(org.eclipse.team.core.synchronize.SyncInfo[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void runSafeUpdate(SyncInfo[] nodes, IProgressMonitor monitor) throws TeamException {
- if(nodes.length > 0) {
- setSubscriber(nodes[0]);
- CVSTag startTag = ((CVSMergeSubscriber)currentSubcriber).getStartTag();
- CVSTag endTag = ((CVSMergeSubscriber)currentSubcriber).getEndTag();
-
- // Incoming additions require different handling then incoming changes and deletions
- List additions = new ArrayList();
- List changes = new ArrayList();
- for (int i = 0; i < nodes.length; i++) {
- SyncInfo resource = nodes[i];
- int kind = resource.getKind();
- if ((kind & SyncInfo.CHANGE_MASK) == SyncInfo.ADDITION) {
- additions.add(resource);
- } else {
- changes.add(resource);
- }
- }
-
- try {
- monitor.beginTask(null, (additions.size() + changes.size()) * 100);
- if (!additions.isEmpty()) {
- safeUpdate(
- getIResourcesFrom((SyncInfo[]) additions.toArray(new SyncInfo[additions.size()])),
- new Command.LocalOption[] {
- Command.DO_NOT_RECURSE,
- Command.makeArgumentOption(Update.JOIN, endTag.getName())
- },
- Policy.subMonitorFor(monitor, additions.size() * 100));
- }
- if (!changes.isEmpty()) {
- safeUpdate(
- getIResourcesFrom((SyncInfo[]) changes.toArray(new SyncInfo[changes.size()])),
- new Command.LocalOption[] {
- Command.DO_NOT_RECURSE,
- Command.makeArgumentOption(Update.JOIN, startTag.getName()),
- Command.makeArgumentOption(Update.JOIN, endTag.getName())
- },
- Policy.subMonitorFor(monitor, changes.size() * 100));
- }
- } finally {
- monitor.done();
- }
- }
- }
-
- /**
- * @param nodes
- * @throws CVSException
- */
- private void setSubscriber(SyncInfo node) throws CVSException {
- // Assumption that all nodes are from the same subscriber.
- currentSubcriber = ((CVSSyncInfo)node).getSubscriber();
- if (!(currentSubcriber instanceof CVSMergeSubscriber)) {
- throw new CVSException(Policy.bind("MergeUpdateAction.invalidSubscriber", currentSubcriber.toString())); //$NON-NLS-1$
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateOperation#overwriteUpdate(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void overwriteUpdate(SyncInfoSet set, IProgressMonitor monitor) throws TeamException {
- SyncInfo[] nodes = set.getSyncInfos();
- if (nodes.length == 0) return;
- setSubscriber(nodes[0]);
- monitor.beginTask(null, 1000 * nodes.length);
- try {
- for (int i = 0; i < nodes.length; i++) {
- makeRemoteLocal(nodes[i], Policy.subMonitorFor(monitor, 1000));
- }
- } finally {
- monitor.done();
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OpenChangeSetAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OpenChangeSetAction.java
deleted file mode 100644
index 753a7db46..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OpenChangeSetAction.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.lang.reflect.InvocationTargetException;
-import java.text.DateFormat;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.ChangeSet;
-import org.eclipse.team.core.subscribers.CheckedInChangeSet;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.*;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.RemoteCompareOperation.CompareTreeBuilder;
-import org.eclipse.team.internal.ui.synchronize.ChangeSetDiffNode;
-import org.eclipse.team.ui.synchronize.*;
-
-class OpenChangeSetAction extends SynchronizeModelAction {
-
- protected OpenChangeSetAction(ISynchronizePageConfiguration configuration) {
- super(Policy.bind("OpenCommitSetAction.20"), configuration); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#getSyncInfoFilter()
- */
- protected FastSyncInfoFilter getSyncInfoFilter() {
- return new AndSyncInfoFilter(new FastSyncInfoFilter[] {
- new FastSyncInfoFilter() {
- public boolean select(SyncInfo info) {
- return info.getLocal().getType() == IResource.FILE;
- }
- },
- new OrSyncInfoFilter(new FastSyncInfoFilter[] {
- new SyncInfoDirectionFilter(new int[] { SyncInfo.INCOMING, SyncInfo.CONFLICTING }),
- new FastSyncInfoFilter() {
- public boolean select(SyncInfo info) {
- return !info.getComparator().isThreeWay();
- }
- }
- })
- });
- }
-
- private ChangeSet getChangeSet(IStructuredSelection selection) {
- // First, check to see if a change set is selected directly
- if (selection.size() == 1) {
- Object o = selection.getFirstElement();
- if (o instanceof IAdaptable) {
- ChangeSet set = (ChangeSet)((IAdaptable)o).getAdapter(ChangeSet.class);
- if (set != null)
- return set;
- }
- }
- // Failing that, check to see if all the selected elements and their childen are in the same change set
- return getChangeSet(selection.toArray());
- }
-
- private ChangeSet getChangeSet(Object[] elements) {
- ChangeSet foundSet = null;
- for (int i = 0; i < elements.length; i++) {
- Object object = elements[i];
- ChangeSet set = getChangeSet((ISynchronizeModelElement)object);
- if (set == null) return null;
- if (foundSet == null) {
- foundSet = set;
- } else if (foundSet != set) {
- return null;
- }
- }
- return foundSet;
- }
-
- private ChangeSet getChangeSet(ISynchronizeModelElement element) {
- if (element == null) return null;
- if (element instanceof IAdaptable) {
- ChangeSet set = (ChangeSet)((IAdaptable)element).getAdapter(ChangeSet.class);
- if (set != null)
- return set;
- }
- return getChangeSet((ISynchronizeModelElement)element.getParent());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection)
- */
- protected boolean updateSelection(IStructuredSelection selection) {
- boolean enabled = super.updateSelection(selection);
- if (enabled) {
- // The selection only contains appropriate files so
- // only enable if the selection is contained within a single change set
- ChangeSet set = getChangeSet(selection);
- return set != null;
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#getSubscriberOperation(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration, org.eclipse.compare.structuremergeviewer.IDiffElement[])
- */
- protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- return new SynchronizeModelOperation(configuration, elements) {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- SyncInfoSet set = getSyncInfoSet();
- SyncInfo[] infos = set.getSyncInfos();
- if (infos.length > 0) {
- ICVSRepositoryLocation location = getLocation(infos[0]);
- if (location == null) {
- handle(new CVSException(Policy.bind("OpenCommitSetAction.21"))); //$NON-NLS-1$
- return;
- }
- CompareTreeBuilder builder = new CompareTreeBuilder(location, null, null);
- if (buildTrees(builder, infos)) {
- try {
- builder.cacheContents(monitor);
- builder.openCompareEditor(getConfiguration().getSite().getPart().getSite().getPage(), getCompareTitle(), getCompareToolTip());
- } catch (CVSException e) {
- handle(e);
- return;
- }
- }
- }
- }
-
- private String getCompareToolTip() {
- IDiffElement[] elements = getSelectedDiffElements();
- for (int i = 0; i < elements.length; i++) {
- IDiffElement element = elements[i];
- while (element != null) {
- if (element instanceof ChangeSetDiffNode) {
- return ((ChangeSetDiffNode)element).getName();
- }
- element = element.getParent();
- }
- }
- return null;
- }
-
- private String getCompareTitle() {
- IDiffElement[] elements = getSelectedDiffElements();
- ChangeSet set = getChangeSet(elements);
- if (set instanceof CheckedInChangeSet) {
- CheckedInChangeSet cics = (CheckedInChangeSet)set;
- String date = DateFormat.getDateTimeInstance().format(cics.getDate());
- return "[" + cics.getAuthor() + "] (" + date + ")";
- }
- return "CVS Change";
- }
-
- private ICVSRepositoryLocation getLocation(SyncInfo info) {
- IResourceVariant remote = info.getRemote();
- if (remote == null) {
- remote = info.getBase();
- }
- if (remote != null) {
- return ((ICVSRemoteResource)remote).getRepository();
- }
- return null;
- }
-
- /*
- * Build the trees that will be compared
- */
- private boolean buildTrees(CompareTreeBuilder builder, SyncInfo[] infos) {
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- IResourceVariant remote = info.getRemote();
- if (remote == null) {
- IResourceVariant predecessor = info.getBase();
- if (predecessor instanceof ICVSRemoteFile) {
- builder.addToTrees((ICVSRemoteFile)predecessor, null);
- }
- } else if (remote instanceof ICVSRemoteFile) {
- try {
- ICVSRemoteFile predecessor = getImmediatePredecessor(remote);
- builder.addToTrees(predecessor, (ICVSRemoteFile)remote);
- } catch (TeamException e) {
- handle(e);
- return false;
- }
- }
- }
- return true;
- }
- };
- }
-
- private ICVSRemoteFile getImmediatePredecessor(IResourceVariant remote) throws TeamException {
- CVSChangeSetCollector changeSetCollector = getChangeSetCollector();
- if (changeSetCollector != null) {
- return changeSetCollector.getImmediatePredecessor((ICVSRemoteFile)remote);
- }
- return null;
- }
-
- private CVSChangeSetCollector getChangeSetCollector() {
- return (CVSChangeSetCollector)getConfiguration().getProperty(CVSChangeSetCollector.CVS_CHECKED_IN_COLLECTOR);
- }
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndCommitAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndCommitAction.java
deleted file mode 100644
index 6ad1b6448..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndCommitAction.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizeModelOperation;
-
-public class OverrideAndCommitAction extends CVSParticipantAction {
-
- public OverrideAndCommitAction(ISynchronizePageConfiguration configuration) {
- super(configuration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.SubscriberAction#getSyncInfoFilter()
- */
- protected FastSyncInfoFilter getSyncInfoFilter() {
- return new SyncInfoDirectionFilter(new int[] {SyncInfo.CONFLICTING, SyncInfo.INCOMING});
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.SubscriberAction#getSubscriberOperation(org.eclipse.compare.structuremergeviewer.IDiffElement[])
- */
- protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- return new WorkspaceCommitOperation(configuration, elements, true /* override */);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateAction.java
deleted file mode 100644
index 3b74f7522..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateAction.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizeModelOperation;
-
-/**
- * Runs an update command that will prompt the user for overwritting local
- * changes to files that have non-mergeable conflicts. All the prompting logic
- * is in the super class.
- */
-public class OverrideAndUpdateAction extends CVSParticipantAction {
-
- public OverrideAndUpdateAction(ISynchronizePageConfiguration configuration) {
- super(configuration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.SubscriberAction#getSyncInfoFilter()
- */
- protected FastSyncInfoFilter getSyncInfoFilter() {
- return new SyncInfoDirectionFilter(new int[] {SyncInfo.CONFLICTING, SyncInfo.OUTGOING});
- }
-
- protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- return new OverrideAndUpdateSubscriberOperation(configuration, elements);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateSubscriberOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateSubscriberOperation.java
deleted file mode 100644
index e744c406f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndUpdateSubscriberOperation.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.OverrideAndUpdateOperation;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-
-public class OverrideAndUpdateSubscriberOperation extends CVSSubscriberOperation {
- protected OverrideAndUpdateSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- super(configuration, elements);
- }
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#shouldRun()
- */
- public boolean shouldRun() {
- SyncInfoSet syncSet = getSyncInfoSet();
- return(promptForOverwrite(syncSet));
- }
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberOperation#run(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void run(SyncInfoSet set, IProgressMonitor monitor) throws TeamException {
- try {
- SyncInfo[] conflicts = set.getNodes(getConflictingAdditionFilter());
- List conflictingResources = new ArrayList();
- for (int i = 0; i < conflicts.length; i++) {
- SyncInfo info = conflicts[i];
- conflictingResources.add(info.getLocal());
- }
- new OverrideAndUpdateOperation(getPart(), set.getResources(), (IResource[]) conflictingResources.toArray(new IResource[conflictingResources.size()]), null /* tag */, false /* recurse */).run(monitor);
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } catch (InterruptedException e) {
- Policy.cancelOperation();
- }
- }
- private FastSyncInfoFilter getConflictingAdditionFilter() {
- return new FastSyncInfoFilter.AndSyncInfoFilter(
- new FastSyncInfoFilter[] {
- new FastSyncInfoFilter.SyncInfoDirectionFilter(new int[] {SyncInfo.CONFLICTING}),
- new FastSyncInfoFilter.SyncInfoChangeTypeFilter(new int[] {SyncInfo.ADDITION})
- });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberAction#getJobName(org.eclipse.team.ui.sync.SyncInfoSet)
- */
- protected String getJobName() {
- SyncInfoSet syncSet = getSyncInfoSet();
- return Policy.bind("UpdateAction.jobName", new Integer(syncSet.size()).toString()); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateAction.java
deleted file mode 100644
index 160aca024..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateAction.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.AndSyncInfoFilter;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoChangeTypeFilter;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizeModelOperation;
-
-/**
- * Resets the dirty state of files whose contents match their base.
- */
-public class RefreshDirtyStateAction extends CVSParticipantAction {
-
- public RefreshDirtyStateAction(ISynchronizePageConfiguration configuration) {
- super(configuration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.SubscriberAction#getSyncInfoFilter()
- */
- protected FastSyncInfoFilter getSyncInfoFilter() {
- // Only interested in outgoing changes
- return new AndSyncInfoFilter(new FastSyncInfoFilter[] {
- new SyncInfoDirectionFilter(new int[] {SyncInfo.OUTGOING, SyncInfo.CONFLICTING }),
- new SyncInfoChangeTypeFilter(SyncInfo.CHANGE)
- });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#getSubscriberOperation(org.eclipse.ui.IWorkbenchPart, org.eclipse.compare.structuremergeviewer.IDiffElement[])
- */
- protected SynchronizeModelOperation getSubscriberOperation(
- ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- return new RefreshDirtyStateOperation(configuration, elements);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateOperation.java
deleted file mode 100644
index a211580b2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateOperation.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoFilter;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.core.synchronize.SyncInfoFilter.ContentComparisonSyncInfoFilter;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-
-/**
- * Resets the dirty state of files whose contents match their base.
- */
-public class RefreshDirtyStateOperation extends CVSSubscriberOperation {
-
- protected RefreshDirtyStateOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- super(configuration, elements);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberOperation#run(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void run(SyncInfoSet set, IProgressMonitor monitor) throws TeamException {
- final ContentComparisonSyncInfoFilter comparator = new SyncInfoFilter.ContentComparisonSyncInfoFilter(false);
- final SyncInfo[] infos = set.getSyncInfos();
- if (infos.length == 0) return;
- IProject project = infos[0].getLocal().getProject();
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(project);
- folder.run(new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- monitor.beginTask(null, infos.length * 100);
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- IResource resource = info.getLocal();
- if (resource.getType() == IResource.FILE) {
- if (comparator.compareContents((IFile)resource, info.getBase(), Policy.subMonitorFor(monitor, 100))) {
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)resource);
- cvsFile.checkedIn(null, false /* not a commit */);
- }
- }
- }
- monitor.done();
- }
- }, monitor);
-
- }
-
- protected String getErrorTitle() {
- return Policy.bind("RefreshDirtyStateOperation.0"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberAction#getJobName(org.eclipse.team.ui.sync.SyncInfoSet)
- */
- protected String getJobName() {
- return Policy.bind("RefreshDirtyStateOperation.1"); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateOperation.java
deleted file mode 100644
index c3ef314cc..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateOperation.java
+++ /dev/null
@@ -1,434 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.AndSyncInfoFilter;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.OrSyncInfoFilter;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.UpdateOnlyMergableOperation;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-
-/**
- * This update action will update all mergable resources first and then prompt the
- * user to overwrite any resources that failed the safe update.
- *
- * Subclasses should determine how the update should handle conflicts by implementing
- * the getOverwriteLocalChanges() method.
- */
-public abstract class SafeUpdateOperation extends CVSSubscriberOperation {
-
- private boolean promptBeforeUpdate = false;
-
- private SyncInfoSet skipped = new SyncInfoSet();
-
- protected SafeUpdateOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements, boolean promptBeforeUpdate) {
- super(configuration, elements);
- this.promptBeforeUpdate = promptBeforeUpdate;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#shouldRun()
- */
- public boolean shouldRun() {
- return promptIfNeeded();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberOperation#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- skipped.clear();
- super.run(monitor);
- try {
- handleFailedUpdates(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberAction#run(org.eclipse.team.ui.sync.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void run(SyncInfoSet syncSet, IProgressMonitor monitor) throws TeamException {
- try {
- monitor.beginTask(null, 100);
-
- // Remove the cases that are known to fail (adding them to skipped list)
- removeKnownFailureCases(syncSet);
-
- // Run the update on the remaining nodes in the set
- // The update will fail for conflicts that turn out to be non-automergable
- safeUpdate(syncSet, Policy.subMonitorFor(monitor, 100));
-
- // Remove all failed conflicts from the original sync set
- syncSet.rejectNodes(new FastSyncInfoFilter() {
- public boolean select(SyncInfo info) {
- return skipped.getSyncInfo(info.getLocal()) != null;
- }
- });
-
- // Signal for the ones that were updated
- updated(syncSet.getResources());
- } finally {
- monitor.done();
- }
- }
-
- /**
- * @param syncSet
- * @return
- */
- private SyncInfoSet removeKnownFailureCases(SyncInfoSet syncSet) {
- // First, remove any known failure cases
- FastSyncInfoFilter failFilter = getKnownFailureCases();
- SyncInfo[] willFail = syncSet.getNodes(failFilter);
- syncSet.rejectNodes(failFilter);
- for (int i = 0; i < willFail.length; i++) {
- SyncInfo info = willFail[i];
- skipped.add(info);
- }
- return syncSet;
- }
-
- private void handleFailedUpdates(IProgressMonitor monitor) throws TeamException {
- // Handle conflicting files that can't be merged, ask the user what should be done.
- if(! skipped.isEmpty()) {
- if(getOverwriteLocalChanges()) {
- // Ask the user if a replace should be performed on the remaining nodes
- if(promptForOverwrite(skipped)) {
- overwriteUpdate(skipped, monitor);
- if (!skipped.isEmpty()) {
- updated(skipped.getResources());
- }
- }
- } else {
- // Warn the user that some nodes could not be updated. This can happen if there are
- // files with conflicts that are not auto-mergeable.
- warnAboutFailedResources(skipped);
- }
- }
- }
-
- protected boolean getOverwriteLocalChanges(){
- return false;
- }
-
- /**
- * Perform a safe update on the resources in the provided set. Any included resources
- * that cannot be updated safely wil be added to the skippedFiles list.
- * @param syncSet the set containing the resources to be updated
- * @param monitor
- */
- protected void safeUpdate(SyncInfoSet syncSet, IProgressMonitor monitor) throws TeamException {
- SyncInfo[] changed = syncSet.getSyncInfos();
- if (changed.length == 0) return;
-
- // The list of sync resources to be updated using "cvs update"
- List updateShallow = new ArrayList();
- // A list of sync resource folders which need to be created locally
- // (incoming addition or previously pruned)
- Set parentCreationElements = new HashSet();
- // A list of sync resources that are incoming deletions.
- // We do these first to avoid case conflicts
- List updateDeletions = new ArrayList();
-
- for (int i = 0; i < changed.length; i++) {
- SyncInfo changedNode = changed[i];
-
- // Make sure that parent folders exist
- SyncInfo parent = getParent(changedNode);
- if (parent != null && isOutOfSync(parent)) {
- // We need to ensure that parents that are either incoming folder additions
- // or previously pruned folders are recreated.
- parentCreationElements.add(parent);
- }
-
- IResource resource = changedNode.getLocal();
- int kind = changedNode.getKind();
- boolean willBeAttempted = false;
- if (resource.getType() == IResource.FILE) {
- // Not all change types will require a "cvs update"
- // Some can be deleted locally without performing an update
- switch (kind & SyncInfo.DIRECTION_MASK) {
- case SyncInfo.INCOMING:
- switch (kind & SyncInfo.CHANGE_MASK) {
- case SyncInfo.DELETION:
- // Incoming deletions can just be deleted instead of updated
- updateDeletions.add(changedNode);
- willBeAttempted = true;
- break;
- default:
- // add the file to the list of files to be updated
- updateShallow.add(changedNode);
- willBeAttempted = true;
- break;
- }
- break;
- case SyncInfo.CONFLICTING:
- switch (kind & SyncInfo.CHANGE_MASK) {
- case SyncInfo.CHANGE:
- // add the file to the list of files to be updated
- updateShallow.add(changedNode);
- willBeAttempted = true;
- break;
- }
- break;
- }
- if (!willBeAttempted) {
- skipped.add(syncSet.getSyncInfo(resource));
- }
- } else {
- // Special handling for folders to support shallow operations on files
- // (i.e. folder operations are performed using the sync info already
- // contained in the sync info.
- if (isOutOfSync(changedNode)) {
- parentCreationElements.add(changedNode);
- }
- }
-
- }
- try {
- monitor.beginTask(null, 100);
-
- if (parentCreationElements.size() > 0) {
- makeInSync((SyncInfo[]) parentCreationElements.toArray(new SyncInfo[parentCreationElements.size()]), Policy.subMonitorFor(monitor, 25));
- }
- if (updateDeletions.size() > 0) {
- runUpdateDeletions((SyncInfo[])updateDeletions.toArray(new SyncInfo[updateDeletions.size()]), Policy.subMonitorFor(monitor, 25));
- }
- if (updateShallow.size() > 0) {
- runSafeUpdate((SyncInfo[])updateShallow.toArray(new SyncInfo[updateShallow.size()]), Policy.subMonitorFor(monitor, 50));
- }
- } finally {
- monitor.done();
- }
- return;
- }
-
- /**
- * Perform an overwrite (unsafe) update on the resources in the provided set.
- * The passed sync set may containe resources from multiple projects and
- * it cannot be assumed that any scheduling rule is held when this method
- * is invoked.
- * @param syncSet the set containing the resources to be updated
- * @param monitor
- */
- protected abstract void overwriteUpdate(SyncInfoSet syncSet, IProgressMonitor monitor) throws TeamException;
-
- /*
- * Return a filter which selects the cases that we know ahead of time
- * will fail on an update
- */
- protected FastSyncInfoFilter getKnownFailureCases() {
- return new OrSyncInfoFilter(new FastSyncInfoFilter[] {
- // Conflicting additions of files will fail
- new AndSyncInfoFilter(new FastSyncInfoFilter[] {
- FastSyncInfoFilter.getDirectionAndChangeFilter(SyncInfo.CONFLICTING, SyncInfo.ADDITION),
- new FastSyncInfoFilter() {
- public boolean select(SyncInfo info) {
- return info.getLocal().getType() == IResource.FILE;
- }
- }
- }),
- // Conflicting changes of files will fail if the local is not managed
- // or is an addition
- new AndSyncInfoFilter(new FastSyncInfoFilter[] {
- FastSyncInfoFilter.getDirectionAndChangeFilter(SyncInfo.CONFLICTING, SyncInfo.CHANGE),
- new FastSyncInfoFilter() {
- public boolean select(SyncInfo info) {
- if (info.getLocal().getType() == IResource.FILE) {
- try {
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)info.getLocal());
- byte[] syncBytes = cvsFile.getSyncBytes();
- return (syncBytes == null || ResourceSyncInfo.isAddition(syncBytes));
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- // Fall though and try to update
- }
- }
- return false;
- }
- }
- }),
- // Conflicting changes involving a deletion on one side will aways fail
- new AndSyncInfoFilter(new FastSyncInfoFilter[] {
- FastSyncInfoFilter.getDirectionAndChangeFilter(SyncInfo.CONFLICTING, SyncInfo.CHANGE),
- new FastSyncInfoFilter() {
- public boolean select(SyncInfo info) {
- IResourceVariant remote = info.getRemote();
- IResourceVariant base = info.getBase();
- if (info.getLocal().exists()) {
- // local != base and no remote will fail
- return (base != null && remote == null);
- } else {
- // no local and base != remote
- return (base != null && remote != null && !base.equals(remote));
- }
- }
- }
- }),
- // Conflicts where the file type is binary will work but are not merged
- // so they should be skipped
- new AndSyncInfoFilter(new FastSyncInfoFilter[] {
- FastSyncInfoFilter.getDirectionAndChangeFilter(SyncInfo.CONFLICTING, SyncInfo.CHANGE),
- new FastSyncInfoFilter() {
- public boolean select(SyncInfo info) {
- IResource local = info.getLocal();
- if (local.getType() == IResource.FILE) {
- try {
- ICVSFile file = CVSWorkspaceRoot.getCVSFileFor((IFile)local);
- byte[] syncBytes = file.getSyncBytes();
- if (syncBytes != null) {
- return ResourceSyncInfo.isBinary(syncBytes);
- }
- } catch (CVSException e) {
- // There was an error obtaining or interpreting the sync bytes
- // Log it and skip the file
- CVSProviderPlugin.log(e);
- return true;
- }
- }
- return false;
- }
- }
- }),
- // Outgoing changes may not fail but they are skipped as well
- new SyncInfoDirectionFilter(SyncInfo.OUTGOING)
- });
- }
-
- /**
- * Warn user that some files could not be updated.
- * Note: This method is designed to be overridden by test cases.
- */
- protected void warnAboutFailedResources(final SyncInfoSet syncSet) {
- TeamUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- public void run() {
- MessageDialog.openInformation(getShell(),
- Policy.bind("SafeUpdateAction.warnFilesWithConflictsTitle"), //$NON-NLS-1$
- Policy.bind("SafeUpdateAction.warnFilesWithConflictsDescription")); //$NON-NLS-1$
- }
- });
- }
-
- /**
- * This method is invoked for all resources in the sync set that are incoming deletions.
- * It is done separately to allow deletions to be performed before additions that may
- * be the same name with different letter case.
- * @param nodes the SyncInfo nodes that are incoming deletions
- * @param monitor
- * @throws TeamException
- */
- protected abstract void runUpdateDeletions(SyncInfo[] nodes, IProgressMonitor monitor) throws TeamException;
-
- /**
- * This method is invoked for all resources in the sync set that are incoming changes
- * (but not deletions: @see runUpdateDeletions) or conflicting changes.
- * This method should only update those conflicting resources that are automergable.
- * @param nodes the incoming or conflicting SyncInfo nodes
- * @param monitor
- * @throws TeamException
- */
- protected abstract void runSafeUpdate(SyncInfo[] nodes, IProgressMonitor monitor) throws TeamException;
-
- protected void safeUpdate(IResource[] resources, LocalOption[] localOptions, IProgressMonitor monitor) throws TeamException {
- try {
- UpdateOnlyMergableOperation operation = new UpdateOnlyMergableOperation(getPart(), resources, localOptions);
- operation.run(monitor);
- addSkippedFiles(operation.getSkippedFiles());
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } catch (InterruptedException e) {
- Policy.cancelOperation();
- }
- }
-
- /**
- * Notification of all resource that were updated (either safely or othrwise)
- */
- protected abstract void updated(IResource[] resources) throws TeamException;
-
- private void addSkippedFiles(IFile[] files) {
- SyncInfoSet set = getSyncInfoSet();
- for (int i = 0; i < files.length; i++) {
- IFile file = files[i];
- skipped.add(set.getSyncInfo(file));
- }
- }
-
- protected String getErrorTitle() {
- return Policy.bind("UpdateAction.update"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberAction#getJobName(org.eclipse.team.ui.sync.SyncInfoSet)
- */
- protected String getJobName() {
- SyncInfoSet syncSet = getSyncInfoSet();
- return Policy.bind("UpdateAction.jobName", new Integer(syncSet.size()).toString()); //$NON-NLS-1$
- }
-
- /**
- * Confirm with the user what we are going to be doing. By default the update action doesn't
- * prompt because the user has usually selected resources first. But in some cases, for example
- * when performing a toolbar action, a confirmation prompt is nice.
- * @param set the resources to be updated
- * @return <code>true</code> if the update operation can continue, and <code>false</code>
- * if the update has been cancelled by the user.
- */
- private boolean promptIfNeeded() {
- final SyncInfoSet set = getSyncInfoSet();
- final boolean[] result = new boolean[] {true};
- if(getPromptBeforeUpdate()) {
- TeamUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- public void run() {
- String sizeString = Integer.toString(set.size());
- String message = set.size() > 1 ? Policy.bind("UpdateAction.promptForUpdateSeveral", sizeString) : Policy.bind("UpdateAction.promptForUpdateOne", sizeString); //$NON-NLS-1$ //$NON-NLS-2$
- result[0] = MessageDialog.openQuestion(getShell(), Policy.bind("UpdateAction.promptForUpdateTitle", sizeString), message); //$NON-NLS-1$
- }
- });
- }
- return result[0];
- }
-
- public void setPromptBeforeUpdate(boolean prompt) {
- this.promptBeforeUpdate = prompt;
- }
-
- public boolean getPromptBeforeUpdate() {
- return promptBeforeUpdate;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SyncInfoSetDetailsDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SyncInfoSetDetailsDialog.java
deleted file mode 100644
index 9a8200f5f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SyncInfoSetDetailsDialog.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.internal.ccvs.ui.AdaptableResourceList;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ui.dialogs.DetailsDialog;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-/**
- * DetailsDialog that has a details area which shows the SyncInfos
- * in a SyncInfoSet.
- */
-public abstract class SyncInfoSetDetailsDialog extends DetailsDialog {
-
- private static final int WIDTH_HINT = 350;
- private final static int SELECTION_HEIGHT_HINT = 100;
-
- private CheckboxTableViewer listViewer;
-
- private SyncInfoSet syncSet;
- private Object[] selectedResources;
-
- /**
- * @param parentShell
- * @param dialogTitle
- */
- public SyncInfoSetDetailsDialog(Shell parentShell, String dialogTitle, String detailsTitle, SyncInfoSet syncSet) {
- super(parentShell, dialogTitle);
- this.syncSet = syncSet;
- //this.detailsTitle = detailsTitle;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.DetailsDialog#createDropDownDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected Composite createDropDownDialogArea(Composite parent) {
- Composite composite = createComposite(parent);
-
- addResourcesArea(composite);
-
- // TODO: set F1 help
- //WorkbenchHelp.setHelp(composite, IHelpContextIds.ADD_TO_VERSION_CONTROL_DIALOG);
-
- return composite;
- }
-
- /**
- * @param composite
- */
- private void addResourcesArea(Composite composite) {
- //createWrappingLabel(composite, detailsTitle);
- // add the selectable checkbox list
-
- listViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = SELECTION_HEIGHT_HINT;
- data.widthHint = WIDTH_HINT;
- listViewer.getTable().setLayoutData(data);
-
- // set the contents of the list
- listViewer.setLabelProvider(new WorkbenchLabelProvider() {
- protected String decorateText(String input, Object element) {
- if (element instanceof IResource)
- return ((IResource)element).getFullPath().toString();
- else
- return input;
- }
- });
- listViewer.setContentProvider(new WorkbenchContentProvider());
- setViewerInput();
- listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- selectedResources = listViewer.getCheckedElements();
- }
- });
-
- addSelectionButtons(composite);
-
- }
-
- /**
- * Add the selection and deselection buttons to the dialog.
- * @param composite org.eclipse.swt.widgets.Composite
- */
- private void addSelectionButtons(Composite composite) {
-
- Composite buttonComposite = new Composite(composite, SWT.RIGHT);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- buttonComposite.setLayout(layout);
- GridData data =
- new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL);
- data.grabExcessHorizontalSpace = true;
- composite.setData(data);
-
- Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, Policy.bind("ReleaseCommentDialog.selectAll"), false); //$NON-NLS-1$
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- listViewer.setAllChecked(true);
- selectedResources = null;
- }
- };
- selectButton.addSelectionListener(listener);
-
- Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, Policy.bind("ReleaseCommentDialog.deselectAll"), false); //$NON-NLS-1$
- listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- listViewer.setAllChecked(false);
- selectedResources = new Object[0];
-
- }
- };
- deselectButton.addSelectionListener(listener);
- }
-
- protected void setViewerInput() {
- if (listViewer == null || listViewer.getControl().isDisposed()) return;
- listViewer.setInput(new AdaptableResourceList(getAllResources()));
- if (selectedResources == null) {
- listViewer.setAllChecked(true);
- } else {
- listViewer.setCheckedElements(selectedResources);
- }
- }
-
- protected void resetViewerInput() {
- selectedResources = null;
- setViewerInput();
- }
- /**
- * Return a list of all the resources that are currently under consideration by the dialog
- */
- protected IResource[] getAllResources() {
- return syncSet.getResources();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.team.internal.ui.DetailsDialog#updateEnablements()
- */
- protected void updateEnablements() {
- }
-
- /**
- * @return
- */
- public SyncInfoSet getSyncSet() {
- return syncSet;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
- */
- protected void buttonPressed(int id) {
- if (id == IDialogConstants.OK_ID) {
- filterSyncSet();
- }
- super.buttonPressed(id);
- }
-
- protected void filterSyncSet() {
- // Keep only the checked resources
- if (selectedResources != null) {
- getSyncSet().selectNodes(new FastSyncInfoFilter() {
- public boolean select(SyncInfo info) {
- IResource local = info.getLocal();
- for (int i = 0; i < selectedResources.length; i++) {
- if (local.equals(selectedResources[i])) return true;
- }
- return false;
- }
- });
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/UpdateDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/UpdateDialog.java
deleted file mode 100644
index bd1ca383a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/UpdateDialog.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-/**
- * This dialog prompts for the type of update which should take place
- * (i.e. update of auto-mergable files or update of all ignore local
- * changes.
- */
-public class UpdateDialog extends SyncInfoSetDetailsDialog {
-
- public static final int YES = IDialogConstants.YES_ID;
-
- public UpdateDialog(Shell parentShell, SyncInfoSet syncSet) {
- super(parentShell, Policy.bind("UpdateDialog.overwriteTitle"), Policy.bind("UpdateDialog.overwriteDetailsTitle"), syncSet); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.DetailsDialog#createMainDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected void createMainDialogArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout());
-
- // TODO: set F1 help
- //WorkbenchHelp.setHelp(composite, IHelpContextIds.ADD_TO_VERSION_CONTROL_DIALOG);
-
- createWrappingLabel(composite, Policy.bind("UpdateDialog.overwriteMessage")); //$NON-NLS-1$
- }
-
- protected void createButtonsForButtonBar(Composite parent) {
- createButton(parent, YES, IDialogConstants.YES_LABEL, true);
- createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, true);
- super.createButtonsForButtonBar(parent);
- }
-
- protected boolean includeOkButton() {
- return false;
- }
-
- protected boolean includeCancelButton() {
- return false;
- }
-
- protected void buttonPressed(int id) {
- // hijack yes and no buttons to set the correct return
- // codes.
- if(id == YES || id == IDialogConstants.NO_ID) {
- setReturnCode(id);
- filterSyncSet();
- close();
- } else {
- super.buttonPressed(id);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitAction.java
deleted file mode 100644
index eea6dc9e7..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitAction.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizeModelOperation;
-
-public class WorkspaceCommitAction extends CVSParticipantAction {
-
- public WorkspaceCommitAction(ISynchronizePageConfiguration configuration) {
- super(configuration);
- }
-
- public WorkspaceCommitAction(ISynchronizePageConfiguration configuration, ISelectionProvider provider, String bundleKey) {
- super(configuration, provider, bundleKey);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.SubscriberAction#getSyncInfoFilter()
- */
- protected FastSyncInfoFilter getSyncInfoFilter() {
- return new SyncInfoDirectionFilter(new int[] {SyncInfo.OUTGOING});
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.SubscriberAction#getSubscriberOperation(org.eclipse.compare.structuremergeviewer.IDiffElement[])
- */
- protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- return new WorkspaceCommitOperation(configuration, elements, false /* override */);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitOperation.java
deleted file mode 100644
index 5079542d6..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitOperation.java
+++ /dev/null
@@ -1,354 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.ChangeSet;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Commit;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.AddOperation;
-import org.eclipse.team.internal.ccvs.ui.operations.CommitOperation;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.team.internal.ccvs.ui.sync.ToolTipMessageDialog;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-
-public class WorkspaceCommitOperation extends CVSSubscriberOperation {
-
- private String comment;
- private SyncInfoSet syncSet;
- private boolean override;
-
- public WorkspaceCommitOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements, boolean override) {
- super(configuration, elements);
- this.override = override;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberOperation#getErrorTitle()
- */
- protected String getErrorTitle() {
- return Policy.bind("CommitAction.commitFailed"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.TeamOperation#getJobName()
- */
- protected String getJobName() {
- SyncInfoSet syncSet = getSyncInfoSet();
- return Policy.bind("CommitAction.jobName", new Integer(syncSet.size()).toString()); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.TeamOperation#shouldRun()
- */
- public boolean shouldRun() {
- SyncInfoSet set = getSyncInfoSet();
- return !set.isEmpty();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.SubscriberOperation#getSyncInfoSet()
- */
- protected SyncInfoSet getSyncInfoSet() {
- if (syncSet == null) {
- syncSet = super.getSyncInfoSet();
- if (!promptForConflictHandling(syncSet)) {
- syncSet.clear();
- return syncSet;
- }
- try {
- if (!promptForUnaddedHandling(syncSet)) {
- syncSet.clear();
- return syncSet;
- }
- } catch (CVSException e) {
- Utils.handle(e);
- syncSet.clear();
- }
- }
- return syncSet;
- }
-
- protected boolean promptForConflictHandling(SyncInfoSet syncSet) {
- if (syncSet.hasConflicts() || syncSet.hasIncomingChanges()) {
- if (override) {
- // If overriding, prompt to ensure that is what the user wants
- switch (promptForConflicts(syncSet)) {
- case 0:
- // Yes, synchronize conflicts as well
- break;
- case 1:
- // No, stop here
- return false;
- case 2:
- default:
- // Cancel
- return false;
- }
- } else {
- // If there is a conflict in the syncSet, remove from sync set.
- syncSet.removeConflictingNodes();
- syncSet.removeIncomingNodes();
- }
- }
- return true;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberOperation#run(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void run(SyncInfoSet syncSet, IProgressMonitor monitor) throws TeamException {
-
- final SyncInfo[] changed = syncSet.getSyncInfos();
- if (changed.length == 0) return;
-
- // A list of files to be committed
- final List commits = new ArrayList(); // of IResource
- // New resources that are not yet under CVS control and need a "cvs add"
- final List additions = new ArrayList(); // of IResource
- // A list of incoming or conflicting file changes to be made outgoing changes
- final List makeOutgoing = new ArrayList(); // of SyncInfo
- // A list of out-of-sync folders that must be made in-sync
- final List makeInSync = new ArrayList(); // of SyncInfo
-
- for (int i = 0; i < changed.length; i++) {
- SyncInfo changedNode = changed[i];
- int kind = changedNode.getKind();
- IResource resource = changedNode.getLocal();
-
- // Any parent folders should be made in-sync.
- // Steps will be taken after the commit to prune any empty folders
- SyncInfo parent = getParent(changedNode);
- if (parent != null) {
- if (isOutOfSync(parent)) {
- makeInSync.add(parent);
- }
- }
-
- if (resource.getType() == IResource.FILE) {
- // By default, all files are committed
- commits.add(resource);
- // Determine what other work needs to be done for the file
- switch (kind & SyncInfo.DIRECTION_MASK) {
- case SyncInfo.INCOMING:
- // Convert the incoming change to an outgoing change
- makeOutgoing.add(changedNode);
- break;
- case SyncInfo.OUTGOING:
- switch (kind & SyncInfo.CHANGE_MASK) {
- case SyncInfo.ADDITION:
- // Outgoing addition. 'add' it before committing.
- if (!isAdded(resource))
- additions.add(resource);
- break;
- case SyncInfo.DELETION:
- // Outgoing deletion is handled by move/delete
- // hook and EclipseSynchronizer
- break;
- case SyncInfo.CHANGE:
- // Outgoing change. Just commit it.
- break;
- }
- break;
- case SyncInfo.CONFLICTING:
- // Convert the conflicting change to an outgoing change
- makeOutgoing.add(changedNode);
- break;
- }
- } else {
- if (((kind & SyncInfo.DIRECTION_MASK) == SyncInfo.OUTGOING)
- && ((kind & SyncInfo.CHANGE_MASK) == SyncInfo.ADDITION)) {
- // Outgoing folder additions must be added
- additions.add(changedNode.getLocal());
- } else if (isOutOfSync(changedNode)) {
- // otherwise, make any out-of-sync folders in-sync using the remote info
- makeInSync.add(changedNode);
- }
- }
- }
- monitor.beginTask(null, 200);
-
- if (makeInSync.size() > 0) {
- makeInSync((SyncInfo[]) makeInSync.toArray(new SyncInfo[makeInSync.size()]), Policy.subMonitorFor(monitor, 25));
- }
-
- if (makeOutgoing.size() > 0) {
- makeOutgoing((SyncInfo[]) makeOutgoing.toArray(new SyncInfo[makeInSync.size()]), Policy.subMonitorFor(monitor, 25));
- }
-
- if (additions.size() != 0) {
- add((IResource[])additions.toArray(new IResource[0]), Policy.subMonitorFor(monitor, 50));
- }
- commit((IResource[])commits.toArray(new IResource[commits.size()]), Policy.subMonitorFor(monitor, 100));
- }
-
- private void commit(IResource[] commits, IProgressMonitor monitor) throws TeamException {
- try {
- new CommitOperation(getPart(), commits,
- new Command.LocalOption[] { Commit.makeArgumentOption(Command.MESSAGE_OPTION, comment) })
- .run(monitor);
- } catch (InvocationTargetException e) {
- throw TeamException.asTeamException(e);
- } catch (InterruptedException e) {
- throw new OperationCanceledException();
- }
- }
-
- private void add(IResource[] additions, IProgressMonitor monitor) throws TeamException {
- try {
- new AddOperation(getPart(), additions).run(monitor);
- } catch (InvocationTargetException e1) {
- throw TeamException.asTeamException(e1);
- } catch (InterruptedException e1) {
- throw new OperationCanceledException();
- }
- }
-
- /**
- * Prompts the user to determine how conflicting changes should be handled.
- * Note: This method is designed to be overridden by test cases.
- * @return 0 to sync conflicts, 1 to sync all non-conflicts, 2 to cancel
- */
- protected int promptForConflicts(SyncInfoSet syncSet) {
- String[] buttons = new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL};
- String question = Policy.bind("CommitSyncAction.questionRelease"); //$NON-NLS-1$
- String title = Policy.bind("CommitSyncAction.titleRelease"); //$NON-NLS-1$
- String[] tips = new String[] {
- Policy.bind("CommitSyncAction.releaseAll"), //$NON-NLS-1$
- Policy.bind("CommitSyncAction.releasePart"), //$NON-NLS-1$
- Policy.bind("CommitSyncAction.cancelRelease") //$NON-NLS-1$
- };
- Shell shell = getShell();
- final ToolTipMessageDialog dialog = new ToolTipMessageDialog(shell, title, null, question, MessageDialog.QUESTION, buttons, tips, 0);
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- dialog.open();
- }
- });
- return dialog.getReturnCode();
- }
-
- /**
- * Prompts the user for a release comment.
- * Note: This method is designed to be overridden by test cases.
- * @return the comment, or null to cancel
- */
- protected String promptForComment(RepositoryManager manager, IResource[] resourcesToCommit) {
- String proposedComment = getProposedComment(resourcesToCommit);
- return manager.promptForComment(getShell(), resourcesToCommit, proposedComment);
- }
-
- private String getProposedComment(IResource[] resourcesToCommit) {
- StringBuffer comment = new StringBuffer();
- ChangeSet[] sets = CVSUIPlugin.getPlugin().getChangeSetManager().getSets();
- int numMatchedSets = 0;
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
- if (containsOne(set, resourcesToCommit)) {
- if(numMatchedSets > 0) comment.append(System.getProperty("line.separator")); //$NON-NLS-1$
- comment.append(set.getComment());
- numMatchedSets++;
- }
- }
- return comment.toString();
- }
-
- private boolean containsOne(ChangeSet set, IResource[] resourcesToCommit) {
- for (int j = 0; j < resourcesToCommit.length; j++) {
- IResource resource = resourcesToCommit[j];
- if (set.contains(resource)) {
- return true;
- }
- }
- return false;
- }
-
- protected IResource[] promptForResourcesToBeAdded(RepositoryManager manager, IResource[] unadded) {
- return manager.promptForResourcesToBeAdded(getShell(), unadded);
- }
-
- private boolean promptForUnaddedHandling(SyncInfoSet syncSet) throws CVSException {
- if (syncSet.isEmpty()) return false;
-
- // accumulate any resources that are not under version control
- IResource[] unadded = getUnaddedResources(syncSet);
-
- // prompt to get comment and any resources to be added to version control
- RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- IResource[] toBeAdded = promptForResourcesToBeAdded(manager, unadded);
- if (toBeAdded == null) return false; // User cancelled.
- comment = promptForComment(manager, syncSet.getResources());
- if (comment == null) return false; // User cancelled.
-
- // remove unshared resources that were not selected by the user
- if (unadded != null && unadded.length > 0) {
- List resourcesToRemove = new ArrayList(unadded.length);
- for (int i = 0; i < unadded.length; i++) {
- IResource unaddedResource = unadded[i];
- boolean included = false;
- for (int j = 0; j < toBeAdded.length; j++) {
- IResource resourceToAdd = toBeAdded[j];
- if (unaddedResource.equals(resourceToAdd)) {
- included = true;
- break;
- }
- }
- if (!included)
- resourcesToRemove.add(unaddedResource);
- }
- syncSet.removeAll((IResource[]) resourcesToRemove.toArray(new IResource[resourcesToRemove.size()]));
- }
- return true;
- }
-
- private IResource[] getUnaddedResources(SyncInfoSet syncSet) throws CVSException {
- // TODO: Should only get outgoing additions (since conflicting additions
- // could be considered to be under version control already)
- IResource[] resources = syncSet.getResources();
- List result = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (!isAdded(resource)) {
- result.add(resource);
- }
- }
- return (IResource[]) result.toArray(new IResource[result.size()]);
- }
-
- private boolean isAdded(IResource resource) throws CVSException {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if (cvsResource.isFolder()) {
- return ((ICVSFolder)cvsResource).isCVSFolder();
- } else {
- return cvsResource.isManaged();
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java
deleted file mode 100644
index b40f36d70..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceSynchronizeParticipant.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.ActiveChangeSet;
-import org.eclipse.team.core.subscribers.SubscriberChangeSetCollector;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.actions.*;
-import org.eclipse.team.internal.ui.synchronize.ScopableSubscriberParticipant;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.*;
-import org.eclipse.ui.*;
-
-public class WorkspaceSynchronizeParticipant extends ScopableSubscriberParticipant {
-
- public static final String ID = "org.eclipse.team.cvs.ui.cvsworkspace-participant"; //$NON-NLS-1$
-
- /**
- * The id of a workspace action group to which additions actions can
- * be added.
- */
- public static final String TOOLBAR_CONTRIBUTION_GROUP = "toolbar_group_1"; //$NON-NLS-1$
-
- public static final String CONTEXT_MENU_CONTRIBUTION_GROUP_1 = "context_group_1"; //$NON-NLS-1$
- public static final String CONTEXT_MENU_CONTRIBUTION_GROUP_2 = "context_group_2"; //$NON-NLS-1$
- public static final String CONTEXT_MENU_CONTRIBUTION_GROUP_3 = "context_group_3"; //$NON-NLS-1$
- public static final String CONTEXT_MENU_CONTRIBUTION_GROUP_4 = "context_group_4"; //$NON-NLS-1$
-
- private WorkspaceChangeSetCapability capability;
-
- /**
- * CVS workspace action contribution
- */
- public class WorkspaceActionContribution extends SynchronizePageActionGroup {
- private WorkspaceCommitAction commitToolbar;
- private WorkspaceUpdateAction updateToolbar;
-
- public void initialize(ISynchronizePageConfiguration configuration) {
- super.initialize(configuration);
-
- updateToolbar = new WorkspaceUpdateAction(
- configuration,
- getVisibleRootsSelectionProvider(),
- "WorkspaceToolbarUpdateAction."); //$NON-NLS-1$
- updateToolbar.setPromptBeforeUpdate(true);
- appendToGroup(
- ISynchronizePageConfiguration.P_TOOLBAR_MENU,
- TOOLBAR_CONTRIBUTION_GROUP,
- updateToolbar);
-
- commitToolbar = new WorkspaceCommitAction(
- configuration,
- getVisibleRootsSelectionProvider(),
- "WorkspaceToolbarCommitAction."); //$NON-NLS-1$
- appendToGroup(
- ISynchronizePageConfiguration.P_TOOLBAR_MENU,
- TOOLBAR_CONTRIBUTION_GROUP,
- commitToolbar);
-
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_1,
- new WorkspaceUpdateAction(configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_1,
- new WorkspaceCommitAction(configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_2,
- new OverrideAndUpdateAction(configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_2,
- new OverrideAndCommitAction(configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_2,
- new ConfirmMergedAction(configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_3,
- new CVSActionDelegateWrapper(new IgnoreAction(), configuration));
- if (!configuration.getSite().isModal()) {
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_3,
- new CVSActionDelegateWrapper(new GenerateDiffFileAction(), configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_3,
- new CVSActionDelegateWrapper(new BranchAction(), configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_3,
- new CVSActionDelegateWrapper(new ShowAnnotationAction(), configuration));
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_3,
- new CVSActionDelegateWrapper(new ShowResourceInHistoryAction(), configuration));
- }
- appendToGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_4,
- new RefreshDirtyStateAction(configuration));
- }
- }
-
- public class WorkspaceChangeSetCapability extends CVSChangeSetCapability {
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ChangeSetCapability#createChangeSet(org.eclipse.team.core.synchronize.SyncInfo[])
- */
- public ActiveChangeSet createChangeSet(ISynchronizePageConfiguration configuration, SyncInfo[] infos) {
- ActiveChangeSet set = getActiveChangeSetManager().createSet(Policy.bind("WorkspaceChangeSetCapability.1"), new SyncInfo[0]); //$NON-NLS-1$
- CommitSetDialog dialog = new CommitSetDialog(configuration.getSite().getShell(), set, getResources(infos),
- Policy.bind("WorkspaceChangeSetCapability.2"), Policy.bind("WorkspaceChangeSetCapability.3")); //$NON-NLS-1$ //$NON-NLS-2$
- dialog.open();
- if (dialog.getReturnCode() != InputDialog.OK) return null;
- set.add(infos);
- return set;
- }
-
- private IResource[] getResources(SyncInfo[] infos) {
- IResource[] resources = new IResource[infos.length];
- for (int i = 0; i < resources.length; i++) {
- resources[i] = infos[i].getLocal();
- }
- return resources;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ChangeSetCapability#editChangeSet(org.eclipse.team.core.subscribers.ActiveChangeSet)
- */
- public void editChangeSet(ISynchronizePageConfiguration configuration, ActiveChangeSet set) {
- CommitSetDialog dialog = new CommitSetDialog(configuration.getSite().getShell(), set, set.getResources(),
- Policy.bind("WorkspaceChangeSetCapability.7"), Policy.bind("WorkspaceChangeSetCapability.8")); //$NON-NLS-1$ //$NON-NLS-2$
- dialog.open();
- if (dialog.getReturnCode() != InputDialog.OK) return;
- // Nothing to do here as the set was updated by the dialog
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ChangeSetCapability#getActiveChangeSetManager()
- */
- public SubscriberChangeSetCollector getActiveChangeSetManager() {
- return CVSUIPlugin.getPlugin().getChangeSetManager();
- }
- }
-
- /**
- * No arg contructor used for
- * creation of persisted participant after startup
- */
- public WorkspaceSynchronizeParticipant() {
- }
-
- public WorkspaceSynchronizeParticipant(ISynchronizeScope scope) {
- super(scope);
- setSubscriber(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.ISynchronizeParticipant#init(org.eclipse.ui.IMemento)
- */
- public void init(String secondaryId, IMemento memento) throws PartInitException {
- super.init(secondaryId, memento);
- setSubscriber(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.subscribers.SubscriberParticipant#initializeConfiguration(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
- protected void initializeConfiguration(ISynchronizePageConfiguration configuration) {
- super.initializeConfiguration(configuration);
- ILabelDecorator labelDecorator = new CVSParticipantLabelDecorator(configuration);
- configuration.addLabelDecorator(labelDecorator);
- configuration.addMenuGroup(ISynchronizePageConfiguration.P_TOOLBAR_MENU, TOOLBAR_CONTRIBUTION_GROUP);
- configuration.addActionContribution(new WorkspaceActionContribution());
- configuration.setSupportedModes(ISynchronizePageConfiguration.ALL_MODES);
- configuration.setMode(ISynchronizePageConfiguration.BOTH_MODE);
-
- // Add context menu groups here to give the client displaying the
- // page a chance to remove the context menu
- configuration.addMenuGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_1);
- configuration.addMenuGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_2);
- configuration.addMenuGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_3);
- configuration.addMenuGroup(
- ISynchronizePageConfiguration.P_CONTEXT_MENU,
- CONTEXT_MENU_CONTRIBUTION_GROUP_4);
- }
-
- protected ISynchronizeParticipantDescriptor getDescriptor() {
- return TeamUI.getSynchronizeManager().getParticipantDescriptor(ID);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.SubscriberParticipant#updateLabels(org.eclipse.team.ui.synchronize.ISynchronizeModelElement, org.eclipse.compare.CompareConfiguration, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void prepareCompareInput(ISynchronizeModelElement element, CompareConfiguration config, IProgressMonitor monitor) throws TeamException {
- monitor.beginTask(null, 100);
- CVSParticipant.deriveBaseContentsFromLocal(element, Policy.subMonitorFor(monitor, 10));
- super.prepareCompareInput(element, config, Policy.subMonitorFor(monitor, 80));
- CVSParticipant.updateLabelsForCVS(element, config, Policy.subMonitorFor(monitor, 10));
- monitor.done();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#getPreferencePages()
- */
- public PreferencePage[] getPreferencePages() {
- return CVSParticipant.addCVSPreferencePages(super.getPreferencePages());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#getChangeSetCapability()
- */
- public ChangeSetCapability getChangeSetCapability() {
- if (capability == null) {
- capability = new WorkspaceChangeSetCapability();
- }
- return capability;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#isViewerContributionsSupported()
- */
- protected boolean isViewerContributionsSupported() {
- return true;
- }
-
- public void refresh(IResource[] resources, IWorkbenchPartSite site) {
- refresh(resources, getShortTaskName(), getLongTaskName(resources), site);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateAction.java
deleted file mode 100644
index 6682d6ffe..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizeModelOperation;
-
-public class WorkspaceUpdateAction extends CVSParticipantAction {
-
- private boolean promptBeforeUpdate;
-
- public WorkspaceUpdateAction(ISynchronizePageConfiguration configuration) {
- super(configuration);
- }
-
- public WorkspaceUpdateAction(ISynchronizePageConfiguration configuration, ISelectionProvider provider, String bundleKey) {
- super(configuration, provider, bundleKey);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.SubscriberAction#getSyncInfoFilter()
- */
- protected FastSyncInfoFilter getSyncInfoFilter() {
- return new SyncInfoDirectionFilter(new int[] {SyncInfo.INCOMING, SyncInfo.CONFLICTING});
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.SubscriberAction#getSubscriberOperation(org.eclipse.compare.structuremergeviewer.IDiffElement[])
- */
- protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- return new WorkspaceUpdateOperation(configuration, elements, promptBeforeUpdate);
- }
-
- public void setPromptBeforeUpdate(boolean prompt) {
- promptBeforeUpdate = prompt;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateOperation.java
deleted file mode 100644
index 4a510bf6d..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceUpdateOperation.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.subscriber;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.ReplaceOperation;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-
-/**
- * This action performs an update for the CVSWorkspaceSubscriber.
- */
-public class WorkspaceUpdateOperation extends SafeUpdateOperation {
-
- protected WorkspaceUpdateOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements, boolean promptBeforeUpdate) {
- super(configuration, elements, promptBeforeUpdate);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateOperation#runUpdateDeletions(org.eclipse.team.core.synchronize.SyncInfo[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void runUpdateDeletions(SyncInfo[] nodes, IProgressMonitor monitor) throws TeamException {
- monitor.beginTask(null, nodes.length * 100);
- for (int i = 0; i < nodes.length; i++) {
- SyncInfo node = nodes[i];
- unmanage(node, Policy.subMonitorFor(monitor, 50));
- deleteAndKeepHistory(node.getLocal(), Policy.subMonitorFor(monitor, 50));
- }
- pruneEmptyParents(nodes);
- monitor.done();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateOperation#runSafeUpdate(org.eclipse.team.core.synchronize.SyncInfo[], org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void runSafeUpdate(SyncInfo[] nodes, IProgressMonitor monitor) throws TeamException {
- safeUpdate(getIResourcesFrom(nodes), new LocalOption[] { Command.DO_NOT_RECURSE }, monitor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateOperation#overwriteUpdate(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void overwriteUpdate(SyncInfoSet syncSet, IProgressMonitor monitor) throws TeamException {
- try {
- new ReplaceOperation(getPart(), syncSet.getResources(), null /* tag */, false /* recurse */)
- .run(monitor);
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } catch (InterruptedException e) {
- Policy.cancelOperation();
- }
-
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateOperation#updated(org.eclipse.core.resources.IResource[])
- */
- protected void updated(IResource[] resources) throws TeamException {
- // Do nothing
- }
-
- private void unmanage(SyncInfo element, IProgressMonitor monitor) throws CVSException {
- CVSWorkspaceRoot.getCVSResourceFor(element.getLocal()).unmanage(monitor);
- }
-
- private void deleteAndKeepHistory(IResource resource, IProgressMonitor monitor) throws CVSException {
- try {
- if (!resource.exists()) return;
- if (resource.getType() == IResource.FILE)
- ((IFile)resource).delete(false /* force */, true /* keep history */, monitor);
- else if (resource.getType() == IResource.FOLDER)
- ((IFolder)resource).delete(false /* force */, true /* keep history */, monitor);
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ToolTipMessageDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ToolTipMessageDialog.java
deleted file mode 100644
index 1e06ab5e6..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ToolTipMessageDialog.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.sync;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-/**
- * A class that adds tool-tips to the buttons of a standard message dialog.
- */
-public class ToolTipMessageDialog extends MessageDialog {
- private String[] buttonToolTips;
- /**
- * Same as the MessageDialog constructor, with the addition of a button tooltip
- * argument. The number of button tool tips must match the number of button labels.
- */
- public ToolTipMessageDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, String[] buttonToolTips, int defaultIndex) {
- super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex);
- this.buttonToolTips = buttonToolTips;
- }
- /**
- * Method declared on MessageDialog.
- */
- protected void createButtonsForButtonBar(Composite parent) {
- super.createButtonsForButtonBar(parent);
- if (buttonToolTips != null) {
- for (int i = 0; i < buttonToolTips.length; i++) {
- getButton(i).setToolTipText(buttonToolTips[i]);
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/BranchPromptDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/BranchPromptDialog.java
deleted file mode 100644
index 4a052014a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/BranchPromptDialog.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.wizards.CVSWizardPage;
-import org.eclipse.team.internal.ui.dialogs.DetailsDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-public class BranchPromptDialog extends DetailsDialog {
-
- private String branchTag = ""; //$NON-NLS-1$
- private String versionTag= ""; //$NON-NLS-1$
- private String versionName= ""; //$NON-NLS-1$
-
- private boolean allStickyResources;
- private boolean update;
-
- private Text versionText;
- private Text branchText;
-
- private static final int TAG_AREA_HEIGHT_HINT = 200;
-
- // widgets;
- private TagSource tagSource;
- private TagSelectionArea tagArea;
- private final IResource[] resources;
-
- public BranchPromptDialog(Shell parentShell, String title, IResource[] resources, boolean allResourcesSticky, String versionName) {
- super(parentShell, title);
- this.resources = resources;
- this.tagSource = TagSource.create(resources);
- this.allStickyResources = allResourcesSticky;
- this.versionName = versionName;
- }
-
- /**
- * @see DetailsDialog#createMainDialogArea(Composite)
- */
- protected void createMainDialogArea(Composite composite) {
- // create message
- Label label = new Label(composite, SWT.WRAP);
- String message;
- if(allStickyResources) {
- message = Policy.bind("BranchWizardPage.pageDescriptionVersion"); //$NON-NLS-1$
- } else {
- message = Policy.bind("BranchWizardPage.pageDescription"); //$NON-NLS-1$
- }
- label.setText(message);
- GridData data = new GridData(
- GridData.GRAB_HORIZONTAL |
- GridData.HORIZONTAL_ALIGN_FILL |
- GridData.VERTICAL_ALIGN_CENTER);
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
- label.setLayoutData(data);
-
- CVSWizardPage.createLabel(composite, Policy.bind("BranchWizardPage.branchName")); //$NON-NLS-1$
- branchText = CVSWizardPage.createTextField(composite);
- branchText.addListener(SWT.Modify, new Listener() {
- public void handleEvent(Event event) {
- branchTag = branchText.getText();
- updateEnablements();
- updateVersionName(branchTag);
- }
- });
- addBranchContentAssist();
-
- final Button check = new Button(composite, SWT.CHECK);
- data = new GridData();
- data.horizontalSpan = 2;
- check.setLayoutData(data);
- check.setText(Policy.bind("BranchWizardPage.startWorking")); //$NON-NLS-1$
- check.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- update = check.getSelection();
- }
- });
- check.setSelection(true);
- update = true;
-
- label = new Label(composite, SWT.WRAP);
- label.setText(Policy.bind("BranchWizardPage.specifyVersion")); //$NON-NLS-1$
- data = new GridData(
- GridData.GRAB_HORIZONTAL |
- GridData.HORIZONTAL_ALIGN_FILL |
- GridData.VERTICAL_ALIGN_CENTER);
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
- data.horizontalSpan = 2;
- label.setLayoutData(data);
-
- CVSWizardPage.createLabel(composite, Policy.bind("BranchWizardPage.versionName")); //$NON-NLS-1$
- versionText = CVSWizardPage.createTextField(composite);
- versionText.addListener(SWT.Modify, new Listener() {
- public void handleEvent(Event event) {
- versionTag = versionText.getText();
- updateEnablements();
- }
- });
-
- if(allStickyResources) {
- versionText.setEditable(false);
- versionText.setText(versionName);
- }
-
- // F1 Help
- WorkbenchHelp.setHelp(composite, IHelpContextIds.BRANCH_DIALOG);
- Dialog.applyDialogFont(composite);
- branchText.setFocus();
- }
-
- private void addBranchContentAssist() {
- TagSource projectTagSource = LocalProjectTagSource.create(getSeedProject());
- if (projectTagSource != null)
- TagContentAssistProcessor.createContentAssistant(branchText, projectTagSource, TagSelectionArea.INCLUDE_BRANCHES);
- }
-
- private IProject getSeedProject() {
- return resources[0].getProject();
- }
-
- /**
- * Updates version name
- */
- protected void updateVersionName(String branchName) {
- if(versionText!=null && !allStickyResources) {
- versionText.setText(Policy.bind("BranchWizardPage.versionPrefix") + branchName); //$NON-NLS-1$
- }
- }
-
- /**
- * @see DetailsDialog#createDropDownDialogArea(Composite)
- */
- protected Composite createDropDownDialogArea(Composite parent) {
-
- // create a composite with standard margins and spacing
- 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);
- GridData gridData = new GridData(GridData.FILL_BOTH);
- gridData.heightHint = TAG_AREA_HEIGHT_HINT;
- composite.setLayoutData(gridData);
-
- tagArea = new TagSelectionArea(getShell(), tagSource, TagSelectionArea.INCLUDE_VERSIONS | TagSelectionArea.INCLUDE_BRANCHES, null);
- tagArea.setTagAreaLabel(Policy.bind("BranchWizardPage.existingVersionsAndBranches")); //$NON-NLS-1$
- tagArea.setIncludeFilterInputArea(false);
- tagArea.createArea(composite);
-
- return composite;
- }
-
- /**
- * Validates branch and version names
- */
- protected void updateEnablements() {
- String message = null;
-
- if (branchTag.length() == 0) {
- message = ""; //$NON-NLS-1$
- } else {
- IStatus status = CVSTag.validateTagName(branchTag);
- if (!status.isOK()) {
- message = Policy.bind("BranchWizard.branchNameWarning", status.getMessage()); //$NON-NLS-1$
- } else {
- if(versionText!=null) {
- status = CVSTag.validateTagName(versionText.getText());
- if (!status.isOK()) {
- message = Policy.bind("BranchWizard.versionNameWarning", status.getMessage()); //$NON-NLS-1$
- } else {
- if(versionTag.length() != 0 && versionTag.equals(branchTag)) {
- message = Policy.bind("BranchWizard.branchAndVersionMustBeDifferent"); //$NON-NLS-1$
- }
- }
- }
- }
- }
- setPageComplete(message == null);
- setErrorMessage(message);
- }
-
- /**
- * Returns the branch tag name
- */
- public String getBranchTagName() {
- return branchTag;
- }
-
- /**
- * Returns the version tag name
- */
- public String getVersionTagName() {
- return versionTag;
- }
-
- /**
- * Returns the state of the update checkbox
- */
- public boolean getUpdate() {
- return update;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#isMainGrabVertical()
- */
- protected boolean isMainGrabVertical() {
- return false;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/CVSFileElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/CVSFileElement.java
deleted file mode 100644
index 4b4e05700..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/CVSFileElement.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.model.CVSResourceElement;
-import org.eclipse.ui.PlatformUI;
-
-public class CVSFileElement extends CVSResourceElement {
-
- private ICVSFile file;
-
- public CVSFileElement(ICVSFile file) {
- this.file = file;
- }
-
- /**
- * Initial implementation: return null;
- */
- public Object[] fetchChildren(Object o, IProgressMonitor monitor) {
- return new Object[0];
- }
- /**
- * Initial implementation: return null.
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return PlatformUI.getWorkbench().getEditorRegistry().getImageDescriptor(file.getName());
- }
- /**
- * Initial implementation: return the file's name and version
- */
- public String getLabel(Object o) {
- try {
- ResourceSyncInfo info = file.getSyncInfo();
- if(info!=null) {
- return file.getName() + " " + info.getRevision(); //$NON-NLS-1$
- } else {
- return file.getName();
- }
- } catch (TeamException e) {
- handle(null, null, e);
- return null;
- }
- }
- /**
- * @see IWorkbenchAdapter#getParent(Object)
- */
- public Object getParent(Object o) {
- return null;
- }
-
- public ICVSFile getCVSFile() {
- return file;
- }
- /**
- * @see CVSResourceElement#getCVSResource()
- */
- public ICVSResource getCVSResource() {
- return file;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/CVSFolderElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/CVSFolderElement.java
deleted file mode 100644
index 865b95801..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/CVSFolderElement.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.model.CVSResourceElement;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-public class CVSFolderElement extends CVSResourceElement {
-
- private ICVSFolder folder;
- private boolean includeUnmanaged;
-
- public CVSFolderElement(ICVSFolder folder, boolean includeUnmanaged) {
- this.folder = folder;
- this.includeUnmanaged = includeUnmanaged;
- }
-
- /**
- * Returns CVSResourceElement instances
- */
- public Object[] fetchChildren(Object o, IProgressMonitor monitor) throws TeamException {
- ICVSResource[] children = folder.fetchChildren(monitor);
- CVSResourceElement[] elements = new CVSResourceElement[children.length];
- for (int i = 0; i < children.length; i++) {
- ICVSResource resource = children[i];
- if(resource.isFolder()) {
- elements[i] = new CVSFolderElement((ICVSFolder)resource, includeUnmanaged);
- } else {
- elements[i] = new CVSFileElement((ICVSFile)resource);
- }
- }
- return elements;
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.model.CVSModelElement#isRemoteElement()
- */
- public boolean isRemoteElement() {
- return true;
- }
-
- /**
- * Overridden to append the version name to remote folders which
- * have version tags and are top-level folders.
- */
- public String getLabel(Object o) {
- return folder.getName();
- }
-
- public ImageDescriptor getImageDescriptor(Object object) {
- return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
- }
-
- /**
- * @see IWorkbenchAdapter#getParent(Object)
- */
- public Object getParent(Object o) {
- return new CVSFolderElement(folder.getParent(), includeUnmanaged);
- }
-
- /**
- * @see CVSResourceElement#getCVSResource()
- */
- public ICVSResource getCVSResource() {
- return folder ;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/FilteredTagList.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/FilteredTagList.java
deleted file mode 100644
index a8266373d..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/FilteredTagList.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.util.StringMatcher;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * Workbench model element that returns a filtered list of tags
- */
-public class FilteredTagList implements IWorkbenchAdapter, IAdaptable {
-
- private final TagSource tagSource;
- private final int[] types;
- private StringMatcher matcher;
-
- public FilteredTagList(TagSource tagSource, int[] types) {
- this.tagSource = tagSource;
- this.types = types;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
- */
- public Object[] getChildren(Object o) {
- CVSTag[] tags = getTags();
- List filtered = new ArrayList();
- for (int i = 0; i < tags.length; i++) {
- CVSTag tag = tags[i];
- if (select(tag)) {
- filtered.add(new TagElement(this, tag));
- }
- }
- return filtered.toArray(new Object[filtered.size()]);
- }
-
- private boolean select(CVSTag tag) {
- if (matcher == null) return true;
- return matcher.match(tag.getName());
- }
-
- private CVSTag[] getTags() {
- return tagSource.getTags(types);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
- */
- public String getLabel(Object o) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
- */
- public Object getParent(Object o) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
- }
-
- public void setPattern(String pattern) {
- if (!pattern.endsWith("*")) { //$NON-NLS-1$
- pattern += "*"; //$NON-NLS-1$
- }
- matcher = new StringMatcher(pattern, true, false);
- }
-
- public CVSTag[] getMatchingTags() {
- CVSTag[] tags = getTags();
- List filtered = new ArrayList();
- for (int i = 0; i < tags.length; i++) {
- CVSTag tag = tags[i];
- if (select(tag)) {
- filtered.add(tag);
- }
- }
- return (CVSTag[])filtered.toArray(new CVSTag[filtered.size()]);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/LocalProjectTagSource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/LocalProjectTagSource.java
deleted file mode 100644
index 1ffa1c7f1..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/LocalProjectTagSource.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.util.*;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-/**
- * Tag source that gets its tags from the projects exist in the workspace
- * and are mapped to the same repository as the seed project
- */
-public class LocalProjectTagSource extends TagSource {
-
- public static TagSource create(IProject seedProject) {
- try {
- ICVSRemoteFolder seedFolder = ((ICVSRemoteFolder)CVSWorkspaceRoot.getRemoteResourceFor(seedProject));
- ICVSRemoteFolder[] remoteFolders = getProjectRemoteFolders(seedFolder.getRepository());
- if (remoteFolders.length == 1) {
- // There are no other projects to get tags from so return null
- return null;
- }
- return new LocalProjectTagSource(seedFolder, remoteFolders);
- } catch (CVSException e) {
- // Log and return null
- CVSUIPlugin.log(e);
- return null;
- }
- }
-
- private ICVSRemoteFolder seedFolder;
- private ICVSRemoteFolder[] remoteFolders;
-
- private LocalProjectTagSource(ICVSRemoteFolder seedFolder, ICVSRemoteFolder[] remoteFolders) {
- this.seedFolder = seedFolder;
- this.remoteFolders = remoteFolders;
- }
-
- /*
- * Return the list of remote folders for the projects in the workspace mapped to the given repository
- */
- private static ICVSRemoteFolder[] getProjectRemoteFolders(ICVSRepositoryLocation repository) {
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- List result = new ArrayList();
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
- try {
- if (project.isAccessible() && RepositoryProvider.isShared(project)) {
- ICVSRemoteFolder remote = (ICVSRemoteFolder)CVSWorkspaceRoot.getRemoteResourceFor(project);
- if (remote != null && remote.getRepository().equals(repository)) {
- result.add(remote);
- }
- }
- } catch (CVSException e) {
- // Log and continue
- CVSUIPlugin.log(e);
- }
- }
- return (ICVSRemoteFolder[]) result.toArray(new ICVSRemoteFolder[result.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#refresh(boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
- public CVSTag[] refresh(boolean bestEffort, IProgressMonitor monitor) throws TeamException {
- // This tag source should not be refreshed
- return new CVSTag[0];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getLocation()
- */
- public ICVSRepositoryLocation getLocation() {
- return seedFolder.getRepository();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getShortDescription()
- */
- public String getShortDescription() {
- return Policy.bind("LocalProjectTagSource.0", Integer.toString(remoteFolders.length)); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#commit(org.eclipse.team.internal.ccvs.core.CVSTag[], boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void commit(CVSTag[] tags, boolean replace, IProgressMonitor monitor) throws CVSException {
- // Does not commit tags
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getCVSResources()
- */
- public ICVSResource[] getCVSResources() {
- return remoteFolders;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getTags(int)
- */
- public CVSTag[] getTags(int type) {
- if (type == CVSTag.HEAD || type == BASE) {
- return super.getTags(type);
- }
- // Accumulate the tags for all folders
- Set allTags = new HashSet();
- for (int i = 0; i < remoteFolders.length; i++) {
- ICVSRemoteFolder folder = remoteFolders[i];
- CVSTag[] tags = SingleFolderTagSource.getTags(folder, type);
- allTags.addAll(Arrays.asList(tags));
- }
- // Exclude the tags for the seedFolder
- CVSTag[] tags = SingleFolderTagSource.getTags(seedFolder, type);
- allTags.removeAll(Arrays.asList(tags));
- return (CVSTag[]) allTags.toArray(new CVSTag[allTags.size()]);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/MultiFolderTagSource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/MultiFolderTagSource.java
deleted file mode 100644
index ac8f949a3..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/MultiFolderTagSource.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-/**
- * A tag source for multiple folders.
- *
- * TODO: Temporarily a subclass of single folder until I
- * can figure out how to handle the multi-folder case.
- */
-public class MultiFolderTagSource extends SingleFolderTagSource {
-
- private final ICVSFolder[] folders;
-
- /* package */ MultiFolderTagSource(ICVSFolder[] folders) {
- super(folders[0]);
- this.folders = folders;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.SingleFolderTagSource#getShortDescription()
- */
- public String getShortDescription() {
- return Policy.bind("MultiFolderTagSource.0", Integer.toString(folders.length)); //$NON-NLS-1$
- }
-
- /**
- * Return the folders of this tag source
- * @return
- */
- public ICVSFolder[] getFolders() {
- return folders;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.SingleFolderTagSource#getCVSResources()
- */
- public ICVSResource[] getCVSResources() {
- return folders;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/SingleFileTagSource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/SingleFileTagSource.java
deleted file mode 100644
index 30cd23307..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/SingleFileTagSource.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-
-/**
- * A tag source for a single ICVSFile
- */
-public class SingleFileTagSource extends TagSource {
-
- public static CVSTag[] fetchTagsFor(ICVSFile file, IProgressMonitor monitor) throws TeamException {
- Set tagSet = new HashSet();
- ILogEntry[] entries = file.getLogEntries(monitor);
- for (int j = 0; j < entries.length; j++) {
- CVSTag[] tags = entries[j].getTags();
- for (int k = 0; k < tags.length; k++) {
- tagSet.add(tags[k]);
- }
- }
- return (CVSTag[])tagSet.toArray(new CVSTag[tagSet.size()]);
- }
-
- private ICVSFile file;
- private TagSource parentFolderTagSource;
-
- /* package */ /**
- *
- */
- public SingleFileTagSource(ICVSFile file) {
- this.file = file;
- parentFolderTagSource = TagSource.create(new ICVSResource[] { file.getParent() });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getTags(int)
- */
- public CVSTag[] getTags(int type) {
- return parentFolderTagSource.getTags(type);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#refresh(org.eclipse.core.runtime.IProgressMonitor)
- */
- public CVSTag[] refresh(boolean bestEffort, IProgressMonitor monitor) throws TeamException {
- CVSTag[] tags = fetchTagsFor(file, monitor);
- commit(tags, false, monitor);
- fireChange();
- return tags;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getLocation()
- */
- public ICVSRepositoryLocation getLocation() {
- RepositoryManager mgr = CVSUIPlugin.getPlugin().getRepositoryManager();
- ICVSRepositoryLocation location = mgr.getRepositoryLocationFor(file);
- return location;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getShortDescription()
- */
- public String getShortDescription() {
- return file.getName();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#commit(org.eclipse.team.internal.ccvs.core.CVSTag[], boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void commit(CVSTag[] tags, boolean replace, IProgressMonitor monitor) throws CVSException {
- parentFolderTagSource.commit(tags, replace, monitor);
- fireChange();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getCVSResources()
- */
- public ICVSResource[] getCVSResources() {
- return new ICVSResource[] { file };
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/SingleFolderTagSource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/SingleFolderTagSource.java
deleted file mode 100644
index 1c6bb08a8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/SingleFolderTagSource.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * A tag source that returns the tags associated with a single remote folder
- */
-public class SingleFolderTagSource extends TagSource {
-
- public static CVSTag[] getTags(ICVSFolder folder, int type) {
- if (type == CVSTag.HEAD)
- return new CVSTag[] { CVSTag.DEFAULT } ;
- return CVSUIPlugin.getPlugin().getRepositoryManager().getKnownTags(folder, type);
- }
-
- private ICVSFolder folder;
-
- /* package */ SingleFolderTagSource(ICVSFolder folder) {
- this.folder = folder;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#getTags(int)
- */
- public CVSTag[] getTags(int type) {
- if (type == CVSTag.HEAD || type == BASE) {
- return super.getTags(type);
- }
- return getTags(getFolder(), type);
- }
-
- /**
- * Return the folder the tags are obtained from
- * @return the folder the tags are obtained from
- */
- public ICVSFolder getFolder() {
- return folder;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#refresh(org.eclipse.core.runtime.IProgressMonitor)
- */
- public CVSTag[] refresh(boolean bestEffort, IProgressMonitor monitor) throws TeamException {
- CVSTag[] tags = CVSUIPlugin.getPlugin().getRepositoryManager().refreshDefinedTags(getFolder(), bestEffort /* recurse */, true /* notify */, monitor);
- fireChange();
- return tags;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#getLocation()
- */
- public ICVSRepositoryLocation getLocation() {
- RepositoryManager mgr = CVSUIPlugin.getPlugin().getRepositoryManager();
- ICVSRepositoryLocation location = mgr.getRepositoryLocationFor(getFolder());
- return location;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#getShortDescription()
- */
- public String getShortDescription() {
- return getFolder().getName();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#commit(org.eclipse.team.internal.ccvs.core.CVSTag[], boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void commit(final CVSTag[] tags, final boolean replace, IProgressMonitor monitor) throws CVSException {
- try {
- final RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- manager.run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ICVSFolder folder = getFolder();
- if (replace) {
- CVSTag[] oldTags = manager.getKnownTags(folder);
- manager.removeTags(folder, oldTags);
- }
- manager.addTags(folder, tags);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- }
- }, monitor);
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } catch (InterruptedException e) {
- // Ignore
- }
- fireChange();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getCVSResources()
- */
- public ICVSResource[] getCVSResources() {
- final ICVSResource[][] resources = new ICVSResource[][] { null };
- try {
- getRunnableContext().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- resources[0] = folder.fetchChildren(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- });
- return resources[0];
- } catch (InvocationTargetException e) {
- CVSUIPlugin.log(CVSException.wrapException(e));
- } catch (InterruptedException e) {
- // Ignore
- }
- return new ICVSResource[] { folder };
- }
-
- private IRunnableContext getRunnableContext() {
- return PlatformUI.getWorkbench().getProgressService();
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagAsVersionDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagAsVersionDialog.java
deleted file mode 100644
index 3a59a7026..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagAsVersionDialog.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.ITagOperation;
-import org.eclipse.team.internal.ui.dialogs.DetailsDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-public class TagAsVersionDialog extends DetailsDialog {
-
- private static final int TAG_AREA_HEIGHT_HINT = 200;
-
- private ITagOperation operation;
-
- private Text tagText;
- private Button moveTagButton;
-
- private String tagName = ""; //$NON-NLS-1$
- private boolean moveTag = false;
-
- private TagSource tagSource;
-
- private TagSelectionArea tagArea;
-
- public TagAsVersionDialog(Shell parentShell, String title, ITagOperation operation) {
- super(parentShell, title);
- this.tagSource = operation.getTagSource();
- this.operation = operation;
- }
-
- /**
- * @see DetailsDialog#createMainDialogArea(Composite)
- */
- protected void createMainDialogArea(Composite parent) {
- // create message
- Label label = new Label(parent, SWT.WRAP);
- label.setText(Policy.bind("TagAction.enterTag")); //$NON-NLS-1$
- GridData data = new GridData(
- GridData.GRAB_HORIZONTAL |
- GridData.HORIZONTAL_ALIGN_FILL |
- GridData.VERTICAL_ALIGN_CENTER);
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);;
- label.setLayoutData(data);
-
- tagText = new Text(parent, SWT.SINGLE | SWT.BORDER);
- tagText.setLayoutData(new GridData(
- GridData.GRAB_HORIZONTAL |
- GridData.HORIZONTAL_ALIGN_FILL));
- tagText.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- tagName = tagText.getText();
- updateEnablements();
- }
- }
- );
-
- moveTagButton = new Button(parent, SWT.CHECK);
- moveTagButton.setText(Policy.bind("TagAction.moveTag")); //$NON-NLS-1$
- moveTagButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- moveTagButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- moveTag = moveTagButton.getSelection();
- }
- });
-
- // Add F1 help
- WorkbenchHelp.setHelp(parent, IHelpContextIds.TAG_AS_VERSION_DIALOG);
- Dialog.applyDialogFont(parent);
- }
-
- public boolean shouldMoveTag() {
- return moveTag;
- }
-
- /**
- * @see DetailsDialog#createDropDownDialogArea(Composite)
- */
- protected Composite createDropDownDialogArea(Composite parent) {
- // create a composite with standard margins and spacing
- 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);
- GridData gridData = new GridData(GridData.FILL_BOTH);
- gridData.heightHint = TAG_AREA_HEIGHT_HINT;
- composite.setLayoutData(gridData);
-
- tagArea = new TagSelectionArea(getShell(), tagSource, TagSelectionArea.INCLUDE_VERSIONS, null);
- tagArea.setTagAreaLabel(Policy.bind("TagAction.existingVersions")); //$NON-NLS-1$
- tagArea.setIncludeFilterInputArea(false);
- tagArea.createArea(composite);
- tagArea.addPropertyChangeListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(TagSelectionArea.SELECTED_TAG)) {
- CVSTag tag = tagArea.getSelection();
- if (tag != null) {
- tagText.setText(tag.getName());
- }
- } else if (event.getProperty().equals(TagSelectionArea.OPEN_SELECTED_TAG)) {
- CVSTag tag = tagArea.getSelection();
- if (tag != null) {
- tagText.setText(tag.getName());
- okPressed();
- }
- }
- }
- });
- return composite;
- }
-
- /**
- * Validates tag name
- */
- protected void updateEnablements() {
- String message = null;
- if(tagName.length() == 0) {
- message = ""; //$NON-NLS-1$
- } else {
- IStatus status = CVSTag.validateTagName(tagName);
- if (!status.isOK()) {
- message = status.getMessage();
- }
- }
- setPageComplete(message == null);
- setErrorMessage(message);
- if (tagArea != null) {
- tagArea.setFilter(tagName);
- }
- }
-
- /**
- * Returns the tag name entered into this dialog
- */
- public String getTagName() {
- return tagName;
- }
-
- /**
- * @return
- */
- public ITagOperation getOperation() {
- operation.setTag(new CVSTag(tagName, CVSTag.VERSION));
- if (moveTag) {
- operation.moveTag();
- }
- return operation;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#isMainGrabVertical()
- */
- protected boolean isMainGrabVertical() {
- return false;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagConfigurationDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagConfigurationDialog.java
deleted file mode 100644
index 0f3a41d3e..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagConfigurationDialog.java
+++ /dev/null
@@ -1,763 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-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.*;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.model.RemoteContentProvider;
-import org.eclipse.team.internal.ccvs.ui.repo.NewDateTagAction;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSourceWorkbenchAdapter.ProjectElementSorter;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-/**
- * Allows configuration of the CVS tags that are shown within the workbench.
- */
-public class TagConfigurationDialog extends Dialog {
-
- // show the resource contained within the roots
- private TreeViewer cvsResourceTree;
-
- // shows the tags found on the selected resources
- private CheckboxTableViewer cvsTagTree;
-
- // shows the defined tags for the given root
- private TreeViewer cvsDefinedTagsTree;
-
- // remember the root element in the defined tags tree
- private TagSourceWorkbenchAdapter cvsDefinedTagsRootElement;
-
- // list of auto-refresh files
- private org.eclipse.swt.widgets.List autoRefreshFileList;
-
- // enable selecting auto-refresh files
- private boolean allowSettingAutoRefreshFiles = true;
-
- // preference keys
- private final String ALLOWREFRESH_WIDTH_KEY = "AllowRefreshWidth"; //$NON-NLS-1$
- private final String ALLOWREFRESH_HEIGHT_KEY = "AllowRefreshHeight"; //$NON-NLS-1$
- private final String NOREFRESH_WIDTH_KEY = "NoRefreshWidth"; //$NON-NLS-1$
- private final String NOREFRESH_HEIGHT_KEY = "NoRefreshHeight"; //$NON-NLS-1$
-
- // buttons
- private Button addSelectedTagsButton;
- private Button addSelectedFilesButton;
- private Button removeFileButton;
- private Button removeTagButton;
-
- // dialogs settings that are persistent between workbench sessions
- private IDialogSettings settings;
-
- private final TagSource tagSource;
-
- private final TagSourceWrapper wrappedTagSource;
-
- class FileSorter extends ViewerSorter {
- public int compare(Viewer viewer, Object e1, Object e2) {
- boolean oneIsFile = e1 instanceof CVSFileElement;
- boolean twoIsFile = e2 instanceof CVSFileElement;
- if (oneIsFile != twoIsFile) {
- return oneIsFile ? 1 : -1;
- }
- return super.compare(viewer, e1, e2);
- }
- }
-
- /*
- * Create a tag source that cahces the added and removed tags
- * so that the changes can be propogated to the repository
- * manager when OK is pressed
- */
- class TagSourceWrapper extends TagSource {
-
- private final TagSource tagSource;
- private final List branches = new ArrayList();
- private final List versions = new ArrayList();
- private final List dates = new ArrayList();
-
- public TagSourceWrapper(TagSource tagSource) {
- this.tagSource = tagSource;
- branches.addAll(Arrays.asList(tagSource.getTags(CVSTag.BRANCH)));
- versions.addAll(Arrays.asList(tagSource.getTags(CVSTag.VERSION)));
- dates.addAll(Arrays.asList(tagSource.getTags(CVSTag.DATE)));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#getTags(int)
- */
- public CVSTag[] getTags(int type) {
- if (type == CVSTag.HEAD || type == BASE) {
- return super.getTags(type);
- }
- List list = getTagList(type);
- if (list != null)
- return (CVSTag[]) list.toArray(new CVSTag[list.size()]);
- return tagSource.getTags(type);
- }
-
- private List getTagList(int type) {
- switch (type) {
- case CVSTag.VERSION:
- return versions;
- case CVSTag.BRANCH:
- return branches;
- case CVSTag.DATE:
- return dates;
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#refresh(org.eclipse.core.runtime.IProgressMonitor)
- */
- public CVSTag[] refresh(boolean bestEffort, IProgressMonitor monitor) throws TeamException {
- // The wrapper is never refreshed
- return new CVSTag[0];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#getLocation()
- */
- public ICVSRepositoryLocation getLocation() {
- return tagSource.getLocation();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#getShortDescription()
- */
- public String getShortDescription() {
- return tagSource.getShortDescription();
- }
-
- public void remove(CVSTag[] tags) {
- for (int i = 0; i < tags.length; i++) {
- CVSTag tag = tags[i];
- List list = getTagList(tag.getType());
- if (list != null)
- list.remove(tag);
- }
- }
-
- public void add(CVSTag[] tags) {
- for (int i = 0; i < tags.length; i++) {
- CVSTag tag = tags[i];
- List list = getTagList(tag.getType());
- if (list != null)
- list.add(tag);
- }
- }
-
- public void removeAll() {
- versions.clear();
- branches.clear();
- dates.clear();
- }
-
- /**
- * Remember the state that has been accumulated
- * @param monitor
- * @throws CVSException
- */
- public void commit(IProgressMonitor monitor) throws CVSException {
- tagSource.commit(getTags(new int[] { CVSTag.VERSION, CVSTag.BRANCH, CVSTag.DATE }), true /* replace */, monitor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#commit(org.eclipse.team.internal.ccvs.core.CVSTag[], boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void commit(CVSTag[] tags, boolean replace, IProgressMonitor monitor) throws CVSException {
- // Not invoked
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getCVSResources()
- */
- public ICVSResource[] getCVSResources() {
- return tagSource.getCVSResources();
- }
- }
-
- public TagConfigurationDialog(Shell shell, TagSource tagSource) {
- super(shell);
- this.tagSource = tagSource;
- wrappedTagSource = new TagSourceWrapper(tagSource);
- setShellStyle(SWT.CLOSE|SWT.RESIZE|SWT.APPLICATION_MODAL);
- allowSettingAutoRefreshFiles = getSingleFolder(tagSource, false) != null;
- IDialogSettings workbenchSettings = CVSUIPlugin.getPlugin().getDialogSettings();
- this.settings = workbenchSettings.getSection("TagConfigurationDialog");//$NON-NLS-1$
- if (settings == null) {
- this.settings = workbenchSettings.addNewSection("TagConfigurationDialog");//$NON-NLS-1$
- }
- }
-
- /**
- * @see Window#configureShell(Shell)
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(Policy.bind("TagConfigurationDialog.1", tagSource.getShortDescription())); //$NON-NLS-1$
- }
-
- /**
- * @see Dialog#createDialogArea(Composite)
- */
- protected Control createDialogArea(Composite parent) {
- Composite shell = new Composite(parent, SWT.NONE);
- GridData data = new GridData (GridData.FILL_BOTH);
- shell.setLayoutData(data);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- gridLayout.makeColumnsEqualWidth = true;
- gridLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- gridLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- shell.setLayout (gridLayout);
-
- Composite comp = new Composite(shell, SWT.NULL);
- gridLayout = new GridLayout();
- gridLayout.numColumns = 1;
- gridLayout.marginWidth = 0;
- gridLayout.marginHeight = 0;
- comp.setLayout(gridLayout);
- comp.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Label cvsResourceTreeLabel = new Label(comp, SWT.NONE);
- cvsResourceTreeLabel.setText(Policy.bind("TagConfigurationDialog.5")); //$NON-NLS-1$
- data = new GridData();
- data.horizontalSpan = 1;
- cvsResourceTreeLabel.setLayoutData(data);
-
- Tree tree = new Tree(comp, SWT.BORDER | SWT.MULTI);
- cvsResourceTree = new TreeViewer (tree);
- cvsResourceTree.setContentProvider(new RemoteContentProvider());
- cvsResourceTree.setLabelProvider(new WorkbenchLabelProvider());
- data = new GridData (GridData.FILL_BOTH);
- data.heightHint = 150;
- data.horizontalSpan = 1;
- cvsResourceTree.getTree().setLayoutData(data);
- cvsResourceTree.setInput(TagSourceResourceAdapter.getViewerInput(tagSource));
- cvsResourceTree.setSorter(new FileSorter());
- cvsResourceTree.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateShownTags();
- updateEnablements();
- }
- });
-
- comp = new Composite(shell, SWT.NULL);
- gridLayout = new GridLayout();
- gridLayout.numColumns = 1;
- gridLayout.marginWidth = 0;
- gridLayout.marginHeight = 0;
- comp.setLayout(gridLayout);
- comp.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Label cvsTagTreeLabel = new Label(comp, SWT.NONE);
- cvsTagTreeLabel.setText(Policy.bind("TagConfigurationDialog.6")); //$NON-NLS-1$
- data = new GridData();
- data.horizontalSpan = 1;
- cvsTagTreeLabel.setLayoutData(data);
-
- final Table table = new Table(comp, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION | SWT.CHECK);
- data = new GridData(GridData.FILL_BOTH);
- data.heightHint = 150;
- data.horizontalSpan = 1;
- table.setLayoutData(data);
- cvsTagTree = new CheckboxTableViewer(table);
- cvsTagTree.setContentProvider(new WorkbenchContentProvider());
- cvsTagTree.setLabelProvider(new WorkbenchLabelProvider());
- cvsTagTree.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateEnablements();
- }
- });
-
- Composite selectComp = new Composite(comp, SWT.NONE);
- GridLayout selectLayout = new GridLayout(2, true);
- selectLayout.marginHeight = selectLayout.marginWidth = 0;
- selectComp.setLayout(selectLayout);
- selectComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Button selectAllButton = new Button(selectComp, SWT.PUSH);
- selectAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- selectAllButton.setText(Policy.bind("ReleaseCommentDialog.selectAll")); //$NON-NLS-1$
- selectAllButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- int nItems = table.getItemCount();
- for (int j=0; j<nItems; j++)
- table.getItem(j).setChecked(true);
- }
- });
- Button deselectAllButton = new Button(selectComp, SWT.PUSH);
- deselectAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- deselectAllButton.setText(Policy.bind("ReleaseCommentDialog.deselectAll")); //$NON-NLS-1$
- deselectAllButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- int nItems = table.getItemCount();
- for (int j=0; j<nItems; j++)
- table.getItem(j).setChecked(false);
- }
- });
-
- cvsTagTree.setSorter(new ViewerSorter() {
- public int compare(Viewer viewer, Object e1, Object e2) {
- if (!(e1 instanceof TagElement) || !(e2 instanceof TagElement)) return super.compare(viewer, e1, e2);
- CVSTag tag1 = ((TagElement)e1).getTag();
- CVSTag tag2 = ((TagElement)e2).getTag();
- int type1 = tag1.getType();
- int type2 = tag2.getType();
- if (type1 != type2) {
- return type1 - type2;
- }
- // Sort in reverse order so larger numbered versions are at the top
- return -tag1.compareTo(tag2);
- }
- });
-
- Composite rememberedTags = new Composite(shell, SWT.NONE);
- data = new GridData (GridData.FILL_BOTH);
- data.horizontalSpan = 2;
- rememberedTags.setLayoutData(data);
- gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- gridLayout.marginHeight = 0;
- gridLayout.marginWidth = 0;
- rememberedTags.setLayout (gridLayout);
-
- Label rememberedTagsLabel = new Label (rememberedTags, SWT.NONE);
- rememberedTagsLabel.setText (Policy.bind("TagConfigurationDialog.7")); //$NON-NLS-1$
- data = new GridData ();
- data.horizontalSpan = 2;
- rememberedTagsLabel.setLayoutData (data);
-
- tree = new Tree(rememberedTags, SWT.BORDER | SWT.MULTI);
- cvsDefinedTagsTree = new TreeViewer (tree);
- cvsDefinedTagsTree.setContentProvider(new WorkbenchContentProvider());
- cvsDefinedTagsTree.setLabelProvider(new WorkbenchLabelProvider());
- data = new GridData (GridData.FILL_BOTH);
- data.heightHint = 100;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- cvsDefinedTagsTree.getTree().setLayoutData(data);
- cvsDefinedTagsRootElement = new TagSourceWorkbenchAdapter(wrappedTagSource, TagSourceWorkbenchAdapter.INCLUDE_BRANCHES | TagSourceWorkbenchAdapter.INCLUDE_VERSIONS |TagSourceWorkbenchAdapter.INCLUDE_DATES);
- cvsDefinedTagsTree.setInput(cvsDefinedTagsRootElement);
- cvsDefinedTagsTree.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateEnablements();
- }
- });
- cvsDefinedTagsTree.setSorter(new ProjectElementSorter());
-
- Composite buttonComposite = new Composite(rememberedTags, SWT.NONE);
- data = new GridData ();
- data.verticalAlignment = GridData.BEGINNING;
- buttonComposite.setLayoutData(data);
- gridLayout = new GridLayout();
- gridLayout.marginHeight = 0;
- gridLayout.marginWidth = 0;
- buttonComposite.setLayout (gridLayout);
-
- addSelectedTagsButton = new Button (buttonComposite, SWT.PUSH);
- addSelectedTagsButton.setText (Policy.bind("TagConfigurationDialog.8")); //$NON-NLS-1$
- data = getStandardButtonData(addSelectedTagsButton);
- data.horizontalAlignment = GridData.FILL;
- addSelectedTagsButton.setLayoutData(data);
- addSelectedTagsButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- rememberCheckedTags();
- updateShownTags();
- updateEnablements();
- }
- });
- Button addDatesButton = new Button(buttonComposite, SWT.PUSH);
- addDatesButton.setText(Policy.bind("TagConfigurationDialog.0")); //$NON-NLS-1$
- data = getStandardButtonData(addDatesButton);
- data.horizontalAlignment = GridData.FILL;
- addDatesButton.setLayoutData(data);
- addDatesButton.addListener(SWT.Selection, new Listener(){
- public void handleEvent(Event event){
- CVSTag dateTag = NewDateTagAction.getDateTag(getShell(), tagSource.getLocation());
- addDateTagsSelected(dateTag);
- updateShownTags();
- updateEnablements();
- }
- });
- removeTagButton = new Button (buttonComposite, SWT.PUSH);
- removeTagButton.setText (Policy.bind("TagConfigurationDialog.9")); //$NON-NLS-1$
- data = getStandardButtonData(removeTagButton);
- data.horizontalAlignment = GridData.FILL;
- removeTagButton.setLayoutData(data);
- removeTagButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- deleteSelected();
- updateShownTags();
- updateEnablements();
- }
- });
-
- Button removeAllTags = new Button (buttonComposite, SWT.PUSH);
- removeAllTags.setText (Policy.bind("TagConfigurationDialog.10")); //$NON-NLS-1$
- data = getStandardButtonData(removeAllTags);
- data.horizontalAlignment = GridData.FILL;
- removeAllTags.setLayoutData(data);
- removeAllTags.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- removeAllKnownTags();
- updateShownTags();
- updateEnablements();
- }
- });
-
- if(allowSettingAutoRefreshFiles) {
- Label explanation = new Label(rememberedTags, SWT.WRAP);
- explanation.setText(Policy.bind("TagConfigurationDialog.11")); //$NON-NLS-1$
- data = new GridData ();
- data.horizontalSpan = 2;
- //data.widthHint = 300;
- explanation.setLayoutData(data);
-
- autoRefreshFileList = new org.eclipse.swt.widgets.List(rememberedTags, SWT.BORDER | SWT.MULTI);
- data = new GridData ();
- data.heightHint = 45;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- autoRefreshFileList.setLayoutData(data);
- try {
- autoRefreshFileList.setItems(CVSUIPlugin.getPlugin().getRepositoryManager().getAutoRefreshFiles(getSingleFolder(tagSource, false)));
- } catch (CVSException e) {
- autoRefreshFileList.setItems(new String[0]);
- CVSUIPlugin.log(e);
- }
- autoRefreshFileList.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- updateEnablements();
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- updateEnablements();
- }
- });
-
- Composite buttonComposite2 = new Composite(rememberedTags, SWT.NONE);
- data = new GridData ();
- data.verticalAlignment = GridData.BEGINNING;
- buttonComposite2.setLayoutData(data);
- gridLayout = new GridLayout();
- gridLayout.marginHeight = 0;
- gridLayout.marginWidth = 0;
- buttonComposite2.setLayout (gridLayout);
-
- addSelectedFilesButton = new Button (buttonComposite2, SWT.PUSH);
- addSelectedFilesButton.setText (Policy.bind("TagConfigurationDialog.12")); //$NON-NLS-1$
- data = getStandardButtonData(addSelectedFilesButton);
- data.horizontalAlignment = GridData.FILL;
- addSelectedFilesButton.setLayoutData(data);
- addSelectedFilesButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- addSelectionToAutoRefreshList();
- }
- });
-
- removeFileButton = new Button (buttonComposite2, SWT.PUSH);
- removeFileButton.setText (Policy.bind("TagConfigurationDialog.13")); //$NON-NLS-1$
- data = getStandardButtonData(removeFileButton);
- data.horizontalAlignment = GridData.FILL;
- removeFileButton.setLayoutData(data);
- removeFileButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- String[] selected = autoRefreshFileList.getSelection();
- for (int i = 0; i < selected.length; i++) {
- autoRefreshFileList.remove(selected[i]);
- autoRefreshFileList.setFocus();
- }
- }
- });
- WorkbenchHelp.setHelp(autoRefreshFileList, IHelpContextIds.TAG_CONFIGURATION_REFRESHLIST);
- }
-
- Label seperator = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
- data = new GridData (GridData.FILL_BOTH);
- data.horizontalSpan = 2;
- seperator.setLayoutData(data);
-
- WorkbenchHelp.setHelp(shell, IHelpContextIds.TAG_CONFIGURATION_OVERVIEW);
-
- updateEnablements();
- Dialog.applyDialogFont(parent);
- return shell;
- }
-
- private void updateShownTags() {
- final CVSFileElement[] filesSelection = getSelectedFiles();
- final Set tags = new HashSet();
- if(filesSelection.length!=0) {
- try {
- CVSUIPlugin.runWithProgress(getShell(), true /*cancelable*/, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- monitor.beginTask(Policy.bind("TagConfigurationDialog.22"), filesSelection.length); //$NON-NLS-1$
- try {
- for (int i = 0; i < filesSelection.length; i++) {
- ICVSFile file = filesSelection[i].getCVSFile();
- tags.addAll(Arrays.asList(getTagsFor(file, Policy.subMonitorFor(monitor, 1))));
- }
- } catch (TeamException e) {
- // ignore the exception
- } finally {
- monitor.done();
- }
- }
- });
- } catch (InterruptedException e) {
- // operation cancelled
- } catch (InvocationTargetException e) {
- // can't happen since we're ignoring all possible exceptions
- }
- cvsTagTree.getTable().removeAll();
- for (Iterator it = tags.iterator(); it.hasNext();) {
- CVSTag tag = (CVSTag) it.next();
- List knownTags = new ArrayList();
- knownTags.addAll(Arrays.asList(wrappedTagSource.getTags(new int[] { CVSTag.VERSION, CVSTag.BRANCH, CVSTag.DATE })));
- if(!knownTags.contains(tag)) {
- TagElement tagElem = new TagElement(tag);
- cvsTagTree.add(tagElem);
- cvsTagTree.setChecked(tagElem, true);
- }
- }
- }
- }
-
- private CVSFileElement[] getSelectedFiles() {
- IStructuredSelection selection = (IStructuredSelection)cvsResourceTree.getSelection();
- if (!selection.isEmpty()) {
- final List filesSelection = new ArrayList();
- Iterator it = selection.iterator();
- while(it.hasNext()) {
- Object o = it.next();
- if(o instanceof CVSFileElement) {
- filesSelection.add(o);
- }
- }
- return (CVSFileElement[]) filesSelection.toArray(new CVSFileElement[filesSelection.size()]);
- }
- return new CVSFileElement[0];
- }
-
- private void addSelectionToAutoRefreshList() {
- IStructuredSelection selection = (IStructuredSelection)cvsResourceTree.getSelection();
- if (!selection.isEmpty()) {
- final List filesSelection = new ArrayList();
- Iterator it = selection.iterator();
- while(it.hasNext()) {
- Object o = it.next();
- if(o instanceof CVSFileElement) {
- filesSelection.add(o);
- }
- }
- if(!filesSelection.isEmpty()) {
- for (it = filesSelection.iterator(); it.hasNext();) {
- try {
- ICVSFile file = ((CVSFileElement)it.next()).getCVSFile();
- ICVSFolder fileParent = file.getParent();
- String filePath = new Path(null, fileParent.getFolderSyncInfo().getRepository())
- .append(file.getRelativePath(fileParent)).toString();
- if(autoRefreshFileList.indexOf(filePath)==-1) {
- autoRefreshFileList.add(filePath);
- }
- } catch(CVSException e) {
- CVSUIPlugin.openError(getShell(), null, null, e);
- }
- }
- }
- }
- }
-
- private CVSTag[] getTagsFor(ICVSFile file, IProgressMonitor monitor) throws TeamException {
- return SingleFileTagSource.fetchTagsFor(file, monitor);
- }
-
- private void rememberCheckedTags() {
- Object[] checked = cvsTagTree.getCheckedElements();
- List tagsToAdd = new ArrayList();
- for (int i = 0; i < checked.length; i++) {
- CVSTag tag = ((TagElement)checked[i]).getTag();
- tagsToAdd.add(tag);
- }
- if (!tagsToAdd.isEmpty()) {
- wrappedTagSource.add((CVSTag[]) tagsToAdd.toArray(new CVSTag[tagsToAdd.size()]));
- cvsDefinedTagsTree.refresh();
- }
- }
-
- private void deleteSelected() {
- IStructuredSelection selection = (IStructuredSelection)cvsDefinedTagsTree.getSelection();
- List tagsToRemove = new ArrayList();
- if (!selection.isEmpty()) {
- Iterator it = selection.iterator();
- while(it.hasNext()) {
- Object o = it.next();
- if(o instanceof TagElement) {
- CVSTag tag = ((TagElement)o).getTag();
- tagsToRemove.add(tag);
- }
- }
- }
- if (!tagsToRemove.isEmpty()) {
- wrappedTagSource.remove((CVSTag[]) tagsToRemove.toArray(new CVSTag[tagsToRemove.size()]));
- cvsDefinedTagsTree.refresh();
- cvsDefinedTagsTree.getTree().setFocus();
- }
- }
- private void addDateTagsSelected(CVSTag tag){
- if(tag == null) return;
- List knownTags = new ArrayList();
- knownTags.addAll(Arrays.asList(wrappedTagSource.getTags(CVSTag.DATE)));
- if(!knownTags.contains( tag)){
- wrappedTagSource.add(new CVSTag[] { tag });
- cvsDefinedTagsTree.refresh();
- cvsDefinedTagsTree.getTree().setFocus();
- }
- }
- private boolean isTagSelectedInKnownTagTree() {
- IStructuredSelection selection = (IStructuredSelection)cvsDefinedTagsTree.getSelection();
- if (!selection.isEmpty()) {
- Iterator it = selection.iterator();
- while(it.hasNext()) {
- Object o = it.next();
- if(o instanceof TagElement) {
- return true;
- }
- }
- }
- return false;
- }
-
- private void removeAllKnownTags() {
- wrappedTagSource.removeAll();
- cvsDefinedTagsTree.refresh();
- }
-
- private void updateEnablements() {
- // add checked tags
- Object[] checked = cvsTagTree.getCheckedElements();
- addSelectedTagsButton.setEnabled(checked.length!=0?true:false);
-
- // Remove known tags
- removeTagButton.setEnabled(isTagSelectedInKnownTagTree()?true:false);
-
- if(allowSettingAutoRefreshFiles) {
- // add selected files
- addSelectedFilesButton.setEnabled(getSelectedFiles().length!=0?true:false);
-
- // remove auto refresh files
- removeFileButton.setEnabled(autoRefreshFileList.getSelection().length!=0?true:false);
- }
- }
-
- /**
- * @see Dialog#okPressed()
- */
- protected void okPressed() {
- try {
- // save auto refresh file names
- if(allowSettingAutoRefreshFiles) {
- RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- manager.setAutoRefreshFiles(getSingleFolder(tagSource, false), autoRefreshFileList.getItems());
- }
-
- wrappedTagSource.commit(null);
-
- super.okPressed();
- } catch (CVSException e) {
- CVSUIPlugin.openError(getShell(), null, null, e);
- }
- }
-
- protected ICVSFolder getSingleFolder(TagSource tagSource, boolean bestEffort) {
- if (!bestEffort && tagSource instanceof MultiFolderTagSource)
- return null;
- if (tagSource instanceof SingleFolderTagSource)
- return ((SingleFolderTagSource)tagSource).getFolder();
- return null;
- }
-
- /**
- * @see Window#getInitialSize()
- */
- protected Point getInitialSize() {
- int width, height;
- if(allowSettingAutoRefreshFiles) {
- try {
- height = settings.getInt(ALLOWREFRESH_HEIGHT_KEY);
- width = settings.getInt(ALLOWREFRESH_WIDTH_KEY);
- } catch(NumberFormatException e) {
- return super.getInitialSize();
- }
- } else {
- try {
- height = settings.getInt(NOREFRESH_HEIGHT_KEY);
- width = settings.getInt(NOREFRESH_WIDTH_KEY);
- } catch(NumberFormatException e) {
- return super.getInitialSize();
- }
- }
- return new Point(width, height);
- }
-
- /**
- * @see Dialog#cancelPressed()
- */
- protected void cancelPressed() {
- super.cancelPressed();
- }
-
- private GridData getStandardButtonData(Button button) {
- GridData data = new GridData();
- data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- //don't crop labels with large font
- //int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- //data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- return data;
- }
-
- /**
- * @see Window#close()
- */
- public boolean close() {
- Rectangle bounds = getShell().getBounds();
- if(allowSettingAutoRefreshFiles) {
- settings.put(ALLOWREFRESH_HEIGHT_KEY, bounds.height);
- settings.put(ALLOWREFRESH_WIDTH_KEY, bounds.width);
- } else {
- settings.put(NOREFRESH_HEIGHT_KEY, bounds.height);
- settings.put(NOREFRESH_WIDTH_KEY, bounds.width);
- }
- return super.close();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagContentAssistProcessor.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagContentAssistProcessor.java
deleted file mode 100644
index fe158424a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagContentAssistProcessor.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.util.*;
-import java.util.List;
-
-import org.eclipse.jface.contentassist.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.*;
-import org.eclipse.jface.text.contentassist.*;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.ui.contentassist.ContentAssistHandler;
-
-/**
- * A content assist processor for tags for use with Text widgets.
- */
-public class TagContentAssistProcessor implements ISubjectControlContentAssistProcessor {
-
- private FilteredTagList tags;
- private Map images = new HashMap();
-
- public static void createContentAssistant(Text text, TagSource tagSource, int includeFlags) {
- final TagContentAssistProcessor tagContentAssistProcessor = new TagContentAssistProcessor(tagSource, includeFlags);
- text.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- tagContentAssistProcessor.dispose();
- }
- });
- ContentAssistHandler.createHandlerForText(text, createSubjectContentAssistant(tagContentAssistProcessor));
- }
-
- private static SubjectControlContentAssistant createSubjectContentAssistant(IContentAssistProcessor processor) {
- final SubjectControlContentAssistant contentAssistant= new SubjectControlContentAssistant();
-
- contentAssistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
-
- //ContentAssistPreference.configure(contentAssistant, JavaPlugin.getDefault().getPreferenceStore());
-
- contentAssistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
- contentAssistant.setInformationControlCreator(new IInformationControlCreator() {
- public IInformationControl createInformationControl(Shell parent) {
- return new DefaultInformationControl(parent);
- }
- });
-
- return contentAssistant;
- }
-
- public TagContentAssistProcessor(TagSource tagSource, int includeFlags) {
- tags = new FilteredTagList(tagSource, TagSource.convertIncludeFlaqsToTagTypes(includeFlags));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.contentassist.ISubjectControlContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.contentassist.IContentAssistSubjectControl, int)
- */
- public ICompletionProposal[] computeCompletionProposals(IContentAssistSubjectControl contentAssistSubjectControl, int documentOffset) {
- Control c = contentAssistSubjectControl.getControl();
- int docLength = contentAssistSubjectControl.getDocument().getLength();
- if (c instanceof Text) {
- Text t = (Text)c;
- String filter = t.getText();
- tags.setPattern(filter);
- CVSTag[] matching = tags.getMatchingTags();
- if (matching.length > 0) {
- List proposals = new ArrayList();
- for (int i = 0; i < matching.length; i++) {
- CVSTag tag = matching[i];
- String name = tag.getName();
- ImageDescriptor desc = TagElement.getImageDescriptor(tag);
- Image image = null;
- if (desc != null) {
- image = (Image)images.get(desc);
- if (image == null) {
- image = desc.createImage();
- images.put(desc, image);
- }
- }
- CompletionProposal proposal = new CompletionProposal(name, 0, docLength, name.length(), image, name, null, null);
- proposals.add(proposal);
- }
- return (ICompletionProposal[]) proposals.toArray(new ICompletionProposal[proposals.size()]);
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.contentassist.ISubjectControlContentAssistProcessor#computeContextInformation(org.eclipse.jface.contentassist.IContentAssistSubjectControl, int)
- */
- public IContextInformation[] computeContextInformation(IContentAssistSubjectControl contentAssistSubjectControl, int documentOffset) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer, int)
- */
- public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
- Assert.isTrue(false, "ITextViewer not supported"); //$NON-NLS-1$
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeContextInformation(org.eclipse.jface.text.ITextViewer, int)
- */
- public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getCompletionProposalAutoActivationCharacters()
- */
- public char[] getCompletionProposalAutoActivationCharacters() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationAutoActivationCharacters()
- */
- public char[] getContextInformationAutoActivationCharacters() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getErrorMessage()
- */
- public String getErrorMessage() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationValidator()
- */
- public IContextInformationValidator getContextInformationValidator() {
- return null;
- }
-
- /**
- * Dispose of any images created by the assistant
- */
- public void dispose() {
- for (Iterator iter = images.values().iterator(); iter.hasNext();) {
- Image image = (Image) iter.next();
- image.dispose();
- }
- }
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagElement.java
deleted file mode 100644
index 139144450..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagElement.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.util.Date;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.model.CVSTagElement;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-public class TagElement implements IWorkbenchAdapter, IAdaptable {
- Object parent;
- CVSTag tag;
-
- public static ImageDescriptor getImageDescriptor(CVSTag tag) {
- if (tag.getType() == CVSTag.BRANCH || tag.equals(CVSTag.DEFAULT)) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_TAG);
- } else if (tag.getType() == CVSTag.DATE){
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_DATE);
- }else {
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_PROJECT_VERSION);
- }
- }
-
- /**
- * @deprecated
- * @param tag
- */
- public TagElement(CVSTag tag) {
- this(null, tag);
- }
- public TagElement(Object parent, CVSTag tag) {
- this.parent = parent;
- this.tag = tag;
- }
- public Object[] getChildren(Object o) {
- return new Object[0];
- }
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
- }
- public ImageDescriptor getImageDescriptor(Object object) {
- return getImageDescriptor(tag);
- }
- public String getLabel(Object o) {
- if(tag.getType() == CVSTag.DATE){
- Date date = tag.asDate();
- if (date != null){
- return CVSTagElement.toDisplayString(date);
- }
- }
- return tag.getName();
- }
- public Object getParent(Object o) {
- return parent;
- }
- public CVSTag getTag() {
- return tag;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return tag.hashCode();
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- if (obj instanceof TagElement) {
- return tag.equals(((TagElement)obj).getTag());
- }
- return super.equals(obj);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRefreshButtonArea.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRefreshButtonArea.java
deleted file mode 100644
index a4506ed9f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRefreshButtonArea.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.util.Assert;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ui.dialogs.DialogArea;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * An area that displays the Refresh and Configure Tags buttons
- */
-public class TagRefreshButtonArea extends DialogArea {
-
- private TagSource tagSource;
- private final Shell shell;
- private Button refreshButton;
- private IRunnableContext context;
-
- public TagRefreshButtonArea(Shell shell, TagSource tagSource) {
- Assert.isNotNull(shell);
- Assert.isNotNull(tagSource);
- this.shell = shell;
- this.tagSource = tagSource;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DialogArea#createArea(org.eclipse.swt.widgets.Composite)
- */
- public void createArea(Composite parent) {
- Composite buttonComp = new Composite(parent, SWT.NONE);
- GridData data = new GridData ();
- data.horizontalAlignment = GridData.END;
- buttonComp.setLayoutData(data);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- buttonComp.setLayout (layout);
-
- refreshButton = createTagRefreshButton(buttonComp, Policy.bind("TagConfigurationDialog.20")); //$NON-NLS-1$
- data = new GridData();
- data.horizontalAlignment = GridData.END;
- data.horizontalSpan = 1;
- refreshButton.setLayoutData (data);
-
- Button addButton = new Button(buttonComp, SWT.PUSH);
- addButton.setText (Policy.bind("TagConfigurationDialog.21")); //$NON-NLS-1$
- data = new GridData ();
- data.horizontalAlignment = GridData.END;
- data.horizontalSpan = 1;
- addButton.setLayoutData (data);
- addButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- TagConfigurationDialog d = new TagConfigurationDialog(shell, tagSource);
- d.open();
- }
- });
-
- WorkbenchHelp.setHelp(refreshButton, IHelpContextIds.TAG_CONFIGURATION_REFRESHACTION);
- WorkbenchHelp.setHelp(addButton, IHelpContextIds.TAG_CONFIGURATION_OVERVIEW);
- Dialog.applyDialogFont(buttonComp);
- }
-
- /*
- * Returns a button that implements the standard refresh tags operation. The runnable is run immediatly after
- * the tags are fetched from the server. A client should refresh their widgets that show tags because they
- * may of changed.
- */
- private Button createTagRefreshButton(Composite composite, String title) {
- Button refreshButton = new Button(composite, SWT.PUSH);
- refreshButton.setText (title);
- refreshButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- try {
- getRunnableContext().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- monitor.beginTask(Policy.bind("TagRefreshButtonArea.5"), 100); //$NON-NLS-1$
- CVSTag[] tags = tagSource.refresh(false, Policy.subMonitorFor(monitor, 70));
- if (tags.length == 0 && promptForBestEffort()) {
- tagSource.refresh(true, Policy.subMonitorFor(monitor, 30));
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- });
- } catch (InterruptedException e) {
- // operation cancelled
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(shell, Policy.bind("TagConfigurationDialog.14"), null, e); //$NON-NLS-1$
- }
- }
- });
- return refreshButton;
- }
-
- private boolean promptForBestEffort() {
- final boolean[] prompt = new boolean[] { false };
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- MessageDialog dialog = new MessageDialog(shell, Policy.bind("TagRefreshButtonArea.0"), null, //$NON-NLS-1$
- getNoTagsFoundMessage(),
- MessageDialog.INFORMATION,
- new String[] {
- Policy.bind("TagRefreshButtonArea.1"), //$NON-NLS-1$
- Policy.bind("TagRefreshButtonArea.2"), //$NON-NLS-1$
- Policy.bind("TagRefreshButtonArea.3") //$NON-NLS-1$
- }, 1);
- int code = dialog.open();
- if (code == 0) {
- prompt[0] = true;
- } else if (code == 1) {
- TagConfigurationDialog d = new TagConfigurationDialog(shell, tagSource);
- d.open();
- }
-
- }
- });
- return prompt[0];
- }
-
- private String getNoTagsFoundMessage() {
- return Policy.bind("TagRefreshButtonArea.4", tagSource.getShortDescription()); //$NON-NLS-1$
- }
-
- protected static ICVSFolder getSingleFolder(TagSource tagSource) {
- if (tagSource instanceof SingleFolderTagSource)
- return ((SingleFolderTagSource)tagSource).getFolder();
- return null;
- }
- public TagSource getTagSource() {
- return tagSource;
- }
- public void setTagSource(TagSource tagSource) {
- Assert.isNotNull(tagSource);
- this.tagSource = tagSource;
- }
-
- public IRunnableContext getRunnableContext() {
- if (context == null)
- return PlatformUI.getWorkbench().getProgressService();
- return context;
- }
-
- public void setRunnableContext(IRunnableContext context) {
- this.context = context;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRootElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRootElement.java
deleted file mode 100644
index c9464dde9..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRootElement.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * Workbench model element that contains a list of tags
- * of the same type (BRANCH, VERSION or DATE).
- */
-public class TagRootElement implements IWorkbenchAdapter, IAdaptable {
- private TagSource tagSource;
- private int typeOfTagRoot;
- private final Object parent;
-
- public TagRootElement(Object parent, TagSource tagSource, int typeOfTagRoot) {
- this.parent = parent;
- this.typeOfTagRoot = typeOfTagRoot;
- this.tagSource = tagSource;
- }
-
- public Object[] getChildren(Object o) {
- CVSTag[] childTags = tagSource.getTags(typeOfTagRoot);
- TagElement[] result = new TagElement[childTags.length];
- for (int i = 0; i < childTags.length; i++) {
- result[i] = new TagElement(this, childTags[i]);
- }
- return result;
- }
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
- }
- public ImageDescriptor getImageDescriptor(Object object) {
- if(typeOfTagRoot==CVSTag.BRANCH) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_BRANCHES_CATEGORY);
- } else if(typeOfTagRoot==CVSTag.DATE){
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_DATES_CATEGORY);
- }else {
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_VERSIONS_CATEGORY);
- }
- }
- public String getLabel(Object o) {
- if(typeOfTagRoot==CVSTag.BRANCH) {
- return Policy.bind("MergeWizardEndPage.branches"); //$NON-NLS-1$
- } else if(typeOfTagRoot==CVSTag.DATE){
- return Policy.bind("TagRootElement.0"); //$NON-NLS-1$
- }else {
- return Policy.bind("VersionsElement.versions"); //$NON-NLS-1$
- }
- }
- public Object getParent(Object o) {
- return parent;
- }
- /**
- * Gets the typeOfTagRoot.
- * @return Returns a int
- */
- public int getTypeOfTagRoot() {
- return typeOfTagRoot;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionArea.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionArea.java
deleted file mode 100644
index 3f165b816..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionArea.java
+++ /dev/null
@@ -1,612 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.util.*;
-import java.util.List;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
-import org.eclipse.team.internal.ccvs.ui.repo.NewDateTagAction;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSourceWorkbenchAdapter.ProjectElementSorter;
-import org.eclipse.team.internal.ui.dialogs.DialogArea;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.part.PageBook;
-
-/**
- * A dialog area that displays a list of tags for selection and supports
- * filtering of the displayed tags.
- */
-public class TagSelectionArea extends DialogArea {
-
- /*
- * Property constant which identifies the selected tag or
- * null if no tag is selected
- */
- public static final String SELECTED_TAG = "selectedTag"; //$NON-NLS-1$
-
- /*
- * Property constant which indicates that a tag has been selected in such
- * a way as to indicate that this is the desired tag (e.g double-click)
- */
- public static final String OPEN_SELECTED_TAG = "openSelectedTag"; //$NON-NLS-1$
-
- /*
- * Constants used to configure which tags are shown
- */
- public static final int INCLUDE_HEAD_TAG = TagSourceWorkbenchAdapter.INCLUDE_HEAD_TAG;
- public static final int INCLUDE_BASE_TAG = TagSourceWorkbenchAdapter.INCLUDE_BASE_TAG;
- public static final int INCLUDE_BRANCHES = TagSourceWorkbenchAdapter.INCLUDE_BRANCHES;
- public static final int INCLUDE_VERSIONS = TagSourceWorkbenchAdapter.INCLUDE_VERSIONS;
- public static final int INCLUDE_DATES = TagSourceWorkbenchAdapter.INCLUDE_DATES;
- public static final int INCLUDE_ALL_TAGS = TagSourceWorkbenchAdapter.INCLUDE_ALL_TAGS;
-
- private String tagAreaLabel;
- private final int includeFlags;
- private CVSTag selection;
- private String helpContext;
- private Text filterText;
- private TagSource tagSource;
- private final Shell shell;
- private TagRefreshButtonArea tagRefreshArea;
- private final TagSource.ITagSourceChangeListener listener = new TagSource.ITagSourceChangeListener() {
- public void tagsChanged(TagSource source) {
- Shell shell = getShell();
- if (!shell.isDisposed()) {
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- refresh();
- }
- });
- }
- }
- };
- private final DisposeListener disposeListener = new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (tagSource != null)
- tagSource.removeListener(listener);
- }
- };
-
- private PageBook switcher;
- private TreeViewer tagTree;
- private TableViewer tagTable;
- private boolean treeVisible = true;
- private boolean includeFilterInputArea = true;
- private String filterPattern = ""; //$NON-NLS-1$
-
- private IRunnableContext context;
-
- public TagSelectionArea(Shell shell, TagSource tagSource, int includeFlags, String helpContext) {
- this.shell = shell;
- this.includeFlags = includeFlags;
- this.helpContext = helpContext;
- this.tagSource = tagSource;
- setSelection(null);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.dialogs.DialogArea#createArea(org.eclipse.swt.widgets.Composite)
- */
- public void createArea(Composite parent) {
- // Create a composite for the entire area
- Composite outer = createComposite(parent, 1, true);
- initializeDialogUnits(outer);
- // Add F1 help
- if (helpContext != null) {
- WorkbenchHelp.setHelp(outer, helpContext);
- }
-
- // Create the tree area and refresh buttons with the possibility to add stuff in between
- createTagDisplayArea(outer);
- createCustomArea(outer);
- createRefreshButtons(outer);
-
- Dialog.applyDialogFont(parent);
- updateTagDisplay(true);
- }
-
- private void createTagDisplayArea(Composite parent) {
- Composite inner = createGrabbingComposite(parent, 1);
- if (isIncludeFilterInputArea()) {
- createFilterInput(inner);
- createWrappingLabel(inner, Policy.bind("TagSelectionArea.0"), 1); //$NON-NLS-1$
- } else {
- createWrappingLabel(inner, Policy.bind("TagSelectionArea.1", getTagAreaLabel()), 1); //$NON-NLS-1$
- }
- switcher = new PageBook(inner, SWT.NONE);
- GridData gridData = new GridData(GridData.FILL_BOTH);
- gridData.heightHint = 0;
- gridData.widthHint = 0;
- switcher.setLayoutData(gridData);
- tagTree = createTree(switcher);
- tagTable = createTable(switcher);
- }
-
- private void createFilterInput(Composite inner) {
- createWrappingLabel(inner, Policy.bind("TagSelectionArea.2", getTagAreaLabel()), 1); //$NON-NLS-1$
- filterText = createText(inner, 1);
- filterText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- setFilter(filterText.getText());
- }
- });
- filterText.addKeyListener(new KeyListener() {
- public void keyPressed(KeyEvent e) {
- if (e.keyCode == SWT.ARROW_DOWN && e.stateMask == 0) {
- tagTable.getControl().setFocus();
- }
- }
- public void keyReleased(KeyEvent e) {
- // Ignore
- }
- });
- }
-
- /**
- * Return the label that should be used for the tag area.
- * It should not have any trailing punctuations as the tag area
- * may position it differently depending on whether the filter
- * text input is included in the area.
- * @return the tag area label
- */
- public String getTagAreaLabel() {
- if (tagAreaLabel == null)
- tagAreaLabel = Policy.bind("TagSelectionArea.3"); //$NON-NLS-1$
- return tagAreaLabel;
- }
-
- /**
- * Set the label that should be used for the tag area.
- * It should not have any trailing punctuations as the tag area
- * may position it differently depending on whether the filter
- * text input is included in the area.
- * @param tagAreaLabel the tag area label
- */
- public void setTagAreaLabel(String tagAreaLabel) {
- this.tagAreaLabel = tagAreaLabel;
- }
-
- /**
- * Update the tag display to show the tags that match the
- * include flags and the filter entered by the user.
- */
- protected void updateTagDisplay(boolean firstTime) {
- String filter = getFilterString();
- if ((filter != null && filter.length() > 0) || isTableOnly()) {
- // Show the table and filter it accordingly
- try {
- switcher.setRedraw(false);
- treeVisible = false;
- switcher.showPage(tagTable.getControl());
- FilteredTagList list = (FilteredTagList)tagTable.getInput();
- list.setPattern(filter);
- tagTable.refresh();
- if (filterText == null || filter == null || filter.length() == 0) {
- setSelection(selection);
- } else {
- // Only set the top selection if there is a filter from the filter text
- // of this area. This is done to avoid selection loops
- selectTopElement();
- }
- } finally {
- switcher.setRedraw(true);
- }
- } else {
- // Show the tree
- if (!isTreeVisible() || firstTime) {
- try {
- switcher.setRedraw(false);
- treeVisible = true;
- switcher.showPage(tagTree.getControl());
- tagTree.refresh();
- setSelection(selection);
- } finally {
- switcher.setRedraw(true);
- }
- }
- }
- }
-
- /**
- * Return whether only a table should be used
- * @return whether only a table should be used
- */
- protected boolean isTableOnly() {
- return (includeFlags == INCLUDE_VERSIONS) || (includeFlags == INCLUDE_BRANCHES);
- }
-
- private String getFilterString() {
- return filterPattern;
- }
-
- /*
- * Select the top element in the tag table
- */
- private void selectTopElement() {
- if (tagTable.getTable().getItemCount() > 1) {
- TableItem item = tagTable.getTable().getItem(0);
- tagTable.getTable().setSelection(new TableItem[] { item });
- tagTable.setSelection(tagTable.getSelection());
- }
- }
-
- private FilteredTagList createFilteredInput() {
- return new FilteredTagList(tagSource, TagSource.convertIncludeFlaqsToTagTypes(includeFlags));
- }
-
- private Text createText(Composite parent, int horizontalSpan) {
- Text text = new Text(parent, SWT.BORDER);
- GridData data = new GridData();
- data.horizontalSpan = horizontalSpan;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.widthHint= 0;
- text.setLayoutData(data);
- return text;
- }
-
- protected void createRefreshButtons(Composite parent) {
- tagSource.addListener(listener);
- parent.addDisposeListener(disposeListener);
- tagRefreshArea = new TagRefreshButtonArea(shell, tagSource);
- if (context != null)
- tagRefreshArea.setRunnableContext(context);
- tagRefreshArea.createArea(parent);
- }
-
- protected void createTreeMenu(TreeViewer tagTree) {
- if ((includeFlags & TagSourceWorkbenchAdapter.INCLUDE_DATES) != 0) {
- // Create the popup menu
- MenuManager menuMgr = new MenuManager();
- Tree tree = tagTree.getTree();
- Menu menu = menuMgr.createContextMenu(tree);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- addMenuItemActions(manager);
- }
-
- });
- menuMgr.setRemoveAllWhenShown(true);
- tree.setMenu(menu);
- }
- }
-
- /**
- * Create aq custom area that is below the tag selection area but above the refresh busson group
- * @param parent
- */
- protected void createCustomArea(Composite parent) {
- // No default custom area
- }
-
- protected TreeViewer createTree(Composite parent) {
- Tree tree = new Tree(parent, SWT.MULTI | SWT.BORDER);
- GridData data = new GridData(GridData.FILL_BOTH);
- tree.setLayoutData(data);
- TreeViewer result = new TreeViewer(tree);
- initialize(result);
- result.getControl().addKeyListener(new KeyListener() {
- public void keyPressed(KeyEvent event) {
- handleKeyPressed(event);
- }
- public void keyReleased(KeyEvent event) {
- handleKeyReleased(event);
- }
- });
- result.setInput(createUnfilteredInput());
- createTreeMenu(result);
- return result;
- }
-
- protected TableViewer createTable(Composite parent) {
- Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
- GridData data = new GridData(GridData.FILL_BOTH);
- table.setLayoutData(data);
- TableLayout layout = new TableLayout();
- layout.addColumnData(new ColumnWeightData(100, true));
- table.setLayout(layout);
- TableColumn col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
- TableViewer viewer = new TableViewer(table);
- initialize(viewer);
- viewer.setInput(createFilteredInput());
- return viewer;
-
- }
-
- private void initialize(StructuredViewer viewer) {
- viewer.setContentProvider(new WorkbenchContentProvider());
- viewer.setLabelProvider(new WorkbenchLabelProvider());
- viewer.setSorter(new ProjectElementSorter());
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handleSelectionChange();
- }
- });
- // select and close on double click
- // To do: use defaultselection instead of double click
- viewer.getControl().addMouseListener(new MouseAdapter() {
- public void mouseDoubleClick(MouseEvent e) {
- CVSTag tag = internalGetSelectedTag();
- if (tag != null) {
- firePropertyChangeChange(OPEN_SELECTED_TAG, null, tag);
- }
- }
- });
- }
-
- private Object createUnfilteredInput() {
- return TagSourceWorkbenchAdapter.createInput(tagSource, includeFlags);
- }
-
- public void handleKeyPressed(KeyEvent event) {
- if (event.character == SWT.DEL && event.stateMask == 0) {
- deleteDateTag();
- }
- }
- private void deleteDateTag() {
- TagElement[] selectedDateTagElements = getSelectedDateTagElement();
- if (selectedDateTagElements.length == 0) return;
- for(int i = 0; i < selectedDateTagElements.length; i++){
- RepositoryManager mgr = CVSUIPlugin.getPlugin().getRepositoryManager();
- CVSTag tag = selectedDateTagElements[i].getTag();
- if(tag.getType() == CVSTag.DATE){
- mgr.removeDateTag(getLocation(),tag);
- }
- }
- tagTree.refresh();
- handleSelectionChange();
- }
-
- /**
- * Returns the selected date tag elements
- */
- private TagElement[] getSelectedDateTagElement() {
- ArrayList dateTagElements = null;
- IStructuredSelection selection = (IStructuredSelection)tagTree.getSelection();
- if (selection!=null && !selection.isEmpty()) {
- dateTagElements = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = CVSAction.getAdapter(elements.next(), TagElement.class);
- if (next instanceof TagElement) {
- if(((TagElement)next).getTag().getType() == CVSTag.DATE){
- dateTagElements.add(next);
- }
- }
- }
- }
- if (dateTagElements != null && !dateTagElements.isEmpty()) {
- TagElement[] result = new TagElement[dateTagElements.size()];
- dateTagElements.toArray(result);
- return result;
- }
- return new TagElement[0];
- }
- private void addDateTag(CVSTag tag){
- if(tag == null) return;
- List dateTags = new ArrayList();
- ICVSRepositoryLocation location = getLocation();
- dateTags.addAll(Arrays.asList(CVSUIPlugin.getPlugin().getRepositoryManager().getDateTags(location)));
- if(!dateTags.contains( tag)){
- CVSUIPlugin.getPlugin().getRepositoryManager().addDateTag(location, tag);
- }
- try {
- tagTree.getControl().setRedraw(false);
- tagTree.refresh();
- setSelection(tag);
- } finally {
- tagTree.getControl().setRedraw(true);
- }
- handleSelectionChange();
- }
- private void addMenuItemActions(IMenuManager manager) {
- manager.add(new Action(Policy.bind("TagSelectionDialog.0")) { //$NON-NLS-1$
- public void run() {
- CVSTag dateTag = NewDateTagAction.getDateTag(getShell(), getLocation());
- addDateTag(dateTag);
- }
- });
- if(getSelectedDateTagElement().length > 0){
- manager.add(new Action(Policy.bind("TagSelectionDialog.1")) { //$NON-NLS-1$
- public void run() {
- deleteDateTag();
- }
- });
- }
- }
-
- protected void handleKeyReleased(KeyEvent event) {
- }
-
- /**
- * handle a selection change event from the visible tag display
- * (which could be either the table or the tree).
- */
- protected void handleSelectionChange() {
- CVSTag newSelection = internalGetSelectedTag();
- if (selection != null && newSelection != null && selection.equals(newSelection)) {
- // the selection hasn't change so return
- return;
- }
- CVSTag oldSelection = selection;
- selection = newSelection;
- firePropertyChangeChange(SELECTED_TAG, oldSelection, selection);
- }
-
- private CVSTag internalGetSelectedTag() {
- IStructuredSelection selection;
- if (isTreeVisible()) {
- selection = (IStructuredSelection)tagTree.getSelection();
- } else {
- selection = (IStructuredSelection)tagTable.getSelection();
- }
- Object o = selection.getFirstElement();
- if (o instanceof TagElement)
- return ((TagElement)o).getTag();
- return null;
- }
-
- private boolean isTreeVisible() {
- return treeVisible;
- }
-
- private ICVSRepositoryLocation getLocation(){
- return tagSource.getLocation();
- }
- public CVSTag getSelection() {
- return selection;
- }
- public Shell getShell() {
- return shell;
- }
-
- /**
- * Set the focus to the filter text widget
- */
- public void setFocus() {
- if (filterText != null)
- filterText.setFocus();
- else if (switcher != null)
- switcher.setFocus();
-
- // Refresh in case tags were added since the last time the area had focus
- refresh();
- }
-
- /**
- * Select the given tag
- * @param selectedTag the tag to be selected
- */
- public void setSelection(CVSTag selectedTag) {
- if (isTreeVisible())
- if (tagTree != null && !tagTree.getControl().isDisposed()) {
- // TODO: Hack to instantiate the model before revealing the selection
- tagTree.expandToLevel(2);
- tagTree.collapseAll();
- // Reveal the selection
- tagTree.reveal(new TagElement(selectedTag));
- tagTree.setSelection(new StructuredSelection(new TagElement(selectedTag)));
- }
- else
- if (tagTable != null && !tagTable.getControl().isDisposed()) {
- tagTable.setSelection(new StructuredSelection(new TagElement(selectedTag)));
- }
- }
-
- /**
- * Refresh the state of the tag selection area
- */
- public void refresh() {
- if (isTreeVisible()) {
- if (tagTree != null && !tagTree.getControl().isDisposed()) {
- tagTree.refresh();
- }
- } else {
- if (tagTable != null && !tagTable.getControl().isDisposed()) {
- tagTable.refresh();
- }
- }
- }
-
- /**
- * Set the enablement state of the area
- * @param enabled the enablement state
- */
- public void setEnabled(boolean enabled) {
- if (filterText != null)
- filterText.setEnabled(enabled);
- tagTree.getControl().setEnabled(enabled);
- tagTable.getControl().setEnabled(enabled);
- }
-
- /**
- * Get the tag source for the tags being displayed
- * @return the tag source for the tags being displayed
- */
- public TagSource getTagSource() {
- return tagSource;
- }
-
- /**
- * Set the tag source from which the displayed tags are determined
- * @param tagSource the source of the tags being displayed
- */
- public void setTagSource(TagSource tagSource) {
- if (this.tagSource != null) {
- this.tagSource.removeListener(listener);
- }
- this.tagSource = tagSource;
- this.tagSource.addListener(listener);
- tagRefreshArea.setTagSource(this.tagSource);
- setTreeAndTableInput();
- }
-
- private void setTreeAndTableInput() {
- if (tagTree != null) {
- tagTree.setInput(createUnfilteredInput());
- }
- if (tagTable != null) {
- tagTable.setInput(createFilteredInput());
- }
-
- }
-
- /**
- * Set whether the input filter text is to be included in the tag selection area.
- * If excluded, clientscan still set the filter text directly using
- * <code>setFilter</code>.
- * @param include whether filter text input should be included
- */
- public void setIncludeFilterInputArea(boolean include) {
- includeFilterInputArea = include;
- }
-
- /**
- * Return whether the input filter text is to be included in the tag selection area.
- * If excluded, clientscan still set the filter text directly using
- * <code>setFilter</code>.
- * @return whether filter text input should be included
- */
- public boolean isIncludeFilterInputArea() {
- return includeFilterInputArea;
- }
-
- /**
- * Set the text used to filter the tag list.
- * @param filter the filter pattern
- */
- public void setFilter(String filter) {
- this.filterPattern = filter;
- updateTagDisplay(false);
- }
-
- public void setRunnableContext(IRunnableContext context) {
- this.context = context;
- if (tagRefreshArea != null)
- tagRefreshArea.setRunnableContext(context);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionDialog.java
deleted file mode 100644
index 30050625d..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionDialog.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-/**
- * Dialog to prompt the user to choose a tag for a selected resource
- */
-public class TagSelectionDialog extends Dialog implements IPropertyChangeListener {
-
- private TagSelectionArea tagSelectionArea;
-
- public static final int INCLUDE_HEAD_TAG = TagSourceWorkbenchAdapter.INCLUDE_HEAD_TAG;
- public static final int INCLUDE_BASE_TAG = TagSourceWorkbenchAdapter.INCLUDE_BASE_TAG;
- public static final int INCLUDE_BRANCHES = TagSourceWorkbenchAdapter.INCLUDE_BRANCHES;
- public static final int INCLUDE_VERSIONS = TagSourceWorkbenchAdapter.INCLUDE_VERSIONS;
- public static final int INCLUDE_DATES = TagSourceWorkbenchAdapter.INCLUDE_DATES;
- public static final int INCLUDE_ALL_TAGS = TagSourceWorkbenchAdapter.INCLUDE_ALL_TAGS;
-
- private Button okButton;
-
- // dialog title, should indicate the action in which the tag selection
- // dialog is being shown
- private String title;
-
- private boolean recurse = true;
-
- // constants
- private static final int SIZING_DIALOG_WIDTH = 400;
- private static final int SIZING_DIALOG_HEIGHT = 400;
-
- private CVSTag selection;
-
- private TagSource tagSource;
-
- private String message;
-
- private int includeFlags;
-
- private String helpContext;
-
- private boolean showRecurse;
-
- public static CVSTag getTagToCompareWith(Shell shell, TagSource tagSource, int includeFlags) {
- TagSelectionDialog dialog = new TagSelectionDialog(shell, tagSource,
- Policy.bind("CompareWithTagAction.message"), //$NON-NLS-1$
- Policy.bind("TagSelectionDialog.Select_a_Tag_1"), //$NON-NLS-1$
- includeFlags,
- false, /* show recurse*/
- IHelpContextIds.COMPARE_TAG_SELECTION_DIALOG);
- dialog.setBlockOnOpen(true);
- int result = dialog.open();
- if (result == Dialog.CANCEL) {
- return null;
- }
- return dialog.getResult();
- }
-
- /**
- * Creates a new TagSelectionDialog.
- * @param resource The resource to select a version for.
- */
- public TagSelectionDialog(Shell parentShell, TagSource tagSource, String title, String message, int includeFlags, final boolean showRecurse, String helpContext) {
- super(parentShell);
-
- // Create a tag selection area with a custom recurse option
- this.tagSource = tagSource;
- this.message = message;
- this.includeFlags = includeFlags;
- this.helpContext = helpContext;
- this.showRecurse = showRecurse;
- this.title = title;
- setShellStyle(getShellStyle() | SWT.RESIZE);
- }
-
- /* (non-Javadoc)
- * Method declared on Window.
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(title);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.window.Window#getInitialSize()
- */
- protected Point getInitialSize() {
- return new Point(SIZING_DIALOG_WIDTH, SIZING_DIALOG_HEIGHT);
- }
-
- /**
- * Creates this window's widgetry.
- * <p>
- * The default implementation of this framework method
- * creates this window's shell (by calling <code>createShell</code>),
- * its control (by calling <code>createContents</code>),
- * and initializes this window's shell bounds
- * (by calling <code>initializeBounds</code>).
- * This framework method may be overridden; however,
- * <code>super.create</code> must be called.
- * </p>
- */
- public void create() {
- super.create();
- initialize();
- }
-
- /**
- * Add buttons to the dialog's button bar.
- *
- * @param parent the button bar composite
- */
- protected void createButtonsForButtonBar(Composite parent) {
- // create OK and Cancel buttons by default
- okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- okButton.setEnabled(false);
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- }
-
- /**
- * Creates and returns the contents of the upper part
- * of this dialog (above the button bar).
- * <p>
- * The default implementation of this framework method
- * creates and returns a new <code>Composite</code> with
- * standard margins and spacing.
- * Subclasses should override.
- * </p>
- *
- * @param the parent composite to contain the dialog area
- * @return the dialog area control
- */
- protected Control createDialogArea(Composite parent) {
- Composite top = (Composite)super.createDialogArea(parent);
-
- // Delegate most of the dialog to the tag selection area
- tagSelectionArea = new TagSelectionArea(getShell(), tagSource, includeFlags, helpContext) {
- protected void createCustomArea(Composite parent) {
- if(showRecurse) {
- final Button recurseCheck = new Button(parent, SWT.CHECK);
- recurseCheck.setText(Policy.bind("TagSelectionDialog.recurseOption")); //$NON-NLS-1$
- recurseCheck.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- recurse = recurseCheck.getSelection();
- }
- });
- recurseCheck.setSelection(true);
- }
- }
- };
- if (message != null)
- tagSelectionArea.setTagAreaLabel(message);
- tagSelectionArea.addPropertyChangeListener(this);
- tagSelectionArea.createArea(top);
-
- // Create a separator between the tag area and the button area
- Label seperator = new Label(top, SWT.SEPARATOR | SWT.HORIZONTAL);
- GridData data = new GridData (GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- seperator.setLayoutData(data);
-
- updateEnablement();
- Dialog.applyDialogFont(parent);
-
- return top;
- }
-
-
- /**
- * Utility method that creates a label instance
- * and sets the default layout data.
- *
- * @param parent the parent for the new label
- * @param text the text for the new label
- * @return the new label
- */
- protected Label createLabel(Composite parent, String text) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = 1;
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
- return label;
- }
-
- /**
- * Returns the selected tag.
- */
- public CVSTag getResult() {
- return selection;
- }
-
- public boolean getRecursive() {
- return recurse;
- }
-
- /**
- * Initializes the dialog contents.
- */
- protected void initialize() {
- okButton.setEnabled(false);
- }
-
-
- /**
- * Updates the dialog enablement.
- */
- protected void updateEnablement() {
- if(okButton!=null) {
- okButton.setEnabled(selection != null);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- if (property.equals(TagSelectionArea.SELECTED_TAG)) {
- selection = (CVSTag)event.getNewValue();
- updateEnablement();
- } else if (property.equals(TagSelectionArea.OPEN_SELECTED_TAG)) {
- okPressed();
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionWizardPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionWizardPage.java
deleted file mode 100644
index f05330b3a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionWizardPage.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.wizards.CVSWizardPage;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * General tag selection page that allows the selection of a tag
- * for a particular remote folder
- */
-public class TagSelectionWizardPage extends CVSWizardPage {
-
- private CVSTag selectedTag;
-
- // Needed to dynamicaly create refresh buttons
- private Composite composite;
-
- private int includeFlags;
-
- // Fields for allowing the use of the tag from the local workspace
- boolean allowNoTag = false;
- private Button useResourceTagButton;
- private Button selectTagButton;
- private boolean useResourceTag = false;
- private String helpContextId;
- private TagSelectionArea tagArea;
- private String tagLabel;
- private TagSource tagSource;
-
- public TagSelectionWizardPage(String pageName, String title, ImageDescriptor titleImage, String description, TagSource tagSource, int includeFlags) {
- super(pageName, title, titleImage, description);
- this.tagSource = tagSource;
- this.includeFlags = includeFlags;
- }
-
- /**
- * Set the help context for the tag selection page.
- * This method must be invoked before <code>createControl</code>
- * @param helpContextId the help context id
- */
- public void setHelpContxtId(String helpContextId) {
- this.helpContextId = helpContextId;
- }
-
- /**
- * Set the label to appear over the tag list/tree.
- * If not set, a default will be used.
- * * This method must be invoked before <code>createControl</code>
- * @param tagLabel the label to appear over the tag list/tree
- */
- public void setTagLabel(String tagLabel) {
- this.tagLabel = tagLabel;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- composite = createComposite(parent, 1, false);
- setControl(composite);
-
- // set F1 help
- if (helpContextId != null)
- WorkbenchHelp.setHelp(composite, helpContextId);
-
- if (allowNoTag) {
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- useResourceTag = useResourceTagButton.getSelection();
- updateEnablement();
- }
- };
- useResourceTag = true;
- useResourceTagButton = createRadioButton(composite, Policy.bind("TagSelectionWizardPage.0"), 1); //$NON-NLS-1$
- selectTagButton = createRadioButton(composite, Policy.bind("TagSelectionWizardPage.1"), 1); //$NON-NLS-1$
- useResourceTagButton.setSelection(useResourceTag);
- selectTagButton.setSelection(!useResourceTag);
- useResourceTagButton.addSelectionListener(listener);
- selectTagButton.addSelectionListener(listener);
- }
-
- createTagArea();
- updateEnablement();
- Dialog.applyDialogFont(parent);
- }
-
- private void createTagArea() {
- tagArea = new TagSelectionArea(getShell(), tagSource, includeFlags, null);
- if (tagLabel != null)
- tagArea.setTagAreaLabel(tagLabel);
- tagArea.setRunnableContext(getContainer());
- tagArea.createArea(composite);
- tagArea.addPropertyChangeListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(TagSelectionArea.SELECTED_TAG)) {
- selectedTag = tagArea.getSelection();
- updateEnablement();
- } else if (event.getProperty().equals(TagSelectionArea.OPEN_SELECTED_TAG)) {
- if (selectedTag != null)
- gotoNextPage();
- }
-
- }
- });
- refreshTagArea();
- }
-
- private void refreshTagArea() {
- if (tagArea != null) {
- tagArea.refresh();
- tagArea.setSelection(selectedTag);
- }
- }
-
- protected void updateEnablement() {
- tagArea.setEnabled(!useResourceTag);
- setPageComplete(useResourceTag || selectedTag != null);
- }
-
- public CVSTag getSelectedTag() {
- if (useResourceTag)
- return null;
- return selectedTag;
- }
-
- protected void gotoNextPage() {
- TagSelectionWizardPage.this.getContainer().showPage(getNextPage());
- }
-
- public void setAllowNoTag(boolean b) {
- allowNoTag = b;
- }
-
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible && tagArea != null) {
- tagArea.setFocus();
- }
- }
-
- /**
- * Set the tag source used by this wizard page
- * @param source the tag source
- */
- public void setTagSource(TagSource source) {
- this.tagSource = source;
- tagArea.setTagSource(tagSource);
- setSelection(null);
- refreshTagArea();
- }
-
- /**
- * Set the selection of the page to the given tag
- * @param selectedTag
- */
- public void setSelection(CVSTag selectedTag) {
- if (selectedTag == null && (includeFlags & TagSelectionArea.INCLUDE_HEAD_TAG) > 0) {
- this.selectedTag = CVSTag.DEFAULT;
- } else {
- this.selectedTag = selectedTag;
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSource.java
deleted file mode 100644
index 0e9540bfb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSource.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.util.*;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-
-/**
- * A tag source provides access to a set of tags.
- */
-public abstract class TagSource {
-
- /*
- * Special constant representing the BASE tag
- */
- public static final int BASE = -1;
-
- public static final TagSource EMPTY = new TagSource() {
- public void commit(CVSTag[] tags, boolean replace, IProgressMonitor monitor) throws CVSException {
- // No-op
- }
- public ICVSRepositoryLocation getLocation() {
- // TODO Auto-generated method stub
- return null;
- }
- public String getShortDescription() {
- return "Empty"; //$NON-NLS-1$
- }
- public CVSTag[] getTags(int type) {
- return new CVSTag[0];
- }
- public CVSTag[] refresh(boolean bestEffort, IProgressMonitor monitor) throws TeamException {
- return new CVSTag[0];
- }
- public ICVSResource[] getCVSResources() {
- return new ICVSResource[0];
- }
- };
-
- private ListenerList listeners = new ListenerList();
-
- /**
- * Simple interface for providing notification when the tags
- * for this source have changed.
- */
- public interface ITagSourceChangeListener {
- void tagsChanged(TagSource source);
- }
-
- public static int[] convertIncludeFlaqsToTagTypes(int includeFlags) {
- List types = new ArrayList();
- if ((includeFlags & TagSelectionArea.INCLUDE_BRANCHES) > 0)
- types.add(new Integer(CVSTag.BRANCH));
- if ((includeFlags & TagSelectionArea.INCLUDE_VERSIONS) > 0)
- types.add(new Integer(CVSTag.VERSION));
- if ((includeFlags & (TagSelectionArea.INCLUDE_HEAD_TAG)) > 0)
- types.add(new Integer(CVSTag.HEAD));
- if ((includeFlags & (TagSelectionArea.INCLUDE_DATES)) > 0)
- types.add(new Integer(CVSTag.DATE));
- if ((includeFlags & (TagSelectionArea.INCLUDE_BASE_TAG)) > 0)
- types.add(new Integer(BASE));
- int[] result = new int[types.size()];
- for (int i = 0; i < result.length; i++) {
- result[i] = ((Integer)types.get(i)).intValue();
-
- }
- return result;
- }
-
- /**
- * Create a tag source for the given folders
- * @param folders one or more folders
- * @return a tag source for the supplied folders
- */
- public static TagSource create(ICVSFolder[] folders) {
- if (folders.length == 1) {
- return new SingleFolderTagSource(folders[0]);
- } else {
- return new MultiFolderTagSource(folders);
- }
- }
-
- /**
- * Create a tag source for a list of resources
- * @param resources one or more resources
- * @return a tag source
- */
- public static TagSource create(ICVSResource[] resources) {
- if (resources.length == 1 && !resources[0].isFolder())
- return new SingleFileTagSource((ICVSFile)resources[0]);
- return create(getFolders(resources));
- }
-
- private static ICVSFolder[] getFolders(ICVSResource[] resources) {
- return new ICVSFolder[] { getFirstFolder(resources) } ;
- }
-
- /**
- * Create a tag source for a list of resources
- * @param resources one or more resources
- * @return a tag source
- */
- public static TagSource create(IResource[] resources) {
- return create(getCVSResources(getProjects(resources)));
- }
-
- private static IResource[] getProjects(IResource[] resources) {
- Set result = new HashSet();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- result.add(resource.getProject());
- }
- return (IResource[]) result.toArray(new IResource[result.size()]);
- }
-
- /**
- * Return a tag source for a single remote folder
- * @param remote the remote folder
- * @return a tag source for that folder
- */
- public static TagSource create(ICVSRemoteFolder remote) {
- return new SingleFolderTagSource(remote);
- }
-
- private static ICVSResource[] getCVSResources(IResource[] resources) {
- List cvsResources = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- cvsResources.add(CVSWorkspaceRoot.getCVSResourceFor(resource));
- }
- return (ICVSResource[]) cvsResources.toArray(new ICVSResource[cvsResources.size()]);
- }
-
- private static ICVSFolder getFirstFolder(ICVSResource[] resources) {
- if (resources[0].isFolder()) {
- return (ICVSFolder)resources[0];
- } else {
- return resources[0].getParent();
- }
- }
-
- public CVSTag[] getTags(int type) {
- switch (type) {
- case BASE:
- return new CVSTag[] { CVSTag.BASE };
- case CVSTag.HEAD:
- return new CVSTag[] { CVSTag.DEFAULT };
- }
- return new CVSTag[0];
- }
-
- public CVSTag[] getTags(int[] types) {
- if (types.length == 0) {
- return new CVSTag[0];
- }
- if (types.length == 1) {
- return getTags(types[0]);
- }
- List result = new ArrayList();
- for (int i = 0; i < types.length; i++) {
- int type = types[i];
- CVSTag[] tags = getTags(type);
- result.addAll(Arrays.asList(tags));
- }
- return (CVSTag[]) result.toArray(new CVSTag[result.size()]);
- }
-
- /**
- * Refresh the tags by contacting the server if appropriate
- * @param monitor a progress monitor
- * @param bestEffort if best effort is true, then the whole folder contents may be searched
- * @return any discovered tags
- */
- public abstract CVSTag[] refresh(boolean bestEffort, IProgressMonitor monitor) throws TeamException;
-
- public abstract ICVSRepositoryLocation getLocation();
-
- /**
- * Return a short description of the tag source for displaying in UI.
- * @return a short description of the tag source for displaying in UI.
- */
- public abstract String getShortDescription();
-
- /**
- * Commit a set of tag changes to the tag cache
- * @param tags the tags that should be cached
- * @param replace whether existing tags not in the list should be removed
- * @param monitor a progress monitor
- * @throws CVSException
- */
- public abstract void commit(CVSTag[] tags, boolean replace, IProgressMonitor monitor) throws CVSException;
-
- public void addListener(ITagSourceChangeListener listener) {
- listeners.add(listener);
- }
-
- public void removeListener(ITagSourceChangeListener listener) {
- listeners.remove(listener);
- }
-
- /**
- * Notify all listeners that the tags from this source may have changed
- */
- public void fireChange() {
- Object[] list = listeners.getListeners();
- for (int i = 0; i < list.length; i++) {
- final ITagSourceChangeListener listener = (ITagSourceChangeListener)list[i];
- Platform.run(new ISafeRunnable() {
- public void handleException(Throwable exception) {
- // logged by run
- }
- public void run() throws Exception {
- listener.tagsChanged(TagSource.this);
- }
- });
- }
- }
-
- public abstract ICVSResource[] getCVSResources();
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceResourceAdapter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceResourceAdapter.java
deleted file mode 100644
index d3902327f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceResourceAdapter.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * A workbench adapter that can be used to view the resources that make up
- * a tag source. It is used by the TagConfigurationDialog.
- */
-public class TagSourceResourceAdapter implements IAdaptable, IWorkbenchAdapter {
-
- public static Object getViewerInput(TagSource tagSource) {
- return new TagSourceResourceAdapter(tagSource);
- }
-
- TagSource tagSource;
-
- private TagSourceResourceAdapter(TagSource tagSource) {
- this.tagSource = tagSource;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
- */
- public Object[] getChildren(Object o) {
- ICVSResource[] children = tagSource.getCVSResources();
- if (children.length == 0) return new Object[0];
- List result = new ArrayList();
- for (int i = 0; i < children.length; i++) {
- ICVSResource resource = children[i];
- if (resource.isFolder()) {
- result.add(new CVSFolderElement((ICVSFolder)resource, false));
- } else {
- result.add(new CVSFileElement((ICVSFile)resource));
- }
- }
- return result.toArray(new Object[result.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- // No imgae descriptor
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
- */
- public String getLabel(Object o) {
- return tagSource.getShortDescription();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
- */
- public Object getParent(Object o) {
- // No parent
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) {
- return this;
- }
- return null;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceWorkbenchAdapter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceWorkbenchAdapter.java
deleted file mode 100644
index 24de6170e..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSourceWorkbenchAdapter.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.tags;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * A workbench adapter for a tag source that creates a model
- * for displaying the tags from a tag source in a tree or table
- * viewer. The workbench adapter is not a singleton since it needs
- * to be configured to display certain types of tags.
- */
-public class TagSourceWorkbenchAdapter implements IAdaptable, IWorkbenchAdapter {
-
- /**
- * Constants for configuring which types of tags should be displayed.
- */
- public static final int INCLUDE_HEAD_TAG = 1;
- public static final int INCLUDE_BASE_TAG = 2;
- public static final int INCLUDE_BRANCHES = 4;
- public static final int INCLUDE_VERSIONS = 8;
- public static final int INCLUDE_DATES = 16;
- public static final int INCLUDE_ALL_TAGS = INCLUDE_HEAD_TAG | INCLUDE_BASE_TAG | INCLUDE_BRANCHES | INCLUDE_VERSIONS | INCLUDE_DATES;
-
- TagRootElement branches;
- TagRootElement versions;
- TagRootElement dates;
- int includeFlags;
-
- public static class ProjectElementSorter extends ViewerSorter {
-
- /*
- * The order in the diaog should be HEAD, Branches, Versions, Dates, BASE
- */
- public int category(Object element) {
- if (element instanceof TagElement) {
- CVSTag tag = ((TagElement)element).getTag();
- if (tag == CVSTag.DEFAULT) return 1;
- if (tag == CVSTag.BASE) return 5;
- if (tag.getType() == CVSTag.BRANCH) return 2;
- if (tag.getType() == CVSTag.VERSION) return 3;
- if (tag.getType() == CVSTag.DATE) return 4;
- } else if (element instanceof TagRootElement) {
- if(((TagRootElement)element).getTypeOfTagRoot() == CVSTag.BRANCH) return 2;
- if(((TagRootElement)element).getTypeOfTagRoot() == CVSTag.VERSION) return 3;
- if(((TagRootElement)element).getTypeOfTagRoot() == CVSTag.DATE) return 4;
- }
- return 0;
- }
- public int compare(Viewer viewer, Object e1, Object e2) {
- int cat1 = category(e1);
- int cat2 = category(e2);
- if (cat1 != cat2) return cat1 - cat2;
- // Sort version tags in reverse order
- if (e1 instanceof TagElement){
- CVSTag tag1 = ((TagElement)e1).getTag();
- int type = tag1.getType();
- if(type == CVSTag.VERSION) {
- return -1 * super.compare(viewer, e1, e2);
- }else if(type == CVSTag.DATE){
- return -1*tag1.compareTo(((TagElement)e2).getTag());
- }
- }
- return super.compare(viewer, e1, e2);
- }
- }
-
-
- /**
- * Create a viewer input for the tag source
- * @param tagSource the tag source
- * @param includeFlags the types of tags to include
- * @return a tree viewer input
- */
- public static Object createInput(TagSource tagSource, int includeFlags) {
- if (includeFlags == INCLUDE_VERSIONS) {
- // Versions only is requested by the merge start page.
- // Only need to show version tags
- return new TagRootElement(null, tagSource, CVSTag.VERSION);
- }
- return new TagSourceWorkbenchAdapter(tagSource, includeFlags);
- }
-
- public TagSourceWorkbenchAdapter(TagSource tagSource, int includeFlags) {
- this.includeFlags = includeFlags;
- if (this.includeFlags == 0) this.includeFlags = INCLUDE_ALL_TAGS;
- if ((includeFlags & INCLUDE_BRANCHES) > 0) {
- branches = new TagRootElement(this, tagSource, CVSTag.BRANCH);
- }
- if ((includeFlags & INCLUDE_VERSIONS) > 0) {
- versions = new TagRootElement(this, tagSource, CVSTag.VERSION);
- }
- if ((includeFlags & INCLUDE_DATES) > 0) {
- dates = new TagRootElement(this, tagSource, CVSTag.DATE);
- }
- }
-
- public Object[] getChildren(Object o) {
- ArrayList children = new ArrayList(4);
- if ((includeFlags & INCLUDE_HEAD_TAG) > 0) {
- children.add(new TagElement(this, CVSTag.DEFAULT));
- }
- if ((includeFlags & INCLUDE_BASE_TAG) > 0) {
- children.add(new TagElement(this, CVSTag.BASE));
- }
- if ((includeFlags & INCLUDE_BRANCHES) > 0) {
- children.add(branches);
- }
- if ((includeFlags & INCLUDE_VERSIONS) > 0) {
- children.add(versions);
- }
- if ((includeFlags & INCLUDE_DATES) > 0) {
- children.add(dates);
- }
- return children.toArray(new Object[children.size()]);
- }
- public int getIncludeFlags() {
- return includeFlags;
- }
- public TagRootElement getBranches() {
- return branches;
- }
- public TagRootElement getVersions() {
- return versions;
- }
- public TagRootElement getDates(){
- return dates;
- }
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
- }
- public ImageDescriptor getImageDescriptor(Object object) {
- return null;
- }
- public String getLabel(Object o) {
- return null;
- }
- public Object getParent(Object o) {
- return null;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSWizardPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSWizardPage.java
deleted file mode 100644
index 3adf28015..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSWizardPage.java
+++ /dev/null
@@ -1,382 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.DecoratingLabelProvider;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardPage;
-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.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.model.WorkbenchViewerSorter;
-import org.eclipse.ui.views.navigator.ResourceSorter;
-
-/**
- * Common superclass for CVS wizard pages. Provides convenience methods
- * for widget creation.
- */
-public abstract class CVSWizardPage extends WizardPage {
-
- protected static final int LABEL_WIDTH_HINT = 400;
- protected static final int LABEL_INDENT_WIDTH = 32;
- protected static final int LIST_HEIGHT_HINT = 100;
- protected static final int SPACER_HEIGHT = 8;
-
- private ICVSWizard wizard;
-
- /**
- * CVSWizardPage constructor comment.
- * @param pageName the name of the page
- */
- public CVSWizardPage(String pageName) {
- super(pageName);
- }
-
- /**
- * CVSWizardPage constructor comment.
- * @param pageName the name of the page
- * @param title the title of the page
- * @param titleImage the image for the page
- */
- public CVSWizardPage(String pageName, String title, ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- }
- /**
- * CVSWizardPage constructor comment.
- * @param pageName the name of the page
- * @param title the title of the page
- * @param titleImage the image for the page
- * @param description the description of the page
- */
- public CVSWizardPage(String pageName, String title, ImageDescriptor titleImage, String description) {
- super(pageName, title, titleImage);
- setDescription(description);
- }
- /**
- * Creates a new checkbox instance and sets the default layout data.
- *
- * @param group the composite in which to create the checkbox
- * @param label the string to set into the checkbox
- * @return the new checkbox
- */
- protected Button createCheckBox(Composite group, String label) {
- Button button = new Button(group, SWT.CHECK | SWT.LEFT);
- button.setText(label);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- button.setLayoutData(data);
- return button;
- }
- /**
- * Utility method that creates a combo box
- *
- * @param parent the parent for the new label
- * @return the new widget
- */
- protected Combo createCombo(Composite parent) {
- Combo combo = new Combo(parent, SWT.READ_ONLY);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- combo.setLayoutData(data);
- return combo;
- }
- /**
- * Creates composite control and sets the default layout data.
- * @param parent the parent of the new composite
- * @param numColumns the number of columns for the new composite
- * @param grabExcess TODO
- *
- * @return the newly-created coposite
- */
- protected Composite createComposite(Composite parent, int numColumns, boolean grabExcess) {
- final Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout(numColumns, false));
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
- return composite;
- }
-
- /**
- * Utility method that creates a label instance
- * and sets the default layout data.
- *
- * @param parent the parent for the new label
- * @param text the text for the new label
- * @return the new label
- */
- public static Label createLabel(Composite parent, String text) {
- return createIndentedLabel(parent, text, 0);
- }
- /**
- * Utility method that creates a label instance indented by the specified
- * number of pixels and sets the default layout data.
- *
- * @param parent the parent for the new label
- * @param text the text for the new label
- * @param indent the indent in pixels, or 0 for none
- * @return the new label
- */
- public static Label createIndentedLabel(Composite parent, String text, int indent) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = 1;
- data.horizontalAlignment = GridData.FILL;
- data.horizontalIndent = indent;
- label.setLayoutData(data);
- return label;
- }
- /**
- * Utility method that creates a label instance with word wrap and sets
- * the default layout data.
- *
- * @param parent the parent for the new label
- * @param text the text for the new label
- * @param indent the indent in pixels, or 0 for none
- * @param widthHint the nominal width of the label
- * @return the new label
- */
- protected Label createWrappingLabel(Composite parent, String text, int indent) {
- return createWrappingLabel(parent, text, indent, 1);
- }
-
- protected Label createWrappingLabel(Composite parent, String text, int indent, int horizontalSpan) {
- Label label = new Label(parent, SWT.LEFT | SWT.WRAP);
- label.setText(text);
- GridData data = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
- data.horizontalIndent = indent;
- data.horizontalSpan = horizontalSpan;
- data.widthHint = LABEL_WIDTH_HINT;
- label.setLayoutData(data);
- return label;
- }
-
- /**
- * Create a text field specific for this application
- *
- * @param parent the parent of the new text field
- * @return the new text field
- */
- static public Text createTextField(Composite parent) {
- Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);
- return layoutTextField(text);
- }
- /**
- * Create a password field specific for this application
- *
- * @param parent the parent of the new text field
- * @return the new text field
- */
- static public Text createPasswordField(Composite parent) {
- Text text = new Text(parent, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);
- return layoutTextField(text);
- }
- /**
- * Layout a text or password field specific for this application
- *
- * @param parent the parent of the new text field
- * @return the new text field
- */
- static public Text layoutTextField(Text text) {
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.verticalAlignment = GridData.CENTER;
- data.grabExcessVerticalSpace = false;
- data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- text.setLayoutData(data);
- return text;
- }
-
- /**
- * Utility method to create a radio button
- *
- * @param parent the parent of the radio button
- * @param label the label of the radio button
- * @param span the number of columns to span
- * @return the created radio button
- */
- protected Button createRadioButton(Composite parent, String label, int span) {
- Button button = new Button(parent, SWT.RADIO);
- button.setText(label);
- GridData data = new GridData();
- data.horizontalSpan = span;
- button.setLayoutData(data);
- return button;
- }
- /**
- * Utility method to create a full width separator preceeded by a blank space
- *
- * @param parent the parent of the separator
- * @param verticalSpace the vertical whitespace to insert before the label
- */
- protected void createSeparator(Composite parent, int verticalSpace) {
- // space
- Label label = new Label(parent, SWT.NONE);
- GridData data = new GridData();
- data.heightHint = verticalSpace;
- label.setLayoutData(data);
- // separator
- label = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
- data = new GridData(GridData.FILL_HORIZONTAL);
- label.setLayoutData(data);
- }
-
- /**
- * Creates a ListViewer whose input is an array of IFiles.
- *
- * @param parent the parent of the viewer
- * @param title the text for the title label
- * @param heightHint the nominal height of the list
- * @return the created list viewer
- */
- public ListViewer createFileListViewer(Composite parent, String title, int heightHint) {
- createLabel(parent, title);
- ListViewer listViewer = new ListViewer(parent, SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
- listViewer.setContentProvider(new IStructuredContentProvider() {
- public Object[] getElements(Object inputElement) {
- return (Object[]) inputElement;
- }
- public void dispose() {
- }
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- });
- listViewer.setLabelProvider(new LabelProvider() {
- public String getText(Object element) {
- return ((IFile) element).getFullPath().toString();
- }
- });
- listViewer.setSorter(new WorkbenchViewerSorter());
-
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = heightHint;
- listViewer.getList().setLayoutData(data);
- return listViewer;
- }
-
- protected TreeViewer createResourceSelectionTree(Composite composite, int types, int span) {
- TreeViewer tree = new TreeViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- tree.setUseHashlookup(true);
- tree.setContentProvider(getResourceProvider(types));
- tree.setLabelProvider(
- new DecoratingLabelProvider(
- new WorkbenchLabelProvider(),
- CVSUIPlugin.getPlugin().getWorkbench().getDecoratorManager().getLabelDecorator()));
- tree.setSorter(new ResourceSorter(ResourceSorter.NAME));
-
- GridData data = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL);
- data.heightHint = LIST_HEIGHT_HINT;
- data.horizontalSpan = span;
- tree.getControl().setLayoutData(data);
- return tree;
- }
-
- /**
- * Returns a content provider for <code>IResource</code>s that returns
- * only children of the given resource type.
- */
- protected ITreeContentProvider getResourceProvider(final int resourceType) {
- return new WorkbenchContentProvider() {
- public Object[] getChildren(Object o) {
- if (o instanceof IContainer) {
- IResource[] members = null;
- try {
- members = ((IContainer)o).members();
- } catch (CoreException e) {
- //just return an empty set of children
- return new Object[0];
- }
-
- //filter out the desired resource types
- ArrayList results = new ArrayList();
- for (int i = 0; i < members.length; i++) {
- //And the test bits with the resource types to see if they are what we want
- if ((members[i].getType() & resourceType) > 0) {
- results.add(members[i]);
- }
- }
- return results.toArray();
- } else {
- return super.getChildren(o);
- }
- }
- };
- }
-
- protected RepositoryManager getRepositoryManager() {
- return CVSUIPlugin.getPlugin().getRepositoryManager();
- }
-
- protected ICVSWizard getCVSWizard() {
- if (wizard != null) {
- return wizard;
- }
- IWizard wizard = getWizard();
- if (wizard instanceof ICVSWizard) {
- // This is the method that is invoked when the next button is pressed
- // Hence, assume that the page s about to be shown
- return ((ICVSWizard)wizard);
- }
- return null;
- }
-
- public void setCVSWizard(ICVSWizard wizard) {
- this.wizard = wizard;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.WizardPage#getNextPage()
- */
- public IWizardPage getNextPage() {
- ICVSWizard w = getCVSWizard();
- if (w != null) {
- // This is the method that is invoked when the next button is pressed
- // Hence, assume that the page s about to be shown
- return w.getNextPage(this, true /* about to show */);
- }
- return super.getNextPage();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.WizardPage#canFlipToNextPage()
- */
- public boolean canFlipToNextPage() {
- ICVSWizard w = getCVSWizard();
- if (w != null) {
- return isPageComplete() &&
- w.getNextPage(this, false /* about to show */) != null;
- }
- return super.canFlipToNextPage();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsLocationSelectionPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsLocationSelectionPage.java
deleted file mode 100644
index 4cfe29bf4..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsLocationSelectionPage.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import java.io.File;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * @author Administrator
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class CheckoutAsLocationSelectionPage extends CVSWizardPage {
-
- public static final String NAME = "CheckoutAsLocationSelectionPage"; //$NON-NLS-1$
-
- private Button browseButton;
- private Text locationPathField;
- private Label locationLabel;
- private boolean useDefaults = true;
- private ICVSRemoteFolder[] remoteFolders;
- private String targetLocation;
- private IProject singleProject;
-
- // constants
- private static final int SIZING_TEXT_FIELD_WIDTH = 250;
-
- /**
- * @param pageName
- * @param title
- * @param titleImage
- * @param description
- */
- public CheckoutAsLocationSelectionPage(ImageDescriptor titleImage, ICVSRemoteFolder[] remoteFolders) {
- super(NAME, Policy.bind("CheckoutAsLocationSelectionPage.title"), titleImage, Policy.bind("CheckoutAsLocationSelectionPage.description")); //$NON-NLS-1$ //$NON-NLS-2$
- this.remoteFolders = remoteFolders;
- }
-
- /**
- * @return
- */
- private boolean isSingleFolder() {
- return remoteFolders.length == 1;
- }
-
- /**
- * @param string
- */
- public void setProject(IProject project) {
- singleProject = project;
- }
-
- /**
- * @param string
- */
- public void setProjectName(String string) {
- if (string == null || string.equals(".")) return; //$NON-NLS-1$
- if (singleProject != null && singleProject.getName().equals(string)) return;
- setProject(ResourcesPlugin.getWorkspace().getRoot().getProject(string));
- }
-
- private IProject getSingleProject() {
- if (singleProject == null) {
- setProjectName(remoteFolders[0].getName());
- }
- return singleProject;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- Composite composite= createComposite(parent, 1, false);
- setControl(composite);
- // required in order to use setButtonLayoutData
- initializeDialogUnits(composite);
-
- WorkbenchHelp.setHelp(composite, IHelpContextIds.CHECKOUT_LOCATION_SELECTION_PAGE);
-
- final Button useDefaultsButton =
- new Button(composite, SWT.CHECK | SWT.RIGHT);
- useDefaultsButton.setText(Policy.bind("CheckoutAsLocationSelectionPage.useDefaultLabel")); //$NON-NLS-1$
- useDefaultsButton.setSelection(this.useDefaults);
-
- createUserSpecifiedProjectLocationGroup(composite, !this.useDefaults);
-
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- useDefaults = useDefaultsButton.getSelection();
- browseButton.setEnabled(!useDefaults);
- locationPathField.setEnabled(!useDefaults);
- locationLabel.setEnabled(!useDefaults);
- setLocationForSelection(true);
- setErrorMessage(useDefaults ? null : checkValidLocation());
- }
- };
- useDefaultsButton.addSelectionListener(listener);
- Dialog.applyDialogFont(parent);
- }
-
- /**
- * Creates the project location specification controls.
- *
- * @return the parent of the widgets created
- * @param projectGroup the parent composite
- * @param enabled - sets the initial enabled state of the widgets
- */
- private Composite createUserSpecifiedProjectLocationGroup(Composite parent, boolean enabled) {
-
- // This group needs 3 columns
- Composite projectGroup = createComposite(parent, 3, false);
-
- // location label
- locationLabel = new Label(projectGroup, SWT.NONE);
- if (isSingleFolder()) {
- locationLabel.setText(Policy.bind("CheckoutAsLocationSelectionPage.locationLabel")); //$NON-NLS-1$
- } else {
- locationLabel.setText(Policy.bind("CheckoutAsLocationSelectionPage.parentDirectoryLabel")); //$NON-NLS-1$
- }
- locationLabel.setEnabled(enabled);
-
- // project location entry field
- locationPathField = new Text(projectGroup, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- locationPathField.setLayoutData(data);
- locationPathField.setEnabled(enabled);
-
- // browse button
- this.browseButton = new Button(projectGroup, SWT.PUSH);
- this.browseButton.setText(Policy.bind("CheckoutAsLocationSelectionPage.browseLabel")); //$NON-NLS-1$
- this.browseButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- handleLocationBrowseButtonPressed();
- }
- });
- this.browseButton.setEnabled(enabled);
- setButtonLayoutData(this.browseButton);
-
- // Set the initial value first before listener
- // to avoid handling an event during the creation.
- setLocationForSelection(true);
- locationPathField.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- setErrorMessage(checkValidLocation());
- }
- });
- return projectGroup;
- }
-
- /**
- * Check if the entry in the widget location is valid. If it is valid return null. Otherwise
- * return a string that indicates the problem.
- */
- private String checkValidLocation() {
-
- if (useDefaults) {
- targetLocation = null;
- return null;
- } else {
- targetLocation = locationPathField.getText();
- if (targetLocation.equals("")) {//$NON-NLS-1$
- return(Policy.bind("CheckoutAsLocationSelectionPage.locationEmpty")); //$NON-NLS-1$
- }
- else{
- IPath path = new Path("");//$NON-NLS-1$
- if (!path.isValidPath(targetLocation)) {
- return Policy.bind("CheckoutAsLocationSelectionPage.invalidLocation"); //$NON-NLS-1$
- }
- }
-
- if (isSingleFolder()) {
- IStatus locationStatus =
- ResourcesPlugin.getWorkspace().validateProjectLocation(
- getSingleProject(),
- new Path(targetLocation));
-
- if (!locationStatus.isOK())
- return locationStatus.getMessage();
- } else {
- for (int i = 0; i < remoteFolders.length; i++) {
- String projectName = remoteFolders[i].getName();
- IStatus locationStatus = ResourcesPlugin.getWorkspace().validateProjectLocation(
- ResourcesPlugin.getWorkspace().getRoot().getProject(projectName),
- new Path(targetLocation).append(projectName));
- if (!locationStatus.isOK())
- return locationStatus.getMessage();
- }
- }
-
- return null;
- }
- }
-
- /**
- * Set the location to the default location if we are set to useDefaults.
- */
- private void setLocationForSelection(boolean changed) {
- if (useDefaults) {
- IPath defaultPath = null;
- if (isSingleFolder()) {
- IProject singleProject = getSingleProject();
- if (singleProject != null) {
- try {
- defaultPath = singleProject.getDescription().getLocation();
- } catch (CoreException e) {
- // ignore
- }
- if (defaultPath == null) {
- defaultPath = Platform.getLocation().append(singleProject.getName());
- }
- }
- } else {
- defaultPath = Platform.getLocation();
- }
- if (defaultPath != null) {
- locationPathField.setText(defaultPath.toOSString());
- }
- targetLocation = null;
- } else if (changed) {
- IPath location = null;
- IProject project = getSingleProject();
- if (project != null) {
- try {
- location = project.getDescription().getLocation();
- } catch (CoreException e) {
- // ignore the exception
- }
- }
- if (location == null) {
- targetLocation = null;
- locationPathField.setText(""); //$NON-NLS-1$
- } else {
- if (isSingleFolder()) {
- targetLocation = location.toOSString();
- } else {
- targetLocation = location.removeLastSegments(1).toOSString();
- }
- locationPathField.setText(targetLocation);
- }
- }
- }
-
- /**
- * Open an appropriate directory browser
- */
- private void handleLocationBrowseButtonPressed() {
- DirectoryDialog dialog = new DirectoryDialog(locationPathField.getShell());
- if (isSingleFolder()) {
- dialog.setMessage(Policy.bind("CheckoutAsLocationSelectionPage.messageForSingle", getSingleProject().getName())); //$NON-NLS-1$
- } else {
- dialog.setMessage(Policy.bind("CheckoutAsLocationSelectionPage.messageForMulti", new Integer(remoteFolders.length).toString())); //$NON-NLS-1$
- }
-
- String dirName = locationPathField.getText();
- if (!dirName.equals("")) {//$NON-NLS-1$
- File path = new File(dirName);
- if (path.exists())
- dialog.setFilterPath(dirName);
- }
-
- String selectedDirectory = dialog.open();
- if (selectedDirectory != null) {
- if (isSingleFolder()) {
- locationPathField.setText(new Path(selectedDirectory).append(getSingleProject().getName()).toOSString());
- } else {
- locationPathField.setText(new Path(selectedDirectory).toOSString());
- }
- }
- targetLocation = locationPathField.getText();
- }
-
- /**
- * Return the custom location for a single project. In this case, the specified
- * location is used as the location of the project.
- *
- * @param project
- * @return
- */
- public String getTargetLocation() {
- if (isCustomLocationSpecified())
- return targetLocation;
- else
- return null;
- }
-
- /**
- * @return
- */
- private boolean isCustomLocationSpecified() {
- return !useDefaults;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsMainPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsMainPage.java
deleted file mode 100644
index 2bf436d1d..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsMainPage.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * This is the main page of the Check Out As wizard. It allows the user to specify
- * whether they want to check out the remote folder(s) as project(s) or into an
- * existing project. For single project checkout, the page will also allow the user to
- * choose whether to configure the new project (if it is missing a .project file).
- */
-public class CheckoutAsMainPage extends CVSWizardPage {
-
- private String newProjectName;
- private boolean allowProjectConfiguration;
- private Button intoProjectButton;
- private Button simpleProjectButton;
- private Button configuredProjectButton;
- private Text projectNameField;
- private ICVSRemoteFolder[] folders;
-
- public static final String NAME = "CheckoutAsMainPage"; //$NON-NLS-1$
-
- /**
- * @param pageName
- * @param title
- * @param titleImage
- * @param description
- */
- public CheckoutAsMainPage(ImageDescriptor titleImage, ICVSRemoteFolder[] folders, boolean allowProjectConfiguration) {
- super(NAME, Policy.bind("CheckoutAsMainPage.title"), titleImage, Policy.bind("CheckoutAsMainPage.description")); //$NON-NLS-1$ //$NON-NLS-2$
- this.folders = folders;
- this.allowProjectConfiguration = allowProjectConfiguration;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
-
- Composite composite = createComposite(parent, 1, false);
- setControl(composite);
-
- WorkbenchHelp.setHelp(composite, IHelpContextIds.CHECKOUT_CONFIGURATION_PAGE);
-
- if (isSingleFolder()) {
- createSingleFolderArea(composite);
- } else {
- createMultipleFoldersArea(composite);
- }
-
- updateEnablements();
- Dialog.applyDialogFont(parent);
- }
-
- /*
- * Is the input to the wizard a single folder or multiple folders
- */
- private boolean isSingleFolder() {
- return folders.length == 1;
- }
-
- /*
- * For the single folder case, return the name of the folder
- */
- private String getFolderName() {
- String name = folders[0].getName();
- if (name .equals(".")) { //$NON-NLS-1$
- name = new Path(null, folders[0].getRepository().getRootDirectory()).lastSegment();
- }
- return name;
- }
-
- /*
- * Create the page contents for a single folder checkout
- */
- private void createSingleFolderArea(Composite composite) {
- createLabel(composite, Policy.bind("CheckoutAsMainPage.singleFolder", getFolderName())); //$NON-NLS-1$
- configuredProjectButton = createRadioButton(composite, Policy.bind("CheckoutAsMainPage.asConfiguredProject"), 1); //$NON-NLS-1$
- if (!allowProjectConfiguration) {
- configuredProjectButton.setEnabled(false);
- Label configuredLabel = createWrappingLabel(composite, Policy.bind("CheckoutAsMainPage.10"), 5); //$NON-NLS-1$
- configuredLabel.setEnabled(false);
- }
- createCheckoutAsProjectRadioArea(composite);
- createCheckoutIntoRadioArea(composite);
- if (allowProjectConfiguration) {
- configuredProjectButton.setSelection(true);
- } else {
- simpleProjectButton.setSelection(true);
- }
- }
-
- /*
- * Create the page contents for a multiple folder checkout
- */
- private void createMultipleFoldersArea(Composite composite) {
- createLabel(composite, Policy.bind("CheckoutAsMainPage.multipleFolders", new Integer(folders.length).toString())); //$NON-NLS-1$
- createCheckoutAsProjectRadioArea(composite);
- createCheckoutIntoRadioArea(composite);
- simpleProjectButton.setSelection(true);
- }
-
- /**
- * @param composite
- */
- private void createCheckoutAsProjectRadioArea(Composite composite) {
- if (isSingleFolder()) {
- simpleProjectButton = createRadioButton(composite, Policy.bind("CheckoutAsMainPage.asSimpleProject"), 1); //$NON-NLS-1$
- createProjectNameGroup(composite);
- } else {
- simpleProjectButton = createRadioButton(composite, Policy.bind("CheckoutAsMainPage.asProjects"), 1); //$NON-NLS-1$
- }
- }
-
- /**
- * @param composite
- */
- private void createCheckoutIntoRadioArea(Composite composite) {
- intoProjectButton = createRadioButton(composite, Policy.bind("CheckoutAsMainPage.intoProject"), 1); //$NON-NLS-1$
- }
-
- /**
- * Creates the project name specification controls.
- *
- * @param parent the parent composite
- */
- private void createProjectNameGroup(Composite parent) {
- // project specification group
- Composite projectGroup = new Composite(parent,SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- projectGroup.setLayout(layout);
- projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // new project label
- Label projectLabel = new Label(projectGroup,SWT.NONE);
- projectLabel.setText(Policy.bind("CheckoutAsMainPage.projectNameLabel")); //$NON-NLS-1$
-
- // new project name entry field
- projectNameField = new Text(projectGroup, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- projectNameField.setLayoutData(data);
-
- // Set the initial value first before listener
- // to avoid handling an event during the creation.
- newProjectName = getFolderName();
- projectNameField.setText(newProjectName);
- projectNameField.selectAll();
-
- // Set the listener to capture modify events
- projectNameField.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- updateEnablements();
- }
- });
- }
-
- /**
- * Check if the entries in the widget are valid. If they are return null otherwise
- * return a string that indicates the problem.
- */
- private void updateEnablements() {
-
- if (projectNameField != null) {
- projectNameField.setEnabled(simpleProjectButton.getSelection());
- if (projectNameField.isEnabled()) {
- newProjectName = this.projectNameField.getText();
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IStatus nameStatus = workspace.validateName(newProjectName, IResource.PROJECT);
- if (!nameStatus.isOK()) {
- setErrorMessage(nameStatus.getMessage());
- setPageComplete(false);
- }
- }
- }
- setErrorMessage(null);
- setPageComplete(true);
- }
-
- public String getProjectName() {
- if (isSingleFolder() && simpleProjectButton.getSelection()) return newProjectName;
- return null;
- }
-
- public boolean isPerformConfigure() {
- if (configuredProjectButton == null) return false;
- return configuredProjectButton.getSelection();
- }
-
- public boolean isPerformCheckoutInto() {
- return intoProjectButton.getSelection();
- }
-
- public boolean isPerformCheckoutAs() {
- return simpleProjectButton.getSelection();
- }
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.wizards.CVSWizardPage#createRadioButton(org.eclipse.swt.widgets.Composite, java.lang.String, int)
- */
- protected Button createRadioButton(Composite parent, String label, int span) {
- Button radio = super.createRadioButton(parent, label, span);
- radio.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateEnablements();
- }
- });
- return radio;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsProjectSelectionPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsProjectSelectionPage.java
deleted file mode 100644
index 2b58b1c97..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsProjectSelectionPage.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-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.*;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * This page allows the user to select the target parent container for
- * the folders being checked out.
- */
-public class CheckoutAsProjectSelectionPage extends CVSWizardPage {
-
- public static final String NAME = "CheckoutAsProjectSelectionPage"; //$NON-NLS-1$
-
- private TreeViewer tree;
- private Text nameField;
- private Combo filterList;
- private Button recurseCheck;
-
- private IResource selection;
- private ICVSRemoteFolder[] remoteFolders;
- private String folderName;
- private boolean recurse;
- private int filter;
-
- /**
- * Constructor for CheckoutIntoProjectSelectionPage.
- * @param pageName
- * @param title
- * @param titleImage
- */
- public CheckoutAsProjectSelectionPage(ImageDescriptor titleImage, ICVSRemoteFolder[] remoteFolders) {
- super(NAME, Policy.bind("CheckoutAsProjectSelectionPage.title"), titleImage, Policy.bind("CheckoutAsProjectSelectionPage.description")); //$NON-NLS-1$ //$NON-NLS-2$
- this.remoteFolders = remoteFolders;
- }
-
- /**
- * @return
- */
- private boolean isSingleFolder() {
- return remoteFolders.length == 1;
- }
-
- /*
- * For the single folder case, return the name of the folder
- */
- private String getInputFolderName() {
- return remoteFolders[0].getName();
- }
-
- private String getRepository() throws CVSException {
- return remoteFolders[0].getFolderSyncInfo().getRoot();
- }
-
- /**
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- Composite composite= createComposite(parent, 2, false);
- setControl(composite);
-
- WorkbenchHelp.setHelp(composite, IHelpContextIds.CHECKOUT_PROJECT_SELECTION_PAGE);
-
- if (isSingleFolder()) {
- createLabel(composite, Policy.bind("CheckoutAsProjectSelectionPage.name")); //$NON-NLS-1$
- nameField = createTextField(composite);
- nameField.addListener(SWT.Modify, new Listener() {
- public void handleEvent(Event event) {
- folderName = nameField.getText();
- updateWidgetEnablements();
- }
- });
- }
-
- createWrappingLabel(composite, Policy.bind("CheckoutAsProjectSelectionPage.treeLabel"), 0, 2); //$NON-NLS-1$
-
- tree = createResourceSelectionTree(composite, IResource.PROJECT | IResource.FOLDER, 2 /* horizontal span */);
- tree.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handleResourceSelection(event);
- }
- });
-
- Composite filterComposite = createComposite(composite, 2, false);
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- data.horizontalSpan = 2;
- filterComposite.setLayoutData(data);
- createLabel(filterComposite, Policy.bind("CheckoutAsProjectSelectionPage.showLabel")); //$NON-NLS-1$
- filterList = createCombo(filterComposite);
- filterList.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleFilterSelection();
- }
- });
-
- createWrappingLabel(composite, "", 0, 2); //$NON-NLS-1$
-
- // Should subfolders of the folder be checked out?
- recurseCheck = createCheckBox(composite, Policy.bind("CheckoutAsProjectSelectionPage.recurse")); //$NON-NLS-1$
- recurseCheck.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- recurse = recurseCheck.getSelection();
- updateWidgetEnablements();
- }
- });
-
- initializeValues();
- updateWidgetEnablements();
- tree.getControl().setFocus();
- Dialog.applyDialogFont(parent);
- }
-
- /**
- * Method initializeValues.
- */
- private void initializeValues() {
- if (isSingleFolder()) {
- nameField.setText(getInputFolderName());
- }
- tree.setInput(ResourcesPlugin.getWorkspace().getRoot());
- recurse = true;
- recurseCheck.setSelection(recurse);
- filter = 0;
- updateTreeContents(filter);
- filterList.add(Policy.bind("CheckoutAsProjectSelectionPage.showAll")); //$NON-NLS-1$
- filterList.add(Policy.bind("CheckoutAsProjectSelectionPage.showUnshared")); //$NON-NLS-1$
- filterList.add(Policy.bind("CheckoutAsProjectSelectionPage.showSameRepo")); //$NON-NLS-1$
- filterList.select(filter);
- }
-
- private void handleResourceSelection(SelectionChangedEvent event) {
- ISelection sel = event.getSelection();
- if (sel.isEmpty()) {
- this.selection = null;
- } else if (sel instanceof IStructuredSelection) {
- this.selection = (IResource)((IStructuredSelection)sel).getFirstElement();
- }
- updateWidgetEnablements();
- }
-
- /**
- * Method updateWidgetEnablement.
- */
- private void updateWidgetEnablements() {
- if (isSingleFolder() && !Path.EMPTY.isValidSegment(folderName)) {
- setPageComplete(false);
- setErrorMessage(Policy.bind("CheckoutAsProjectSelectionPage.invalidFolderName", folderName)); //$NON-NLS-1$
- return;
- }
- boolean complete = selection != null && selection.getType() != IResource.FILE;
- setErrorMessage(null);
- setPageComplete(complete);
- }
-
- /**
- * Returns the selection.
- * @return IResource
- */
- public IResource getSelection() {
- return selection;
- }
-
- /**
- * Returns the folderName.
- * @return String
- */
- public String getFolderName() {
- return folderName;
- }
-
- private void updateTreeContents(int selected) {
- try {
- if (selected == 0) {
- tree.setInput(new AdaptableResourceList(getProjects(getRepository(), true)));
- } else if (selected == 1) {
- tree.setInput(new AdaptableResourceList(getProjects(null, true)));
- } else if (selected == 2) {
- tree.setInput(new AdaptableResourceList(getProjects(getRepository(), false)));
- }
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
-
- /**
- * Method getValidTargetProjects returns the set of projects that match the provided criteria.
- * @return IResource
- */
- private IProject[] getProjects(String root, boolean unshared) throws CVSException {
- List validTargets = new ArrayList();
- try {
- IResource[] projects = ResourcesPlugin.getWorkspace().getRoot().members();
- for (int i = 0; i < projects.length; i++) {
- IResource resource = projects[i];
- if (resource instanceof IProject) {
- IProject project = (IProject) resource;
- if (project.isAccessible()) {
- RepositoryProvider provider = RepositoryProvider.getProvider(project);
- if (provider == null && unshared) {
- validTargets.add(project);
- } else if (provider != null && provider.getID().equals(CVSProviderPlugin.getTypeId())) {
- ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor(project);
- FolderSyncInfo info = cvsFolder.getFolderSyncInfo();
- if (root != null && info != null && root.equals(info.getRoot())) {
- validTargets.add(project);
- }
- }
- }
- }
- }
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- }
- return (IProject[]) validTargets.toArray(new IProject[validTargets.size()]);
- }
-
- public IContainer getLocalFolder() {
- if (Path.EMPTY.isValidSegment(folderName)) {
- return ((IContainer)getSelection()).getFolder(new Path(null, folderName));
- } else {
- return null;
- }
- }
-
- public IContainer getParentFolder() {
- return ((IContainer)getSelection());
- }
-
- /**
- * Returns the recurse.
- * @return boolean
- */
- public boolean isRecurse() {
- return recurse;
- }
-
- private void handleFilterSelection() {
- filter = filterList.getSelectionIndex();
- updateTreeContents(filter);
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsWizard.java
deleted file mode 100644
index 0dfe5a4db..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsWizard.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.*;
-import org.eclipse.team.internal.ccvs.ui.tags.*;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.NewProjectAction;
-
-/**
- * @author Administrator
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class CheckoutAsWizard extends Wizard {
-
- private ICVSRemoteFolder[] remoteFolders;
- private boolean allowProjectConfiguration;
-
- private CheckoutAsMainPage mainPage;
- private CheckoutAsProjectSelectionPage projectSelectionPage;
- private CheckoutAsLocationSelectionPage locationSelectionPage;
- private TagSelectionWizardPage tagSelectionPage;
- private IWorkbenchPart part;
-
- class NewProjectListener implements IResourceChangeListener {
- private IProject newProject = null;
- /**
- * @see IResourceChangeListener#resourceChanged(IResourceChangeEvent)
- */
- public void resourceChanged(IResourceChangeEvent event) {
- IResourceDelta root = event.getDelta();
- IResourceDelta[] projectDeltas = root.getAffectedChildren();
- for (int i = 0; i < projectDeltas.length; i++) {
- IResourceDelta delta = projectDeltas[i];
- IResource resource = delta.getResource();
- if (delta.getKind() == IResourceDelta.ADDED) {
- newProject = (IProject)resource;
- }
- }
- }
- /**
- * Gets the newProject.
- * @return Returns a IProject
- */
- public IProject getNewProject() {
- return newProject;
- }
- }
-
- public CheckoutAsWizard(IWorkbenchPart part, ICVSRemoteFolder[] remoteFolders, boolean allowProjectConfiguration) {
- this.part = part;
- this.remoteFolders = remoteFolders;
- setWindowTitle(Policy.bind("CheckoutAsWizard.title")); //$NON-NLS-1$
- this.allowProjectConfiguration = allowProjectConfiguration;
- }
-
- /**
- * @see org.eclipse.jface.wizard.IWizard#addPages()
- */
- public void addPages() {
- setNeedsProgressMonitor(true);
- ImageDescriptor substImage = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_CHECKOUT);
-
- mainPage = new CheckoutAsMainPage(substImage, remoteFolders, allowProjectConfiguration);
- addPage(mainPage);
-
- projectSelectionPage = new CheckoutAsProjectSelectionPage(substImage, remoteFolders);
- addPage(projectSelectionPage);
-
- locationSelectionPage = new CheckoutAsLocationSelectionPage(substImage, remoteFolders);
- addPage(locationSelectionPage);
-
- tagSelectionPage = new TagSelectionWizardPage("tagPage", Policy.bind("CheckoutAsWizard.3"), substImage, Policy.bind("CheckoutAsWizard.4"), TagSource.create(remoteFolders), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- TagSelectionArea.INCLUDE_HEAD_TAG |
- TagSelectionArea.INCLUDE_BRANCHES |
- TagSelectionArea.INCLUDE_VERSIONS |
- TagSelectionArea.INCLUDE_DATES
- );
- if (remoteFolders.length > 0) {
- try {
- CVSTag selectedTag = remoteFolders[0].getFolderSyncInfo().getTag();
- tagSelectionPage.setSelection(selectedTag);
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
- tagSelectionPage.setHelpContxtId(IHelpContextIds.CHECKOUT_TAG_SELETION_PAGE);
- addPage(tagSelectionPage);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#performFinish()
- */
- public boolean performFinish() {
- try {
- if (mainPage.isPerformConfigure()) {
- return performConfigureAndCheckout();
- } else if (mainPage.isPerformCheckoutAs()) {
- if (isSingleFolder()) {
- return performSingleCheckoutAs();
- } else {
- return performMultipleCheckoutAs();
- }
- } else if (mainPage.isPerformCheckoutInto()) {
- return performCheckoutInto();
- }
- } catch (InvocationTargetException e) {
- handle(e);
- // drop through
- } catch (InterruptedException e) {
- // drop through
- }
- return false;
- }
-
- /**
- * @return
- */
- private boolean isSingleFolder() {
- return remoteFolders.length == 1;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#canFinish()
- */
- public boolean canFinish() {
- return (mainPage.isPageComplete()
- && (mainPage.isPerformConfigure()
- || (mainPage.isPerformCheckoutInto() && projectSelectionPage.isPageComplete())
- || (mainPage.isPerformCheckoutAs() && locationSelectionPage.isPageComplete())));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#getNextPage(org.eclipse.jface.wizard.IWizardPage)
- */
- public IWizardPage getNextPage(IWizardPage page) {
- if (page == mainPage) {
- if (mainPage.isPerformConfigure()) return tagSelectionPage;
- if (mainPage.isPerformCheckoutInto()) return projectSelectionPage;
- if (mainPage.isPerformCheckoutAs()) {
- if (isSingleFolder()) {
- locationSelectionPage.setProjectName(mainPage.getProjectName());
- } else {
- locationSelectionPage.setProject(null);
- }
- return locationSelectionPage;
- }
- }
- // The tag selection page is always shown as the last page
- if (page != tagSelectionPage) {
- return tagSelectionPage;
- }
- return null;
- }
-
- private void handle(Throwable e) {
- CVSUIPlugin.openError(getShell(), Policy.bind("CheckoutAsWizard.error"), null, e); //$NON-NLS-1$
- }
-
- /*
- * Configure a local project and checkout the selected remote folder into the project.
- * This only occurs for single folders.
- */
- private boolean performConfigureAndCheckout() throws InvocationTargetException, InterruptedException {
- IProject newProject = getNewProject();
- if (newProject == null) return false;
- // Run the checkout in the background
- ICVSRemoteFolder folder = getRemoteFolder();
- new CheckoutSingleProjectOperation(part, folder, newProject, null, true).run();
- return true;
- }
-
- /*
- * Return the single remote folder to be checked out
- */
- private ICVSRemoteFolder getRemoteFolder() {
- ICVSRemoteFolder folder = remoteFolders[0];
- folder = (ICVSRemoteFolder)folder.forTag(getSelectedTag());
- return folder;
- }
-
- /*
- * Return the remote folders to be checked out
- */
- private ICVSRemoteFolder[] getRemoteFolders() {
- ICVSRemoteFolder[] folders = new ICVSRemoteFolder[remoteFolders.length];
- for (int i = 0; i < remoteFolders.length; i++) {
- ICVSRemoteFolder remote = remoteFolders[i];
- folders[i] = (ICVSRemoteFolder)remote.forTag(getSelectedTag());
- }
- return folders;
- }
-
- private CVSTag getSelectedTag() {
- return tagSelectionPage.getSelectedTag();
- }
-
- private boolean performSingleCheckoutAs() throws InvocationTargetException, InterruptedException {
- IProject newProject = ResourcesPlugin.getWorkspace().getRoot().getProject(mainPage.getProjectName());
- String targetLocation = locationSelectionPage.getTargetLocation();
- // Run the checkout in the background
- ICVSRemoteFolder folder = getRemoteFolder();
- new CheckoutSingleProjectOperation(part, folder, newProject, targetLocation, false).run();
- return true;
- }
-
- /**
- * Check out multiple folders to the workspace using a custom location if one is
- * specified.
- */
- private boolean performMultipleCheckoutAs() throws InvocationTargetException, InterruptedException {
- String targetLocation = locationSelectionPage.getTargetLocation();
- // Run the checkout in the background
- new CheckoutMultipleProjectsOperation(part, getRemoteFolders(), targetLocation).run();
- return true;
- }
-
- private boolean performCheckoutInto() throws InvocationTargetException, InterruptedException {
- CheckoutIntoOperation operation;
- boolean recursive = projectSelectionPage.isRecurse();
- if (isSingleFolder()) {
- ICVSRemoteFolder folder = getRemoteFolder();
- operation = new CheckoutIntoOperation(part, folder, projectSelectionPage.getLocalFolder(), recursive);
- } else {
- operation = new CheckoutIntoOperation(part, getRemoteFolders(), projectSelectionPage.getParentFolder(), recursive);
- }
- // Run the checkout in the background
- operation.run();
- return true;
- }
-
- /**
- * Get a new project that is configured by the new project wizard.
- * This is currently the only way to do this.
- */
- private IProject getNewProject() {
- NewProjectListener listener = new NewProjectListener();
- ResourcesPlugin.getWorkspace().addResourceChangeListener(listener, IResourceChangeEvent.POST_CHANGE);
- (new NewProjectAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow())).run();
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(listener);
- IProject project = listener.getNewProject();
- return project;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutWizard.java
deleted file mode 100644
index 04bfdefe3..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutWizard.java
+++ /dev/null
@@ -1,287 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.CheckoutMultipleProjectsOperation;
-import org.eclipse.team.internal.ccvs.ui.operations.HasProjectMetaFileOperation;
-import org.eclipse.ui.*;
-
-/**
- * Gathers all information necesary for a checkout from a repository.
- */
-public class CheckoutWizard extends Wizard implements ICVSWizard, INewWizard {
-
- private RepositorySelectionPage locationPage;
- private ConfigurationWizardMainPage createLocationPage;
- private ModuleSelectionPage modulePage;
- private CheckoutAsWizard wizard;
- private ICVSRepositoryLocation location;
- private boolean isNewLocation;
- private CVSWizardPage dummyPage;
-
- public CheckoutWizard() {
- setWindowTitle(Policy.bind("CheckoutWizard.0")); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#addPages()
- */
- public void addPages() {
- setNeedsProgressMonitor(true);
-
- ImageDescriptor substImage = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_CHECKOUT);
-
- ICVSRepositoryLocation[] locations = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownRepositoryLocations();
- if (locations.length > 0) {
- locationPage = new RepositorySelectionPage("locationSelection", Policy.bind("CheckoutWizard.7"), substImage); //$NON-NLS-1$ //$NON-NLS-2$
- locationPage.setDescription(Policy.bind("SharingWizard.importTitleDescription")); //$NON-NLS-1$
- locationPage.setExtendedDescription(Policy.bind("CheckoutWizard.8")); //$NON-NLS-1$
- addPage(locationPage);
- }
-
- createLocationPage = new ConfigurationWizardMainPage("createLocationPage", Policy.bind("SharingWizard.enterInformation"), substImage); //$NON-NLS-1$ //$NON-NLS-2$
- createLocationPage.setDescription(Policy.bind("SharingWizard.enterInformationDescription")); //$NON-NLS-1$
- addPage(createLocationPage);
- createLocationPage.setDialogSettings(NewLocationWizard.getLocationDialogSettings());
-
- modulePage = new ModuleSelectionPage("moduleSelection", Policy.bind("CheckoutWizard.10"), substImage); //$NON-NLS-1$ //$NON-NLS-2$
- modulePage.setDescription(Policy.bind("CheckoutWizard.11")); //$NON-NLS-1$
- modulePage.setHelpContxtId(IHelpContextIds.CHECKOUT_MODULE_SELECTION_PAGE);
- modulePage.setSupportsMultiSelection(true);
- addPage(modulePage);
-
- // Dummy page to allow lazy creation of CheckoutAsWizard
- dummyPage = new CVSWizardPage("dummyPage") { //$NON-NLS-1$
- public void createControl(Composite parent) {
- Composite composite = createComposite(parent, 1, false);
- setControl(composite);
- }
- };
- addPage(dummyPage);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#canFinish()
- */
- public boolean canFinish() {
- return (wizard == null && getSelectedModules().length > 0) ||
- (wizard != null && wizard.canFinish());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#performFinish()
- */
- public boolean performFinish() {
- if (wizard != null) {
- // The finish of the child wizard will get called directly.
- // We only get here if it completed successfully
- if (isNewLocation) {
- KnownRepositories.getInstance().addRepository(location, true /* broadcast */);
- }
- return true;
- } else {
- try {
- new CheckoutMultipleProjectsOperation(getPart(), getSelectedModules(), null)
- .run();
- if (isNewLocation) {
- KnownRepositories.getInstance().addRepository(location, true /* broadcast */);
- }
- return true;
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(getShell(), null, null, e);
- } catch (InterruptedException e) {
- // Cancelled. fall through.
- }
- return false;
- }
- }
-
- private IWorkbenchPart getPart() {
- // This wizard doesn't have a part
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#performCancel()
- */
- public boolean performCancel() {
- if (location != null && isNewLocation) {
- KnownRepositories.getInstance().disposeRepository(location);
- location = null;
- }
- return wizard == null || wizard.performCancel();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#getNextPage(org.eclipse.jface.wizard.IWizardPage)
- */
- public IWizardPage getNextPage(IWizardPage page) {
- // Assume the page is about to be shown when this method is
- // invoked
- return getNextPage(page, true /* about to show*/);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.wizards.ICVSWizard#getNextPage(org.eclipse.jface.wizard.IWizardPage, boolean)
- */
- public IWizardPage getNextPage(IWizardPage page, boolean aboutToShow) {
- if (page == locationPage) {
- if (locationPage.getLocation() == null) {
- return createLocationPage;
- } else {
- if (aboutToShow) {
- try {
- modulePage.setLocation(getLocation());
- } catch (TeamException e1) {
- CVSUIPlugin.log(e1);
- }
- }
- return modulePage;
- }
- }
- if (page == createLocationPage) {
- if (aboutToShow) {
- try {
- ICVSRepositoryLocation l = getLocation();
- if (l != null) {
- modulePage.setLocation(l);
- }
- } catch (TeamException e1) {
- CVSUIPlugin.log(e1);
- }
- }
- return modulePage;
- }
- if (page == modulePage) {
- ICVSRemoteFolder[] selectedModules = getSelectedModules();
- if (selectedModules.length == 0) return null;
- for (int i = 0; i < selectedModules.length; i++) {
- ICVSRemoteFolder folder = selectedModules[i];
- if (folder.isDefinedModule()) {
- // No further configuration is possible for defined modules
- return null;
- }
- }
- if (aboutToShow) {
- try {
- boolean hasMetafile = true;
- if (selectedModules.length == 1) {
- // Only allow configuration if one module is selected
- hasMetafile = hasProjectMetafile(selectedModules[0]);
- }
- wizard = new CheckoutAsWizard(getPart(), selectedModules, ! hasMetafile /* allow configuration */);
- wizard.addPages();
- return wizard.getStartingPage();
- } catch (InvocationTargetException e) {
- // Show the error and fall through to return null as the next page
- CVSUIPlugin.openError(getShell(), null, null, e);
- } catch (InterruptedException e) {
- // Cancelled by user. Fall through and return null
- }
- return null;
- } else {
- if (wizard == null) {
- return dummyPage;
- } else {
- return wizard.getStartingPage();
- }
- }
- }
- if (wizard != null) {
- return wizard.getNextPage(page);
- }
- return null;
- }
-
- private boolean hasProjectMetafile(final ICVSRemoteFolder selectedModule) throws InvocationTargetException, InterruptedException {
- final boolean[] result = new boolean[] { true };
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- HasProjectMetaFileOperation op = new HasProjectMetaFileOperation(getPart(), selectedModule);
- op.run(monitor);
- result[0] = op.metaFileExists();
- }
- });
- return result[0];
- }
-
- private ICVSRemoteFolder[] getSelectedModules() {
- if (modulePage == null) return null;
- return modulePage.getSelectedModules();
- }
-
- /**
- * Return an ICVSRepositoryLocation
- */
- private ICVSRepositoryLocation getLocation() throws TeamException {
- // If the location page has a location, use it.
- if (locationPage != null) {
- ICVSRepositoryLocation newLocation = locationPage.getLocation();
- if (newLocation != null) {
- return recordLocation(newLocation);
- }
- }
-
- // Otherwise, get the location from the create location page
- final ICVSRepositoryLocation[] locations = new ICVSRepositoryLocation[] { null };
- final CVSException[] exception = new CVSException[] { null };
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- try {
- locations[0] = createLocationPage.getLocation();
- } catch (CVSException e) {
- exception[0] = e;
- }
- }
- });
- if (exception[0] != null) {
- throw exception[0];
- }
- return recordLocation(locations[0]);
- }
-
- private ICVSRepositoryLocation recordLocation(ICVSRepositoryLocation newLocation) {
- if (newLocation == null) return location;
- if (location == null || !newLocation.equals(location)) {
- if (location != null && isNewLocation) {
- // Dispose of the previous location
- KnownRepositories.getInstance().disposeRepository(location);
- }
- location = newLocation;
- isNewLocation = !KnownRepositories.getInstance().isKnownRepository(newLocation.getLocation());
- if (isNewLocation) {
- // Add the location silently so we can work with it
- location = KnownRepositories.getInstance().addRepository(location, false /* silently */);
- }
- }
- return location;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
- */
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardAutoconnectPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardAutoconnectPage.java
deleted file mode 100644
index 072d36252..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardAutoconnectPage.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-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.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * This configuration page explains to the user that CVS/ directories already exists and
- * it will attach the selected project to the repository that is specified in the CVS/ files.
- *
- * This is useful for people who have checked out a project using command-line tools.
- */
-public class ConfigurationWizardAutoconnectPage extends CVSWizardPage {
- private boolean validate = true;
- private FolderSyncInfo info;
- ICVSRepositoryLocation location;
-
- public ConfigurationWizardAutoconnectPage(String pageName, String title, ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- }
-
- /*
- * @see IDialogPage#createControl(Composite)
- */
- public void createControl(Composite parent) {
- Composite composite = createComposite(parent, 2, false);
- setControl(composite);
-
- // set F1 help
- WorkbenchHelp.setHelp(composite, IHelpContextIds.SHARING_AUTOCONNECT_PAGE);
-
- Label description = new Label(composite, SWT.WRAP);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- data.widthHint = 350;
- description.setLayoutData(data);
- description.setText(Policy.bind("ConfigurationWizardAutoconnectPage.description")); //$NON-NLS-1$
-
- if (location == null) return;
-
- // Spacer
- createLabel(composite, ""); //$NON-NLS-1$
- createLabel(composite, ""); //$NON-NLS-1$
-
- createLabel(composite, Policy.bind("ConfigurationWizardAutoconnectPage.user")); //$NON-NLS-1$
- createLabel(composite, location.getUsername());
- createLabel(composite, Policy.bind("ConfigurationWizardAutoconnectPage.host")); //$NON-NLS-1$
- createLabel(composite, location.getHost());
- createLabel(composite, Policy.bind("ConfigurationWizardAutoconnectPage.port")); //$NON-NLS-1$
- int port = location.getPort();
- if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT) {
- createLabel(composite, Policy.bind("ConfigurationWizardAutoconnectPage.default")); //$NON-NLS-1$
- } else {
- createLabel(composite, "" + port); //$NON-NLS-1$
- }
- createLabel(composite, Policy.bind("ConfigurationWizardAutoconnectPage.connectionType")); //$NON-NLS-1$
- createLabel(composite, location.getMethod().getName());
- createLabel(composite, Policy.bind("ConfigurationWizardAutoconnectPage.repositoryPath")); //$NON-NLS-1$
- createLabel(composite, location.getRootDirectory());
- createLabel(composite, Policy.bind("ConfigurationWizardAutoconnectPage.module")); //$NON-NLS-1$
- createLabel(composite, info.getRepository());
-
- // Spacer
- createLabel(composite, ""); //$NON-NLS-1$
- createLabel(composite, ""); //$NON-NLS-1$
-
- final Button check = new Button(composite, SWT.CHECK);
- data = new GridData();
- data.horizontalSpan = 2;
- check.setText(Policy.bind("ConfigurationWizardAutoconnectPage.validate")); //$NON-NLS-1$
- check.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- validate = check.getSelection();
- }
- });
- check.setSelection(true);
- Dialog.applyDialogFont(parent);
- }
-
- public FolderSyncInfo getFolderSyncInfo() {
- return info;
- }
- public boolean getValidate() {
- return validate;
- }
- public void setProject(IProject project) {
- try {
- ICVSFolder folder = (ICVSFolder)CVSWorkspaceRoot.getCVSResourceFor(project);
- info = folder.getFolderSyncInfo();
- if (info == null) {
- // This should never happen
- CVSUIPlugin.openError(null, Policy.bind("ConfigurationWizardAutoconnectPage.noSyncInfo"), Policy.bind("ConfigurationWizardAutoconnectPage.noCVSDirectory"), null); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- location = CVSRepositoryLocation.fromString(info.getRoot());
- } catch (TeamException e) {
- CVSUIPlugin.openError(null, null, null, e);
- }
- }
-
- public FolderSyncInfo getSharing() {
- return info;
- }
-
- /**
- * Gets the location.
- * @return Returns a ICVSRepositoryLocation
- */
- public ICVSRepositoryLocation getLocation() {
- return location;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java
deleted file mode 100644
index 24aa65f36..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java
+++ /dev/null
@@ -1,616 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Properties;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.FontMetrics;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.layout.FillLayout;
-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.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.IConnectionMethod;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Wizard page for entering information about a CVS repository location.
- */
-public class ConfigurationWizardMainPage extends CVSWizardPage {
- private boolean showValidate;
- private boolean validate;
-
- // Widgets
-
- // Connection Method
- private Combo connectionMethodCombo;
- // User
- private Combo userCombo;
- // Password
- private Text passwordText;
- // Port
- private Text portText;
- private Button useDefaultPort;
- private Button useCustomPort;
- // Host
- private Combo hostCombo;
- // Repository Path
- private Combo repositoryPathCombo;
- // Validation
- private Button validateButton;
- // Caching password
- private Button allowCachingButton;
- private boolean allowCaching = false;
-
- private static final int COMBO_HISTORY_LENGTH = 5;
-
- private Properties properties = null;
-
- // The previously created repository.
- // It is recorded when asked for and
- // nulled when the page is changed.
- private ICVSRepositoryLocation location;
-
- // The previously created repository.
- // It is recorded when fields are changed
- private ICVSRepositoryLocation oldLocation;
-
- // Dialog store id constants
- private static final String STORE_USERNAME_ID =
- "ConfigurationWizardMainPage.STORE_USERNAME_ID";//$NON-NLS-1$
- private static final String STORE_HOSTNAME_ID =
- "ConfigurationWizardMainPage.STORE_HOSTNAME_ID";//$NON-NLS-1$
- private static final String STORE_PATH_ID =
- "ConfigurationWizardMainPage.STORE_PATH_ID";//$NON-NLS-1$
- private static final String STORE_DONT_VALIDATE_ID =
- "ConfigurationWizardMainPage.STORE_DONT_VALIDATE_ID";//$NON-NLS-1$
-
- // In case the page was launched from a different wizard
- private IDialogSettings settings;
-
- /**
- * ConfigurationWizardMainPage constructor.
- *
- * @param pageName the name of the page
- * @param title the title of the page
- * @param titleImage the image for the page
- */
- public ConfigurationWizardMainPage(String pageName, String title, ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- }
- /**
- * Adds an entry to a history, while taking care of duplicate history items
- * and excessively long histories. The assumption is made that all histories
- * should be of length <code>ConfigurationWizardMainPage.COMBO_HISTORY_LENGTH</code>.
- *
- * @param history the current history
- * @param newEntry the entry to add to the history
- * @return the history with the new entry appended
- */
- private String[] addToHistory(String[] history, String newEntry) {
- ArrayList l = new ArrayList(Arrays.asList(history));
- addToHistory(l, newEntry);
- String[] r = new String[l.size()];
- l.toArray(r);
- return r;
- }
- protected IDialogSettings getDialogSettings() {
- return settings;
- }
- protected void setDialogSettings(IDialogSettings settings) {
- this.settings = settings;
- }
- /**
- * Adds an entry to a history, while taking care of duplicate history items
- * and excessively long histories. The assumption is made that all histories
- * should be of length <code>ConfigurationWizardMainPage.COMBO_HISTORY_LENGTH</code>.
- *
- * @param history the current history
- * @param newEntry the entry to add to the history
- */
- private void addToHistory(List history, String newEntry) {
- history.remove(newEntry);
- history.add(0,newEntry);
-
- // since only one new item was added, we can be over the limit
- // by at most one item
- if (history.size() > COMBO_HISTORY_LENGTH)
- history.remove(COMBO_HISTORY_LENGTH);
- }
- /**
- * Creates the UI part of the page.
- *
- * @param parent the parent of the created widgets
- */
- public void createControl(Composite parent) {
- Composite composite = createComposite(parent, 2, false);
- // set F1 help
- WorkbenchHelp.setHelp(composite, IHelpContextIds.SHARING_NEW_REPOSITORY_PAGE);
-
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- if (location != null) {
- oldLocation = location;
- location = null;
- }
- updateWidgetEnablements();
- }
- };
-
- Group g = createGroup(composite, Policy.bind("ConfigurationWizardMainPage.Location_1")); //$NON-NLS-1$
-
- // Host name
- createLabel(g, Policy.bind("ConfigurationWizardMainPage.host")); //$NON-NLS-1$
- hostCombo = createEditableCombo(g);
- hostCombo.addListener(SWT.Selection, listener);
- hostCombo.addListener(SWT.Modify, listener);
-
- // Repository Path
- createLabel(g, Policy.bind("ConfigurationWizardMainPage.repositoryPath")); //$NON-NLS-1$
- repositoryPathCombo = createEditableCombo(g);
- repositoryPathCombo.addListener(SWT.Selection, listener);
- repositoryPathCombo.addListener(SWT.Modify, listener);
-
- g = createGroup(composite, Policy.bind("ConfigurationWizardMainPage.Authentication_2")); //$NON-NLS-1$
-
- // User name
- createLabel(g, Policy.bind("ConfigurationWizardMainPage.userName")); //$NON-NLS-1$
- userCombo = createEditableCombo(g);
- userCombo.addListener(SWT.Selection, listener);
- userCombo.addListener(SWT.Modify, listener);
-
- // Password
- createLabel(g, Policy.bind("ConfigurationWizardMainPage.password")); //$NON-NLS-1$
- passwordText = createPasswordField(g);
- passwordText.addListener(SWT.Modify, listener);
-
- g = createGroup(composite, Policy.bind("ConfigurationWizardMainPage.Connection_3")); //$NON-NLS-1$
-
- // Connection type
- createLabel(g, Policy.bind("ConfigurationWizardMainPage.connection")); //$NON-NLS-1$
- connectionMethodCombo = createCombo(g);
- connectionMethodCombo.addListener(SWT.Selection, listener);
-
- // Port number
- // create a composite to ensure the radio buttons come in the correct order
- Composite portGroup = new Composite(g, SWT.NONE);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- portGroup.setLayoutData(data);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- portGroup.setLayout(layout);
- useDefaultPort = createRadioButton(portGroup, Policy.bind("ConfigurationWizardMainPage.useDefaultPort"), 2); //$NON-NLS-1$
- useCustomPort = createRadioButton(portGroup, Policy.bind("ConfigurationWizardMainPage.usePort"), 1); //$NON-NLS-1$
- useCustomPort.addListener(SWT.Selection, listener);
- portText = createTextField(portGroup);
- portText.addListener(SWT.Modify, listener);
-
- // create a composite to ensure the validate button is in its own tab group
- if (showValidate) {
- Composite validateButtonTabGroup = new Composite(composite, SWT.NONE);
- data = new GridData();
- data.horizontalSpan = 2;
- validateButtonTabGroup.setLayoutData(data);
- validateButtonTabGroup.setLayout(new FillLayout());
-
- validateButton = new Button(validateButtonTabGroup, SWT.CHECK);
- validateButton.setText(Policy.bind("ConfigurationWizardAutoconnectPage.validate")); //$NON-NLS-1$
- validateButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- validate = validateButton.getSelection();
- }
- });
- }
-
- allowCachingButton = new Button(composite, SWT.CHECK);
- allowCachingButton.setText(Policy.bind("UserValidationDialog.6")); //$NON-NLS-1$
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- data.horizontalSpan = 3;
- allowCachingButton.setLayoutData(data);
- allowCachingButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- allowCaching = allowCachingButton.getSelection();
- }
- });
-
- Composite warningComposite = new Composite(composite, SWT.NONE);
- layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 0;
- layout.marginHeight = 0;
- warningComposite.setLayout(layout);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 3;
- warningComposite.setLayoutData(data);
- Label warningLabel = new Label(warningComposite, SWT.NONE);
- warningLabel.setImage(Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
- warningLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_BEGINNING));
- Label warningText = new Label(warningComposite, SWT.WRAP);
- warningText.setText(Policy.bind("UserValidationDialog.7")); //$NON-NLS-1$
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = 300;
- GC gc= new GC(composite);
- gc.setFont(parent.getFont());
- FontMetrics fontMetrics= gc.getFontMetrics();
- gc.dispose();
- data.heightHint= Dialog.convertHeightInCharsToPixels(fontMetrics, 3);
- warningText.setLayoutData(data);
-
- initializeValues();
- updateWidgetEnablements();
- hostCombo.setFocus();
-
- setControl(composite);
- Dialog.applyDialogFont(parent);
- }
- /**
- * Utility method to create an editable combo box
- *
- * @param parent the parent of the combo box
- * @return the created combo
- */
- protected Combo createEditableCombo(Composite parent) {
- Combo combo = new Combo(parent, SWT.NULL);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- combo.setLayoutData(data);
- return combo;
- }
-
- protected Group createGroup(Composite parent, String text) {
- Group group = new Group(parent, SWT.NULL);
- group.setText(text);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- //data.widthHint = GROUP_WIDTH;
-
- group.setLayoutData(data);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- group.setLayout(layout);
- return group;
- }
-
- /*
- * Create a Proeprties node that contains everything needed to create a repository location
- */
- private Properties createProperties() {
- Properties result = new Properties();
- result.setProperty("connection", connectionMethodCombo.getText()); //$NON-NLS-1$
- result.setProperty("user", userCombo.getText()); //$NON-NLS-1$
- result.setProperty("password", passwordText.getText()); //$NON-NLS-1$
- result.setProperty("host", hostCombo.getText()); //$NON-NLS-1$
- if (useCustomPort.getSelection()) {
- result.setProperty("port", portText.getText()); //$NON-NLS-1$
- }
- result.setProperty("root", repositoryPathCombo.getText()); //$NON-NLS-1$
- return result;
- }
-
- /**
- * Crate a new location with the information entered on the page.
- * The location will exists and can be sed for connecting but is not
- * registered for persistance. This method must be called from the UI
- * thread.
- * @return a location or <code>null</code>
- * @throws CVSException
- */
- public ICVSRepositoryLocation getLocation() throws CVSException {
- if (location == null) {
- if (!isPageComplete()) return null;
- location = CVSRepositoryLocation.fromProperties(createProperties());
- if (location.equals(oldLocation)) {
- location = oldLocation;
- }
- location.setAllowCaching(allowCaching);
- oldLocation = null;
- saveWidgetValues();
- }
- return location;
- }
-
- /**
- * Initializes states of the controls.
- */
- private void initializeValues() {
- // Set remembered values
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- String[] hostNames = settings.getArray(STORE_HOSTNAME_ID);
- if (hostNames != null) {
- for (int i = 0; i < hostNames.length; i++) {
- hostCombo.add(hostNames[i]);
- }
- }
- String[] paths = settings.getArray(STORE_PATH_ID);
- if (paths != null) {
- for (int i = 0; i < paths.length; i++) {
- repositoryPathCombo.add(paths[i]);
- }
- }
- String[] userNames = settings.getArray(STORE_USERNAME_ID);
- if (userNames != null) {
- for (int i = 0; i < userNames.length; i++) {
- userCombo.add(userNames[i]);
- }
- }
- if (showValidate) {
- validate = !settings.getBoolean(STORE_DONT_VALIDATE_ID);
- validateButton.setSelection(validate);
- }
- }
-
- // Initialize other values and widget states
- IConnectionMethod[] methods = CVSRepositoryLocation.getPluggedInConnectionMethods();
- for (int i = 0; i < methods.length; i++) {
- connectionMethodCombo.add(methods[i].getName());
- }
-
- connectionMethodCombo.select(0);
- useDefaultPort.setSelection(true);
-
- if(properties != null) {
- String method = properties.getProperty("connection"); //$NON-NLS-1$
- if (method == null) {
- connectionMethodCombo.select(0);
- } else {
- connectionMethodCombo.select(connectionMethodCombo.indexOf(method));
- }
-
- String user = properties.getProperty("user"); //$NON-NLS-1$
- if (user != null) {
- userCombo.setText(user);
- }
-
- String password = properties.getProperty("password"); //$NON-NLS-1$
- if (password != null) {
- passwordText.setText(password);
- }
-
- String host = properties.getProperty("host"); //$NON-NLS-1$
- if (host != null) {
- hostCombo.setText(host);
- }
-
- String port = properties.getProperty("port"); //$NON-NLS-1$
- if (port != null) {
- useCustomPort.setSelection(true);
- portText.setText(port);
- }
-
- String repositoryPath = properties.getProperty("root"); //$NON-NLS-1$
- if (repositoryPath != null) {
- repositoryPathCombo.setText(repositoryPath);
- }
- }
- }
- /**
- * Saves the widget values
- */
- private void saveWidgetValues() {
- // Update history
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- String[] userNames = settings.getArray(STORE_USERNAME_ID);
- if (userNames == null) userNames = new String[0];
- userNames = addToHistory(userNames, userCombo.getText());
- settings.put(STORE_USERNAME_ID, userNames);
-
- String[] hostNames = settings.getArray(STORE_HOSTNAME_ID);
- if (hostNames == null) hostNames = new String[0];
- hostNames = addToHistory(hostNames, hostCombo.getText());
- settings.put(STORE_HOSTNAME_ID, hostNames);
-
- String[] paths = settings.getArray(STORE_PATH_ID);
- if (paths == null) paths = new String[0];
- paths = addToHistory(paths, repositoryPathCombo.getText());
- settings.put(STORE_PATH_ID, paths);
-
- if (showValidate) {
- settings.put(STORE_DONT_VALIDATE_ID, !validate);
- }
- }
- }
-
- public void setShowValidate(boolean showValidate) {
- this.showValidate = showValidate;
- }
-
- /**
- * Sets the properties for the repository connection
- *
- * @param properties the properties or null
- */
- public void setProperties(Properties properties) {
- this.properties = properties;
- }
-
- /**
- * Updates widget enablements and sets error message if appropriate.
- */
- protected void updateWidgetEnablements() {
- if (useDefaultPort.getSelection()) {
- portText.setEnabled(false);
- } else {
- portText.setEnabled(true);
- }
-
- validateFields();
- }
- /**
- * Validates the contents of the editable fields and set page completion
- * and error messages appropriately.
- */
- private void validateFields() {
- String user = userCombo.getText();
- IStatus status = validateUserName(user);
- if (!isStatusOK(status)) {
- return;
- }
-
- String host = hostCombo.getText();
- status = validateHost(host);
- if (!isStatusOK(status)) {
- return;
- }
-
- if (portText.isEnabled()) {
- String port = portText.getText();
- status = validatePort(port);
- if (!isStatusOK(status)) {
- return;
- }
- }
-
- String pathString = repositoryPathCombo.getText();
- status = validatePath(pathString);
- if (!isStatusOK(status)) {
- return;
- }
-
- try {
- CVSRepositoryLocation l = CVSRepositoryLocation.fromProperties(createProperties());
- if (!l.equals(oldLocation) && KnownRepositories.getInstance().isKnownRepository(l.getLocation())) {
- setErrorMessage(Policy.bind("ConfigurationWizardMainPage.0")); //$NON-NLS-1$
- setPageComplete(false);
- return;
- }
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- // Let it pass. Creation should fail
- }
-
- // Everything passed so we're good to go
- setErrorMessage(null);
- setPageComplete(true);
- }
-
- private boolean isStatusOK(IStatus status) {
- if (!status.isOK()) {
- if (status.getCode() == REQUIRED_FIELD) {
- // Don't set the message for an empty field
- setErrorMessage(null);
- } else {
- setErrorMessage(status.getMessage());
- }
- setPageComplete(false);
- return false;
- }
- return true;
- }
-
- public boolean getValidate() {
- return validate;
- }
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible) {
- hostCombo.setFocus();
- }
- }
-
- public static final int REQUIRED_FIELD = 1;
- public static final int INVALID_FIELD_CONTENTS = 2;
- public static final IStatus validateUserName(String user) {
- if (user.length() == 0) {
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, REQUIRED_FIELD, Policy.bind("ConfigurationWizardMainPage.1"), null); //$NON-NLS-1$
- }
- if ((user.indexOf('@') != -1) || (user.indexOf(':') != -1)) {
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, INVALID_FIELD_CONTENTS,
- Policy.bind("ConfigurationWizardMainPage.invalidUserName"), null); //$NON-NLS-1$
- }
- return Status.OK_STATUS;
- }
- public static final IStatus validateHost(String host) {
- if (host.length() == 0) {
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, REQUIRED_FIELD, Policy.bind("ConfigurationWizardMainPage.2"), null); //$NON-NLS-1$
- }
- if (host.indexOf(':') != -1) {
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, INVALID_FIELD_CONTENTS,
- Policy.bind("ConfigurationWizardMainPage.invalidHostName"), null); //$NON-NLS-1$
- }
- if (host.startsWith(" ") || host.endsWith(" ")) { //$NON-NLS-1$ //$NON-NLS-2$
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, INVALID_FIELD_CONTENTS,
- Policy.bind("ConfigurationWizardMainPage.5"), null); //$NON-NLS-1$
- }
- return Status.OK_STATUS;
- }
- public static final IStatus validatePort(String port) {
- if (port.length() == 0) {
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, REQUIRED_FIELD, Policy.bind("ConfigurationWizardMainPage.3"), null); //$NON-NLS-1$
- }
- try {
- Integer.parseInt(port);
- } catch (NumberFormatException e) {
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, INVALID_FIELD_CONTENTS,
- Policy.bind("ConfigurationWizardMainPage.invalidPort"), null); //$NON-NLS-1$
- }
- return Status.OK_STATUS;
- }
- public static final IStatus validatePath(String pathString) {
- if (pathString.length() == 0) {
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, REQUIRED_FIELD, Policy.bind("ConfigurationWizardMainPage.4"), null); //$NON-NLS-1$
- }
- IPath path = new Path(null, pathString);
- String[] segments = path.segments();
- for (int i = 0; i < segments.length; i++) {
- String string = segments[i];
- if (string.charAt(0) == ' ' || string.charAt(string.length() -1) == ' ') {
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, INVALID_FIELD_CONTENTS,
- Policy.bind("ConfigurationWizardMainPage.invalidPathWithSpaces"), null); //$NON-NLS-1$
- }
- }
- // look for // and inform the user that we support use of C:\cvs\root instead of /c//cvs/root
- if (pathString.indexOf("//") != -1) { //$NON-NLS-1$
- if (pathString.indexOf("//") == 2) { //$NON-NLS-1$
- // The user is probably trying to specify a CVSNT path
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, INVALID_FIELD_CONTENTS,
- Policy.bind("ConfigurationWizardMainPage.useNTFormat"), null); //$NON-NLS-1$
- } else {
- return new Status(IStatus.ERROR, CVSUIPlugin.ID, INVALID_FIELD_CONTENTS,
- Policy.bind("ConfigurationWizardMainPage.invalidPathWithSlashes"), null); //$NON-NLS-1$
- }
- }
- return Status.OK_STATUS;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileOperation.java
deleted file mode 100644
index ba77d16d7..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileOperation.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-/**
- * An operation to run the CVS diff operation on a set of resources. The result
- * of the diff is written to a file. If there are no differences found, the
- * user is notified and the output file is not created.
- */
-public class GenerateDiffFileOperation implements IRunnableWithProgress {
-
- private File outputFile;
- private IResource resource;
- private Shell shell;
- private LocalOption[] options;
-
- GenerateDiffFileOperation(IResource resource, File file, LocalOption[] options, Shell shell) {
- this.resource = resource;
- this.outputFile = file;
- this.shell = shell;
- this.options = options;
- }
-
- /**
- * @see IRunnableWithProgress#run(IProgressMonitor)
- */
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
-
- final CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId());
- monitor.beginTask("", 500); //$NON-NLS-1$
- monitor.setTaskName(Policy.bind("GenerateCVSDiff.working")); //$NON-NLS-1$
- try {
- if (outputFile != null) {
- generateDiffToFile(monitor, provider, outputFile);
- } else {
- generateDiffToClipboard(monitor, provider);
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
-
- private void generateDiffToFile(IProgressMonitor monitor, CVSTeamProvider provider, File file) throws TeamException {
-
- final FileOutputStream os;
- try {
- os= new FileOutputStream(file);
- try {
- provider.diff(resource, options, new PrintStream(os), new SubProgressMonitor(monitor, 500));
- } finally {
- os.close();
- }
- } catch (FileNotFoundException e) {
- throw new TeamException(Policy.bind("GenerateDiffFileOperation.0"), e); //$NON-NLS-1$
- } catch (IOException e) {
- throw new TeamException(Policy.bind("GenerateDiffFileOperation.1"), e); //$NON-NLS-1$
- }
-
- if (file.length() == 0) {
- outputFile.delete();
- reportEmptyDiff();
- }
- }
-
- private void generateDiffToClipboard(IProgressMonitor monitor, CVSTeamProvider provider) throws TeamException {
- final ByteArrayOutputStream os = new ByteArrayOutputStream();
- try {
- try {
- provider.diff(resource, options, new PrintStream(os), new SubProgressMonitor(monitor, 500));
- } finally {
- os.close();
- }
- } catch (IOException e) {
- throw new TeamException(Policy.bind("GenerateDiffFileOperation.2"), e); //$NON-NLS-1$
- }
- if (os.size() == 0) {
- reportEmptyDiff();
- } else {
- copyToClipboard(os);
- }
- }
-
- private void copyToClipboard(final ByteArrayOutputStream baos) {
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- TextTransfer plainTextTransfer = TextTransfer.getInstance();
- Clipboard clipboard = new Clipboard(shell.getDisplay());
- clipboard.setContents(
- new String[]{baos.toString()},
- new Transfer[]{plainTextTransfer});
- clipboard.dispose();
- }
- });
- }
-
- private void reportEmptyDiff() {
- CVSUIPlugin.openDialog(shell, new CVSUIPlugin.IOpenableInShell() {
- public void open(Shell shell) {
- MessageDialog.openInformation(
- shell,
- Policy.bind("GenerateCVSDiff.noDiffsFoundTitle"), //$NON-NLS-1$
- Policy.bind("GenerateCVSDiff.noDiffsFoundMsg")); //$NON-NLS-1$
- }
- }, CVSUIPlugin.PERFORM_SYNC_EXEC);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileWizard.java
deleted file mode 100644
index b537c83d0..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileWizard.java
+++ /dev/null
@@ -1,775 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardPage;
-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.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.FileDialog;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Diff;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.ide.misc.ContainerContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-/**
- * A wizard for creating a patch file by running the CVS diff command.
- */
-public class GenerateDiffFileWizard extends Wizard {
-
- /**
- * Page to select a patch file. Overriding validatePage was necessary to allow
- * entering a file name that already exists.
- */
- private class LocationPage extends WizardPage {
-
- /**
- * The possible locations to save a patch.
- */
- public final static int CLIPBOARD = 1;
- public final static int FILESYSTEM = 2;
- public final static int WORKSPACE = 3;
-
- /**
- * GUI controls for clipboard (cp), filesystem (fs) and workspace (ws).
- */
- private Button cpRadio;
-
- private Button fsRadio;
- protected Text fsPathText;
- private Button fsBrowseButton;
-
- private Button wsRadio;
- protected TreeViewer wsTreeViewer;
- private Text wsFilenameText;
-
-
- /**
- * State information of this page, updated by the listeners.
- */
- protected boolean pageValid;
- protected IContainer wsSelectedContainer;
- protected int selectedLocation;
-
- /**
- * The default values store used to initialize the selections.
- */
- private final DefaultValuesStore store;
-
- LocationPage(String pageName, String title, ImageDescriptor image, DefaultValuesStore store) {
- super(pageName, title, image);
- setPageComplete(false);
- this.store= store;
- }
-
- /**
- * Allow the user to finish if a valid file has been entered.
- */
- protected boolean validatePage() {
-
- switch (selectedLocation) {
- case WORKSPACE:
- pageValid= validateWorkspaceLocation();
- break;
- case FILESYSTEM:
- pageValid= validateFilesystemLocation();
- break;
- case CLIPBOARD:
- pageValid= true;
- break;
- }
-
- /**
- * Avoid draw flicker by clearing error message
- * if all is valid.
- */
- if (pageValid) {
- setMessage(null);
- setErrorMessage(null);
- }
- setPageComplete(pageValid);
- return pageValid;
- }
-
- /**
- * The following conditions must hold for the file system location
- * to be valid:
- * - the path must be valid and non-empty
- * - the path must be absolute
- * - the specified file must be of type file
- * - the parent must exist (new folders can be created via the browse button)
- */
- private boolean validateFilesystemLocation() {
- final String pathString= fsPathText.getText().trim();
- if (pathString.length() == 0 || !new Path("").isValidPath(pathString)) { //$NON-NLS-1$
- setErrorMessage(Policy.bind("GenerateDiffFileWizard.0")); //$NON-NLS-1$
- return false;
- }
-
- final File file= new File(pathString);
- if (!file.isAbsolute()) {
- setErrorMessage(Policy.bind("GenerateDiffFileWizard.0")); //$NON-NLS-1$
- return false;
- }
-
- if (file.isDirectory()) {
- setErrorMessage(Policy.bind("GenerateDiffFileWizard.2")); //$NON-NLS-1$
- return false;
- }
-
- if (pathString.endsWith("/") || pathString.endsWith("\\")) { //$NON-NLS-1$//$NON-NLS-2$
- setErrorMessage(Policy.bind("GenerateDiffFileWizard.3")); //$NON-NLS-1$
- return false;
- }
-
- final File parent= file.getParentFile();
- if (!(parent.exists() && parent.isDirectory())) {
- setErrorMessage(Policy.bind("GenerateDiffFileWizard.3")); //$NON-NLS-1$
- return false;
- }
- return true;
- }
-
- /**
- * The following conditions must hold for the file system location to be valid:
- * - a parent must be selected in the workspace tree view
- * - the resource name must be valid
- */
- private boolean validateWorkspaceLocation() {
- if (wsSelectedContainer == null) {
- setErrorMessage(Policy.bind("GenerateDiffFileWizard.4")); //$NON-NLS-1$
- return false;
- }
- final String filename= wsFilenameText.getText().trim();
- if (!new Path("").isValidSegment(filename)) { //$NON-NLS-1$
- setErrorMessage(Policy.bind("GenerateDiffFileWizard.5")); //$NON-NLS-1$
- return false;
- }
- return true;
- }
-
- /**
- * Answers a full path to a file system file or <code>null</code> if the user
- * selected to save the patch in the clipboard.
- */
- public File getFile() {
- if (pageValid && selectedLocation == FILESYSTEM) {
- return new File(fsPathText.getText().trim());
- }
- if (pageValid && selectedLocation == WORKSPACE) {
- final String filename= wsFilenameText.getText().trim();
- final IFile file= wsSelectedContainer.getFile(new Path(filename));
- return file.getLocation().toFile();
- }
- return null;
- }
-
- /**
- * Get the selected workspace resource if the patch is to be saved in the
- * workspace, or null otherwise.
- */
- public IResource getResource() {
- if (pageValid && selectedLocation == WORKSPACE) {
- final String filename= wsFilenameText.getText().trim();
- return wsSelectedContainer.getFile(new Path(null, filename));
- }
- return null;
- }
-
- /**
- * Allow the user to chose to save the patch to the workspace or outside
- * of the workspace.
- */
- public void createControl(Composite parent) {
-
- final Composite composite= new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- setControl(composite);
- initializeDialogUnits(composite);
-
- // set F1 help
- WorkbenchHelp.setHelp(composite, IHelpContextIds.PATCH_SELECTION_PAGE);
-
- setupClipboardControls(composite);
- setupFilesystemControls(composite);
- setupWorkspaceControls(composite);
-
- Dialog.applyDialogFont(parent);
-
- initializeDefaultValues();
-
- /**
- * Ensure the page is in a valid state.
- */
- if (!validatePage()) {
- store.storeRadioSelection(CLIPBOARD);
- initializeDefaultValues();
- validatePage();
- }
- pageValid= true;
-
- updateEnablements();
- setupListeners();
- }
-
-
- /**
- * Setup the controls for the workspace option.
- */
- private void setupWorkspaceControls(Composite composite) {
- wsRadio= new Button(composite, SWT.RADIO);
- wsRadio.setText(Policy.bind("Save_In_Workspace_7")); //$NON-NLS-1$
-
- new Label(composite, SWT.LEFT).setText(Policy.bind("Select_a_folder_then_type_in_the_file_name__8")); //$NON-NLS-1$
-
- wsTreeViewer = new TreeViewer(composite, SWT.BORDER);
- final GridData gd= new GridData(SWT.FILL, SWT.FILL, true, true);
- gd.widthHint= 0;
- gd.heightHint= 0;
- wsTreeViewer.getTree().setLayoutData(gd);
-
- final ContainerContentProvider cp = new ContainerContentProvider();
- cp.showClosedProjects(false);
- wsTreeViewer.setContentProvider(cp);
- wsTreeViewer.setLabelProvider(new WorkbenchLabelProvider());
- wsTreeViewer.setInput(ResourcesPlugin.getWorkspace());
-
- final Composite group = new Composite(composite, SWT.NONE);
- final GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- group.setLayout(layout);
- group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- final Label label = new Label(group, SWT.NONE);
- label.setLayoutData(new GridData());
- label.setText(Policy.bind("Fi&le_name__9")); //$NON-NLS-1$
-
- wsFilenameText = new Text(group,SWT.BORDER);
- wsFilenameText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
- }
-
- /**
- * Setup the controls for the file system option.
- */
- private void setupFilesystemControls(final Composite composite) {
- GridLayout layout;
- fsRadio= new Button(composite, SWT.RADIO);
-
- fsRadio.setText(Policy.bind("Save_In_File_System_3")); //$NON-NLS-1$
-
- final Composite nameGroup = new Composite(composite,SWT.NONE);
- layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginWidth = 0;
- nameGroup.setLayout(layout);
- final GridData data = new GridData(SWT.FILL, SWT.FILL, false, false);
- nameGroup.setLayoutData(data);
-
- fsPathText= new Text(nameGroup, SWT.BORDER);
- GridData gd= new GridData(GridData.FILL_HORIZONTAL);
- fsPathText.setLayoutData(gd);
-
- fsBrowseButton = new Button(nameGroup, SWT.NULL);
- fsBrowseButton.setText(Policy.bind("Browse..._4")); //$NON-NLS-1$
- }
-
- /**
- * Setup the controls for the clipboard option.
- */
- private void setupClipboardControls(final Composite composite) {
- cpRadio= new Button(composite, SWT.RADIO);
- cpRadio.setText(Policy.bind("Save_To_Clipboard_2")); //$NON-NLS-1$
- }
-
-
- /**
- * Initialize the controls with the saved default values which are
- * obtained from the DefaultValuesStore.
- */
- private void initializeDefaultValues() {
-
- selectedLocation= store.getRadioSelection();
- wsSelectedContainer= store.getWorkspaceSelection();
-
- /**
- * Radio buttons
- */
- cpRadio.setSelection(selectedLocation == CLIPBOARD);
- fsRadio.setSelection(selectedLocation == FILESYSTEM);
- wsRadio.setSelection(selectedLocation == WORKSPACE);
-
- /**
- * Text fields.
- */
- fsPathText.setText(store.getFilesystemPath());
- wsFilenameText.setText(store.getWorkspaceFilename());
-
- /**
- * Tree viewer.
- */
- if (wsSelectedContainer != null) {
- final ISelection selection= new StructuredSelection(wsSelectedContainer);
- wsTreeViewer.setSelection(selection, true);
- }
- }
-
- /**
- * Setup all the listeners for the controls.
- */
- private void setupListeners() {
-
- cpRadio.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- selectedLocation= CLIPBOARD;
- validatePage();
- updateEnablements();
- }
- });
- fsRadio.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- selectedLocation= FILESYSTEM;
- validatePage();
- updateEnablements();
- }
- });
-
- wsRadio.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- selectedLocation= WORKSPACE;
- validatePage();
- updateEnablements();
- }
- });
-
- fsPathText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validatePage();
- }
- });
-
- fsBrowseButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- final FileDialog dialog = new FileDialog(getShell(), SWT.PRIMARY_MODAL | SWT.SAVE);
- if (pageValid) {
- final File file= new File(fsPathText.getText());
- dialog.setFilterPath(file.getParent());
- }
- dialog.setText(Policy.bind("Save_Patch_As_5")); //$NON-NLS-1$
- dialog.setFileName(Policy.bind("patch.txt_6")); //$NON-NLS-1$
- final String path = dialog.open();
- if (path != null) {
- fsPathText.setText(new Path(path).toOSString());
- }
- }
- });
-
- wsTreeViewer.addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection s = (IStructuredSelection)event.getSelection();
- wsSelectedContainer = ((IContainer) s.getFirstElement());
- validatePage();
- }
- });
-
- wsTreeViewer.addDoubleClickListener(
- new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- ISelection s= event.getSelection();
- if (s instanceof IStructuredSelection) {
- Object item = ((IStructuredSelection)s).getFirstElement();
- if (wsTreeViewer.getExpandedState(item))
- wsTreeViewer.collapseToLevel(item, 1);
- else
- wsTreeViewer.expandToLevel(item, 1);
- }
- }
- });
-
- wsFilenameText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validatePage();
- }
- });
- }
-
- /**
- * Enable and disable controls based on the selected radio button.
- */
- protected void updateEnablements() {
- fsBrowseButton.setEnabled(selectedLocation == FILESYSTEM);
- fsPathText.setEnabled(selectedLocation == FILESYSTEM);
- wsTreeViewer.getTree().setEnabled(selectedLocation == WORKSPACE);
- wsFilenameText.setEnabled(selectedLocation == WORKSPACE);
- }
-
- public int getSelectedLocation() {
- return selectedLocation;
- }
- }
-
- /**
- * Page to select the options for creating the patch.
- */
- private class OptionsPage extends WizardPage {
-
- private Button recurseOption;
- private Button contextDiffOption;
- private Button unifiedDiffOption;
- private Button regularDiffOption;
- private Button includeNewFilesOptions;
-
- /**
- * Constructor for PatchFileCreationOptionsPage.
- */
- protected OptionsPage(String pageName) {
- super(pageName);
- }
-
- /**
- * Constructor for PatchFileCreationOptionsPage.
- */
- protected OptionsPage(String pageName, String title, ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- }
-
- /*
- * @see IDialogPage#createControl(Composite)
- */
- public void createControl(Composite parent) {
- Composite composite= new Composite(parent, SWT.NULL);
- GridLayout layout= new GridLayout();
- composite.setLayout(layout);
- composite.setLayoutData(new GridData());
- setControl(composite);
-
- // set F1 help
- WorkbenchHelp.setHelp(composite, IHelpContextIds.PATCH_OPTIONS_PAGE);
-
- recurseOption = new Button(composite, SWT.CHECK);
- recurseOption.setText(Policy.bind("Do_not_recurse_into_sub-folders_10")); //$NON-NLS-1$
- recurseOption.setSelection(true);
-
- includeNewFilesOptions = new Button(composite, SWT.CHECK);
- includeNewFilesOptions.setText(Policy.bind("Do_not_include_new_files_in_patch_11")); //$NON-NLS-1$
- includeNewFilesOptions.setSelection(true);
-
- Group diffTypeGroup = new Group(composite, SWT.NONE);
- layout = new GridLayout();
- layout.marginHeight = 0;
- diffTypeGroup.setLayout(layout);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- diffTypeGroup.setLayoutData(data);
- diffTypeGroup.setText(Policy.bind("Diff_output_format_12")); //$NON-NLS-1$
-
- unifiedDiffOption = new Button(diffTypeGroup, SWT.RADIO);
- unifiedDiffOption.setText(Policy.bind("Unified_(format_required_by_Compare_With_Patch_feature)_13")); //$NON-NLS-1$
- unifiedDiffOption.setSelection(true);
- contextDiffOption = new Button(diffTypeGroup, SWT.RADIO);
- contextDiffOption.setText(Policy.bind("Context_14")); //$NON-NLS-1$
- regularDiffOption = new Button(diffTypeGroup, SWT.RADIO);
- regularDiffOption.setText(Policy.bind("Standard_15")); //$NON-NLS-1$
-
- Dialog.applyDialogFont(parent);
- }
-
- /**
- * Answers if the difference operation should be run recursively.
- */
- public boolean isRecursive() {
- return !recurseOption.getSelection();
- }
-
- /**
- * Return the list of Diff command options configured on this page.
- */
- public LocalOption[] getOptions() {
- List options = new ArrayList(5);
- if(includeNewFilesOptions.getSelection()) {
- options.add(Diff.INCLUDE_NEWFILES);
- }
- if(!recurseOption.getSelection()) {
- options.add(Command.DO_NOT_RECURSE);
- }
- if(unifiedDiffOption.getSelection()) {
- options.add(Diff.UNIFIED_FORMAT);
- } else if(contextDiffOption.getSelection()) {
- options.add(Diff.CONTEXT_FORMAT);
- }
- return (LocalOption[]) options.toArray(new LocalOption[options.size()]);
- }
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible) {
- recurseOption.setFocus();
- }
- }
- }
-
- /**
- * Class to retrieve and store the default selected values.
- */
- private final class DefaultValuesStore {
-
- private static final String PREF_LAST_SELECTION= "org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard.PatchFileSelectionPage.selection"; //$NON-NLS-1$
- private static final String PREF_LAST_FS_PATH= "org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard.PatchFileSelectionPage.fs.path"; //$NON-NLS-1$
- private static final String PREF_LAST_WS_FILENAME= "org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard.PatchFileSelectionPage.ws.filename"; //$NON-NLS-1$
- private static final String PREF_LAST_WS_PATH= "org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard.PatchFileSelectionPage.ws.path"; //$NON-NLS-1$
-
- private final IDialogSettings dialogSettings;
-
- public DefaultValuesStore() {
- dialogSettings= CVSUIPlugin.getPlugin().getDialogSettings();
- }
-
- public int getRadioSelection() {
- int value= LocationPage.CLIPBOARD;
- try {
- value= dialogSettings.getInt(PREF_LAST_SELECTION);
- } catch (NumberFormatException e) {
- }
-
- switch (value) {
- case LocationPage.FILESYSTEM:
- case LocationPage.WORKSPACE:
- case LocationPage.CLIPBOARD:
- return value;
- default:
- return LocationPage.CLIPBOARD;
- }
- }
-
- public String getFilesystemPath() {
- final String path= dialogSettings.get(PREF_LAST_FS_PATH);
- return path != null ? path : ""; //$NON-NLS-1$
- }
-
- public String getWorkspaceFilename() {
- final String filename= dialogSettings.get(PREF_LAST_WS_FILENAME);
- return filename != null ? filename : ""; //$NON-NLS-1$
- }
-
- public IContainer getWorkspaceSelection() {
- final String value= dialogSettings.get(PREF_LAST_WS_PATH);
- if ( value != null ) {
- final IPath path= new Path(value);
- final IResource container= ResourcesPlugin.getWorkspace().getRoot().findMember(path);
- if (container instanceof IContainer) {
- return (IContainer)container;
- }
- }
- return null;
- }
-
- public void storeRadioSelection(int defaultSelection) {
- dialogSettings.put(PREF_LAST_SELECTION, defaultSelection);
- }
-
- public void storeFilesystemPath(String path) {
- dialogSettings.put(PREF_LAST_FS_PATH, path);
- }
-
- public void storeWorkspacePath(String path) {
- dialogSettings.put(PREF_LAST_WS_PATH, path);
- }
-
- public void storeWorkspaceFilename(String filename) {
- dialogSettings.put(PREF_LAST_WS_FILENAME, filename);
- }
- }
-
-
- private LocationPage locationPage;
- private OptionsPage optionsPage;
-
- private final IResource resource;
- private final DefaultValuesStore defaultValuesStore;
-
-
- public GenerateDiffFileWizard(IResource resource) {
- super();
- this.resource = resource;
- setWindowTitle(Policy.bind("GenerateCVSDiff.title")); //$NON-NLS-1$
- initializeDefaultPageImageDescriptor();
- defaultValuesStore= new DefaultValuesStore();
- }
-
- public void addPages() {
- String pageTitle = Policy.bind("GenerateCVSDiff.pageTitle"); //$NON-NLS-1$
- String pageDescription = Policy.bind("GenerateCVSDiff.pageDescription"); //$NON-NLS-1$
- locationPage = new LocationPage(pageTitle, pageTitle, CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_DIFF), defaultValuesStore);
- locationPage.setDescription(pageDescription);
- addPage(locationPage);
-
- pageTitle = Policy.bind("Advanced_options_19"); //$NON-NLS-1$
- pageDescription = Policy.bind("Configure_the_options_used_for_the_CVS_diff_command_20"); //$NON-NLS-1$
- optionsPage = new OptionsPage(pageTitle, pageTitle, CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_DIFF));
- optionsPage.setDescription(pageDescription);
- addPage(optionsPage);
- }
-
- /**
- * Declares the wizard banner iamge descriptor
- */
- protected void initializeDefaultPageImageDescriptor() {
- final String iconPath= "icons/full/"; //$NON-NLS-1$
- try {
- final URL installURL = CVSUIPlugin.getPlugin().getBundle().getEntry("/"); //$NON-NLS-1$
- final URL url = new URL(installURL, iconPath + "wizards/newconnect_wiz.gif"); //$NON-NLS-1$
- ImageDescriptor desc = ImageDescriptor.createFromURL(url);
- setDefaultPageImageDescriptor(desc);
- } catch (MalformedURLException e) {
- // Should not happen. Ignore.
- }
- }
-
- /* (Non-javadoc)
- * Method declared on IWizard.
- */
- public boolean needsProgressMonitor() {
- return true;
- }
-
- /**
- * Completes processing of the wizard. If this method returns <code>
- * true</code>, the wizard will close; otherwise, it will stay active.
- */
- public boolean performFinish() {
-
- final int location= locationPage.getSelectedLocation();
-
- final File file= location != LocationPage.CLIPBOARD? locationPage.getFile() : null;
-
- if (!(file == null || validateFile(file))) {
- return false;
- }
-
- /**
- * Perform diff operation.
- */
- try {
- getContainer().run(true, true, new GenerateDiffFileOperation(resource, file, optionsPage.getOptions(), getShell()));
- } catch (InterruptedException e1) {
- return true;
- } catch (InvocationTargetException e2) {
- CVSUIPlugin.openError(getShell(), null, null, e2);
- return false;
- }
-
- /**
- * Refresh workspace if necessary and save default selection.
- */
- switch (location) {
-
- case LocationPage.WORKSPACE:
- defaultValuesStore.storeRadioSelection(LocationPage.WORKSPACE);
- final IResource workspaceResource= locationPage.getResource();
- defaultValuesStore.storeWorkspacePath(workspaceResource.getParent().getFullPath().toString());
- defaultValuesStore.storeWorkspaceFilename(workspaceResource.getName());
- try {
- workspaceResource.getParent().refreshLocal(IResource.DEPTH_ONE, null);
- } catch(CoreException e) {
- CVSUIPlugin.openError(getShell(), Policy.bind("GenerateCVSDiff.error"), null, e); //$NON-NLS-1$
- return false;
- }
- break;
-
- case LocationPage.FILESYSTEM:
- defaultValuesStore.storeFilesystemPath(file.getPath());
- defaultValuesStore.storeRadioSelection(LocationPage.FILESYSTEM);
- break;
-
- case LocationPage.CLIPBOARD:
- defaultValuesStore.storeRadioSelection(LocationPage.CLIPBOARD);
- break;
-
- default:
- return false;
- }
- return true;
- }
-
- public boolean validateFile(File file) {
-
- if (file == null)
- return false;
-
- /**
- * Consider file valid if it doesn't exist for now.
- */
- if (!file.exists())
- return true;
-
- /**
- * The file exists.
- */
- if (!file.canWrite()) {
- final String title= Policy.bind("GenerateCVSDiff.1"); //$NON-NLS-1$
- final String msg= Policy.bind("GenerateCVSDiff.2"); //$NON-NLS-1$
- final MessageDialog dialog= new MessageDialog(getShell(), title, null, msg, MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0);
- dialog.open();
- return false;
- }
-
- final String title = Policy.bind("GenerateCVSDiff.overwriteTitle"); //$NON-NLS-1$
- final String msg = Policy.bind("GenerateCVSDiff.overwriteMsg"); //$NON-NLS-1$
- final MessageDialog dialog = new MessageDialog(getShell(), title, null, msg, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
- dialog.open();
- if (dialog.getReturnCode() != 0)
- return false;
-
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ICVSWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ICVSWizard.java
deleted file mode 100644
index 77195124f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ICVSWizard.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on 16-Mar-2004
- *
- * To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-
-/**
- * Extended wizard interface that differentiates retrieving
- * the next page for display vs. for determining it's state
- */
-public interface ICVSWizard extends IWizard {
-
- /**
- * Get the wizard page that follows the given page. If
- * aboutToShow is true then the page will be shown.
- * Otherwise, only its state will be queried.
- * @param page a wizard page
- * @param aboutToShow true iof the page returned will be shown
- * @return the next wizard page
- */
- public IWizardPage getNextPage(IWizardPage page, boolean aboutToShow);
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizard.java
deleted file mode 100644
index 6d455b898..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizard.java
+++ /dev/null
@@ -1,428 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSStatus;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-/**
- * A wizard for changing the keyword substitution mode of files.
- *
- * 1. Ask the user select to select the desired keyword substitution mode.
- * 2. Compute the set of possibly affected resources
- * 3. If the affected resources include existing committed files, warn the user
- * and provide an option to include them in the operation anyways.
- * 4. If the affected resources include dirty files, warn the user and provide
- * an option to include them in the operation anyways.
- * 5. Perform the operation on Finish.
- */
-public class KSubstWizard extends Wizard {
- private KSubstOption defaultKSubst;
-
- private final IResource[] resources;
- private final int depth;
- private List changeList = null;
- private KSubstOption changeOption = null;
-
- private KSubstWizardSelectionPage mainPage;
- private KSubstWizardSummaryPage summaryPage;
- private KSubstWizardSharedFilesPage sharedFilesPage;
- private KSubstWizardDirtyFilesPage dirtyFilesPage;
-
- private Dialog parentDialog;
-
- private KSubstWizardCommitCommentPage commitCommentPage;
-
- public class KSubstChangeElement {
- public static final int ADDED_FILE = 1;
- public static final int CHANGED_FILE = 2;
- public static final int UNCHANGED_FILE = 4;
-
- private IFile file;
- private int classification;
- private boolean excluded;
- private KSubstOption fromKSubst;
- private KSubstOption toKSubst;
-
- private KSubstChangeElement(IFile file, int classification, boolean excluded, KSubstOption fromKSubst, KSubstOption toKSubst) {
- this.file = file;
- this.classification = classification;
- this.excluded = excluded;
- this.fromKSubst = fromKSubst;
- this.toKSubst = toKSubst;
- }
- public boolean matchesFilter(int filter) {
- return (classification & filter) != 0;
- }
- public boolean isExcluded() {
- return excluded;
- }
- public void setExcluded(boolean excluded) {
- this.excluded = excluded;
- }
- public boolean isNewKSubstMode() {
- return ! fromKSubst.equals(toKSubst);
- }
- public void setKSubst(KSubstOption toKSubst) {
- this.toKSubst = toKSubst;
- }
- public KSubstOption getKSubst() {
- return toKSubst;
- }
- public IFile getFile() {
- return file;
- }
- }
-
- /**
- * Creates a wizard to set the keyword substitution mode for the specified resources.
- *
- * @param resources the resources to alter
- * @param depth the recursion depth
- * @param defaultOption the keyword substitution option to select by default
- */
- public KSubstWizard(IResource[] resources, int depth, KSubstOption defaultOption) {
- super();
- this.defaultKSubst = defaultOption;
- this.resources = resources;
- this.depth = depth;
- setWindowTitle(Policy.bind("KSubstWizard.title")); //$NON-NLS-1$
- }
-
- /**
- * Returns the keyword substitution option that was selected at the time
- * the Finish button was pressed.
- */
- public KSubstOption getKSubstOption() {
- return defaultKSubst;
- }
-
- public void addPages() {
- ImageDescriptor substImage = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_KEYWORD);
-
- // add main page
- String pageTitle = Policy.bind("KSubstWizardSelectionPage.pageTitle"); //$NON-NLS-1$
- String pageDescription = Policy.bind("KSubstWizardSelectionPage.pageDescription"); //$NON-NLS-1$
- mainPage = new KSubstWizardSelectionPage(pageTitle, pageTitle, substImage, defaultKSubst);
- mainPage.setDescription(pageDescription);
- mainPage.setTitle(pageTitle);
- addPage(mainPage);
-
- // add summary page
- pageTitle = Policy.bind("KSubstWizardSummaryPage.pageTitle"); //$NON-NLS-1$
- pageDescription = Policy.bind("KSubstWizardSummaryPage.pageDescription"); //$NON-NLS-1$
- summaryPage = new KSubstWizardSummaryPage(pageTitle, pageTitle, substImage, false);
- summaryPage.setDescription(pageDescription);
- addPage(summaryPage);
-
- // add shared files warning page
- pageTitle = Policy.bind("KSubstWizardSharedFilesPage.pageTitle"); //$NON-NLS-1$
- pageDescription = Policy.bind("KSubstWizardSharedFilesPage.pageDescription"); //$NON-NLS-1$
- sharedFilesPage = new KSubstWizardSharedFilesPage(pageTitle, pageTitle, substImage, false);
- sharedFilesPage.setDescription(pageDescription);
- addPage(sharedFilesPage);
-
- // add changed files warning page
- pageTitle = Policy.bind("KSubstWizardDirtyFilesPage.pageTitle"); //$NON-NLS-1$
- pageDescription = Policy.bind("KSubstWizardDirtyFilesPage.pageDescription"); //$NON-NLS-1$
- dirtyFilesPage = new KSubstWizardDirtyFilesPage(pageTitle, pageTitle, substImage, false);
- dirtyFilesPage.setDescription(pageDescription);
- addPage(dirtyFilesPage);
-
- // add commit comment page
- pageTitle = Policy.bind("KSubstWizardCommitCommentPage.pageTitle"); //$NON-NLS-1$
- pageDescription = Policy.bind("KSubstWizardCommitCommentPage.pageDescription"); //$NON-NLS-1$
- commitCommentPage = new KSubstWizardCommitCommentPage(parentDialog, pageTitle, pageTitle, substImage, pageDescription);
- addPage(commitCommentPage);
- }
-
- public IWizardPage getNextPage(IWizardPage page) {
- if (page == mainPage) {
- if (prepareSharedFilesPage()) return sharedFilesPage;
- } else if (page == sharedFilesPage) {
- if (sharedFilesPage.includeSharedFiles() && prepareDirtyFilesPage()) return dirtyFilesPage;
- } else if (page == summaryPage) {
- return null;
- }
- prepareSummaryPage();
- if (page != commitCommentPage) return commitCommentPage;
- return summaryPage;
- }
-
- public IWizardPage getPreviousPage(IWizardPage page) {
- if (page == summaryPage) {
- return commitCommentPage;
- } else if (page == commitCommentPage) {
- if (sharedFilesPage.includeSharedFiles() && prepareDirtyFilesPage()) return dirtyFilesPage;
- if (prepareSharedFilesPage()) return sharedFilesPage;
- return mainPage;
- } else if (page == dirtyFilesPage) {
- if (prepareSharedFilesPage()) return sharedFilesPage;
- return mainPage;
- } else if (page == sharedFilesPage) {
- return mainPage;
- }
- return null;
- }
-
- /* (Non-javadoc)
- * Method declared on IWizard.
- */
- public boolean needsProgressMonitor() {
- return true;
- }
-
- /* (Non-javadoc)
- * Method declared on IWizard.
- */
- public boolean needsPreviousAndNextButtons() {
- return true;
- }
-
- /* (Non-javadoc)
- * Method declared on IWizard.
- */
- public boolean performFinish() {
- try {
- if (sharedFilesPage.includeSharedFiles()
- && !MessageDialog.openConfirm(getShell(), null, Policy.bind("KSubstWizardSharedFilesPage.contents"))) { //$NON-NLS-1$
- return false;
- }
- defaultKSubst = mainPage.getKSubstOption();
- final List messages = new ArrayList();
- getContainer().run(false /*fork*/, true /*cancelable*/, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- monitor.beginTask("", 10000); //$NON-NLS-1$
- monitor.setTaskName(Policy.bind("KSubstWizard.working")); //$NON-NLS-1$
- computeChangeList(mainPage.getKSubstOption());
- Map table = getProviderMapping();
-
- int workPerProvider = 10000 / (table.size() + 1);
- monitor.worked(workPerProvider);
- for (Iterator it = table.entrySet().iterator(); it.hasNext();) {
- Map.Entry entry = (Map.Entry) it.next();
- CVSTeamProvider provider = (CVSTeamProvider) entry.getKey();
- Map providerFiles = (Map) entry.getValue();
-
- String comment = commitCommentPage.getComment();
- IStatus status = provider.setKeywordSubstitution(providerFiles, comment,
- Policy.subMonitorFor(monitor, workPerProvider));
- if (status.getCode() != CVSStatus.OK) {
- messages.add(status);
- }
- }
- // Broadcast a decorator change so all interested parties will update their labels.
- // This is done in particular because the syncview will not see this change
- // as a change in state for the resources involved
- CVSUIPlugin.broadcastPropertyChange(new PropertyChangeEvent(this, CVSUIPlugin.P_DECORATORS_CHANGED, null, null));
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- });
- // Check for any status messages and display them
- if ( ! messages.isEmpty()) {
- boolean error = false;
- MultiStatus combinedStatus = new MultiStatus(CVSUIPlugin.ID, 0,
- Policy.bind("KSubstWizard.problemsMessage"), null); //$NON-NLS-1$
- for (int i = 0; i < messages.size(); i++) {
- IStatus status = (IStatus)messages.get(i);
- if (status.getSeverity() == IStatus.ERROR || status.getCode() == CVSStatus.SERVER_ERROR) {
- error = true;
- }
- combinedStatus.merge(status);
- }
- String message = null;
- IStatus statusToDisplay;
- if (combinedStatus.getChildren().length == 1) {
- message = combinedStatus.getMessage();
- statusToDisplay = combinedStatus.getChildren()[0];
- } else {
- statusToDisplay = combinedStatus;
- }
- String title;
- if (error) {
- title = Policy.bind("KSubstWizard.errorTitle"); //$NON-NLS-1$
- } else {
- title = Policy.bind("KSubstWizard.warningTitle"); //$NON-NLS-1$
- }
- CVSUIPlugin.openError(getShell(), title, message, new CVSException(statusToDisplay));
- }
- return true;
- } catch (InterruptedException e1) {
- return true;
- } catch (InvocationTargetException e2) {
- CVSUIPlugin.openError(getShell(), Policy.bind("KSubstWizard.problemsMessage"), null, e2); //$NON-NLS-1$
- return false;
- }
- }
-
- private boolean prepareDirtyFilesPage() {
- BusyIndicator.showWhile(getContainer().getShell().getDisplay(), new Runnable() {
- public void run() {
- computeChangeList(mainPage.getKSubstOption());
- dirtyFilesPage.setChangeList(changeList);
- }
- });
- return ! dirtyFilesPage.isListEmpty();
- }
-
- private boolean prepareSharedFilesPage() {
- BusyIndicator.showWhile(getContainer().getShell().getDisplay(), new Runnable() {
- public void run() {
- computeChangeList(mainPage.getKSubstOption());
- sharedFilesPage.setChangeList(changeList);
- }
- });
- return ! sharedFilesPage.isListEmpty();
- }
-
- private void prepareSummaryPage() {
- BusyIndicator.showWhile(getContainer().getShell().getDisplay(), new Runnable() {
- public void run() {
- computeChangeList(mainPage.getKSubstOption());
- summaryPage.setChangeList(changeList, getFilters());
- }
- });
- }
-
- /**
- * @param ksubst the desired keyword substitution mode, if null chooses for each file:
- * <code>KSubstOption.fromPattern(fileName).isBinary() ? KSUBST_BINARY : KSUBST_TEXT</code>
- */
- private void computeChangeList(final KSubstOption ksubst) {
- if (changeList != null) {
- if (changeOption == ksubst) return;
- changeList.clear();
- } else {
- changeList = new ArrayList();
- }
- changeOption = ksubst;
- // recurse over all specified resources, considering each exactly once
- final Set seen = new HashSet();
- for (int i = 0; i < resources.length; i++) {
- final IResource currentResource = resources[i];
- try {
- currentResource.accept(new IResourceVisitor() {
- public boolean visit(IResource resource) throws CoreException {
- try {
- if (resource.getType() == IResource.FILE && resource.exists() && ! seen.contains(resource)) {
- seen.add(resource);
- IFile file = (IFile) resource;
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor(file);
- if (cvsFile.isManaged()) {
- ResourceSyncInfo info = cvsFile.getSyncInfo();
- // classify the change
- final int classification;
- if (info.isAdded()) {
- classification = KSubstChangeElement.ADDED_FILE;
- } else if (info.isDeleted()) {
- return true;
- } else if (cvsFile.isModified(null)) {
- classification = KSubstChangeElement.CHANGED_FILE;
- } else {
- classification = KSubstChangeElement.UNCHANGED_FILE;
- }
- // determine the to/from substitution modes
- KSubstOption fromKSubst = info.getKeywordMode();
- KSubstOption toKSubst = ksubst;
- if (ksubst == null) {
- toKSubst = KSubstOption.fromFile(file);
- }
- changeList.add(new KSubstChangeElement(file, classification, false, fromKSubst, toKSubst));
- }
- }
- } catch (TeamException e) {
- throw new CoreException(e.getStatus());
- }
- // always return true and let the depth determine if children are visited
- return true;
- }
- }, depth, false);
- } catch (CoreException e) {
- CVSUIPlugin.openError(getShell(), Policy.bind("KSubstWizard.problemsMessage"), null, e); //$NON-NLS-1$
- }
- }
- }
-
- private int getFilters() {
- return KSubstChangeElement.ADDED_FILE |
- (sharedFilesPage.includeSharedFiles() ? KSubstChangeElement.UNCHANGED_FILE |
- (dirtyFilesPage.includeDirtyFiles() ? KSubstChangeElement.CHANGED_FILE : 0) : 0);
- }
-
- private Map getProviderMapping() {
- Map table = new HashMap();
- int filter = getFilters();
- for (Iterator it = changeList.iterator(); it.hasNext();) {
- KSubstChangeElement change = (KSubstChangeElement) it.next();
- if (! change.isExcluded() && change.isNewKSubstMode() && change.matchesFilter(filter)) {
- // classify file according to its provider
- IFile file = change.getFile();
- RepositoryProvider provider = RepositoryProvider.getProvider(file.getProject(), CVSProviderPlugin.getTypeId());
- Map providerMap = (Map) table.get(provider);
- if (providerMap == null) {
- providerMap = new HashMap();
- table.put(provider, providerMap);
- }
- providerMap.put(file, change.toKSubst);
- }
- }
- return table;
- }
-
- /**
- * Method setParentDialog.
- * @param dialog
- */
- public void setParentDialog(Dialog dialog) {
- this.parentDialog = dialog;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardCommitCommentPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardCommitCommentPage.java
deleted file mode 100644
index d9bbe10e8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardCommitCommentPage.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.internal.ccvs.ui.CommitCommentArea;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-public class KSubstWizardCommitCommentPage extends CVSWizardPage {
-
- private CommitCommentArea commitCommentArea;
-
- /**
- * Constructor for KSubstWizardCommitCommentPage.
- * @param pageName
- * @param title
- * @param titleImage
- * @param description
- */
- public KSubstWizardCommitCommentPage(
- Dialog parentDialog,
- String pageName,
- String title,
- ImageDescriptor titleImage,
- String description) {
-
- super(pageName, title, titleImage, description);
- commitCommentArea = new CommitCommentArea();
- }
-
- /**
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- Composite top = new Composite(parent, SWT.NONE);
- top.setLayout(new GridLayout());
- setControl(top);
- // set F1 help
- WorkbenchHelp.setHelp(top, IHelpContextIds.KEYWORD_SUBSTITUTION_COMMIT_COMMENT_PAGE);
- commitCommentArea.createArea(top);
- Dialog.applyDialogFont(parent);
- }
-
- /**
- * Method getComment.
- * @return String
- */
- public String getComment() {
- return commitCommentArea.getComment();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean)
- */
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible) {
- commitCommentArea.setFocus();
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardDirtyFilesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardDirtyFilesPage.java
deleted file mode 100644
index 7df0ba1e6..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardDirtyFilesPage.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.swt.SWT;
-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.Listener;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.wizards.KSubstWizard.KSubstChangeElement;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Page to warn user about uncommitted outgoing changes.
- */
-public class KSubstWizardDirtyFilesPage extends CVSWizardPage {
- private boolean includeDirtyFiles;
- private Button includeDirtyFilesButton;
- private ListViewer listViewer;
-
- public KSubstWizardDirtyFilesPage(String pageName, String title, ImageDescriptor image, boolean includeDirtyFiles) {
- super(pageName, title, image);
- this.includeDirtyFiles = includeDirtyFiles;
- }
-
- public void createControl(Composite parent) {
- Composite top = new Composite(parent, SWT.NONE);
- top.setLayout(new GridLayout());
- setControl(top);
-
- // set F1 help
- WorkbenchHelp.setHelp(top, IHelpContextIds.KEYWORD_SUBSTITUTION_CHANGED_PAGE);
-
- createWrappingLabel(top, Policy.bind("KSubstWizardDirtyFilesPage.contents"), 0); //$NON-NLS-1$
-
- includeDirtyFilesButton = new Button(top, SWT.CHECK);
- includeDirtyFilesButton.setText(Policy.bind("KSubstWizardDirtyFilesPage.includeDirtyFiles")); //$NON-NLS-1$
- includeDirtyFilesButton.setSelection(includeDirtyFiles);
- includeDirtyFilesButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- includeDirtyFiles = includeDirtyFilesButton.getSelection();
- }
- });
-
- createSeparator(top, SPACER_HEIGHT);
- listViewer = createFileListViewer(top,
- Policy.bind("KSubstWizardDirtyFilesPage.dirtyFilesViewer.title"), LIST_HEIGHT_HINT); //$NON-NLS-1$
- Dialog.applyDialogFont(parent);
- }
-
- public boolean includeDirtyFiles() {
- return includeDirtyFiles;
- }
-
- public void setChangeList(List changes) {
- List filteredFiles = new ArrayList();
- for (Iterator it = changes.iterator(); it.hasNext();) {
- KSubstChangeElement change = (KSubstChangeElement) it.next();
- if (change.matchesFilter(KSubstChangeElement.CHANGED_FILE)) {
- filteredFiles.add(change.getFile());
- }
- }
- listViewer.setInput(filteredFiles.toArray());
- }
-
- public boolean isListEmpty() {
- // returns true iff the list is empty after filtering
- return listViewer.getList().getItemCount() == 0;
- }
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible) {
- includeDirtyFilesButton.setFocus();
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardSelectionPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardSelectionPage.java
deleted file mode 100644
index 4fec08d51..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardSelectionPage.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-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.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Page to select keyword substitution mode.
- */
-public class KSubstWizardSelectionPage extends CVSWizardPage {
- private KSubstOption ksubst;
- private List ksubstOptions;
- private Button automaticRadioButton;
- private Button binaryRadioButton;
- private Button textRadioButton;
- private Button ksubstRadioButton;
- private Combo ksubstOptionCombo;
-
- public KSubstWizardSelectionPage(String pageName, String title, ImageDescriptor image, KSubstOption defaultKSubst) {
- super(pageName, title, image);
- this.ksubst = defaultKSubst;
-
- // sort the options by display text
- KSubstOption[] options = KSubstOption.getAllKSubstOptions();
- this.ksubstOptions = new ArrayList();
- for (int i = 0; i < options.length; i++) {
- KSubstOption option = options[i];
- if (! (Command.KSUBST_BINARY.equals(option) ||
- Command.KSUBST_TEXT.equals(option))) {
- ksubstOptions.add(option);
- }
- }
- Collections.sort(ksubstOptions, new Comparator() {
- public int compare(Object a, Object b) {
- String aKey = ((KSubstOption) a).getLongDisplayText();
- String bKey = ((KSubstOption) b).getLongDisplayText();
- return aKey.compareTo(bKey);
- }
- });
- }
-
- public void createControl(Composite parent) {
- Composite top = new Composite(parent, SWT.NONE);
- top.setLayout(new GridLayout());
- setControl(top);
-
- // set F1 help
- WorkbenchHelp.setHelp(top, IHelpContextIds.KEYWORD_SUBSTITUTION_SELECTION_PAGE);
-
- Listener selectionListener = new Listener() {
- public void handleEvent(Event event) {
- updateEnablements();
- }
- };
-
- // Automatic
- automaticRadioButton = createRadioButton(top, Policy.bind("KSubstWizardSelectionPage.automaticButton"), 1); //$NON-NLS-1$
- automaticRadioButton.addListener(SWT.Selection, selectionListener);
- automaticRadioButton.setSelection(ksubst == null);
- createWrappingLabel(top, Policy.bind("KSubstWizardSelectionPage.automaticLabel", //$NON-NLS-1$
- Command.KSUBST_BINARY.getLongDisplayText(),
- CVSProviderPlugin.getPlugin().getDefaultTextKSubstOption().getLongDisplayText()),
- LABEL_INDENT_WIDTH);
-
- // Binary
- binaryRadioButton = createRadioButton(top, Policy.bind("KSubstWizardSelectionPage.binaryButton"), 1); //$NON-NLS-1$
- binaryRadioButton.addListener(SWT.Selection, selectionListener);
- binaryRadioButton.setSelection(Command.KSUBST_BINARY.equals(ksubst));
- createIndentedLabel(top, Policy.bind("KSubstWizardSelectionPage.binaryLabel"), LABEL_INDENT_WIDTH); //$NON-NLS-1$
-
- // Text without keyword substitution
- textRadioButton = createRadioButton(top, Policy.bind("KSubstWizardSelectionPage.textButton"), 1); //$NON-NLS-1$
- textRadioButton.addListener(SWT.Selection, selectionListener);
- textRadioButton.setSelection(Command.KSUBST_TEXT.equals(ksubst));
- createIndentedLabel(top, Policy.bind("KSubstWizardSelectionPage.textLabel"), LABEL_INDENT_WIDTH); //$NON-NLS-1$
-
- // Text with keyword substitution
- ksubstRadioButton = createRadioButton(top, Policy.bind("KSubstWizardSelectionPage.textWithSubstitutionsButton"), 1); //$NON-NLS-1$
- ksubstRadioButton.addListener(SWT.Selection, selectionListener);
- ksubstRadioButton.setSelection(false);
- createIndentedLabel(top, Policy.bind("KSubstWizardSelectionPage.textWithSubstitutionsLabel"), LABEL_INDENT_WIDTH); //$NON-NLS-1$
-
- ksubstOptionCombo = new Combo(top, SWT.READ_ONLY);
- ksubstOptionCombo.addListener(SWT.Selection, selectionListener);
- GridData data = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_BEGINNING);
- data.horizontalIndent = LABEL_INDENT_WIDTH;
- ksubstOptionCombo.setLayoutData(data);
-
- // populate the combo box and select the default option
- for (int i = 0; i < ksubstOptions.size(); ++i) {
- KSubstOption option = (KSubstOption) ksubstOptions.get(i);
- ksubstOptionCombo.add(option.getLongDisplayText());
- if (option.equals(ksubst)) {
- ksubstOptionCombo.select(i);
- ksubstRadioButton.setSelection(true);
- } else if (option.equals(Command.KSUBST_TEXT_EXPAND)) {
- // if no expansion mode selected, show KSUBST_TEXT_EXPAND
- // since it is the server default
- if (! ksubstRadioButton.getSelection()) ksubstOptionCombo.select(i);
- }
- }
- updateEnablements();
- Dialog.applyDialogFont(parent);
- }
-
- /**
- * Enable and disable controls based on the selected radio button.
- */
- protected void updateEnablements() {
- if (ksubstRadioButton.getSelection()) {
- ksubstOptionCombo.setEnabled(true);
- ksubst = (KSubstOption) ksubstOptions.get(ksubstOptionCombo.getSelectionIndex());
- } else {
- ksubstOptionCombo.setEnabled(false);
- if (automaticRadioButton.getSelection()) {
- ksubst = null;
- } else if (binaryRadioButton.getSelection()) {
- ksubst = Command.KSUBST_BINARY;
- } else if (textRadioButton.getSelection()) {
- ksubst = Command.KSUBST_TEXT;
- }
- }
- }
-
- public KSubstOption getKSubstOption() {
- return ksubst;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardSharedFilesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardSharedFilesPage.java
deleted file mode 100644
index de8f0e67a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardSharedFilesPage.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.swt.SWT;
-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.Listener;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.wizards.KSubstWizard.KSubstChangeElement;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Page to warn user about the side-effects of changing keyword
- * substitution on already committed files.
- */
-public class KSubstWizardSharedFilesPage extends CVSWizardPage {
- private boolean includeSharedFiles;
- private Button includeSharedFilesButton;
- private ListViewer listViewer;
-
- public KSubstWizardSharedFilesPage(String pageName, String title, ImageDescriptor image, boolean includeSharedFiles) {
- super(pageName, title, image);
- this.includeSharedFiles = includeSharedFiles;
- }
-
- public void createControl(Composite parent) {
- Composite top = new Composite(parent, SWT.NONE);
- top.setLayout(new GridLayout());
- setControl(top);
- createWrappingLabel(top, Policy.bind("KSubstWizardSharedFilesPage.contents"), 0); //$NON-NLS-1$
-
- // set F1 help
- WorkbenchHelp.setHelp(top, IHelpContextIds.KEYWORD_SUBSTITUTION_SHARED_PAGE);
-
- includeSharedFilesButton = new Button(top, SWT.CHECK);
- includeSharedFilesButton.setText(Policy.bind("KSubstWizardSharedFilesPage.includeSharedFiles")); //$NON-NLS-1$
- includeSharedFilesButton.setSelection(includeSharedFiles);
- includeSharedFilesButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- includeSharedFiles = includeSharedFilesButton.getSelection();
- }
- });
-
- createSeparator(top, SPACER_HEIGHT);
- listViewer = createFileListViewer(top,
- Policy.bind("KSubstWizardSharedFilesPage.sharedFilesViewer.title"), LIST_HEIGHT_HINT); //$NON-NLS-1$
- Dialog.applyDialogFont(parent);
- }
-
- public boolean includeSharedFiles() {
- return includeSharedFiles;
- }
-
- public void setChangeList(List changes) {
- List filteredFiles = new ArrayList();
- for (Iterator it = changes.iterator(); it.hasNext();) {
- KSubstChangeElement change = (KSubstChangeElement) it.next();
- if (change.matchesFilter(KSubstChangeElement.CHANGED_FILE | KSubstChangeElement.UNCHANGED_FILE)) {
- filteredFiles.add(change.getFile());
- }
- }
- listViewer.setInput(filteredFiles.toArray());
- }
-
- public boolean isListEmpty() {
- // returns true iff the list is empty after filtering
- return listViewer.getList().getItemCount() == 0;
- }
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible) {
- includeSharedFilesButton.setFocus();
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardSummaryPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardSummaryPage.java
deleted file mode 100644
index 7322eaaf1..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardSummaryPage.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ComboBoxCellEditor;
-import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.custom.TableEditor;
-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.Listener;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.wizards.KSubstWizard.KSubstChangeElement;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.model.WorkbenchViewerSorter;
-
-public class KSubstWizardSummaryPage extends CVSWizardPage {
- private CheckboxTableViewer tableViewer = null;
- private KSubstOption[] ksubstOptions;
- private String[] ksubstOptionsDisplayText;
- private int filterType;
-
- private Button showUnaffectedFilesButton;
- private boolean showUnaffectedFiles;
-
- public KSubstWizardSummaryPage(String pageName, String title, ImageDescriptor image, boolean showUnaffectedFiles) {
- super(pageName, title, image);
- this.showUnaffectedFiles = showUnaffectedFiles;
-
- // sort the options by display text
- ksubstOptions = KSubstOption.getAllKSubstOptions();
- ksubstOptionsDisplayText = new String[ksubstOptions.length];
- Arrays.sort(ksubstOptions, new Comparator() {
- public int compare(Object a, Object b) {
- String aKey = getModeDisplayText((KSubstOption) a);
- String bKey = getModeDisplayText((KSubstOption) b);
- return aKey.compareTo(bKey);
- }
- });
- for (int i = 0; i < ksubstOptions.length; i++) {
- ksubstOptionsDisplayText[i] = getModeDisplayText(ksubstOptions[i]);
- }
- }
-
- public void createControl(Composite parent) {
- Composite top = new Composite(parent, SWT.NONE);
- top.setLayout(new GridLayout());
- setControl(top);
- createWrappingLabel(top, Policy.bind("KSubstWizardSummaryPage.contents"), 0); //$NON-NLS-1$
-
- // set F1 help
- WorkbenchHelp.setHelp(top, IHelpContextIds.KEYWORD_SUBSTITUTION_SUMMARY_PAGE);
-
- createSeparator(top, 0);
-
- showUnaffectedFilesButton = new Button(top, SWT.CHECK);
- showUnaffectedFilesButton.setText(Policy.bind("KSubstWizardSummaryPage.showUnaffectedFiles")); //$NON-NLS-1$
- showUnaffectedFilesButton.setSelection(showUnaffectedFiles);
- showUnaffectedFilesButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- BusyIndicator.showWhile(getContainer().getShell().getDisplay(), new Runnable() {
- public void run() {
- showUnaffectedFiles = showUnaffectedFilesButton.getSelection();
- refresh(false);
- }
- });
- }
- });
-
- tableViewer = createFileTableViewer(top,
- Policy.bind("KSubstWizardSummaryPage.summaryViewer.title"), //$NON-NLS-1$
- Policy.bind("KSubstWizardSummaryPage.summaryViewer.fileHeader"), //$NON-NLS-1$
- Policy.bind("KSubstWizardSummaryPage.summaryViewer.ksubstHeader"), //$NON-NLS-1$
- LIST_HEIGHT_HINT);
- Dialog.applyDialogFont(parent);
- }
-
- /**
- * Creates a TableViewer whose input is a Map from IFile to KSubstOption.
- *
- * @param parent the parent of the viewer
- * @param title the text for the title label
- * @param heightHint the nominal height of the list
- * @return the created list viewer
- */
- public CheckboxTableViewer createFileTableViewer(Composite parent, String title,
- String fileHeader, String ksubstHeader, int heightHint) {
- createLabel(parent, title);
- // create a table
- Table table = new Table(parent, SWT.CHECK | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = heightHint;
- table.setLayoutData(data);
- table.setLinesVisible(true);
- table.setHeaderVisible(true);
-
- // add the columns
- TableColumn column = new TableColumn(table, SWT.LEFT);
- column.setText(fileHeader);
- column = new TableColumn(table, SWT.LEFT);
- column.setText(ksubstHeader);
- TableLayout tableLayout = new TableLayout();
- table.setLayout(tableLayout);
- tableLayout.addColumnData(new ColumnWeightData(1, true));
- tableLayout.addColumnData(new ColumnWeightData(1, true));
-
- // create a viewer for the table
- final CheckboxTableViewer tableViewer = new CheckboxTableViewer(table);
- tableViewer.setContentProvider(new IStructuredContentProvider() {
- public Object[] getElements(Object inputElement) {
- return (Object[]) inputElement;
- }
- public void dispose() {
- }
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- });
-
- // show file name and keyword substitution mode
- tableViewer.setLabelProvider(new ITableLabelProvider() {
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
- public String getColumnText(Object element, int columnIndex) {
- KSubstChangeElement change = (KSubstChangeElement) element;
- if (columnIndex == 0) {
- return change.getFile().getFullPath().toString();
- } else if (columnIndex == 1) {
- return getModeDisplayText(change.getKSubst());
- }
- return null;
- }
- public void addListener(ILabelProviderListener listener) {
- }
- public void dispose() {
- }
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
- public void removeListener(ILabelProviderListener listener) {
- }
- });
-
- // sort by file name
- tableViewer.setSorter(new WorkbenchViewerSorter() {
- public int compare(Viewer viewer, Object e1, Object e2) {
- IFile file1 = ((KSubstChangeElement) e1).getFile();
- IFile file2 = ((KSubstChangeElement) e2).getFile();
- return super.compare(viewer, file1, file2);
- }
- });
-
- // filter
- tableViewer.addFilter(new ViewerFilter() {
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- KSubstChangeElement change = (KSubstChangeElement) element;
- return ( showUnaffectedFiles || change.isNewKSubstMode()) && change.matchesFilter(filterType);
- }
- });
-
- // add a check state listener
- tableViewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- KSubstChangeElement change = (KSubstChangeElement) event.getElement();
- if (tableViewer.getGrayed(change)) {
- // if it's grayed then give it the appearance of being disabled
- updateCheckStatus(change);
- } else {
- // otherwise record the change
- change.setExcluded(! event.getChecked());
- }
- }
- });
-
- // add a cell editor in the Keyword Substitution Mode column
- new TableEditor(table);
- CellEditor cellEditor = new ComboBoxCellEditor(table, ksubstOptionsDisplayText);
- tableViewer.setCellEditors(new CellEditor[] { null, cellEditor });
- tableViewer.setColumnProperties(new String[] { "file", "mode" }); //$NON-NLS-1$ //$NON-NLS-2$
- tableViewer.setCellModifier(new ICellModifier() {
- public Object getValue(Object element, String property) {
- KSubstChangeElement change = (KSubstChangeElement) element;
- KSubstOption option = change.getKSubst();
- for (int i = 0; i < ksubstOptions.length; ++i) {
- if (ksubstOptions[i].equals(option)) return new Integer(i);
- }
- // XXX need to handle this better
- return null;
- }
- public boolean canModify(Object element, String property) {
- return true;
- }
- public void modify(Object element, String property, Object value) {
- // XXX The runtime type of 'element' seems to be a TableItem instead of the
- // actual element data as with the other methods. As a workaround, use
- // the table's selection mechanism instead.
- IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
- element = selection.getFirstElement();
- int index = ((Integer) value).intValue();
- // selection will be -1 if some arbitrary text was entered since the combo box is not read only
- if (index != -1) {
- KSubstChangeElement change = (KSubstChangeElement) element;
- KSubstOption newOption = ksubstOptions[index];
- if (! newOption.equals(change.getKSubst())) {
- // the option has been changed, include it by default now if it wasn't before
- // since the user has shown interest in it
- change.setKSubst(newOption);
- change.setExcluded(false);
- tableViewer.refresh(change, true /*updateLabels*/);
- updateCheckStatus(change);
- }
- }
- }
- });
- return tableViewer;
- }
-
- public void setChangeList(List changes, int filterType) {
- this.filterType = filterType;
- tableViewer.setInput(changes.toArray());
- refresh(true);
- }
-
- private void refresh(boolean updateLabels) {
- tableViewer.refresh(updateLabels);
- Object[] elements = (Object[]) tableViewer.getInput();
- for (int i = 0; i < elements.length; i++) {
- KSubstChangeElement change = (KSubstChangeElement) elements[i];
- updateCheckStatus(change);
- }
- }
-
- private void updateCheckStatus(KSubstChangeElement change) {
- if (change.isNewKSubstMode()) {
- // if the mode differs, the checkbox indicates the inclusion/exclusion status
- tableViewer.setGrayed(change, false);
- tableViewer.setChecked(change, ! change.isExcluded());
- } else {
- // otherwise, the checkbox is meaningless except to indicate that the file will not be changed
- tableViewer.setGrayed(change, true);
- tableViewer.setChecked(change, false);
- }
- }
-
- private String getModeDisplayText(KSubstOption option) {
- return option.getLongDisplayText();
- }
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible) {
- showUnaffectedFilesButton.setFocus();
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java
deleted file mode 100644
index e7e527a57..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.team.internal.ccvs.core.CVSMergeSubscriber;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Update;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.operations.UpdateOperation;
-import org.eclipse.team.internal.ccvs.ui.subscriber.MergeSynchronizeParticipant;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class MergeWizard extends Wizard {
- MergeWizardPage page;
- IResource[] resources;
- private final IWorkbenchPart part;
-
- public MergeWizard(IWorkbenchPart part, IResource[] resources) {
- this.part = part;
- this.resources = resources;
- }
-
- public void addPages() {
- setNeedsProgressMonitor(true);
- TagSource tagSource = TagSource.create(resources);
- setWindowTitle(Policy.bind("MergeWizard.title")); //$NON-NLS-1$
- ImageDescriptor mergeImage = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_MERGE);
- page = new MergeWizardPage("mergePage", Policy.bind("MergeWizard.0"), mergeImage, Policy.bind("MergeWizard.1"), tagSource); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- addPage(page);
- }
-
- /*
- * @see IWizard#performFinish()
- */
- public boolean performFinish() {
-
- CVSTag startTag = page.getStartTag();
- CVSTag endTag = page.getEndTag();
-
- if (startTag == null || !page.isPreview()) {
- // Perform the update (merge) in the background
- UpdateOperation op = new UpdateOperation(getPart(), resources, getLocalOptions(startTag, endTag), null);
- try {
- op.run();
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(getShell(), null, null, e);
- } catch (InterruptedException e) {
- // Ignore
- }
- } else {
- // First check if there is an existing matching participant, if so then re-use it
- MergeSynchronizeParticipant participant = MergeSynchronizeParticipant.getMatchingParticipant(resources, startTag, endTag);
- if(participant == null) {
- CVSMergeSubscriber s = new CVSMergeSubscriber(resources, startTag, endTag);
- participant = new MergeSynchronizeParticipant(s);
- TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[] {participant});
- }
- participant.refresh(resources, null, null, null);
- }
- return true;
- }
-
- private Command.LocalOption[] getLocalOptions(CVSTag startTag, CVSTag endTag) {
- List options = new ArrayList();
- if (startTag != null) {
- options.add(Command.makeArgumentOption(Update.JOIN, startTag.getName()));
- }
- options.add(Command.makeArgumentOption(Update.JOIN, endTag.getName()));
- return (Command.LocalOption[]) options.toArray(new Command.LocalOption[options.size()]);
- }
-
- private IWorkbenchPart getPart() {
- return part;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizardPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizardPage.java
deleted file mode 100644
index c10125b69..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizardPage.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.tags.*;
-
-public class MergeWizardPage extends CVSWizardPage {
-
- private Text endTagField;
- private Button endTagBrowseButton;
- private TagSource tagSource;
- private Text startTagField;
- private Button startTagBrowseButton;
- private TagRefreshButtonArea tagRefreshArea;
- private CVSTag startTag;
- private CVSTag endTag;
- private Button previewButton;
- private Button noPreviewButton;
- protected boolean preview = true;
-
- public MergeWizardPage(String pageName, String title, ImageDescriptor titleImage, String description, TagSource tagSource) {
- super(pageName, title, titleImage, description);
- this.tagSource = tagSource;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- Composite composite = createComposite(parent, 1, true);
-
- Composite mainArea = createComposite(composite, 2, true);
- createEndTagArea(mainArea);
- createStartTagArea(mainArea);
- createPreviewOptionArea(mainArea);
-
- createTagRefreshArea(composite);
-
- Dialog.applyDialogFont(composite);
- setControl(composite);
- }
-
- private void createPreviewOptionArea(Composite mainArea) {
- previewButton = createRadioButton(mainArea, Policy.bind("MergeWizardPage.0"), 2); //$NON-NLS-1$
- noPreviewButton = createRadioButton(mainArea, Policy.bind("MergeWizardPage.1"), 2); //$NON-NLS-1$
- SelectionAdapter selectionAdapter = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- preview = previewButton.getSelection();
- updateEnablements();
- }
- };
- previewButton.setSelection(preview);
- noPreviewButton.setSelection(!preview);
- previewButton.addSelectionListener(selectionAdapter);
- noPreviewButton.addSelectionListener(selectionAdapter);
- }
-
- private void createTagRefreshArea(Composite parent) {
- tagRefreshArea = new TagRefreshButtonArea(getShell(), getTagSource());
- tagRefreshArea.setRunnableContext(getContainer());
- tagRefreshArea.createArea(parent);
- }
-
- private void createEndTagArea(Composite parent) {
- createWrappingLabel(parent, Policy.bind("MergeWizardPage.2"), 0, 2); //$NON-NLS-1$
- endTagField = createTextField(parent);
- endTagField.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- updateEndTag(endTagField.getText());
- }
- });
- final int endTagIncludeFlags = TagSelectionArea.INCLUDE_VERSIONS | TagSelectionArea.INCLUDE_BRANCHES | TagSelectionArea.INCLUDE_HEAD_TAG;
- TagContentAssistProcessor.createContentAssistant(endTagField, tagSource, endTagIncludeFlags);
- endTagBrowseButton = createPushButton(parent, Policy.bind("MergeWizardPage.3")); //$NON-NLS-1$
- endTagBrowseButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TagSelectionDialog dialog = new TagSelectionDialog(getShell(), getTagSource(),
- Policy.bind("MergeWizardPage.4"), //$NON-NLS-1$
- Policy.bind("MergeWizardPage.5"), //$NON-NLS-1$
- endTagIncludeFlags,
- false, IHelpContextIds.MERGE_END_PAGE);
- if (dialog.open() == Dialog.OK) {
- CVSTag selectedTag = dialog.getResult();
- setEndTag(selectedTag);
- }
- }
- });
- }
-
- private void createStartTagArea(Composite parent) {
- createWrappingLabel(parent, Policy.bind("MergeWizardPage.6"), 0, 2); //$NON-NLS-1$
- startTagField = createTextField(parent);
- startTagField.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- updateStartTag(startTagField.getText());
- }
- });
- TagContentAssistProcessor.createContentAssistant(startTagField, tagSource, TagSelectionArea.INCLUDE_VERSIONS);
- startTagBrowseButton = createPushButton(parent, Policy.bind("MergeWizardPage.7")); //$NON-NLS-1$
- startTagBrowseButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TagSelectionDialog dialog = new TagSelectionDialog(getShell(), getTagSource(),
- Policy.bind("MergeWizardPage.8"), //$NON-NLS-1$
- Policy.bind("MergeWizardPage.9"), //$NON-NLS-1$
- TagSelectionDialog.INCLUDE_VERSIONS,
- false, IHelpContextIds.MERGE_START_PAGE);
- if (dialog.open() == Dialog.OK) {
- CVSTag selectedTag = dialog.getResult();
- setStartTag(selectedTag);
- }
- }
- });
- }
-
- protected void updateEndTag(String text) {
- if (endTag == null || !endTag.getName().equals(text)) {
- CVSTag tag = getTagFor(text, false);
- setEndTag(tag);
- }
- updateEnablements();
- }
-
- protected void updateStartTag(String text) {
- if (startTag == null || !startTag.getName().equals(text)) {
- CVSTag tag = getTagFor(text, true);
- setStartTag(tag);
- }
- updateEnablements();
- }
-
- private CVSTag getTagFor(String text, boolean versionsOnly) {
- if (text.equals(CVSTag.DEFAULT.getName())) {
- if (versionsOnly) return null;
- return CVSTag.DEFAULT;
- }
- if (text.equals(CVSTag.BASE.getName())) {
- if (versionsOnly) return null;
- return CVSTag.BASE;
- }
- CVSTag[] tags;
- if (versionsOnly) {
- tags = tagSource.getTags(new int[] { CVSTag.VERSION, CVSTag.DATE });
- } else {
- tags = tagSource.getTags(new int[] { CVSTag.VERSION, CVSTag.BRANCH, CVSTag.DATE });
- }
- for (int i = 0; i < tags.length; i++) {
- CVSTag tag = tags[i];
- if (tag.getName().equals(text)) {
- return tag;
- }
- }
- return null;
- }
-
- protected void setEndTag(CVSTag selectedTag) {
- if (selectedTag == null || endTag == null || !endTag.equals(selectedTag)) {
- endTag = selectedTag;
- if (endTagField != null) {
- String name = endTagField.getText();
- if (endTag != null)
- name = endTag.getName();
- if (!endTagField.getText().equals(name))
- endTagField.setText(name);
- if (startTag == null && endTag != null && endTag.getType() == CVSTag.BRANCH) {
- CVSTag tag = findCommonBaseTag(endTag);
- if (tag != null) {
- setStartTag(tag);
- }
- }
- }
- updateEnablements();
- }
- }
-
- protected void setStartTag(CVSTag selectedTag) {
- if (selectedTag == null || startTag != null || !endTag.equals(selectedTag)) {
- startTag = selectedTag;
- if (startTagField != null) {
- String name = startTagField.getText();
- if (startTag != null)
- name = startTag.getName();
- if (!startTagField.getText().equals(name))
- startTagField.setText(name);
- }
- updateEnablements();
- }
- }
-
- private CVSTag findCommonBaseTag(CVSTag tag) {
- CVSTag[] tags = tagSource.getTags(CVSTag.VERSION);
- for (int i = 0; i < tags.length; i++) {
- CVSTag potentialMatch = tags[i];
- if (potentialMatch.getName().indexOf(tag.getName()) != -1) {
- return potentialMatch;
- }
- }
- return null;
- }
-
- private void updateEnablements() {
- if (endTag == null && endTagField.getText().length() > 0) {
- setErrorMessage(Policy.bind("MergeWizardPage.10")); //$NON-NLS-1$
- } else if (startTag == null && startTagField.getText().length() > 0) {
- setErrorMessage(Policy.bind("MergeWizardPage.11")); //$NON-NLS-1$
- } else if (endTag != null && startTag != null && startTag.equals(endTag)) {
- setErrorMessage(Policy.bind("MergeWizardPage.12")); //$NON-NLS-1$
- } else if (startTag == null && endTag != null && preview) {
- setErrorMessage(Policy.bind("MergeWizardPage.13")); //$NON-NLS-1$
- } else {
- setErrorMessage(null);
- }
- setPageComplete((startTag != null || !preview) && endTag != null && (startTag == null || !startTag.equals(endTag)));
- }
-
- protected TagSource getTagSource() {
- return tagSource;
- }
-
- private Button createPushButton(Composite parent, String label) {
- Button b = new Button(parent, SWT.PUSH);
- b.setText(label);
- b.setLayoutData(new GridData(GridData.END | GridData.HORIZONTAL_ALIGN_FILL));
- return b;
- }
-
- public CVSTag getStartTag() {
- return startTag;
- }
-
- public CVSTag getEndTag() {
- return endTag;
- }
-
- public boolean isPreview() {
- return preview;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModuleSelectionPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModuleSelectionPage.java
deleted file mode 100644
index 7df778ff7..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModuleSelectionPage.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.model.RemoteContentProvider;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositorySorter;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-public class ModuleSelectionPage extends CVSWizardPage {
- Button useProjectNameButton;
- Button useSpecifiedNameButton;
- private Button selectModuleButton;
- Text text;
- TreeViewer moduleList;
-
- String moduleName;
-
- // The project being associated with the remote module (or null)
- private IProject project;
- private ICVSRepositoryLocation location;
- private boolean badLocation = false;
- private String helpContextId;
- private boolean supportsMultiSelection;
-
- private boolean isFetchingModules = false;
- private Object fetchingModulesLock = new Object();
-
- public ModuleSelectionPage(String pageName, String title, ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- }
-
- public void setHelpContxtId(String helpContextId) {
- this.helpContextId = helpContextId;
- }
-
- public void createControl(Composite parent) {
- Composite composite = createComposite(parent, 2, false);
-
- if (helpContextId != null)
- WorkbenchHelp.setHelp(composite, helpContextId);
-
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- updateEnablements(false);
- }
- };
-
- if (project != null) {
- useProjectNameButton = createRadioButton(composite, Policy.bind("ModuleSelectionPage.moduleIsProject"), 2); //$NON-NLS-1$
- useProjectNameButton.addListener(SWT.Selection, listener);
- }
- useSpecifiedNameButton = createRadioButton(composite, Policy.bind("ModuleSelectionPage.specifyModule"), 1); //$NON-NLS-1$
- useSpecifiedNameButton.addListener(SWT.Selection, listener);
-
- text = createTextField(composite);
- text.addListener(SWT.Modify, listener);
-
- selectModuleButton = createRadioButton(composite, Policy.bind("ModuleSelectionPage.2"), 2); //$NON-NLS-1$
- selectModuleButton.addListener(SWT.Selection, listener);
- moduleList = createModuleTree(composite, 2);
-
- // Set the initial enablement
- if (useProjectNameButton != null) {
- useProjectNameButton.setSelection(true);
- useSpecifiedNameButton.setSelection(false);
- } else {
- useSpecifiedNameButton.setSelection(true);
- }
- selectModuleButton.setSelection(false);
- updateEnablements(false);
- setControl(composite);
- Dialog.applyDialogFont(parent);
- }
-
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible) {
- if (useProjectNameButton != null && useProjectNameButton.getSelection()) {
- useProjectNameButton.setFocus();
- } else if (useSpecifiedNameButton.getSelection()) {
- text.setFocus();
- } else {
- moduleList.getControl().setFocus();
- }
- }
- }
-
- protected void updateEnablements(boolean updateModulesList) {
- if (useProjectNameButton != null && useProjectNameButton.getSelection()) {
- text.setEnabled(false);
- moduleList.getControl().setEnabled(false);
- moduleName = null;
- setPageComplete(true);
- } else if (useSpecifiedNameButton.getSelection()) {
- text.setEnabled(true);
- moduleList.getControl().setEnabled(false);
- moduleName = text.getText();
- if (moduleName.length() == 0) {
- moduleName = null;
- setPageComplete(false);
- } else {
- setPageComplete(true);
- }
- } else if (!badLocation){
- text.setEnabled(false);
- moduleList.getControl().setEnabled(true);
- moduleName = null;
- if (moduleList.getInput() == null || updateModulesList) {
- boolean fetchModules = false;
- // The input is set after the page is shown to avoid
- // fetching if the user wants to specify the name manually
- try {
- // This can be called from different events in the event loop.
- // Ensure that we only fetch the input once
- synchronized (fetchingModulesLock) {
- if (!isFetchingModules) {
- // This the first thread in so fetch the modules
- fetchModules = true;
- isFetchingModules = true;
- }
- }
- if (fetchModules) {
- // Validate the location first since the module fecthing is
- // done in a deferred fashion
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- location.validateConnection(monitor);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- setModuleListInput();
- }
- } catch (InvocationTargetException e) {
- if (!badLocation) {
- badLocation = true;
- CVSUIPlugin.openError(getShell(), null, null, e);
- // This will null the module list input
- setModuleListInput();
- }
- } catch (InterruptedException e) {
- // Canceled by the user
- } finally {
- synchronized (fetchingModulesLock) {
- if (fetchModules) {
- isFetchingModules = false;
- }
- }
- }
- }
- setPageComplete(internalGetSelectedModules().length > 0);
- }
- }
-
- private ICVSRemoteFolder[] internalGetSelectedModules() {
- if (moduleList != null && moduleList.getControl().isEnabled()) {
- ISelection selection = moduleList.getSelection();
- if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection)selection;
- ArrayList result = new ArrayList();
- for (Iterator iter = ss.iterator(); iter.hasNext();) {
- Object element = iter.next();
- if (element instanceof ICVSRemoteFolder) {
- result.add(element);
- }
-
- }
- return (ICVSRemoteFolder[]) result.toArray(new ICVSRemoteFolder[result.size()]);
- }
- } else {
- ICVSRemoteFolder folder = null;
- if (moduleName != null) {
- folder = internalCreateModuleHandle(moduleName);
- } else {
- if (project != null) {
- folder = internalCreateModuleHandle(project.getName());
- }
- }
- if (folder != null) {
- return new ICVSRemoteFolder[] { folder };
- }
- }
- return new ICVSRemoteFolder[0];
- }
-
- private ICVSRemoteFolder internalCreateModuleHandle(String name) {
- ICVSRepositoryLocation location = getLocation();
- if (location == null) return null;
- return location.getRemoteFolder(name, CVSTag.DEFAULT);
- }
-
- /**
- * Return the selected existing remote folder. If this
- * method returns <code>null</code>, then <code>getModuleName()</code>
- * can be used to get the name entered manually by the use.
- * @return the selected exisiting remote module
- */
- public ICVSRemoteFolder getSelectedModule() {
- ICVSRemoteFolder[] selectedModules = getSelectedModules();
- if (selectedModules.length > 0) {
- return selectedModules[0];
- } else {
- return null;
- }
- }
-
- public ICVSRemoteFolder[] getSelectedModules() {
- final ICVSRemoteFolder[][] folder = new ICVSRemoteFolder[][] { null };
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- folder[0] = internalGetSelectedModules();
- }
- });
- return folder[0];
- }
-
- private TreeViewer createModuleTree(Composite composite, int horizontalSpan) {
- Tree tree = new Tree(composite, (supportsMultiSelection ? SWT.MULTI : SWT.SINGLE) | SWT.BORDER);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.horizontalSpan = horizontalSpan;
- tree.setLayoutData(data);
- TreeViewer result = new TreeViewer(tree) {
- /*
- * Fix to allow filtering to be used without triggering fetching
- * of the contents of all children (see bug 62268)
- */
- public boolean isExpandable(Object element) {
- ITreeContentProvider cp = (ITreeContentProvider) getContentProvider();
- if(cp == null)
- return false;
-
- return cp.hasChildren(element);
- }
- };
- result.setContentProvider(new RemoteContentProvider());
- result.setLabelProvider(new WorkbenchLabelProvider());
- result.addFilter(new ViewerFilter() {
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- return !(element instanceof ICVSRemoteFile);
- }
- });
- result.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateEnablements(false);
- ICVSRemoteFolder[] modules = internalGetSelectedModules();
- if (modules.length == 1) {
- // There is at 1 module selected
- ICVSRemoteFolder selectedModule = modules[0];
- String repositoryRelativePath = selectedModule.getRepositoryRelativePath();
- if (!repositoryRelativePath.equals(FolderSyncInfo.VIRTUAL_DIRECTORY)) {
- text.setText(repositoryRelativePath);
- }
- } else {
- text.setText(""); //$NON-NLS-1$
- }
- }
- });
- result.getTree().addMouseListener(new MouseAdapter() {
- public void mouseDoubleClick(MouseEvent e) {
- if (getSelectedModule() != null) {
- ModuleSelectionPage.this.getContainer().showPage(getNextPage());
- }
- }
- });
- result.setSorter(new RepositorySorter());
- return result;
- }
-
- private void setModuleListInput() {
- ICVSRepositoryLocation location = getLocation();
- if (location == null || badLocation) return;
- moduleList.setInput(location.getRemoteFolder(ICVSRemoteFolder.REPOSITORY_ROOT_FOLDER_NAME, CVSTag.DEFAULT));
- }
-
- private ICVSRepositoryLocation getLocation() {
- return location;
- }
-
- public void setLocation(ICVSRepositoryLocation location) {
- boolean refresh = location != null && !location.equals(this.location);
- this.location = location;
- badLocation = false;
- if (moduleList != null) {
- updateEnablements(refresh);
- }
- }
-
- public void setProject(IProject project) {
- this.project = project;
- }
- public void setSupportsMultiSelection(boolean supportsMultiSelection) {
- this.supportsMultiSelection = supportsMultiSelection;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/NewLocationWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/NewLocationWizard.java
deleted file mode 100644
index b45b81f40..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/NewLocationWizard.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Properties;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.*;
-
-public class NewLocationWizard extends Wizard {
- private ConfigurationWizardMainPage mainPage;
-
- private Properties properties = null;
-
- /**
- * Return the settings used for all location pages
- */
- public static IDialogSettings getLocationDialogSettings() {
- IDialogSettings workbenchSettings = CVSUIPlugin.getPlugin().getDialogSettings();
- IDialogSettings section = workbenchSettings.getSection("NewLocationWizard");//$NON-NLS-1$
- if (section == null) {
- section = workbenchSettings.addNewSection("NewLocationWizard");//$NON-NLS-1$
- }
- return section;
- }
-
- public NewLocationWizard() {
- IDialogSettings section = getLocationDialogSettings();
- setDialogSettings(section);
- setWindowTitle(Policy.bind("NewLocationWizard.title")); //$NON-NLS-1$
- }
-
-
- public NewLocationWizard(Properties initialProperties) {
- this();
- this.properties = initialProperties;
- }
-
- /**
- * Creates the wizard pages
- */
- public void addPages() {
- mainPage = new ConfigurationWizardMainPage("repositoryPage1", Policy.bind("NewLocationWizard.heading"), CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_NEW_LOCATION)); //$NON-NLS-1$ //$NON-NLS-2$
- if (properties != null) {
- mainPage.setProperties(properties);
- }
- mainPage.setShowValidate(true);
- mainPage.setDescription(Policy.bind("NewLocationWizard.description")); //$NON-NLS-1$
- mainPage.setDialogSettings(getDialogSettings());
- addPage(mainPage);
- }
- /*
- * @see IWizard#performFinish
- */
- public boolean performFinish() {
- final ICVSRepositoryLocation[] location = new ICVSRepositoryLocation[] { null };
- boolean keepLocation = false;
- try {
- // Create a handle to a repository location
- location[0] = mainPage.getLocation();
- // Add the location quitely so we can validate
- location[0] = KnownRepositories.getInstance().addRepository(location[0], false /* don't tell anybody */);
-
- if (mainPage.getValidate()) {
- try {
- new ProgressMonitorDialog(getShell()).run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- location[0].validateConnection(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- keepLocation = true;
- } catch (InterruptedException e) {
- // Cancelled by user. Fall through to dispose of location
- } catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- if (t instanceof TeamException) {
- throw (TeamException)t;
- } else if (t instanceof Exception) {
- throw CVSException.wrapException((Exception)t);
- } else {
- throw CVSException.wrapException(e);
- }
- }
- } else {
- keepLocation = true;
- }
- } catch (TeamException e) {
- if (location[0] == null) {
- // Exception creating the root, we cannot continue
- CVSUIPlugin.openError(getContainer().getShell(), Policy.bind("NewLocationWizard.exception"), null, e); //$NON-NLS-1$
- return false;
- } else {
- // Exception validating. We can continue if the user wishes.
- IStatus error = e.getStatus();
- if (error.isMultiStatus() && error.getChildren().length == 1) {
- error = error.getChildren()[0];
- }
-
- if (error.isMultiStatus()) {
- CVSUIPlugin.openError(getContainer().getShell(), Policy.bind("NewLocationWizard.validationFailedTitle"), null, e); //$NON-NLS-1$
- } else {
- keepLocation = MessageDialog.openQuestion(getContainer().getShell(),
- Policy.bind("NewLocationWizard.validationFailedTitle"), //$NON-NLS-1$
- Policy.bind("NewLocationWizard.validationFailedText", new Object[] {error.getMessage()})); //$NON-NLS-1$
- }
- }
- }
- if (keepLocation) {
- KnownRepositories.getInstance().addRepository(location[0], true /* let the world know */);
- } else {
- KnownRepositories.getInstance().disposeRepository(location[0]);
- }
- return keepLocation;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RepositorySelectionPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RepositorySelectionPage.java
deleted file mode 100644
index 4d02c7d57..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RepositorySelectionPage.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.model.*;
-
-/**
- * First wizard page for importing a project into a CVS repository.
- * This page prompts the user to select an existing repo or create a new one.
- * If the user selected an existing repo, then getLocation() will return it.
- */
-public class RepositorySelectionPage extends CVSWizardPage {
- private TableViewer table;
- private Button useExistingRepo;
- private Button useNewRepo;
-
- private ICVSRepositoryLocation result;
-
- String extendedDescription;
-
- /**
- * RepositorySelectionPage constructor.
- *
- * @param pageName the name of the page
- * @param title the title of the page
- * @param titleImage the image for the page
- */
- public RepositorySelectionPage(String pageName, String title, ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- }
- protected TableViewer createTable(Composite parent, int span) {
- Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
- GridData data = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL);
- data.horizontalSpan = span;
- data.widthHint = 200;
- table.setLayoutData(data);
- TableLayout layout = new TableLayout();
- layout.addColumnData(new ColumnWeightData(100, true));
- table.setLayout(layout);
- TableColumn col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
-
- return new TableViewer(table);
- }
- /**
- * Creates the UI part of the page.
- *
- * @param parent the parent of the created widgets
- */
- public void createControl(Composite parent) {
- Composite composite = createComposite(parent, 1, false);
- // set F1 help
- WorkbenchHelp.setHelp(composite, IHelpContextIds.SHARING_SELECT_REPOSITORY_PAGE);
- if (extendedDescription == null) {
- extendedDescription = Policy.bind("RepositorySelectionPage.description"); //$NON-NLS-1$
- }
- createWrappingLabel(composite, extendedDescription, 0 /* indent */, 1 /* columns */);
-
- useNewRepo = createRadioButton(composite, Policy.bind("RepositorySelectionPage.useNew"), 1); //$NON-NLS-1$
-
- useExistingRepo = createRadioButton(composite, Policy.bind("RepositorySelectionPage.useExisting"), 1); //$NON-NLS-1$
- table = createTable(composite, 1);
- table.setContentProvider(new WorkbenchContentProvider());
- table.setLabelProvider(new WorkbenchLabelProvider());
- table.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- result = (ICVSRepositoryLocation)((IStructuredSelection)table.getSelection()).getFirstElement();
- setPageComplete(true);
- }
- });
- table.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- getContainer().showPage(getNextPage());
- }
- });
-
- useExistingRepo.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- if (useNewRepo.getSelection()) {
- table.getTable().setEnabled(false);
- result = null;
- } else {
- table.getTable().setEnabled(true);
- result = (ICVSRepositoryLocation)((IStructuredSelection)table.getSelection()).getFirstElement();
- }
- setPageComplete(true);
- }
- });
-
- setControl(composite);
-
- initializeValues();
- Dialog.applyDialogFont(parent);
- }
- /**
- * Initializes states of the controls.
- */
- private void initializeValues() {
- ICVSRepositoryLocation[] locations = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownRepositoryLocations();
- AdaptableList input = new AdaptableList(locations);
- table.setInput(input);
- if (locations.length == 0) {
- useNewRepo.setSelection(true);
- } else {
- useExistingRepo.setSelection(true);
- table.setSelection(new StructuredSelection(locations[0]));
- }
- }
-
- public ICVSRepositoryLocation getLocation() {
- return result;
- }
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible) {
- useExistingRepo.setFocus();
- }
- }
-
- public void setExtendedDescription(String extendedDescription) {
- this.extendedDescription = extendedDescription;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryFileSelectionPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryFileSelectionPage.java
deleted file mode 100644
index 1133bf716..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryFileSelectionPage.java
+++ /dev/null
@@ -1,558 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import java.io.BufferedInputStream;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-
-import org.eclipse.compare.*;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.views.navigator.ResourceSorter;
-
-/**
- * Select the files to restore
- */
-public class RestoreFromRepositoryFileSelectionPage extends CVSWizardPage {
- private TreeViewer fileTree;
- private CompareViewerPane fileSelectionPane;
- private CompareViewerPane revisionSelectionPane;
- private CheckboxTableViewer revisionsTable;
- private CompareViewerSwitchingPane fileContentPane;
-
- private HistoryTableProvider historyTableProvider;
- private AdaptableHierarchicalResourceList treeInput = new AdaptableHierarchicalResourceList(ResourcesPlugin.getWorkspace().getRoot(), new IResource[0]);
-
- private IContainer folder;
- private IFile selectedFile;
- private ILogEntry selectedRevision;
- private Map entriesCache = new HashMap();
- private Map filesToRestore = new HashMap();
-
- private static final int WIZARD_WIDTH = 550;
-
- class HistoryInput implements ITypedElement, IEncodedStreamContentAccessor, IModificationDate {
- IFile file;
- ILogEntry logEntry;
-
- HistoryInput(IFile file, ILogEntry logEntry) {
- this.file= file;
- this.logEntry = logEntry;
- }
- public InputStream getContents() throws CoreException {
- IStorage s = getStorageFromLogEntry(logEntry);
- if (s == null) return null;
- return new BufferedInputStream(s.getContents());
- }
- public String getName() {
- return file.getName();
- }
- public String getType() {
- return file.getFileExtension();
- }
- public Image getImage() {
- return CompareUI.getImage(file);
- }
- public long getModificationDate() {
- return logEntry.getDate().getTime();
- }
- public String getCharset() throws CoreException {
- IStorage s = getStorageFromLogEntry(logEntry);
- if (s instanceof IEncodedStorage) {
- return ((IEncodedStorage)s).getCharset();
- }
- return null;
- }
- }
-
- /**
- * Constructor for RestoreFromRepositoryFileSelectionPage.
- * @param pageName
- * @param title
- * @param titleImage
- * @param description
- */
- public RestoreFromRepositoryFileSelectionPage(
- String pageName,
- String title,
- ImageDescriptor titleImage,
- String description) {
- super(pageName, title, titleImage, description);
- }
-
- /**
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- Composite composite= createComposite(parent, 1, false);
- setControl(composite);
-
- WorkbenchHelp.setHelp(composite, IHelpContextIds.RESTORE_FROM_REPOSITORY_FILE_SELECTION_PAGE);
-
- // Top and bottom panes: top is the two selection panes, bottom is the file content viewer
- Splitter vsplitter= new Splitter(composite, SWT.VERTICAL);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL
- | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL);
- // Set the width to be extra wide to accomodate the two selection lists
- data.widthHint = WIZARD_WIDTH;
- vsplitter.setLayoutData(data);
-
- // Top left and top right panes: the left for the files, the right for the log entries
- Splitter hsplitter= new Splitter(vsplitter, SWT.HORIZONTAL);
-
- // Top left: file selection pane
- fileSelectionPane = new CompareViewerPane(hsplitter, SWT.BORDER | SWT.FLAT);
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- fileSelectionPane.setLayoutData(data);
- fileTree = createFileSelectionTree(fileSelectionPane);
-
- // Top right: Revision selection pane
- revisionSelectionPane = new CompareViewerPane(hsplitter, SWT.BORDER | SWT.FLAT);
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- revisionSelectionPane.setLayoutData(data);
- historyTableProvider = new HistoryTableProvider();
- revisionsTable = createRevisionSelectionTable(revisionSelectionPane, historyTableProvider);
- revisionSelectionPane.setText(Policy.bind("RestoreFromRepositoryFileSelectionPage.emptyRevisionPane")); //$NON-NLS-1$
-
- // Bottom: File content viewer
- fileContentPane = new CompareViewerSwitchingPane(vsplitter, SWT.BORDER | SWT.FLAT) {
- protected Viewer getViewer(Viewer oldViewer, Object input) {
- return CompareUI.findContentViewer(oldViewer, input, this, null);
- }
- };
-
- initializeValues();
- updateWidgetEnablements();
- Dialog.applyDialogFont(parent);
- }
-
- protected CheckboxTableViewer createRevisionSelectionTable(CompareViewerPane composite, HistoryTableProvider tableProvider) {
- CheckboxTableViewer table = tableProvider.createCheckBoxTable(composite);
- table.setContentProvider(new IStructuredContentProvider() {
- public Object[] getElements(Object inputElement) {
- ILogEntry[] entries = getSelectedEntries();
- if (entries != null) return entries;
- return new Object[0];
- }
- public void dispose() {
- }
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- });
- table.setInput(this);
- table.getTable().addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- // Handle check selection in the check state listener
- if (e.detail == SWT.CHECK) return;
- handleRevisionSelection(e.item);
- }
- }
- );
- table.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- handleRevisionChecked(event);
- }
- });
- composite.setContent(table.getControl());
- return table;
- }
-
- protected TreeViewer createFileSelectionTree(CompareViewerPane composite) {
- TreeViewer tree = new TreeViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- tree.setUseHashlookup(true);
- tree.setContentProvider(treeInput.getTreeContentProvider());
- tree.setLabelProvider(
- new DecoratingLabelProvider(
- new WorkbenchLabelProvider() {
- protected String decorateText(String input, Object element) {
- String text;
- if (element instanceof IFolder && element.equals(folder)) {
- text = super.decorateText(folder.getProjectRelativePath().toString(), element);
- } else {
- ILogEntry entry = (ILogEntry)filesToRestore.get(element);
- text = super.decorateText(input, element);
- if (entry != null) {
- text = Policy.bind("RestoreFromRepositoryFileSelectionPage.fileToRestore", text, entry.getRevision()); //$NON-NLS-1$
- }
- }
- return text;
- }
- },
- CVSUIPlugin.getPlugin().getWorkbench().getDecoratorManager().getLabelDecorator()));
- tree.setSorter(new ResourceSorter(ResourceSorter.NAME));
- tree.setInput(treeInput);
-
- GridData data = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL);
- tree.getTree().setLayoutData(data);
- tree.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handleFileSelection(event);
- }
- });
- composite.setContent(tree.getControl());
- return tree;
- }
-
- /**
- * Method updateWidgetEnablements.
- */
- private void updateWidgetEnablements() {
-
- if (filesToRestore.isEmpty()) {
- setPageComplete(false);
- setErrorMessage(null);
- return;
- }
-
- for (Iterator iter = filesToRestore.keySet().iterator(); iter.hasNext();) {
- IFile file = (IFile) iter.next();
- if (file.exists()) {
- setPageComplete(false);
- setErrorMessage(Policy.bind("RestoreFromRepositoryFileSelectionPage.fileExists", file.getName())); //$NON-NLS-1$
- return;
- }
-
- ILogEntry entry = (ILogEntry) filesToRestore.get(file);
- if (entry.isDeletion()) {
- setPageComplete(false);
- setErrorMessage(Policy.bind("RestoreFromRepositoryFileSelectionPage.revisionIsDeletion", entry.getRevision(), file.getName())); //$NON-NLS-1$
- return;
- }
- }
- setPageComplete(true);
- setErrorMessage(null);
- }
-
- /**
- * Method initializeValues.
- */
- private void initializeValues() {
- refresh();
- }
-
- /**
- * Sets the folder.
- * @param folder The folder to set
- */
- public void setInput(IContainer folder, ICVSFile[] files) {
- if (folder.equals(this.folder)) return;
- this.folder = folder;
- setTreeInput(folder, files);
- initializeValues();
- updateWidgetEnablements();
- }
-
- /*
- * Set the resource tree input to the files that were deleted
- */
- private void setTreeInput(IContainer folder, ICVSFile[] cvsFiles) {
- reset();
- IResource[] files = new IResource[cvsFiles.length];
- for (int i = 0; i < cvsFiles.length; i++) {
- try {
- files[i] = cvsFiles[i].getIResource();
- } catch (CVSException e) {
- // In practive, this error shold not occur.
- // It may if there is an existing folder with a name that matches the file
- // but this is bad in general when using CVS
- CVSUIPlugin.log(e);
- }
- }
- treeInput.setResources(files);
- // kludge to avoid auto-selection of first element
- // set the root to the folder's parent so the folder appears in the tree
- treeInput.setRoot(folder.getParent());
- refresh();
- }
-
- private void reset() {
- this.selectedFile = null;
- this.selectedRevision = null;
- treeInput.setResources(null);
- filesToRestore = new HashMap();
- if (fileContentPane != null && !fileContentPane.isDisposed()) {
- fileContentPane.setInput(null);
- }
- updateWidgetEnablements();
- }
-
- /**
- * Method refresh.
- */
- private void refresh() {
- if (folder == null) return;
-
- if (fileSelectionPane != null && !fileSelectionPane.isDisposed()) {
- fileSelectionPane.setText(Policy.bind("RestoreFromRepositoryFileSelectionPage.fileSelectionPaneTitle", folder.getProject().getName())); //$NON-NLS-1$
- fileSelectionPane.setImage(CompareUI.getImage(folder.getProject()));
- }
-
- if (revisionSelectionPane != null && !revisionSelectionPane.isDisposed()) {
- if (selectedFile == null) {
- revisionSelectionPane.setText(Policy.bind("RestoreFromRepositoryFileSelectionPage.emptyRevisionPane")); //$NON-NLS-1$
- revisionSelectionPane.setImage(null);
- }
- }
-
- // Empty the file content viewer
- if (fileContentPane != null && !fileContentPane.isDisposed()) {
- fileContentPane.setInput(null);
- }
-
- // refresh the tree
- if (fileTree != null) {
- // If the parent folder is in the tree, make sure it is expanded
- fileTree.setExpandedState(folder, true);
- fileTree.refresh();
- }
- if (revisionsTable != null)
- revisionsTable.refresh();
- }
-
- /*
- * Set the log entry table input to the fetched entries in response to a file selection
- */
- private void setLogEntryTableInput(ILogEntry[] entries) {
- this.selectedRevision = null;
- // Refresh the table so it picks up the selected entries through its content provider
- revisionsTable.refresh();
- // Check the previously checked entry if one exists
- ILogEntry selectedEntry = (ILogEntry)filesToRestore.get(selectedFile);
- if (selectedEntry != null) {
- revisionsTable.setChecked(selectedEntry, true);
- }
- // Disable entries that represent deletions since they can't be loaded
- for (int i = 0; i < entries.length; i++) {
- ILogEntry entry = entries[i];
- if (entry.isDeletion()) {
- revisionsTable.setGrayed(entry, true);
- }
- }
- // Set the titlebar text for the revisions table
- revisionSelectionPane.setText(Policy.bind("RestoreFromRepositoryFileSelectionPage.revisionSelectionPaneTitle", selectedFile.getName())); //$NON-NLS-1$
- revisionSelectionPane.setImage(CompareUI.getImage(selectedFile));
- // Clear the file content pane
- fileContentPane.setInput(null);
- }
-
- private void handleFileSelection(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- if (selection == null || selection.isEmpty()) {
- clearSelection();
- } else {
- if (selection instanceof StructuredSelection) {
- StructuredSelection structuredSelection = (StructuredSelection) selection;
- IResource resource = (IResource)structuredSelection.getFirstElement();
- if (resource instanceof IFile) {
- handleFileSelection((IFile) resource);
- } else {
- clearSelection();
- }
- }
- }
- }
-
- /**
- * Method handleFileSelection.
- * @param file
- */
- private void handleFileSelection(IFile file) {
- if (this.selectedFile == file) return;
- this.selectedFile = file;
- if (entriesCache.get(file) == null) {
- try {
-
- // First, we need to create a remote file handle so we can get the log entries
- ICVSFolder parent = CVSWorkspaceRoot.getCVSFolderFor(file.getParent());
- FolderSyncInfo info = parent.getFolderSyncInfo();
- ICVSRepositoryLocation location = KnownRepositories.getInstance().getRepository(info.getRoot());
- final ICVSRemoteFile remoteFile = location.getRemoteFile(new Path(null, info.getRepository()).append(file.getName()).toString(), CVSTag.DEFAULT);
-
- // Then we need to fetch the log entries
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- // fetch the entries
- ILogEntry[] entries = remoteFile.getLogEntries(monitor);
- // cache the entries with the selected file
- entriesCache.put(selectedFile, entries);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (CVSException e) {
- setErrorMessage(
- CVSUIPlugin.openError(getShell(), null, null, e, CVSUIPlugin.PERFORM_SYNC_EXEC)
- .getMessage());
- return;
- } catch (InvocationTargetException e) {
- setErrorMessage(
- CVSUIPlugin.openError(getShell(), null, null, e, CVSUIPlugin.PERFORM_SYNC_EXEC)
- .getMessage());
- return;
- } catch (InterruptedException e) {
- return;
- }
- }
-
- // Set the log table to display the entries for the selected file
- setLogEntryTableInput(getSelectedEntries());
- }
-
- private ILogEntry[] getSelectedEntries() {
- return (ILogEntry[])entriesCache.get(selectedFile);
- }
-
- private IStorage getStorageFromLogEntry(final ILogEntry logEntry) {
- final IStorage[] s = new IStorage[] { null };
- try {
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ICVSRemoteFile remoteFile = logEntry.getRemoteFile();
- s[0] = ((IResourceVariant)remoteFile).getStorage(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InvocationTargetException e) {
- setErrorMessage(
- CVSUIPlugin.openError(getShell(), null, null, e, CVSUIPlugin.PERFORM_SYNC_EXEC)
- .getMessage());
- return null;
- } catch (InterruptedException e) {
- return null;
- }
- return s[0];
- }
-
- private void handleRevisionChecked(CheckStateChangedEvent event) {
- if (event.getChecked()) {
- revisionsTable.setCheckedElements(new Object[] {event.getElement()});
- filesToRestore.put(selectedFile, event.getElement());
- }
- if (revisionsTable.getCheckedElements().length == 0) {
- filesToRestore.remove(selectedFile);
- }
- fileTree.refresh();
- updateWidgetEnablements();
- }
-
- /*
- * A revision in the revision table has been selected.
- * Populate the file contents pane with the selected log entry.
- */
- private void handleRevisionSelection(Widget w) {
- if (fileContentPane != null && !fileContentPane.isDisposed()) {
- Object o= w.getData();
- if (o instanceof ILogEntry) {
- ILogEntry selected = (ILogEntry) o;
- if (this.selectedRevision == selected) return;
- this.selectedRevision = selected;
- if (selected.isDeletion()) {
- fileContentPane.setInput(null);
- } else {
- fileContentPane.setInput(new HistoryInput(selectedFile, selected));
- fileContentPane.setText(getEditionLabel(selectedFile, selected));
- fileContentPane.setImage(CompareUI.getImage(selectedFile));
- }
- } else {
- fileContentPane.setInput(null);
- }
- }
- }
- /**
- * Method getEditionLabel.
- * @param selectedFile
- * @param selected
- * @return String
- */
- private String getEditionLabel(IFile selectedFile, ILogEntry selected) {
- return Policy.bind("RestoreFromRepositoryFileSelectionPage.fileContentPaneTitle", //$NON-NLS-1$
- new Object[] { selectedFile.getName(), selected.getRevision(), selectedFile.getFullPath().makeRelative().removeLastSegments(1).toString() });
- }
-
- public boolean restoreSelectedFiles() {
- try {
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- monitor.beginTask(null, 100 * filesToRestore.size());
- for (Iterator iter = filesToRestore.keySet().iterator();iter.hasNext();) {
- IFile file = (IFile) iter.next();
- ILogEntry entry = (ILogEntry)filesToRestore.get(file);
- ensureParentExists(file);
- file.create(entry.getRemoteFile().getContents(Policy.subMonitorFor(monitor, 50)), false, Policy.subMonitorFor(monitor, 50));
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- });
- } catch (InvocationTargetException e) {
- setErrorMessage(
- CVSUIPlugin.openError(getShell(), null, null, e, CVSUIPlugin.PERFORM_SYNC_EXEC)
- .getMessage());
- return false;
- } catch (InterruptedException e) {
- return false;
- }
- return true;
- }
-
- /**
- * Method ensureParentExists.
- * @param file
- */
- private void ensureParentExists(IResource resource) throws CoreException {
- IContainer parent = resource.getParent();
- if (!parent.exists() && parent.getType() == IResource.FOLDER) {
- ensureParentExists(parent);
- ((IFolder)parent).create(false, true, null);
- }
- }
-
- private void clearSelection() {
- this.selectedFile = null;
- this.selectedRevision = null;
- refresh();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryWizard.java
deleted file mode 100644
index 960671851..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryWizard.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-/**
- * This wizard allows the user to show deleted resources in the history view
- */
-public class RestoreFromRepositoryWizard extends Wizard {
-
- private RestoreFromRepositoryFileSelectionPage fileSelectionPage;
- private IContainer parent;
- private ICVSFile[] files;
-
- /**
- * Constructor for RestoreFromRepositoryWizard.
- */
- public RestoreFromRepositoryWizard(IContainer parent, ICVSFile[] files) {
- this.parent = parent;
- this.files = files;
- setWindowTitle(Policy.bind("RestoreFromRepositoryWizard.fileSelectionPageTitle")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.jface.wizard.IWizard#performFinish()
- */
- public boolean performFinish() {
- return fileSelectionPage.restoreSelectedFiles();
- }
-
- /**
- * @see org.eclipse.jface.wizard.IWizard#addPages()
- */
- public void addPages() {
- setNeedsProgressMonitor(true);
- ImageDescriptor substImage = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_CHECKOUT);
-
- fileSelectionPage = new RestoreFromRepositoryFileSelectionPage("FileSelectionPage", Policy.bind("RestoreFromRepositoryWizard.fileSelectionPageTitle"), substImage, Policy.bind("RestoreFromRepositoryWizard.fileSelectionPageDescription")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- fileSelectionPage.setInput(parent, files);
- addPage(fileSelectionPage);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java
deleted file mode 100644
index 9b3651bcc..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java
+++ /dev/null
@@ -1,548 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.*;
-import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant;
-import org.eclipse.team.internal.ccvs.ui.tags.*;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSourceWorkbenchAdapter;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
-import org.eclipse.team.ui.IConfigurationWizard;
-import org.eclipse.ui.IWorkbench;
-
-/**
- * This wizard helps the user to import a new project in their workspace
- * into a CVS repository for the first time.
- */
-public class SharingWizard extends Wizard implements IConfigurationWizard, ICVSWizard {
- // The project to configure
- private IProject project;
-
- // The autoconnect page is used if CVS/ directories already exist.
- private ConfigurationWizardAutoconnectPage autoconnectPage;
-
- // The import page is used if CVS/ directories do not exist.
- private RepositorySelectionPage locationPage;
-
- // The page that prompts the user for connection information.
- private ConfigurationWizardMainPage createLocationPage;
-
- // The page that prompts the user for module name.
- private ModuleSelectionPage modulePage;
-
- // The page that lets the user pick a branch to share against
- private TagSelectionWizardPage tagPage;
-
- // The page that allows the user to commit or update resources
- private SharingWizardSyncPage syncPage;
-
- // Keep track of location state so we know what to do at the end
- private ICVSRepositoryLocation location;
- private boolean isNewLocation;
-
- // Keep track of the folder that existed the last time we checked
- private ICVSRemoteFolder existingRemote;
-
- public SharingWizard() {
- IDialogSettings cvsSettings = CVSUIPlugin.getPlugin().getDialogSettings();
- IDialogSettings section = cvsSettings.getSection("SharingWizard");//$NON-NLS-1$
- if (section == null) {
- section = cvsSettings.addNewSection("SharingWizard");//$NON-NLS-1$
- }
- setDialogSettings(section);
- setNeedsProgressMonitor(true);
- setWindowTitle(Policy.bind("SharingWizard.title")); //$NON-NLS-1$
- }
-
- public void addPages() {
- ImageDescriptor sharingImage = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_SHARE);
- if (doesCVSDirectoryExist()) {
- autoconnectPage = new ConfigurationWizardAutoconnectPage("autoconnectPage", Policy.bind("SharingWizard.autoConnectTitle"), sharingImage); //$NON-NLS-1$ //$NON-NLS-2$
- autoconnectPage.setProject(project);
- autoconnectPage.setDescription(Policy.bind("SharingWizard.autoConnectTitleDescription")); //$NON-NLS-1$
- addPage(autoconnectPage);
- } else {
- ICVSRepositoryLocation[] locations = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownRepositoryLocations();
- if (locations.length > 0) {
- locationPage = new RepositorySelectionPage("importPage", Policy.bind("SharingWizard.importTitle"), sharingImage); //$NON-NLS-1$ //$NON-NLS-2$
- locationPage.setDescription(Policy.bind("SharingWizard.importTitleDescription")); //$NON-NLS-1$
- addPage(locationPage);
- }
- createLocationPage = new ConfigurationWizardMainPage("createLocationPage", Policy.bind("SharingWizard.enterInformation"), sharingImage); //$NON-NLS-1$ //$NON-NLS-2$
- createLocationPage.setDescription(Policy.bind("SharingWizard.enterInformationDescription")); //$NON-NLS-1$
- createLocationPage.setCVSWizard(this);
- createLocationPage.setDialogSettings(NewLocationWizard.getLocationDialogSettings());
- addPage(createLocationPage);
- modulePage = new ModuleSelectionPage("modulePage", Policy.bind("SharingWizard.enterModuleName"), sharingImage); //$NON-NLS-1$ //$NON-NLS-2$
- modulePage.setDescription(Policy.bind("SharingWizard.enterModuleNameDescription")); //$NON-NLS-1$
- modulePage.setCVSWizard(this);
- modulePage.setProject(project);
- modulePage.setHelpContxtId(IHelpContextIds.SHARING_MODULE_PAGE);
- addPage(modulePage);
-
- addTagPage(sharingImage);
- addSyncPage(sharingImage);
- }
- }
-
- private void addTagPage(ImageDescriptor sharingImage) {
- tagPage = new TagSelectionWizardPage("tagPage", //$NON-NLS-1$
- Policy.bind("SharingWizard.selectTagTitle"), //$NON-NLS-1$
- sharingImage,
- Policy.bind("SharingWizard.selectTag"), //$NON-NLS-1$
- TagSource.EMPTY, // start with an empty tag source
- TagSourceWorkbenchAdapter.INCLUDE_HEAD_TAG | TagSourceWorkbenchAdapter.INCLUDE_BRANCHES); //$NON-NLS-1$
- tagPage.setCVSWizard(this);
- tagPage.setHelpContxtId(IHelpContextIds.SHARING_TAG_SELETION_PAGE);
- addPage(tagPage);
- }
-
- private void addSyncPage(ImageDescriptor sharingImage) {
- syncPage = new SharingWizardSyncPage("syncPagePage", //$NON-NLS-1$
- Policy.bind("SharingWizard.23"), //$NON-NLS-1$
- sharingImage,
- Policy.bind("SharingWizard.24")); //$NON-NLS-1$
- syncPage.setProject(project);
- syncPage.setCVSWizard(this);
- addPage(syncPage);
- }
-
- public boolean canFinish() {
- IWizardPage page = getContainer().getCurrentPage();
- return (page == autoconnectPage || page == syncPage);
- }
-
- protected String getMainPageDescription() {
- return Policy.bind("SharingWizard.description"); //$NON-NLS-1$
- }
-
- protected String getMainPageTitle() {
- return Policy.bind("SharingWizard.heading"); //$NON-NLS-1$
- }
-
- public IWizardPage getNextPage(IWizardPage page) {
- // Assume the page is about to be shown when this method is
- // invoked
- return getNextPage(page, true /* about to show*/);
- }
-
- public IWizardPage getNextPage(IWizardPage page, boolean aboutToShow) {
- if (page == autoconnectPage) return null;
- if (page == locationPage) {
- if (locationPage.getLocation() == null) {
- return createLocationPage;
- } else {
- if (aboutToShow) {
- try {
- modulePage.setLocation(getLocation());
- } catch (TeamException e1) {
- CVSUIPlugin.log(e1);
- }
- }
- return modulePage;
- }
- }
- if (page == createLocationPage) {
- if (aboutToShow) {
- try {
- modulePage.setLocation(getLocation());
- } catch (TeamException e1) {
- CVSUIPlugin.log(e1);
- }
- }
- return modulePage;
- }
- try {
- if (page == modulePage) {
- if (aboutToShow) {
- ICVSRemoteFolder remoteFolder = getRemoteFolder();
- if (exists(remoteFolder)) {
- prepareTagPage(remoteFolder);
- return tagPage;
- } else {
- try {
- populateSyncPage(false /* remote exists */);
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(getShell(), null, null, e);
- if (!RepositoryProvider.isShared(project)) {
- // Only stay on the current page if the sharing was a total failure
- return null;
- }
- }
- return syncPage;
- }
- } else {
- return syncPage;
- }
- }
- if (page == tagPage) {
- if (aboutToShow) {
- populateSyncPage(true /* remote exists */);
- }
- return syncPage;
- }
- } catch (InvocationTargetException e) {
- // Show the error and fall through to return null as the next page
- CVSUIPlugin.openError(getShell(), null, null, e);
- } catch (InterruptedException e) {
- // The user cancelled. Falll through and return null as the next page.
- }
- return null;
- }
-
- /*
- * @see IWizard#performFinish
- */
- public boolean performFinish() {
- final boolean[] result = new boolean[] { true };
- if (isAutoconnect()) {
- try {
- getContainer().run(true /* fork */, true /* cancel */, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- try {
- result[0] = autoconnectCVSProject(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- });
- } catch (InterruptedException e) {
- return true;
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(getContainer().getShell(), null, null, e);
- result[0] = false;
- }
- }
- // Add the location to the provider if it is new
- if (result[0] && isNewLocation) {
- KnownRepositories.getInstance().addRepository(location, true /* broadcast */);
- }
- if (getContainer().getCurrentPage() == syncPage) {
- syncPage.saveSettings();
- syncPage.promptToCommit();
- }
- return result[0];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#performCancel()
- */
- public boolean performCancel() {
- boolean disposeLocation = isNewLocation;
- ICVSRepositoryLocation location;
- try {
- location = getLocation();
- } catch (TeamException e) {
- CVSUIPlugin.log(e);
- return true;
- }
- if (location == null) return true;
- // If on the last page, offer to disconnect
- if (getContainer().getCurrentPage() == syncPage
- && RepositoryProvider.getProvider(project) != null) {
- // Prompt to see if we should undo out work
- if (promptToKeepMapping()) {
- // If we didn't disconnect, don't dispose the repo
- disposeLocation = false;
- // Add the location to the provider if it is new
- if (isNewLocation) {
- KnownRepositories.getInstance().addRepository(location, true /* broadcast */);
- }
- } else {
- try {
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- new DisconnectOperation(null, new IProject[] { project }, true)
- .run(monitor);
- }
- });
- } catch (InvocationTargetException e) {
- CVSUIPlugin.log(IStatus.ERROR, e.getMessage(), e.getTargetException());
- } catch (InterruptedException e) {
- // Ignore
- }
- }
- }
- // Dispose of the location if appropriate
- if (disposeLocation) {
- KnownRepositories.getInstance().disposeRepository(location);
- }
- return super.performCancel();
- }
-
- private boolean promptToKeepMapping() {
- return (MessageDialog.openQuestion(getShell(), Policy.bind("SharingWizard.26"), Policy.bind("SharingWizard.27", project.getName()))); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- private void reconcileProject(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- new ReconcileProjectOperation(getShell(), project, getRemoteFolder()).run(monitor);
- }
-
- /**
- * Return an ICVSRepositoryLocation
- */
- private ICVSRepositoryLocation getLocation() throws TeamException {
- // If there is an autoconnect page then it has the location
- if (autoconnectPage != null) {
- return recordLocation(autoconnectPage.getLocation());
- }
-
- // If the location page has a location, use it.
- if (locationPage != null) {
- ICVSRepositoryLocation newLocation = locationPage.getLocation();
- if (newLocation != null) {
- return recordLocation(newLocation);
- }
- }
-
- // Otherwise, get the location from the create location page
- final ICVSRepositoryLocation[] locations = new ICVSRepositoryLocation[] { null };
- final CVSException[] exception = new CVSException[] { null };
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- try {
- locations[0] = createLocationPage.getLocation();
- } catch (CVSException e) {
- exception[0] = e;
- }
- }
- });
- if (exception[0] != null) {
- throw exception[0];
- }
- return recordLocation(locations[0]);
- }
-
- private ICVSRepositoryLocation recordLocation(ICVSRepositoryLocation newLocation) {
- if (newLocation == null) return location;
- if (location == null || !newLocation.equals(location)) {
- if (location != null && isNewLocation) {
- // Dispose of the previous location
- KnownRepositories.getInstance().disposeRepository(location);
- }
- location = newLocation;
- isNewLocation = !KnownRepositories.getInstance().isKnownRepository(newLocation.getLocation());
- if (isNewLocation) {
- // Add the location silently so we can work with it
- location = KnownRepositories.getInstance().addRepository(location, false /* silently */);
- }
- }
- return location;
- }
-
- /*
- * @see IConfigurationWizard#init(IWorkbench, IProject)
- */
- public void init(IWorkbench workbench, IProject project) {
- this.project = project;
- }
-
- private boolean doesCVSDirectoryExist() {
- // Determine if there is an existing CVS/ directory from which configuration
- // information can be retrieved.
- Shell shell = null;
- if (getContainer() != null) {
- shell = getContainer().getShell();
- }
- final boolean[] isCVSFolder = new boolean[] { false };
- try {
- CVSUIPlugin.runWithRefresh(shell, new IResource[] { project }, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ICVSFolder folder = (ICVSFolder)CVSWorkspaceRoot.getCVSResourceFor(project);
- FolderSyncInfo info = folder.getFolderSyncInfo();
- isCVSFolder[0] = info != null;
- } catch (final TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- }, null);
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(shell, null, null, e);
- } catch (InterruptedException e) {
- // Cancelled. Just fall through
- }
- return isCVSFolder[0];
- }
-
- /*
- * Shoudl the project be auto-connected
- */
- /* private*/ boolean isAutoconnect() {
- return autoconnectPage != null && doesCVSDirectoryExist();
- }
-
- /*
- * Auto-connect to the repository using CVS/ directories
- */
- /*private */ boolean autoconnectCVSProject(IProgressMonitor monitor) throws TeamException {
- try {
- monitor.beginTask(null, 100);
-
- FolderSyncInfo info = autoconnectPage.getFolderSyncInfo();
- if (info == null) {
- // Error!
- return false;
- }
-
- // Get the repository location (the get will add the locatin to the provider)
- ICVSRepositoryLocation location = getLocation();
-
- // Validate the connection if the user wants to
- boolean validate = autoconnectPage.getValidate();
- if (validate) {
- // Do the validation
- try {
- location.validateConnection(Policy.subMonitorFor(monitor, 50));
- } catch (final TeamException e) {
- // Exception validating. We can continue if the user wishes.
- final boolean[] keep = new boolean[] { false };
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- keep[0] = MessageDialog.openQuestion(getContainer().getShell(),
- Policy.bind("SharingWizard.validationFailedTitle"), //$NON-NLS-1$
- Policy.bind("SharingWizard.validationFailedText", new Object[] {e.getStatus().getMessage()})); //$NON-NLS-1$
- }
- });
- if (!keep[0]) {
- return false;
- }
- // They want to keep the connection anyway. Fall through.
- }
- }
-
- // Set the sharing
- CVSWorkspaceRoot.setSharing(project, info, Policy.subMonitorFor(monitor, 50));
- return true;
- } finally {
- monitor.done();
- }
- }
-
- private boolean shareProject(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- monitor.beginTask(null, 100);
- ICVSRepositoryLocation location = null;
- try {
- location = getLocation();
- location.validateConnection(Policy.subMonitorFor(monitor, 50));
- } catch (TeamException e) {
- CVSUIPlugin.openError(getShell(), null, null, e, CVSUIPlugin.PERFORM_SYNC_EXEC);
- if (isNewLocation && location != null) location.flushUserInfo();
- return false;
- }
-
- // Create the remote module for the project
- ShareProjectOperation op = new ShareProjectOperation(null, location, project, getRemoteFolder().getRepositoryRelativePath());
- op.setShell(getShell());
- op.run(Policy.subMonitorFor(monitor, 50));
- return true;
- }
-
- private CVSTag getTag() {
- if (tagPage == null || tagPage.getSelectedTag() == null) {
- return CVSTag.DEFAULT;
- }
- return tagPage.getSelectedTag();
- }
-
- private ICVSRemoteFolder getRemoteFolder() {
- ICVSRemoteFolder folder = modulePage.getSelectedModule();
- return (ICVSRemoteFolder)folder.forTag(getTag());
- }
-
- private boolean exists(ICVSRemoteFolder folder, IProgressMonitor monitor) throws TeamException {
- if (existingRemote != null && existingRemote.equals(folder)) return true;
- if (folder.exists(monitor)) {
- existingRemote = folder;
- return true;
- } else {
- existingRemote = null;
- return false;
- }
- }
-
- private boolean exists(final ICVSRemoteFolder folder) throws InvocationTargetException, InterruptedException {
- final boolean[] result = new boolean[] { false };
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- try {
- result[0] = exists(folder, monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- return result[0];
- }
-
- private void populateSyncPage(final boolean exists) throws InvocationTargetException, InterruptedException {
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- monitor.beginTask(null, 100);
- if (exists) {
- reconcileProject(Policy.subMonitorFor(monitor, 50));
- } else {
- shareProject(Policy.subMonitorFor(monitor, 50));
- }
- getParticipant().refreshNow(new IResource[] {project}, Policy.bind("ShareProjectOperation.1"), Policy.subMonitorFor(monitor, 50)); //$NON-NLS-1$
- if (monitor.isCanceled()) {
- throw new InterruptedException();
- }
- monitor.done();
- }
- });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#getPreviousPage(org.eclipse.jface.wizard.IWizardPage)
- */
- public IWizardPage getPreviousPage(IWizardPage page) {
- if (page == syncPage) {
- // There's no going back from the sync page
- return null;
- }
- return super.getPreviousPage(page);
- }
-
- private void prepareTagPage(ICVSRemoteFolder remote) {
- tagPage.setTagSource(TagSource.create(remote));
- tagPage.setDescription(Policy.bind("SharingWizard.25", remote.getRepositoryRelativePath())); //$NON-NLS-1$
- }
-
- private WorkspaceSynchronizeParticipant getParticipant() {
- return syncPage.getParticipant();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardPageActionGroup.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardPageActionGroup.java
deleted file mode 100644
index 8cf1f8848..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardPageActionGroup.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
-import org.eclipse.team.internal.ccvs.ui.actions.IgnoreAction;
-import org.eclipse.team.internal.ccvs.ui.subscriber.CVSActionDelegateWrapper;
-import org.eclipse.team.internal.ccvs.ui.subscriber.CVSParticipantAction;
-import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceCommitOperation;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizeModelAction;
-import org.eclipse.team.ui.synchronize.SynchronizeModelOperation;
-import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
-
-/**
- * Adviser used to add toolbar buttons to the last page of the sharing wizard.
- */
-public class SharingWizardPageActionGroup extends SynchronizePageActionGroup {
-
- public static final String ACTION_GROUP = "cvs_sharing_page_actions"; //$NON-NLS-1$
-
- private SharingCommitAction commitAction;
-
- /**
- * Custom commit that includes outgoing and conflicting.
- */
- class SharingCommitAction extends CVSParticipantAction {
- public SharingCommitAction(ISynchronizePageConfiguration configuration, ISelectionProvider provider) {
- super(configuration, provider, "SharingCommitAction."); //$NON-NLS-1$
- }
- protected FastSyncInfoFilter getSyncInfoFilter() {
- return new SyncInfoDirectionFilter(new int[] {SyncInfo.CONFLICTING, SyncInfo.OUTGOING});
- }
- protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- return new WorkspaceCommitOperation(configuration, elements, true /* override */);
- }
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.subscriber.SynchronizeViewerAdvisor#initializeActions(org.eclipse.jface.viewers.StructuredViewer)
- */
- public void initialize(ISynchronizePageConfiguration configuration) {
- super.initialize(configuration);
- configuration.addMenuGroup(ISynchronizePageConfiguration.P_TOOLBAR_MENU, ACTION_GROUP);
-
- commitAction = new SharingCommitAction(
- configuration,
- getVisibleRootsSelectionProvider());
- appendToGroup(
- ISynchronizePageConfiguration.P_TOOLBAR_MENU,
- ACTION_GROUP,
- commitAction);
-
- appendToGroup(
- ISynchronizePageConfiguration.P_TOOLBAR_MENU,
- ACTION_GROUP,
- new CVSActionDelegateWrapper(new IgnoreAction(), configuration){
- protected String getBundleKeyPrefix() {
- return "SharingWizardIgnore."; //$NON-NLS-1$
- }
- });
- }
- /**
- * @return Returns the commitAction.
- */
- public SynchronizeModelAction getCommitAction() {
- return commitAction;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardSyncPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardSyncPage.java
deleted file mode 100644
index eb2339d0f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardSyncPage.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.ITeamStatus;
-import org.eclipse.team.core.TeamStatus;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant;
-import org.eclipse.team.ui.synchronize.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.part.PageBook;
-
-/**
- * Page that displays the compare input for sharing
- */
-public class SharingWizardSyncPage extends CVSWizardPage implements ISyncInfoSetChangeListener {
-
- // Constant keys used to store last size for this page
- private static final String PAGE_HEIGHT = "SyncPageHeight"; //$NON-NLS-1$
- private static final String PAGE_WIDTH = "SyncPageWidth"; //$NON-NLS-1$
-
- private ParticipantPageSaveablePart input;
- private ISynchronizePageConfiguration configuration;
- private SyncInfoSet infos;
- private IProject project;
-
- PageBook pageBook;
- private Control syncPage;
- private Control noChangesPage;
- private Control errorPage;
-
- private int width;
- private int height;
- private SharingWizardPageActionGroup sharingWizardPageActionGroup;
-
- public SharingWizardSyncPage(String pageName, String title, ImageDescriptor titleImage, String description) {
- super(pageName, title, titleImage, description);
- }
-
- public void setProject(IProject project) {
- this.project = project;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- Composite composite = createComposite(parent, 1, false);
- setControl(composite);
-
- // set F1 help
- WorkbenchHelp.setHelp(composite, IHelpContextIds.SHARING_SYNC_PAGE);
-
- pageBook = new PageBook(composite, SWT.NONE);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.grabExcessHorizontalSpace = true;
- data.grabExcessVerticalSpace = true;
- pageBook.setLayoutData(data);
-
- input = createCompareInput();
- input.createPartControl(pageBook);
- syncPage = input.getControl();
- infos = configuration.getSyncInfoSet();
- infos.addSyncSetChangedListener(this);
-
- noChangesPage = createNoChangesPage(pageBook);
- noChangesPage.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- errorPage = createErrorPage(pageBook);
- errorPage.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- updatePage();
-
- Dialog.applyDialogFont(parent);
- }
-
- private Control createNoChangesPage(PageBook pageBook) {
- Composite composite = createComposite(pageBook, 1, false);
- createWrappingLabel(composite, Policy.bind("SharingWizardSyncPage.3", project.getName()), 0); //$NON-NLS-1$
- return composite;
- }
-
- private Control createErrorPage(PageBook pageBook) {
- Composite composite = new Composite(pageBook, SWT.NONE);
- GridLayout layout = new GridLayout();
- composite.setLayout(layout);
-
- createWrappingLabel(composite, Policy.bind("SharingWizardSyncPage.4"), 0); //$NON-NLS-1$
-
- Button showErrors = new Button(composite, SWT.PUSH);
- showErrors.setText(Policy.bind("SharingWizardSyncPage.5")); //$NON-NLS-1$
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END);
- showErrors.setLayoutData(data);
- showErrors.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- showErrors();
- }
- });
-
- return composite;
- }
-
- /* private */ void showErrors() {
- ITeamStatus[] status = infos.getErrors();
- String title = Policy.bind("SharingWizardSyncPage.8"); //$NON-NLS-1$
- if (status.length == 1) {
- IStatus s = status[0];
- if (s.getException() instanceof CoreException) {
- s = ((CoreException)s.getException()).getStatus();
- }
- ErrorDialog.openError(getShell(), title, null, s);
- } else {
- MultiStatus multi = new MultiStatus(CVSUIPlugin.ID, 0, status, Policy.bind("SharingWizardSyncPage.9"), null); //$NON-NLS-1$
- ErrorDialog.openError(getShell(), title, null, multi);
- }
- }
-
- private ParticipantPageSaveablePart createCompareInput() {
- WorkspaceSynchronizeParticipant participant = new WorkspaceSynchronizeParticipant(new ResourceScope(new IResource[] { project }));
- configuration = participant.createPageConfiguration();
- configuration.setProperty(ISynchronizePageConfiguration.P_TOOLBAR_MENU, new String[] {ISynchronizePageConfiguration.LAYOUT_GROUP, SharingWizardPageActionGroup.ACTION_GROUP});
- sharingWizardPageActionGroup = new SharingWizardPageActionGroup();
- configuration.addActionContribution(sharingWizardPageActionGroup);
- configuration.setRunnableContext(getContainer());
-
- CompareConfiguration cc = new CompareConfiguration();
- cc.setLeftEditable(false);
- cc.setRightEditable(false);
- ParticipantPageSaveablePart part = new ParticipantPageSaveablePart(getShell(), cc, configuration, participant);
- part.setShowContentPanes(false);
- return part;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#dispose()
- */
- public void dispose() {
- if (input != null) {
- input.getParticipant().dispose();
- input.dispose();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.WizardPage#setPreviousPage(org.eclipse.jface.wizard.IWizardPage)
- */
- public void setPreviousPage(IWizardPage page) {
- // There's no going back from this page
- super.setPreviousPage(null);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener#syncInfoSetReset(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor) {
- updatePage();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener#syncInfoChanged(org.eclipse.team.core.synchronize.ISyncInfoSetChangeEvent, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void syncInfoChanged(ISyncInfoSetChangeEvent event, IProgressMonitor monitor) {
- updatePage();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener#syncInfoSetErrors(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.team.core.ITeamStatus[], org.eclipse.core.runtime.IProgressMonitor)
- */
- public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) {
- updatePage();
- }
-
- private void updatePage() {
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- if (pageBook.isDisposed()) return;
- if (infos.getErrors().length > 0) {
- pageBook.showPage(errorPage);
- } else if (infos.isEmpty()) {
- pageBook.showPage(noChangesPage);
- } else {
- pageBook.showPage(syncPage);
- }
- }
- });
- }
-
- public void showError(TeamStatus status) {
- infos.addError(status);
- }
-
- public WorkspaceSynchronizeParticipant getParticipant() {
- return (WorkspaceSynchronizeParticipant)configuration.getParticipant();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean)
- */
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (syncPage.isVisible()) {
- initializeSize();
- getShell().setSize(Math.max(width, 300), Math.max(height, 300));
- if(input != null) {
- Viewer viewer = input.getPageConfiguration().getPage().getViewer();
- if(viewer instanceof AbstractTreeViewer) {
- ((AbstractTreeViewer)viewer).expandToLevel(2);
- }
- }
- }
- }
-
- private void initializeSize() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- try {
- width = settings.getInt(PAGE_WIDTH);
- height = settings.getInt(PAGE_HEIGHT);
- } catch (NumberFormatException e) {
- // Ignore and go on;
- }
- }
- if (width == 0) width = 640;
- if (height == 0) height = 480;
- }
-
- /**
- * Save the size of the page so it can be opened with the same size next time
- */
- public void saveSettings() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- Point size = getShell().getSize();
- settings.put(PAGE_WIDTH, size.x);
- settings.put(PAGE_HEIGHT, size.y);
- }
- }
-
- /**
- * Prompt to commit any leftovers
- */
- public void promptToCommit() {
- if (sharingWizardPageActionGroup != null) {
- if (sharingWizardPageActionGroup.getCommitAction().isEnabled()) {
- if (MessageDialog.openQuestion(getShell(), Policy.bind("SharingWizardSyncPage.10"), Policy.bind("SharingWizardSyncPage.11"))) { //$NON-NLS-1$ //$NON-NLS-2$
- // Null the context so the commit will run in the background
- configuration.setRunnableContext(null);
- sharingWizardPageActionGroup.getCommitAction().run();
- }
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizard.java
deleted file mode 100644
index 8a09ef5c0..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizard.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * 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 Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.operations.UpdateOperation;
-import org.eclipse.team.internal.ccvs.ui.tags.*;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSourceWorkbenchAdapter;
-import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class UpdateWizard extends Wizard {
-
- private IResource[] resources;
- private final IWorkbenchPart part;
- private TagSelectionWizardPage tagSelectionPage;
-
- public UpdateWizard(IWorkbenchPart part, IResource[] resources) {
- this.part = part;
- this.resources = resources;
- setWindowTitle(Policy.bind("UpdateWizard.title")); //$NON-NLS-1$
- }
-
- public void addPages() {
- ImageDescriptor substImage = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_CHECKOUT);
- tagSelectionPage = new TagSelectionWizardPage("tagPage", Policy.bind("UpdateWizard.0"), substImage, Policy.bind("UpdateWizard.1"), TagSource.create(resources), TagSourceWorkbenchAdapter.INCLUDE_ALL_TAGS); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- tagSelectionPage.setAllowNoTag(true);
- tagSelectionPage.setHelpContxtId(IHelpContextIds.UPDATE_TAG_SELETION_PAGE);
- ICVSFolder[] folders = getCVSFolders();
- if (folders.length > 0) {
- try {
- CVSTag selectedTag = folders[0].getFolderSyncInfo().getTag();
- tagSelectionPage.setSelection(selectedTag);
- } catch (CVSException e) {
- CVSUIPlugin.log(e);
- }
- }
- addPage(tagSelectionPage);
- }
-
- private ICVSFolder[] getCVSFolders() {
- Set projects = new HashSet();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- projects.add(resource.getProject());
- }
- ICVSFolder[] folders = new ICVSFolder[projects.size()];
- int i = 0;
- for (Iterator iter = projects.iterator(); iter.hasNext();) {
- IProject project = (IProject) iter.next();
- folders[i++] = CVSWorkspaceRoot.getCVSFolderFor(project);
- }
- return folders;
- }
-
- /*
- * @see IWizard#performFinish()
- */
- public boolean performFinish() {
- try {
- new UpdateOperation(part, resources, Command.NO_LOCAL_OPTIONS, tagSelectionPage.getSelectedTag()).run();
- } catch (InvocationTargetException e) {
- CVSUIPlugin.openError(getShell(), null, null, e);
- return false;
- } catch (InterruptedException e) {
- return false;
- }
- return true;
- }
-}

Back to the top