Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal')
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AlternateUserValidationDialog.java245
-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/BranchPromptDialog.java284
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSAbstractResolutionGenerator.java121
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSAddResolutionGenerator.java136
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java382
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java464
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java81
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorationRunnable.java300
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java512
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorConfiguration.java77
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorPreferencesPage.java398
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFilePropertiesPage.java141
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFolderPropertiesPage.java133
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLocalCompareEditorInput.java78
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPerspective.java1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java458
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java369
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectSetSerializer.java197
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSRemoveResolutionGenerator.java177
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSRepositoryPropertiesPage.java311
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java439
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Console.java429
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConsoleDocument.java126
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConsolePreferencesPage.java185
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DetailsDialog.java190
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java151
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryDropAdapter.java60
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryFilter.java64
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryFilterAction.java45
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryFilterDialog.java254
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistorySorter.java105
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java736
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java110
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IDecorationNotifier.java26
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java74
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IPromptCondition.java29
-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.java257
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/OverlayIcon.java71
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/OverlayIconCache.java49
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Policy.java98
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/PromptingDialog.java119
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ReleaseCommentDialog.java97
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteFileEditorInput.java178
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteFileStorage.java71
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoriesView.java313
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryManager.java769
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositorySorter.java44
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResizableWizardDialog.java21
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java152
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourcePropertiesPage.java103
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/SimpleContentProvider.java41
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagAsVersionDialog.java219
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagConfigurationDialog.java737
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagSelectionDialog.java292
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TextViewerAction.java35
-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.java186
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/VersionCollator.java67
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkbenchUserAuthenticator.java154
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java81
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddToWorkspaceAction.java114
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java203
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java390
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAction.java127
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAsAction.java201
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java71
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteResourcesAction.java88
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java89
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java100
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java61
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ConfigureTagsFromRepoView.java123
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ConfigureTagsFromRepoViewOnFolder.java87
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ContentAction.java85
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CopyRepositoryNameAction.java59
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/DefineBranchAction.java108
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/DefineVersionAction.java109
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java67
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java58
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java41
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MoveRemoteTagAction.java76
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/NewCVSAnonEclipseConnection.java40
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/NewCVSRepositoryAction.java34
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/NewRepositoryAction.java54
-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.java131
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RemoveBranchTagAction.java80
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RemoveRootAction.java121
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java77
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java131
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SetKeywordSubstitutionAction.java60
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowCVSPerspectiveAction.java36
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowHistoryAction.java99
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowResourceInHistoryAction.java72
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java56
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncOutgoingAction.java19
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java185
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagInRepositoryAction.java132
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java205
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java87
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeEditorInput.java94
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java56
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardEndPage.java117
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardStartPage.java142
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/OverrideUpdateMergeAction.java31
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/ProjectElement.java79
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/TagElement.java43
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/TagRootElement.java98
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/UpdateMergeAction.java153
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/UpdateWithForcedJoinAction.java82
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties725
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/AllRootsElement.java35
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/BranchCategory.java97
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/BranchTag.java88
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java72
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSFileElement.java67
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSFolderElement.java89
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSModelElement.java48
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFilePropertySource.java161
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFolderPropertySource.java95
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRepositoryLocationPropertySource.java120
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRepositoryRootElement.java42
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSResourceElement.java33
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRootFolderElement.java49
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/GroupedByVersionCategory.java110
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteContentProvider.java49
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteFileElement.java41
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteFolderElement.java61
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteModule.java129
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteResourceElement.java25
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteVersionModule.java97
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/VersionCategory.java118
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/AddSyncAction.java149
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java462
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java381
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareUnsharedInput.java50
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncSet.java110
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CommitSyncAction.java46
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ForceCommitSyncAction.java319
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ForceUpdateSyncAction.java45
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/IgnoreAction.java128
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/MergeAction.java349
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ToolTipMessageDialog.java25
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/UpdateSyncAction.java399
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSWizardPage.java238
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardAutoconnectPage.java119
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java477
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileOperation.java111
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileWizard.java549
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizard.java401
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardDirtyFilesPage.java75
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardSelectionPage.java144
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardSharedFilesPage.java76
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardSummaryPage.java272
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModuleSelectionPage.java81
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/NewLocationWizard.java127
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RepositorySelectionPage.java131
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java367
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardFinishPage.java32
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizard.java97
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizardPage.java153
162 files changed, 0 insertions, 25357 deletions
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 4cd427b08..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AlternateUserValidationDialog.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial 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.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
-import org.eclipse.swt.graphics.Font;
-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.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-public class AlternateUserValidationDialog extends Dialog {
- String user;
- String password = ""; //$NON-NLS-1$
- List numXs = new ArrayList();
- Font font;
- 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.setFont(font);
- passwordText.addVerifyListener(new VerifyListener() {
- public void verifyText(VerifyEvent e) {
- if (inUpdate) return;
- e.doit = false;
- inUpdate = true;
- switch ((int)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();
- }
- });
-
- return main;
- }
-
- public boolean close() {
- boolean result = super.close();
- if (font != null) font.dispose();
- 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$
- }
- font = new Font(Display.getDefault(), fd);
- }
- 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/AvoidableMessageDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AvoidableMessageDialog.java
deleted file mode 100644
index 03d67d968..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) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial 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/BranchPromptDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/BranchPromptDialog.java
deleted file mode 100644
index c62e7b436..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/BranchPromptDialog.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial implementation
- ******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TreeViewer;
-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.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.swt.widgets.Tree;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.ui.wizards.CVSWizardPage;
-import org.eclipse.team.internal.ccvs.ui.merge.ProjectElement;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-public class BranchPromptDialog extends DetailsDialog {
-
- private ICVSFolder folder;
- 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 TABLE_HEIGHT_HINT = 150;
-
- // widgets;
- private TreeViewer tagTree;
-
- public BranchPromptDialog(Shell parentShell, String title, ICVSFolder folder, boolean allResourcesSticky, String versionName) {
- super(parentShell, title);
- this.folder = folder;
- 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.GRAB_VERTICAL |
- GridData.HORIZONTAL_ALIGN_FILL |
- GridData.VERTICAL_ALIGN_CENTER);
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);;
- label.setLayoutData(data);
- label.setFont(composite.getFont());
-
- 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);
- }
- });
-
- 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();
- data.horizontalSpan = 2;
- data.widthHint = 350;
- 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);
-
- branchText.setFocus();
- }
-
- /**
- * 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);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite.setFont(parent.getFont());
-
- Label label = new Label(composite, SWT.WRAP);
- label.setText(Policy.bind("BranchWizardPage.existingVersionsAndBranches")); //$NON-NLS-1$
- GridData data = new GridData(
- GridData.GRAB_HORIZONTAL |
- GridData.GRAB_VERTICAL |
- GridData.HORIZONTAL_ALIGN_FILL |
- GridData.VERTICAL_ALIGN_CENTER);
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);;
- label.setLayoutData(data);
- label.setFont(composite.getFont());
-
- tagTree = createTree(composite);
- tagTree.setInput(new ProjectElement(folder, ProjectElement.INCLUDE_BRANCHES | ProjectElement.INCLUDE_VERSIONS));
- Runnable refresh = new Runnable() {
- public void run() {
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- tagTree.refresh();
- }
- });
- }
- };
- TagConfigurationDialog.createTagDefinitionButtons(getShell(), composite, new ICVSFolder[] {folder},
- convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT),
- convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH),
- refresh, refresh);
- return composite;
- }
-
- /**
- * Creates the existing branch and version tree viewer in the details pane
- */
- protected TreeViewer createTree(Composite parent) {
- Tree tree = new Tree(parent, SWT.SINGLE | SWT.BORDER);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = TABLE_HEIGHT_HINT;
- tree.setLayoutData(data);
- TreeViewer result = new TreeViewer(tree);
- result.setContentProvider(new WorkbenchContentProvider());
- result.setLabelProvider(new WorkbenchLabelProvider());
- result.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- }
- });
- result.setSorter(new RepositorySorter());
- return result;
- }
-
- /**
- * Validates branch and version names
- */
- protected void updateEnablements() {
- String message = null;
- boolean complete = false;
-
- 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);
- }
-
- /**
- * Answers if the given tag name already exists
- */
- protected boolean doesTagNameExists(String name) {
- CVSTag[] tags = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownVersionTags(folder);
- for (int i = 0; i < tags.length; i++) {
- if(tags[i].getName().equals(name)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Answers if the given branch name already exists
- */
- protected boolean doesBranchNameExists(String name) {
- CVSTag[] tags = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownBranchTags(folder);
- for (int i = 0; i < tags.length; i++) {
- if(tags[i].getName().equals(name)) {
- return true;
- }
- }
- return false;
- }
-
-
- /**
- * 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;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSAbstractResolutionGenerator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSAbstractResolutionGenerator.java
deleted file mode 100644
index 2b2fdfc39..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSAbstractResolutionGenerator.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-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.ui.IMarkerResolutionGenerator;
-import org.eclipse.ui.IWorkbenchWindow;
-
-public abstract class CVSAbstractResolutionGenerator implements IMarkerResolutionGenerator {
- protected Shell getShell() {
- IWorkbenchWindow window = CVSUIPlugin.getPlugin().getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- return window.getShell();
- } else {
- Display display = Display.getCurrent();
- return new Shell(display);
- }
- }
-
- protected void run(final IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
- final Exception[] exception = new Exception[] {null};
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- try {
- new ProgressMonitorDialog(getShell()).run(true, true, runnable);
- } catch (InterruptedException e) {
- exception[0] = e;
- } catch (InvocationTargetException e) {
- exception[0] = e;
- }
- }
- });
- if (exception[0] != null) {
- if (exception[0] instanceof InvocationTargetException) {
- throw (InvocationTargetException)exception[0];
- } else if (exception[0] instanceof InterruptedException) {
- throw (InterruptedException)exception[0];
- } else {
- throw new InvocationTargetException(exception[0]);
- }
- }
- }
-
- /**
- * Shows the given errors to the user.
- *
- * @param status the status containing the error
- * @param title the title of the error dialog
- * @param message the message for the error dialog
- * @param shell the shell to open the error dialog in
- */
- protected void handle(Throwable exception, String title, final String message) {
- // Handle the target exception for InvocationTargetExceptions
- if (exception instanceof InvocationTargetException) {
- handle(((InvocationTargetException)exception).getTargetException(), title, message);
- return;
- }
-
- // Create a status to be displayed for the exception
- IStatus status = null;
- boolean log = false;
- boolean dialog = false;
- if (exception instanceof TeamException) {
- status = ((TeamException)exception).getStatus();
- log = false;
- dialog = true;
- } else if (exception instanceof CoreException) {
- status = ((CoreException)exception).getStatus();
- log = true;
- dialog = true;
- } else if (exception instanceof InterruptedException) {
- return;
- } else {
- status = new Status(IStatus.ERROR, CVSUIPlugin.ID, 1, Policy.bind("TeamAction.internal"), exception); //$NON-NLS-1$
- log = true;
- dialog = true;
- }
-
- // Display and/or log as appropriate
- if (status == null) return;
- if (!status.isOK()) {
- IStatus toShow = status;
- if (status.isMultiStatus()) {
- IStatus[] children = status.getChildren();
- if (children.length == 1) {
- toShow = children[0];
- }
- }
- if (title == null) title = status.getMessage();
- if (dialog) {
- final IStatus showStatus = toShow;
- final String displayTitle = title;
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- ErrorDialog.openError(getShell(), displayTitle, message, showStatus);
- }
- });
- }
- if (log) CVSUIPlugin.log(toShow);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSAddResolutionGenerator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSAddResolutionGenerator.java
deleted file mode 100644
index 565912a66..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSAddResolutionGenerator.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-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.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.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.ui.IMarkerResolution;
-
-/**
- * Generate marker resoultions for a cvs remove marker
- */
-public class CVSAddResolutionGenerator extends CVSAbstractResolutionGenerator {
- /*
- * @see IMarkerResolutionGenerator#getResolutions(IMarker)
- */
- public IMarkerResolution[] getResolutions(IMarker marker) {
- IMarkerResolution manage = new IMarkerResolution() {
- public String getLabel() {
- return Policy.bind("CVSAddResolutionGenerator.Add_Resource_to_CVS_1"); //$NON-NLS-1$
- }
- public void run(IMarker marker) {
- try {
- final IResource resource = marker.getResource();
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- final TeamException[] exception = new TeamException[] {null};
- if ( ! cvsResource.isManaged()) {
- CVSAddResolutionGenerator.this.run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)throws InvocationTargetException, InterruptedException {
- try {
- ((CVSTeamProvider)RepositoryProvider.getProvider(resource.getProject())).add(new IResource[] {resource}, IResource.DEPTH_ZERO, monitor);
- } catch (TeamException e) {
- exception[0] = e;
- }
- }
- });
- }
- if (exception[0] != null) {
- throw exception[0];
- }
- marker.delete();
- } catch (TeamException e) {
- handle(e, null, null);
- } catch (CoreException e) {
- handle(e, null, null);
- } catch (InvocationTargetException e) {
- handle(e, null, null);
- } catch (InterruptedException e) {
- // do nothing
- }
- }
- };
- IMarkerResolution manageDeep = new IMarkerResolution() {
- public String getLabel() {
- return Policy.bind("CVSAddResolutionGenerator.Add_Resource_and_Children_to_CVS_2"); //$NON-NLS-1$
- }
- public void run(IMarker marker) {
- try {
- final IResource resource = marker.getResource();
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- final TeamException[] exception = new TeamException[] {null};
- if ( ! cvsResource.isManaged()) {
- CVSAddResolutionGenerator.this.run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)throws InvocationTargetException, InterruptedException {
- try {
- ((CVSTeamProvider)RepositoryProvider.getProvider(resource.getProject())).add(new IResource[] {resource}, IResource.DEPTH_INFINITE, monitor);
- } catch (TeamException e) {
- exception[0] = e;
- }
- }
- });
- }
- if (exception[0] != null) {
- throw exception[0];
- }
- marker.delete();
- } catch (TeamException e) {
- handle(e, null, null);
- } catch (CoreException e) {
- handle(e, null, null);
- } catch (InvocationTargetException e) {
- handle(e, null, null);
- } catch (InterruptedException e) {
- // do nothing
- }
- }
-
- };
- IMarkerResolution ignore = new IMarkerResolution() {
- public String getLabel() {
- return Policy.bind("CVSAddResolutionGenerator.Add_to_.cvsignore_3"); //$NON-NLS-1$
- }
- public void run(IMarker marker) {
- try {
- ICVSResource resource = CVSWorkspaceRoot.getCVSResourceFor(marker.getResource());
- if ( resource.isManaged()) {
- resource.unmanage(null);
- }
- resource.setIgnored();
- marker.delete();
- } catch (CVSException e) {
- handle(e, null, null);
- } catch (CoreException e) {
- handle(e, null, null);
- }
- }
-
- };
- if (marker.getResource().getType() == IResource.FILE) {
- return new IMarkerResolution[] {manage, ignore};
- } else {
- return new IMarkerResolution[] {manageDeep, manage, ignore};
- }
- }
-}
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 6ff815c24..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java
+++ /dev/null
@@ -1,382 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.io.ByteArrayInputStream;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.compare.ResourceNode;
-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.resources.IContainer;
-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.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-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.widgets.Composite;
-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.ICVSFile;
-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.ICVSRunnable;
-import org.eclipse.team.internal.ccvs.core.client.Session;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-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;
-
- // comparison constants
- private static final int NODE_EQUAL = 0;
- private static final int NODE_NOT_EQUAL = 1;
- private static final int NODE_UNKNOWN = 2;
-
- /**
- * Creates a new CVSCompareEditorInput.
- */
- public CVSCompareEditorInput(ResourceEditionNode left, ResourceEditionNode right) {
- this(left, right, null);
- }
-
- /**
- * Creates a new CVSCompareEditorInput.
- */
- public CVSCompareEditorInput(ResourceEditionNode left, ResourceEditionNode right, ResourceEditionNode ancestor) {
- super(new CompareConfiguration());
- this.left = left;
- this.right = right;
- this.ancestor = ancestor;
- }
-
- /**
- * Returns the label for the given input element.
- */
- private String getLabel(ITypedElement element) {
- if (element instanceof ResourceEditionNode) {
- ICVSRemoteResource edition = ((ResourceEditionNode)element).getRemoteResource();
- ICVSResource resource = (ICVSResource)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 = (ICVSResource)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$
- }
-
- /**
- * 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);
- }
- }
-
- /**
- * Sets up the title and pane labels for the comparison view.
- */
- private void initLabels() {
- CompareConfiguration cc = (CompareConfiguration) getCompareConfiguration();
- setLabels(cc, new StructuredSelection());
-
- String title;
- if (ancestor != null) {
- title = Policy.bind("CVSCompareEditorInput.titleAncestor", new Object[] {guessResourceName(), 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();
- boolean differentNames = false;
- 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$
- }
- }
- 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(left.getImage());
- }
-
- if (right != null) {
- cc.setRightLabel(getLabel(right));
- cc.setRightImage(right.getImage());
- }
-
- if (ancestor != null) {
- cc.setAncestorLabel(getLabel(ancestor));
- cc.setAncestorImage(ancestor.getImage());
- }
- }
-
- /* (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
- final Object[] result = new Object[] { null };
- Session.run(null, null, false, new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- 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[0] = d.findDifferences(threeWay, sub, null, ancestor, left, right);
- } finally {
- sub.done();
- }
- }
- }, monitor);
- return result[0];
- } catch (OperationCanceledException e) {
- throw new InterruptedException(e.getMessage());
- } catch (RuntimeException e) {
- handle(e);
- return null;
- } catch (CVSException 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());
- }
- });
- return viewer;
- }
-
-} \ No newline at end of file
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 71ded5a3a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java
+++ /dev/null
@@ -1,464 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.text.DateFormat;
-import java.util.Date;
-
-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.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-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.ErrorDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.viewers.ColumnWeightData;
-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.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-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.events.SelectionAdapter;
-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.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-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.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
-import org.eclipse.team.internal.core.TeamPlugin;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-public class CVSCompareRevisionsInput extends CompareEditorInput {
- IFile resource;
- ICVSRemoteFile currentEdition;
- ILogEntry[] editions;
- TableViewer viewer;
- Action getContentsAction;
- Action getRevisionAction;
- Shell shell;
-
- /**
- * 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() {
- ICVSRemoteResource edition = getRemoteResource();
- 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 {
- public VersionCompareDiffNode(ITypedElement left, ITypedElement right) {
- super(left, right);
- }
- public String getName() {
- return getRight().getName();
- }
- };
- /**
- * 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;
- }
- };
- /**
- * A sorter which gets the remote resources from the diff nodes
- */
- class VersionSorter extends HistorySorter {
- public VersionSorter(int columnNumber) {
- super(columnNumber);
- }
- public int compare(Viewer viewer, Object o1, Object o2) {
- VersionCompareDiffNode d1 = (VersionCompareDiffNode)o1;
- VersionCompareDiffNode d2 = (VersionCompareDiffNode)o2;
- return super.compare(viewer, ((ResourceRevisionNode)d1.getRight()).getLogEntry(), ((ResourceRevisionNode)d2.getRight()).getLogEntry());
- }
-
- };
-
- //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;
-
- /**
- * A history label provider, largely copied from HistoryView.
- */
- class HistoryLabelProvider extends LabelProvider implements ITableLabelProvider {
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
- public String getColumnText(Object element, int columnIndex) {
- if (!(element instanceof DiffNode)) return ""; //$NON-NLS-1$
- ITypedElement right = ((DiffNode)element).getRight();
- if (!(right instanceof ResourceRevisionNode)) return ""; //$NON-NLS-1$
- ILogEntry entry = ((ResourceRevisionNode)right).getLogEntry();
- switch (columnIndex) {
- case COL_REVISION:
- try {
- if (currentEdition != null && currentEdition.getRevision().equals(entry.getRevision())) {
- return Policy.bind("currentRevision", entry.getRevision()); //$NON-NLS-1$
- } else {
- return entry.getRevision();
- }
- } catch (TeamException e) {
- handle(e);
- }
- return entry.getRevision();
- 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$
- if (index == -1) return comment;
- return Policy.bind("CVSCompareRevisionsInput.truncate", comment.substring(0, index)); //$NON-NLS-1$
- }
- return ""; //$NON-NLS-1$
- }
- }
-
- public CVSCompareRevisionsInput(IFile resource, ILogEntry[] editions) {
- super(new CompareConfiguration());
- this.resource = resource;
- this.editions = editions;
- updateCurrentEdition();
- initializeActions();
- }
- /**
- * Creates the columns for the history table.
- * Copied from HistoryView.
- */
- private void createColumns(Table table, TableLayout layout) {
- SelectionListener headerListener = getColumnListener();
- // 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));
- }
- public Viewer createDiffViewer(Composite parent) {
- this.shell = parent.getShell();
- 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);
- table.setData(CompareUI.COMPARE_VIEWER_TITLE, Policy.bind("CVSCompareRevisionsInput.structureCompare")); //$NON-NLS-1$
-
- TableLayout layout = new TableLayout();
- table.setLayout(layout);
-
- createColumns(table, layout);
-
- viewer = new TableViewer(table);
- viewer.setContentProvider(new VersionCompareContentProvider());
- viewer.setLabelProvider(new HistoryLabelProvider());
-
- 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)) {
- getContentsAction.setEnabled(false);
- getRevisionAction.setEnabled(false);
- return;
- }
- IStructuredSelection ss = (IStructuredSelection)selection;
- getContentsAction.setEnabled(ss.size() == 1);
- getRevisionAction.setEnabled(ss.size() == 1);
- }
- });
- return viewer;
- }
- /**
- * Adds the listener that sets the sorter.
- */
- private SelectionListener getColumnListener() {
- /**
- * 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 = viewer.getTable().indexOf((TableColumn) e.widget);
- VersionSorter oldSorter = (VersionSorter)viewer.getSorter();
- if (oldSorter != null && column == oldSorter.getColumnNumber()) {
- oldSorter.setReversed(!oldSorter.isReversed());
- viewer.refresh();
- } else {
- viewer.setSorter(new VersionSorter(column));
- }
- }
- };
- }
- private void initLabels() {
- CompareConfiguration cc = (CompareConfiguration)getCompareConfiguration();
- String resourceName = resource.getName();
-// if (editions[0].isTeamStreamResource()) {
-// setTitle(Policy.bind("CompareResourceEditorInput.compareResourceAndStream", new Object[] {resourceName, editions[0].getTeamStream().getName()}));
-// } else {
-// setTitle(Policy.bind("CompareResourceEditorInput.compareResourceAndVersions", new Object[] {resourceName}));
-// }
- setTitle(Policy.bind("CVSCompareRevisionsInput.compareResourceAndVersions", new Object[] {resourceName})); //$NON-NLS-1$
- cc.setLeftEditable(true);
- cc.setRightEditable(false);
-
- 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() {
- getContentsAction = new Action(Policy.bind("HistoryView.getContentsAction"), null) { //$NON-NLS-1$
- public void run() {
- try {
- new ProgressMonitorDialog(shell).run(false, true, new WorkspaceModifyOperation() {
- 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 {
- monitor.beginTask(null, 100);
- InputStream in = edition.getContents(new SubProgressMonitor(monitor, 50));
- resource.setContents(in, false, true, new SubProgressMonitor(monitor, 50));
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- });
- } catch (InterruptedException e) {
- // Do nothing
- return;
- } catch (InvocationTargetException e) {
- handle(e);
- }
- // recompute the labels on the viewer
- updateCurrentEdition();
- viewer.refresh();
- }
- };
-
- getRevisionAction = new Action(Policy.bind("HistoryView.getRevisionAction"), null) { //$NON-NLS-1$
- public void run() {
- try {
- new ProgressMonitorDialog(shell).run(false, true, new WorkspaceModifyOperation() {
- 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 {
- CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(resource.getProject());
- CVSTag revisionTag = new CVSTag(((ICVSRemoteFile)edition).getRevision(), CVSTag.VERSION);
- if(CVSAction.checkForMixingTags(shell, new IResource[] {resource}, revisionTag)) {
- provider.update(new IResource[] {resource}, new Command.LocalOption[] {Command.UPDATE.IGNORE_LOCAL_CHANGES},
- revisionTag, true /*create backups*/, monitor);
- currentEdition = (ICVSRemoteFile)edition;
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InterruptedException e) {
- // Do nothing
- return;
- } catch (InvocationTargetException e) {
- handle(e);
- }
- // recompute the labels on the viewer
- viewer.refresh();
- }
- };
- }
- public boolean isSaveNeeded() {
- return false;
- }
- protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- initLabels();
- DiffNode diffRoot = new DiffNode(Differencer.NO_CHANGE);
- for (int i = 0; i < editions.length; i++) {
- ITypedElement left = new ResourceNode(resource);
- ITypedElement right = new ResourceRevisionNode(editions[i]);
- diffRoot.add(new VersionCompareDiffNode(left, right));
- }
- return diffRoot;
- }
- private void updateCurrentEdition() {
- try {
- this.currentEdition = ((ICVSRemoteFile) CVSWorkspaceRoot.getRemoteResourceFor(resource));
- } catch (TeamException e) {
- handle(e);
- }
- }
- 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());
- ErrorDialog.openError(shell, null, null, error);
- if (!(t instanceof TeamException)) {
- CVSUIPlugin.log(error);
- }
- }
-} \ No newline at end of file
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 25ab25ef3..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.List;
-import java.util.Map;
-
-public class CVSDecoration {
-
- private String format;
- private Map bindings;
- private List overlays;
-
- /* package */ CVSDecoration() {
- this(null, null, null);
- }
-
- /* package */ CVSDecoration(String format, Map bindings, List overlays) {
- setFormat(format);
- setBindings(bindings);
- setOverlays(overlays);
- }
-
- public int hashCode() {
- return overlays.hashCode();
- }
- public boolean equals(Object o) {
- if (!(o instanceof CVSDecoration)) return false;
- return overlays.equals(((CVSDecoration)o).overlays);
- }
- /**
- * Gets the overlays.
- * @return Returns a List
- */
- public List getOverlays() {
- return overlays;
- }
-
- /**
- * Sets the overlays.
- * @param overlays The overlays to set
- */
- public void setOverlays(List overlays) {
- this.overlays = overlays;
- }
-
- /**
- * Gets the substitutions.
- * @return Returns a String[]
- */
- public Map getBindings() {
- return bindings;
- }
-
- /**
- * Sets the substitutions.
- * @param substitutions The substitutions to set
- */
- public void setBindings(Map bindings) {
- this.bindings = bindings;
- }
-
- /**
- * Gets the textBinding.
- * @return Returns a String
- */
- public String getFormat() {
- return format;
- }
-
- /**
- * Sets the textBinding.
- * @param textBinding The textBinding to set
- */
- public void setFormat(String format) {
- this.format = format;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorationRunnable.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorationRunnable.java
deleted file mode 100644
index a5bd6a516..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorationRunnable.java
+++ /dev/null
@@ -1,300 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.team.core.RepositoryProvider;
-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.ICVSResource;
-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.ui.ISharedImages;
-import org.eclipse.team.ui.TeamImages;
-
-/**
- * Performs the decoration calculation for elements made available via the decoration notifier.
- */
-public class CVSDecorationRunnable implements Runnable {
-
- // Images cached for better performance
- private static ImageDescriptor dirty;
- private static ImageDescriptor checkedIn;
- private static ImageDescriptor checkedOut;
- private static ImageDescriptor merged;
-
- // Provides resources to be decorated and is notified when decoration has been calculated
- private IDecorationNotifier notifier;
-
- // Remember the non posted decorated resources
- List resources = new ArrayList();
- List decorations = new ArrayList();
- private final static int NUM_TO_BATCH = 50;
-
- static {
- dirty = new CachedImageDescriptor(TeamImages.getImageDescriptor(ISharedImages.IMG_DIRTY_OVR));
- checkedIn = new CachedImageDescriptor(TeamImages.getImageDescriptor(ISharedImages.IMG_CHECKEDIN_OVR));
- checkedOut = new CachedImageDescriptor(TeamImages.getImageDescriptor(ISharedImages.IMG_CHECKEDOUT_OVR));
- merged = new CachedImageDescriptor(CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_MERGED));
- }
-
- /*
- * 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) {
- this.descriptor = descriptor;
- }
- public ImageData getImageData() {
- if (data == null) {
- data = descriptor.getImageData();
- }
- return data;
- }
- }
-
- /* package */
- CVSDecorationRunnable(IDecorationNotifier notifier) {
- this.notifier = notifier;
- }
-
- /*
- * @see Runnable#run()
- */
- public void run() {
- while (true) {
- // will block if there are no resources to be decorated
- IResource resource = notifier.next();
-
- // if next() returned null, we are done and should shut down.
- if (resource == null) {
- return;
- }
-
- CVSDecoration decoration = decorate(resource);
-
- // notify that decoration is ready
- if(decoration!=null) {
- resources.add(resource);
- decorations.add(decoration);
- if(!resources.isEmpty() && (notifier.remaining()==0 || resources.size() >= NUM_TO_BATCH)) {
- notifier.decorated((IResource[])resources.toArray(new IResource[resources.size()]),
- (CVSDecoration[])decorations.toArray(new CVSDecoration[decorations.size()]));
- resources.clear();
- decorations.clear();
- }
- }
- }
- }
-
- public CVSDecoration decorate(IResource resource) {
- // it is possible that the resource to be decorated is no longer associated
- // with a CVS provider. This could happen if the team nature was removed
- // between the time the decoration event was posted to the thread and the time
- // the thread processes the decoration.
- RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId());
- if(!resource.exists() || provider==null) {
- return null;
- }
-
- // if the resource is ignored return an empty decoration. This will
- // force a decoration update event and clear the existing CVS decoration.
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- try {
- if(cvsResource.isIgnored()) {
- return new CVSDecoration();
- }
- } catch (CVSException e) {
- // The was an exception in isIgnored. Don't decorate
- return new CVSDecoration();
- }
-
- // determine a if resource has outgoing changes (e.g. is dirty).
- IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- boolean isDirty = false;
- boolean computeDeepDirtyCheck = store.getBoolean(ICVSUIConstants.PREF_CALCULATE_DIRTY);
- int type = resource.getType();
- if(type == IResource.FILE || computeDeepDirtyCheck) {
- isDirty = CVSDecorator.isDirty(resource);
- }
-
- // compute decorations
- CVSDecoration decoration = computeTextLabelFor(resource, isDirty);
- decoration.setOverlays(computeLabelOverlaysFor(resource, isDirty, (CVSTeamProvider)provider));
- return decoration;
- }
-
- public static CVSDecoration computeTextLabelFor(IResource resource, boolean isDirty) {
- try {
- Map bindings = new HashMap(3);
- String format = ""; //$NON-NLS-1$
- IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
-
- IPath resourceLocation = resource.getLocation();
- int type = resource.getType();
-
- // if the resource does not have a location then return. This can happen if the resource
- // has been deleted after we where asked to decorate it.
- if(resourceLocation==null) {
- return new CVSDecoration(format, bindings, null);
- }
-
- if(type==IResource.FOLDER) {
- format = store.getString(ICVSUIConstants.PREF_FOLDERTEXT_DECORATION);
- } else if(type==IResource.PROJECT) {
- format = store.getString(ICVSUIConstants.PREF_PROJECTTEXT_DECORATION);
- } else {
- format = store.getString(ICVSUIConstants.PREF_FILETEXT_DECORATION);
- }
-
- if(isDirty) {
- bindings.put(CVSDecoratorConfiguration.DIRTY_FLAG, store.getString(ICVSUIConstants.PREF_DIRTY_FLAG));
- }
-
- CVSTag tag = getTagToShow(resource);
- if(tag != null) {
- bindings.put(CVSDecoratorConfiguration.RESOURCE_TAG, tag.getName());
- }
-
- if(type != IResource.FILE) {
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor((IContainer) resource);
- FolderSyncInfo folderInfo = folder.getFolderSyncInfo();
- if (folderInfo != null) {
- ICVSRepositoryLocation location = CVSProviderPlugin.getProvider().getRepository(folderInfo.getRoot());
- 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, folderInfo.getRepository());
- }
- } else {
- format = store.getString(ICVSUIConstants.PREF_FILETEXT_DECORATION);
- ICVSFile file = CVSWorkspaceRoot.getCVSFileFor((IFile) resource);
- ResourceSyncInfo fileInfo = file.getSyncInfo();
- if (fileInfo != null) {
- if(fileInfo.isAdded()) {
- bindings.put(CVSDecoratorConfiguration.ADDED_FLAG, store.getString(ICVSUIConstants.PREF_ADDED_FLAG));
- } else {
- bindings.put(CVSDecoratorConfiguration.FILE_REVISION, fileInfo.getRevision());
- }
- KSubstOption option = fileInfo.getKeywordMode() != null ?
- fileInfo.getKeywordMode() :
- KSubstOption.fromFile((IFile) resource);
- bindings.put(CVSDecoratorConfiguration.FILE_KEYWORD, option.getShortDisplayText());
- } else {
- // only show the type that cvs will use when comitting the file
- KSubstOption option = KSubstOption.fromFile((IFile) resource);
- bindings.put(CVSDecoratorConfiguration.FILE_KEYWORD, option.getShortDisplayText());
- }
- }
- return new CVSDecoration(format, bindings, null);
- } catch (CVSException e) {
- CVSUIPlugin.log(e.getStatus());
- return new CVSDecoration();
- }
- }
-
- /**
- * 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;
- if(cvsResource.isFolder()) {
- FolderSyncInfo folderInfo = ((ICVSFolder)cvsResource).getFolderSyncInfo();
- if(folderInfo != null) {
- tag = folderInfo.getTag();
- }
- } else {
- ResourceSyncInfo info = ((ICVSFile)cvsResource).getSyncInfo();
- if(info != null) {
- tag = info.getTag();
- }
- }
-
- ICVSFolder parent = cvsResource.getParent();
- if(parent != null && tag != null) {
- 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;
- }
-
- public static List computeLabelOverlaysFor(IResource resource, boolean isDirty, CVSTeamProvider provider) {
- List overlays = new ArrayList(3);
-
- IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- boolean showDirty = store.getBoolean(ICVSUIConstants.PREF_SHOW_DIRTY_DECORATION);
- boolean showHasRemote = store.getBoolean(ICVSUIConstants.PREF_SHOW_HASREMOTE_DECORATION);
- boolean showAdded = store.getBoolean(ICVSUIConstants.PREF_SHOW_ADDED_DECORATION);
-
- if (showAdded && resource.getType() == IResource.FILE) {
- try {
- IPath location = resource.getLocation();
- if(location!=null) {
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile) resource);
- ResourceSyncInfo info = cvsFile.getSyncInfo();
- // show merged icon if file has been merged but has not been edited (e.g. on commit it will be ignored)
- if(info!=null && info.isNeedsMerge(cvsFile.getTimeStamp())) {
- overlays.add(merged);
- // show added icon if file has been added locally.
- } else if(info!=null && info.isAdded()) {
- overlays.add(checkedOut);
- }
- }
- } catch (CVSException e) {
- CVSUIPlugin.log(e.getStatus());
- return null;
- }
- }
-
- // show outgoing arrow
- if(showDirty && isDirty) {
- overlays.add(dirty);
- }
-
- // show remote icon
- if (showHasRemote && provider.hasRemote(resource)) {
- overlays.add(checkedIn);
- }
-
- if(overlays.isEmpty()) {
- return null;
- } else {
- return overlays;
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java
deleted file mode 100644
index 0d4e1cc6a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java
+++ /dev/null
@@ -1,512 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.ArrayList;
-import java.util.Collections;
-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.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-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.core.IResourceStateChangeListener;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.ui.IDecoratorManager;
-
-/**
- * Classes registered with the workbench decoration extension point. The <code>CVSDecorationRunnable</code> class
- * actually calculates the decoration, while this class is responsible for listening to the following sources
- * for indications that the decorators need updating:
- * <ul>
- * <li>workbench label requests (decorateText/decorateImage)
- * <li>workspace resource change events (resourceChanged)
- * <li>cvs state changes (resourceStateChanged)
- * </ul>
- * <p>
- * [Note: There are several optimization that can be implemented in this class: (1) cache something
- * so that computing the dirty state of containers does not imply traversal of all children, (2) improve
- * the queue used between the decorator and the decorator runnable such that priority can be
- * given to visible elements when decoration requests are made.]
- */
-public class CVSDecorator extends LabelProvider implements ILabelDecorator, IResourceChangeListener, IResourceStateChangeListener, IDecorationNotifier {
-
- // Resources that need an icon and text computed for display to the user
- private List decoratorNeedsUpdating = new ArrayList();
-
- // When decorations are computed they are added to this cache via decorated() method
- private Map cache = Collections.synchronizedMap(new HashMap());
-
- // Updater thread, computes decoration labels and images
- private Thread decoratorUpdateThread;
-
- private boolean shutdown = false;
-
- private OverlayIconCache iconCache = new OverlayIconCache();
-
- // Keep track of deconfigured projects
- private Set deconfiguredProjects = new HashSet();
-
- private static class DecoratorOverlayIcon extends OverlayIcon {
- public DecoratorOverlayIcon(Image base, ImageDescriptor[] overlays) {
- super(base, overlays, new Point(base.getBounds().width, base.getBounds().height));
- }
- // all cvs overlays are shown on the rightmost portion
- // of the base image
- protected void drawOverlays(ImageDescriptor[] overlays) {
- for (int i = overlays.length - 1; i >= 0; --i) {
- ImageData imageData = overlays[i].getImageData();
- Point p = getSize();
- drawImage(imageData, p.x-imageData.width, 0);
- }
- }
- }
-
- /*
- * Return the CVSDecorator instance that is currently enabled.
- * Return null if we don't have a decorator or its not enabled.
- */
- private static CVSDecorator getActiveCVSDecorator() {
- IDecoratorManager manager = CVSUIPlugin.getPlugin().getWorkbench().getDecoratorManager();
- if (manager.getEnabled(CVSUIPlugin.DECORATOR_ID))
- return (CVSDecorator) manager.getLabelDecorator(CVSUIPlugin.DECORATOR_ID);
- return null;
- }
-
- /*
- * Blanket refresh the displaying of our decorator.
- */
- public static void refresh() {
- CVSDecorator activeDecorator = getActiveCVSDecorator();
-
- if(activeDecorator == null)
- return; //nothing to do, our decorator isn't active
- activeDecorator.clearCache(); //clear the cache of previous decorations so we can compute them anew
-
- //update all displaying of our decorator;
- activeDecorator.fireLabelProviderChanged(new LabelProviderChangedEvent(activeDecorator));
- }
-
- /*
- * 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 static CVSTeamProvider getCVSProviderFor(IResource resource) {
- RepositoryProvider p = RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId());
- if (p == null) {
- return null;
- }
- return (CVSTeamProvider) p;
- }
-
-
- public CVSDecorator() {
- // thread that calculates the decoration for a resource
- decoratorUpdateThread = new Thread(new CVSDecorationRunnable(this), "CVS"); //$NON-NLS-1$
- decoratorUpdateThread.start();
- CVSProviderPlugin.addResourceStateChangeListener(this);
- ResourcesPlugin.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.PRE_AUTO_BUILD);
- }
-
- public String decorateText(String text, Object o) {
- IResource resource = getResource(o);
- if (resource == null || text == null || resource.getType() == IResource.ROOT)
- return text;
- if (getCVSProviderFor(resource) == null)
- return text;
-
- CVSDecoration decoration = (CVSDecoration) cache.get(resource);
-
- if (decoration != null) {
- String format = decoration.getFormat();
- if (format == null) {
- return text;
- } else {
- Map bindings = decoration.getBindings();
- if (bindings.isEmpty())
- return text;
- bindings.put(CVSDecoratorConfiguration.RESOURCE_NAME, text);
- return CVSDecoratorConfiguration.bind(format, bindings);
- }
- } else {
- addResourcesToBeDecorated(new IResource[] { resource });
- return text;
- }
- }
-
- public Image decorateImage(Image image, Object o) {
- IResource resource = getResource(o);
- if (resource == null || image == null || resource.getType() == IResource.ROOT)
- return image;
- if (getCVSProviderFor(resource) == null)
- return image;
-
- CVSDecoration decoration = (CVSDecoration) cache.get(resource);
-
- if (decoration != null) {
- List overlays = decoration.getOverlays();
- if (overlays != null) {
- return iconCache.getImageFor(new DecoratorOverlayIcon(image,
- (ImageDescriptor[]) overlays.toArray(new ImageDescriptor[overlays.size()])));
- }
- } else {
- addResourcesToBeDecorated(new IResource[] { resource });
- }
- return image;
- }
-
-
- /*
- * @see IDecorationNotifier#next()
- */
- public synchronized IResource next() {
- try {
- if (shutdown) return null;
-
- if (decoratorNeedsUpdating.isEmpty()) {
- wait();
- }
- // We were awakened.
- if (shutdown) {
- // The decorator was awakened by the plug-in as it was shutting down.
- return null;
- }
- IResource resource = (IResource) decoratorNeedsUpdating.remove(0);
-
- //System.out.println("++ Next: " + resource.getFullPath() + " remaining in cache: " + cache.size());
-
- return resource;
- } catch (InterruptedException e) {
- }
- return null;
- }
-
- /*
- * @see IDecorationNotifier#decorated(IResource[], CVSDecoration[])
- */
- public synchronized void decorated(IResource[] resources, CVSDecoration[] decorations) {
- if(!shutdown) {
- List decorated = new ArrayList();
-
- for (int i = 0; i < resources.length; i++) {
- IResource resource= resources[i];
- if(resource.exists()) {
- cache.put(resource, decorations[i]);
- decorated.add(resource);
- }
- }
- postLabelEvent(new LabelProviderChangedEvent(this, decorated.toArray()));
- }
- }
-
- /*
- * @see IDecorationNotifier#remaining()
- */
- public int remaining() {
- return decoratorNeedsUpdating.size();
- }
- /*
- * Handle resource changes and project description changes
- *
- * @see IResourceChangeListener#resourceChanged(IResourceChangeEvent)
- */
- public void resourceChanged(IResourceChangeEvent event) {
- try {
- final List changedResources = new ArrayList();
- event.getDelta().accept(new IResourceDeltaVisitor() {
- public boolean visit(IResourceDelta delta) throws CoreException {
- IResource resource = delta.getResource();
-
- if(resource.getType()==IResource.ROOT) {
- // continue with the delta
- return true;
- }
-
- if (resource.getType() == IResource.PROJECT) {
- // If there is no CVS nature, don't continue
- if (RepositoryProvider.getProvider((IProject)resource, CVSProviderPlugin.getTypeId()) == null) {
- // deconfigure if appropriate (see CVSDecorator#projectDeconfigured(IProject))
- if (deconfiguredProjects.contains(resource)) {
- refresh((IProject)resource);
- deconfiguredProjects.remove(resource);
- }
- return false;
- }
- }
-
- switch (delta.getKind()) {
- case IResourceDelta.REMOVED:
- // remove the cached decoration for any removed resource
- cache.remove(resource);
- break;
- case IResourceDelta.CHANGED:
- // for changed resources we have to update the decoration
- changedResources.add(resource);
- }
-
- return true;
- }
- });
- resourceStateChanged((IResource[])changedResources.toArray(new IResource[changedResources.size()]));
- changedResources.clear();
- } catch (CoreException e) {
- CVSProviderPlugin.log(e.getStatus());
- }
- }
- /*
- * @see IResourceStateChangeListener#resourceStateChanged(IResource[])
- */
- public void resourceStateChanged(IResource[] changedResources) {
- // add depth first so that update thread processes parents first.
- //System.out.println(">> State Change Event");
- List resources = new ArrayList();
- List noProviderResources = new ArrayList();
- for (int i = 0; i < changedResources.length; i++) {
- // ignore subtrees that aren't associated with a provider, this can happen on import
- // of a new project to CVS.
- IResource resource = changedResources[i];
- if (getCVSProviderFor(resource) == null) {
- // post a changed event but forget any cached information about this resource
- noProviderResources.add(resource);
- }
- resources.addAll(computeParents(resource));
- }
-
- addResourcesToBeDecorated((IResource[]) resources.toArray(new IResource[resources.size()]));
-
- // post label events for resources that cannot or should not be decorated by CVS
- if(!noProviderResources.isEmpty()) {
- List resourcesToUpdate = new ArrayList();
- for (Iterator it = resources.iterator(); it.hasNext();) {
- IResource element = (IResource) it.next();
- resourcesToUpdate.add(element);
- }
- postLabelEvent(new LabelProviderChangedEvent(this, resourcesToUpdate.toArray()));
- }
- }
-
- private void clearCache() {
- cache.clear();
- }
-
- 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;
- }
- });
- resourceStateChanged((IResource[]) resources.toArray(new IResource[resources.size()]));
- } catch (CoreException e) {
- }
- }
-
- private List computeParents(IResource resource) {
- IResource current = resource;
- List resources = new ArrayList();
- if(CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_CALCULATE_DIRTY)) {
- while (current.getType() != IResource.ROOT) {
- resources.add(current);
- current = current.getParent();
- }
- } else {
- resources.add(current);
- }
- return resources;
- }
-
- private synchronized void addResourcesToBeDecorated(IResource[] resources) {
- if (resources.length > 0) {
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if(!decoratorNeedsUpdating.contains(resource)) {
- decoratorNeedsUpdating.add(resource);
- }
- }
- notify();
- }
- }
-
- /**
- * 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;
- }
-
- /**
- * 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);
- }
- });
- }
-
-
- private void shutdown() {
- shutdown = true;
- // Wake the thread up if it is asleep.
- synchronized (this) {
- notifyAll();
- }
- try {
- // Wait for the decorator thread to finish before returning.
- decoratorUpdateThread.join();
- } catch (InterruptedException e) {
- }
- }
-
- /*
- * @see IBaseLabelProvider#dispose()
- */
- public void dispose() {
- super.dispose();
-
- // terminate decoration thread
- shutdown();
-
- // unregister change listeners
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
- CVSProviderPlugin.removeResourceStateChangeListener(this);
-
- // dispose of images created as overlays
- decoratorNeedsUpdating.clear();
- clearCache();
- iconCache.disposeAll();
- }
- /**
- * @see IResourceStateChangeListener#projectConfigured(IProject)
- */
- public void projectConfigured(IProject project) {
- refresh(project);
- }
-
- /**
- * @see IResourceStateChangeListener#projectDeconfigured(IProject)
- */
- public void projectDeconfigured(IProject project) {
- // Unfortunately, the nature is still associated with the project at this point.
- // Therefore, we will remember that the project has been deconfigured and we will
- // refresh the decorators in the resource delta listener
- deconfiguredProjects.add(project);
- }
-
- public static boolean isDirty(ICVSFile cvsFile) {
- try {
- // file is dirty or file has been merged by an update
- if(!cvsFile.isIgnored()) {
- return cvsFile.isModified();
- } else {
- return false;
- }
- } catch (CVSException e) {
- //if we get an error report it to the log but assume dirty
- CVSUIPlugin.log(e.getStatus());
- return true;
- }
- }
-
- public static boolean isDirty(IFile file) {
- return isDirty(CVSWorkspaceRoot.getCVSFileFor(file));
- }
-
- public static boolean isDirty(IResource resource) {
- if(resource.getType() == IResource.FILE) {
- return isDirty((IFile) resource);
- }
-
- final CoreException DECORATOR_EXCEPTION = new CoreException(new Status(IStatus.OK, "id", 1, "", null)); //$NON-NLS-1$ //$NON-NLS-2$
- try {
- resource.accept(new IResourceVisitor() {
- public boolean visit(IResource resource) throws CoreException {
-
- // a project can't be dirty, continue with its children
- if (resource.getType() == IResource.PROJECT) {
- return true;
- }
-
- // if the resource does not exist in the workbench or on the file system, stop searching.
- if(!resource.exists()) {
- return false;
- }
-
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
-
- try {
- if (!cvsResource.isManaged()) {
- if (cvsResource.isIgnored()) {
- return false;
- } else {
- // new resource, show as dirty
- throw DECORATOR_EXCEPTION;
- }
- }
- } catch (CVSException e) {
- // isManaged threw an exception
- CVSUIPlugin.log(e.getStatus());
- return false;
- }
- if (!cvsResource.isFolder()) {
- if(isDirty((ICVSFile) cvsResource)) {
- throw DECORATOR_EXCEPTION;
- }
- }
- // no change -- keep looking in children
- return true;
- }
- }, IResource.DEPTH_INFINITE, true);
- } catch (CoreException e) {
- //if our exception was caught, we know there's a dirty child
- return e == DECORATOR_EXCEPTION;
- }
- return false;
- }
-} \ 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 53027e294..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorConfiguration.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.Map;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.team.internal.ccvs.core.CVSStatus;
-
-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_SEPSPACE = ' ';
- private static final char KEYWORD_SEPCOLON = ':';
- private static final char KEYWORD_SEPAT = '@';
-
- 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 1650bab57..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorPreferencesPage.java
+++ /dev/null
@@ -1,398 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-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.Control;
-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.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.dialogs.ListSelectionDialog;
-
-public class CVSDecoratorPreferencesPage extends PreferencePage implements IWorkbenchPreferencePage {
-
- private Button imageShowDirty;
- private Button imageShowHasRemote;
- private Button imageShowAdded;
-
- private Text fileTextFormat;
- private Text fileTextFormatExample;
-
- private Text folderTextFormat;
- private Text folderTextFormatExample;
-
- private Text projectTextFormat;
- private Text projectTextFormatExample;
-
- private Text dirtyFlag;
- private Text addedFlag;
-
- private Button showDirty;
-
- class StringPair {
- String s1;
- String s2;
- }
-
- class TextPair {
- TextPair(Text t1, Text t2) {
- this.t1 = t1;
- this.t2 = t2;
- }
- Text t1;
- Text t2;
- }
-
- 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) {
- updateExamples();
- }
- });
- Button b = new Button(composite, SWT.NONE);
- b.setText(buttonText);
- GridData 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);
- final Text formatToInsert = format;
- b.addListener(SWT.Selection, new Listener() {
- public void handleEvent (Event event) {
- addVariables(formatToInsert, supportedBindings);
- }
- });
-
- createLabel(composite, Policy.bind("Example__1"), 1); //$NON-NLS-1$
- Text example = new Text(composite, SWT.BORDER);
- example.setEditable(false);
- example.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- createLabel(composite, "", 1); // spacer //$NON-NLS-1$
- return new TextPair(format, example);
- }
-
- protected void updateExamples() {
- String example = ""; //$NON-NLS-1$
- Map bindings = new HashMap();
- try {
- ICVSRepositoryLocation location = CVSRepositoryLocation.fromString(":pserver:username@host.acme.org:/home/cvsroot"); //$NON-NLS-1$
- bindings.put(CVSDecoratorConfiguration.RESOURCE_TAG, "v2_0"); //$NON-NLS-1$
- bindings.put(CVSDecoratorConfiguration.FILE_KEYWORD,
- Command.KSUBST_TEXT.getShortDisplayText()); //$NON-NLS-1$
- bindings.put(CVSDecoratorConfiguration.FILE_REVISION, "1.34"); //$NON-NLS-1$
- bindings.put(CVSDecoratorConfiguration.DIRTY_FLAG, dirtyFlag.getText());
- bindings.put(CVSDecoratorConfiguration.ADDED_FLAG, addedFlag.getText());
- 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, "org.eclipse.project1"); //$NON-NLS-1$
- } catch(CVSException e) {
- example = e.getMessage();
- }
- bindings.put(CVSDecoratorConfiguration.RESOURCE_NAME, "file.txt"); //$NON-NLS-1$
- setTextFormatExample(bindings);
- bindings.remove(CVSDecoratorConfiguration.RESOURCE_NAME);
- bindings.put(CVSDecoratorConfiguration.RESOURCE_NAME, "folder"); //$NON-NLS-1$
- setFolderFormatExample(bindings);
- bindings.remove(CVSDecoratorConfiguration.RESOURCE_NAME);
- bindings.put(CVSDecoratorConfiguration.RESOURCE_NAME, "Project"); //$NON-NLS-1$
- setProjectFormatExample(bindings);
- }
-
- /**
- * @see PreferencePage#createContents(Composite)
- */
- protected Control createContents(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout= new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData());
-
- // file text decoration options
-
- Group fileTextGroup = new Group(composite, SWT.NULL);
- layout = new GridLayout();
- layout.numColumns = 3;
- fileTextGroup.setLayout(layout);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- fileTextGroup.setLayoutData(data);
- fileTextGroup.setText(Policy.bind("Text_Labels_12")); //$NON-NLS-1$
- createLabel(fileTextGroup, Policy.bind("Select_the_format_for_file,_folders,_and_project_text_labels__13"), 3); //$NON-NLS-1$
-
- TextPair format = createFormatEditorControl(fileTextGroup, Policy.bind("&File_Format__14"), Policy.bind("Add_&Variables_15"), getFileBindingDescriptions()); //$NON-NLS-1$ //$NON-NLS-2$
- fileTextFormat = format.t1;
- fileTextFormatExample = format.t2;
- 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;
- folderTextFormatExample = format.t2;
- format = createFormatEditorControl(fileTextGroup, Policy.bind("&Project_Format__18"), Policy.bind("Add_Variable&s_19"), getFolderBindingDescriptions()); //$NON-NLS-1$ //$NON-NLS-2$
- projectTextFormat = format.t1;
- projectTextFormatExample = format.t2;
-
- 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) {
- updateExamples();
- }
- });
- 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) {
- updateExamples();
- }
- });
-
- createLabel(fileTextGroup, "", 1); // spacer //$NON-NLS-1$
-
- // image decoration options
-
- Group imageGroup = new Group(composite, SWT.NULL);
- layout = new GridLayout();
- imageGroup.setLayout(layout);
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- imageGroup.setLayoutData(data);
- imageGroup.setText(Policy.bind("Icon_Overlays_24")); //$NON-NLS-1$
- 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$
-
- showDirty = createCheckBox(composite, Policy.bind("&Compute_deep_outgoing_state_for_folders_(disabling_this_will_improve_decorator_performance)_28")); //$NON-NLS-1$
-
- initializeValues();
- 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;
- label.setLayoutData(data);
- return label;
- }
-
- private Button createCheckBox(Composite group, String label) {
- Button button = new Button(group, SWT.CHECK);
- button.setText(label);
- return button;
- }
-
- protected void setTextFormatExample(Map bindings) {
- String example = CVSDecoratorConfiguration.bind(fileTextFormat.getText(), bindings);
- fileTextFormatExample.setText(example);
- }
-
- protected void setFolderFormatExample(Map bindings) {
- String example = CVSDecoratorConfiguration.bind(folderTextFormat.getText(), bindings);
- folderTextFormatExample.setText(example);
- }
-
- protected void setProjectFormatExample(Map bindings) {
- String example = CVSDecoratorConfiguration.bind(projectTextFormat.getText(), bindings);
- projectTextFormatExample.setText(example);
- }
-
- /**
- * 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));
-
- 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_CALCULATE_DIRTY, showDirty.getSelection());
-
- CVSDecorator.refresh();
-
- 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));
-
- 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 (Object[]) 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() != dialog.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$
- }
- }
-
- 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_subsitution_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;
- }
-} \ No newline at end of file
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 5c0d0257e..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFilePropertiesPage.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.text.DateFormat;
-import java.util.Date;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IAdaptable;
-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.CVSDateFormatter;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-public class CVSFilePropertiesPage extends PropertyPage {
- 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() ? 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 = syncInfo.getTag();
- if (tag == null) {
- createLabel(composite, Policy.bind("CVSFilePropertiesPage.none")); //$NON-NLS-1$
- } else {
- // In an entry file we can't differentiate branch and version tags. They both appear
- // as T<tagName>. Instead just display the tag name to the user.
- createLabel(composite, tag.getName());
- }
-
- // 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$
- }
- 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 525812488..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFolderPropertiesPage.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- ******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.IAdaptable;
-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.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-public class CVSFolderPropertiesPage extends PropertyPage {
-
- IFolder folder;
-
- /**
- * @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 {
- FolderSyncInfo syncInfo = cvsResource.getFolderSyncInfo();
- createLabel(composite, Policy.bind("CVSFolderPropertiesPage.root")); //$NON-NLS-1$
- createLabel(composite, syncInfo.getRoot());
- createLabel(composite, Policy.bind("CVSFolderPropertiesPage.repository")); //$NON-NLS-1$
- createLabel(composite, syncInfo.getRepository());
-
- // Tag
- createLabel(composite, Policy.bind("CVSFilePropertiesPage.tag")); //$NON-NLS-1$
- CVSTag tag = syncInfo.getTag();
- if (tag == null) {
- createLabel(composite, Policy.bind("CVSFilePropertiesPage.none")); //$NON-NLS-1$
- } else {
- switch (tag.getType()) {
- case CVSTag.HEAD:
- createLabel(composite, tag.getName());
- break;
- case CVSTag.VERSION:
- createLabel(composite, Policy.bind("CVSFilePropertiesPage.version", tag.getName())); //$NON-NLS-1$
- break;
- case CVSTag.BRANCH:
- createLabel(composite, Policy.bind("CVSFilePropertiesPage.branch", tag.getName())); //$NON-NLS-1$
- break;
- case CVSTag.DATE:
- createLabel(composite, Policy.bind("CVSFilePropertiesPage.date", tag.getName())); //$NON-NLS-1$
- break;
- }
- }
-
- // 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$
- }
-
- }
- } catch (TeamException e) {
- // Display error text
- createLabel(composite, Policy.bind("CVSFilePropertiesPage.error"), 2); //$NON-NLS-1$
- }
- 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;
- }
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLocalCompareEditorInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLocalCompareEditorInput.java
deleted file mode 100644
index f38b90806..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLocalCompareEditorInput.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.compare.structuremergeviewer.ICompareInput;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteResource;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.resources.CVSRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.util.Assert;
-import org.eclipse.team.internal.ccvs.ui.sync.CVSSyncCompareInput;
-import org.eclipse.team.internal.ui.sync.SyncView;
-
-public class CVSLocalCompareEditorInput extends CVSSyncCompareInput {
- CVSTag[] tags;
-
- public CVSLocalCompareEditorInput(IResource[] resources, CVSTag[] tags) {
- super(resources);
- Assert.isTrue(resources.length == tags.length);
- this.tags = tags;
- }
-
- public CVSLocalCompareEditorInput(IResource[] resources, CVSTag tag) {
- super(resources);
- Assert.isTrue(tag != null);
- this.tags = new CVSTag[] {tag};
- }
-
- public Viewer createDiffViewer(Composite parent) {
- Viewer viewer = super.createDiffViewer(parent);
- getViewer().syncModeChanged(SyncView.SYNC_COMPARE);
- return viewer;
- }
-
- protected IRemoteSyncElement[] createSyncElements(IProgressMonitor monitor) throws TeamException {
- IResource[] resources = getResources();
- IRemoteSyncElement[] trees = new IRemoteSyncElement[resources.length];
- int work = 100 * resources.length;
- monitor.beginTask(null, work);
- try {
- for (int i = 0; i < trees.length; i++) {
- IResource resource = resources[i];
- CVSTag tag;
- if(tags.length != resources.length) {
- tag = tags[0];
- } else {
- tag = tags[i];
- }
- IRemoteResource remote = CVSWorkspaceRoot.getRemoteTree(resource, tag, Policy.subMonitorFor(monitor, 50));
- trees[i] = new CVSRemoteSyncElement(false /* two-way */, resource, null, remote);
- }
- } finally {
- monitor.done();
- }
- //getViewer().resetFilters();
- return trees;
- }
-
- public String getTitle() {
- return Policy.bind("CVSLocalCompareEditorInput.title", tags[0].getName()); //$NON-NLS-1$
- }
-
- public boolean isSaveNeeded() {
- return false;
- }
-
- protected void contentsChanged(ICompareInput source) {
- }
-} \ No newline at end of file
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 8710d22f2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPerspective.java
+++ /dev/null
@@ -1 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui; /* * (c) Copyright IBM Corp. 2000, 2002. * All Rights Reserved. */ import org.eclipse.ui.*; public class CVSPerspective implements IPerspectiveFactory { /* (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); } /** * 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); } } \ No newline at end of file
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 f2bbf27c2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java
+++ /dev/null
@@ -1,458 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-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.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.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 List ksubstOptions;
- private Button considerContentsInCompare;
- private Button showMarkers;
- private Button replaceUnmanaged;
-
- 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$
- considerContentsInCompare = createCheckBox(composite, Policy.bind("CVSPreferencePage.considerContentsInCompare")); //$NON-NLS-1$
- showMarkers = createCheckBox(composite, Policy.bind("CVSPreferencePage.showAddRemoveMarkers")); //$NON-NLS-1$
- replaceUnmanaged = createCheckBox(composite, Policy.bind("CVSPreferencePage.replaceUnmanaged")); //$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(timeoutValue, IHelpContextIds.PREF_COMMS_TIMEOUT);
- WorkbenchHelp.setHelp(considerContentsInCompare, IHelpContextIds.PREF_CONSIDER_CONTENT);
- WorkbenchHelp.setHelp(replaceUnmanaged, IHelpContextIds.PREF_REPLACE_DELETE_UNMANAGED);
- WorkbenchHelp.setHelp(showMarkers, IHelpContextIds.PREF_MARKERS_ENABLED);
-
- 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());
- 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)));
- considerContentsInCompare.setSelection(store.getBoolean(ICVSUIConstants.PREF_CONSIDER_CONTENTS));
- showMarkers.setSelection(store.getBoolean(ICVSUIConstants.PREF_SHOW_MARKERS));
- replaceUnmanaged.setSelection(store.getBoolean(ICVSUIConstants.PREF_REPLACE_UNMANAGED));
-
- 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
-
- CVSProviderPlugin.getPlugin().setShowTasksOnAddAndDelete(showMarkers.getSelection());
-
- 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());
- store.setValue(ICVSUIConstants.PREF_TEXT_KSUBST, ((KSubstOption) ksubstOptions.get(ksubstCombo.getSelectionIndex())).toMode());
- store.setValue(ICVSUIConstants.PREF_CONSIDER_CONTENTS, considerContentsInCompare.getSelection());
- store.setValue(ICVSUIConstants.PREF_SHOW_MARKERS, showMarkers.getSelection());
- store.setValue(ICVSUIConstants.PREF_REPLACE_UNMANAGED, replaceUnmanaged.getSelection());
- store.setValue(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS, getSaveRadio());
-
- 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));
- KSubstOption oldKSubst = CVSProviderPlugin.getPlugin().getDefaultTextKSubstOption();
- KSubstOption newKSubst = KSubstOption.fromMode(store.getString(ICVSUIConstants.PREF_TEXT_KSUBST));
- CVSProviderPlugin.getPlugin().setDefaultTextKSubstOption(newKSubst);
-
- // changing the default keyword substitution mode for text files may affect
- // information displayed in the decorators
- if (! oldKSubst.equals(newKSubst)) CVSDecorator.refresh();
-
- 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)));
- showMarkers.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_SHOW_MARKERS));
- replaceUnmanaged.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_REPLACE_UNMANAGED));
- initializeSaveRadios(store.getDefaultInt(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS));
- }
-
- 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$
- }
-
- /**
- * 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;
- }
- }
-} \ No newline at end of file
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 48662edd0..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java
+++ /dev/null
@@ -1,369 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - 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.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-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.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.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-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.ICVSRepositoryLocation;
-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.dialogs.PropertyPage;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-public class CVSProjectPropertiesPage extends PropertyPage {
- IProject project;
- ICVSRepositoryLocation oldLocation;
- ICVSRepositoryLocation newLocation = null;
-
- private static final int TABLE_HEIGHT_HINT = 150;
- private static final int TABLE_WIDTH_HINT = 300;
-
- // Widgets
- Label methodLabel;
- Label userLabel;
- Label hostLabel;
- Label pathLabel;
- Label moduleLabel;
- Label portLabel;
- Label tagLabel;
-
- IUserInfo info;
- CVSTeamProvider provider;
-
- private class RepositorySelectionDialog extends Dialog {
- ICVSRepositoryLocation[] locations;
- ICVSRepositoryLocation location;
-
- TableViewer viewer;
- Button okButton;
- public RepositorySelectionDialog(Shell shell) {
- super(shell);
- }
- 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 = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- 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();
- data.widthHint = TABLE_WIDTH_HINT;
- 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) {
- return locations;
- }
- });
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection)event.getSelection();
- if (selection.isEmpty()) {
- location = null;
- okButton.setEnabled(false);
- } else {
- location = (ICVSRepositoryLocation)selection.getFirstElement();
- okButton.setEnabled(true);
- }
- }
- });
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- okPressed();
- }
- });
- viewer.setInput(locations);
- return composite;
- }
- protected void cancelPressed() {
- location = null;
- super.cancelPressed();
- }
- public void setLocations(ICVSRepositoryLocation[] locations) {
- this.locations = locations;
- }
- public ICVSRepositoryLocation getLocation() {
- return location;
- }
- };
-
- /*
- * @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("CVSPropertiesPage.connectionType"), 1); //$NON-NLS-1$
- methodLabel = createLabel(composite, "", 1); //$NON-NLS-1$
-
- label = createLabel(composite, Policy.bind("CVSPropertiesPage.user"), 1); //$NON-NLS-1$
- userLabel = createLabel(composite, "", 1); //$NON-NLS-1$
-
- label = createLabel(composite, Policy.bind("CVSPropertiesPage.host"), 1); //$NON-NLS-1$
- hostLabel = createLabel(composite, "", 1); //$NON-NLS-1$
-
- label = createLabel(composite, Policy.bind("CVSPropertiesPage.port"), 1); //$NON-NLS-1$
- portLabel = createLabel(composite, "", 1); //$NON-NLS-1$
-
- label = createLabel(composite, Policy.bind("CVSPropertiesPage.path"), 1); //$NON-NLS-1$
- pathLabel = createLabel(composite, "", 1); //$NON-NLS-1$
-
- label = createLabel(composite, Policy.bind("CVSPropertiesPage.module"), 1); //$NON-NLS-1$
- moduleLabel = createLabel(composite, "", 1); //$NON-NLS-1$
-
- label = createLabel(composite, Policy.bind("CVSPropertiesPage.tag"), 1); //$NON-NLS-1$
- tagLabel = createLabel(composite, "", 1); //$NON-NLS-1$
-
- 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();
- data.widthHint = 300;
- data.horizontalSpan = 2;
- label.setLayoutData(data);
-
- Button changeButton = new Button(composite, SWT.PUSH);
- changeButton.setText(Policy.bind("CVSProjectPropertiesPage.Change_Sharing_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, changeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- changeButton.setLayoutData(data);
- changeButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- // Find out which repo locations are appropriate
- ICVSRepositoryLocation[] locations = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownRoots();
- List compatibleLocations = new ArrayList();
- for (int i = 0; i < locations.length; i++) {
- ICVSRepositoryLocation location = locations[i];
- // Only locations with the same host and root are eligible
- if (!location.getHost().equals(hostLabel.getText())) continue;
- if (!location.getRootDirectory().equals(pathLabel.getText())) continue;
- if (location.equals(oldLocation)) continue;
- compatibleLocations.add(location);
- }
- RepositorySelectionDialog dialog = new RepositorySelectionDialog(getShell());
- dialog.setLocations((ICVSRepositoryLocation[])compatibleLocations.toArray(new ICVSRepositoryLocation[compatibleLocations.size()]));
- dialog.open();
- ICVSRepositoryLocation location = dialog.getLocation();
- if (location == null) return;
- newLocation = location;
- initializeValues(newLocation);
- }
- });
-
- initializeValues(oldLocation);
- 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;
- }
- /**
- * 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();
- } 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;
- methodLabel.setText(location.getMethod().getName());
- info = location.getUserInfo(true);
- userLabel.setText(info.getUsername());
- hostLabel.setText(location.getHost());
- int port = location.getPort();
- if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT) {
- portLabel.setText(Policy.bind("CVSPropertiesPage.defaultPort")); //$NON-NLS-1$
- } else {
- portLabel.setText("" + port); //$NON-NLS-1$
- }
- pathLabel.setText(location.getRootDirectory());
- FolderSyncInfo syncInfo = folder.getFolderSyncInfo();
- if (syncInfo == null) return;
- moduleLabel.setText(syncInfo.getRepository());
- } catch (TeamException e) {
- handle(e);
- }
-
- initializeTag();
- }
-
- private void initializeTag() {
- provider = (CVSTeamProvider)RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId());
- if (provider == null) return;
- CVSWorkspaceRoot cvsRoot = provider.getCVSWorkspaceRoot();
- try {
- ICVSFolder local = cvsRoot.getCVSFolderFor(project);
- CVSTag tag = local.getFolderSyncInfo().getTag();
- String tagName;
- if (tag == null) {
- tagName = CVSTag.DEFAULT.getName();
- } else {
- tagName = tag.getName();
- }
- tagLabel.setText(tagName);
- } catch (TeamException e) {
- handle(e);
- }
- }
- /*
- * @see PreferencesPage#performOk
- */
- public boolean performOk() {
- if (newLocation == null) {
- return true;
- }
- try {
- new ProgressMonitorDialog(getShell()).run(true, false, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- provider.setRemoteRoot(newLocation, monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- if (t instanceof TeamException) {
- handle((TeamException)t);
- } else if (t instanceof CoreException) {
- handle(((CoreException)t).getStatus());
- } else {
- IStatus status = new Status(IStatus.ERROR, CVSUIPlugin.ID, 1, Policy.bind("internal"), t); //$NON-NLS-1$
- handle(status);
- CVSUIPlugin.log(status);
- }
- } catch (InterruptedException e) {
- return false;
- }
-
- return true;
- }
- /**
- * Shows the given errors to the user.
- */
- protected void handle(TeamException e) {
- handle(e.getStatus());
- }
-
- protected void handle(IStatus status) {
- if (!status.isOK()) {
- IStatus toShow = status;
- if (status.isMultiStatus()) {
- IStatus[] children = status.getChildren();
- if (children.length == 1) {
- toShow = children[0];
- }
- }
- ErrorDialog.openError(getShell(), status.getMessage(), null, toShow);
- }
- }
-}
-
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 6b548799c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectSetSerializer.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - 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.CVSProvider;
-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.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.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 CVSProvider provider = CVSProvider.getInstance();
- 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] = CVSRepositoryLocation.fromString(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) {
- provider.checkout(locations[i], projects[i], modules[i], tags[i], new SubProgressMonitor(monitor, 1000));
- }
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } 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 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/CVSRemoveResolutionGenerator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSRemoveResolutionGenerator.java
deleted file mode 100644
index c38784003..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSRemoveResolutionGenerator.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Date;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFileState;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-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.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-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.MutableResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.AddDeleteMoveListener;
-import org.eclipse.ui.IMarkerResolution;
-
-/**
- * Generate marker resoultions for a cvs remove marker
- */
-public class CVSRemoveResolutionGenerator extends CVSAbstractResolutionGenerator {
- IMarkerResolution commitDeletion =new IMarkerResolution() {
- public String getLabel() {
- return Policy.bind("CVSRemoveResloutionGenerator.Commit_Deletion_to_CVS_1"); //$NON-NLS-1$
- }
- public void run(IMarker marker) {
- try {
- final IContainer parent = (IContainer)marker.getResource();
- final String childName = (String)marker.getAttribute(AddDeleteMoveListener.NAME_ATTRIBUTE);
- ICVSFile mFile = CVSWorkspaceRoot.getCVSFileFor(parent.getFile(new Path(childName)));
- final TeamException[] exception = new TeamException[] {null};
- CVSRemoveResolutionGenerator.this.run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)throws InvocationTargetException, InterruptedException {
- try {
- ((CVSTeamProvider)RepositoryProvider.getProvider(parent.getProject())).checkin(new IResource[] {parent.getFile(new Path(childName))}, IResource.DEPTH_ZERO, monitor);
- } catch (TeamException e) {
- exception[0] = e;
- }
- }
- });
- if (exception[0] != null) {
- throw exception[0];
- }
- marker.delete();
- } catch (TeamException e) {
- handle(e, null, null);
- } catch (CoreException e) {
- handle(e, null, null);
- } catch (InvocationTargetException e) {
- handle(e, null, null);
- } catch (InterruptedException e) {
- // do nothing
- }
- }
- };
-
- IMarkerResolution undoDeletionLocal = new IMarkerResolution() {
- public String getLabel() {
- return Policy.bind("CVSRemoveResloutionGenerator.Undo_Deletion_from_Local_History_2"); //$NON-NLS-1$
- }
- public void run(IMarker marker) {
- try {
- final IContainer parent = (IContainer)marker.getResource();
- final String childName = (String)marker.getAttribute(AddDeleteMoveListener.NAME_ATTRIBUTE);
- final IFile file = parent.getFile(new Path(childName));
- final ICVSFile mFile = CVSWorkspaceRoot.getCVSFileFor(parent.getFile(new Path(childName)));
-
- boolean recreated = false;
- IFileState[] history = file.getHistory(null);
- for (int i = 0; i < history.length; i++) {
- IFileState state = history[i];
- if (state.exists()) {
- file.create(state.getContents(), false, null);
- mFile.setTimeStamp(new Date(state.getModificationTime()));
- recreated = true;
- break;
- }
- }
-
- if (recreated) {
- if (mFile.isManaged()) {
- ResourceSyncInfo info = mFile.getSyncInfo();
- if (info.isDeleted()) {
- MutableResourceSyncInfo deletedInfo = info.cloneMutable();
- deletedInfo.setDeleted(false);
- mFile.setSyncInfo(deletedInfo);
- }
- }
- marker.delete();
- } else {
- throw new CVSException(Policy.bind("CVSRemoveResloutionGenerator.No_local_history_available._Try_undoing_from_the_server_3")); //$NON-NLS-1$
- }
- } catch (TeamException e) {
- handle(e, null, null);
- } catch (CoreException e) {
- handle(e, null, null);
- }
- }
- };
-
- IMarkerResolution undoDeletion = new IMarkerResolution() {
- public String getLabel() {
- return Policy.bind("CVSRemoveResloutionGenerator.Undo_Deletion_from_CVS_Server_4"); //$NON-NLS-1$
- }
- public void run(IMarker marker) {
- try {
- final IContainer parent = (IContainer)marker.getResource();
- final String childName = (String)marker.getAttribute(AddDeleteMoveListener.NAME_ATTRIBUTE);
- final IFile file = parent.getFile(new Path(childName));
- final ICVSFile mFile = CVSWorkspaceRoot.getCVSFileFor(parent.getFile(new Path(childName)));
-
- if (mFile.isManaged()) {
- ResourceSyncInfo info = mFile.getSyncInfo();
- if (info.isDeleted()) {
- MutableResourceSyncInfo deletedInfo = info.cloneMutable();
- deletedInfo.setDeleted(false);
- mFile.setSyncInfo(deletedInfo);
- }
- }
-
- final TeamException[] exception = new TeamException[] {null};
- CVSRemoveResolutionGenerator.this.run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)throws InvocationTargetException, InterruptedException {
- try {
- CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(parent.getProject());
- provider.update(new IResource[] { parent.getFile(new Path(childName)) },
- Command.NO_LOCAL_OPTIONS, null, true /*createBackups*/, monitor);
- } catch (TeamException e) {
- exception[0] = e;
- }
- }
- });
- if (exception[0] != null) {
- throw exception[0];
- }
- marker.delete();
- } catch (TeamException e) {
- handle(e, null, null);
- } catch (CoreException e) {
- handle(e, null, null);
- } catch (InvocationTargetException e) {
- handle(e, null, null);
- } catch (InterruptedException e) {
- // do nothing
- }
- }
- };
-
- /*
- * @see IMarkerResolutionGenerator#getResolutions(IMarker)
- */
- public IMarkerResolution[] getResolutions(IMarker marker) {
- return new IMarkerResolution[] {
- commitDeletion, undoDeletionLocal, undoDeletion
- };
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSRepositoryPropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSRepositoryPropertiesPage.java
deleted file mode 100644
index efe42d63b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSRepositoryPropertiesPage.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- ******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-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.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-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.Label;
-import org.eclipse.swt.widgets.Listener;
-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.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.IUserInfo;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-public class CVSRepositoryPropertiesPage extends PropertyPage {
- ICVSRepositoryLocation location;
-
- // Widgets
- Text userText;
- Text passwordText;
- Combo methodType;
- Label hostLabel;
- Label pathLabel;
- Label portLabel;
-
- boolean passwordChanged;
- boolean connectionInfoChanged;
-
- IUserInfo info;
-
- /*
- * @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);
-
- Label label = createLabel(composite, Policy.bind("CVSPropertiesPage.connectionType"), 1); //$NON-NLS-1$
- methodType = createCombo(composite);
-
- label = createLabel(composite, Policy.bind("CVSPropertiesPage.user"), 1); //$NON-NLS-1$
- userText = createTextField(composite);
-
- label = createLabel(composite, Policy.bind("CVSPropertiesPage.password"), 1); //$NON-NLS-1$
- passwordText = createTextField(composite);
- passwordText.setEchoChar('*');
-
- label = createLabel(composite, Policy.bind("CVSPropertiesPage.host"), 1); //$NON-NLS-1$
- hostLabel = createLabel(composite, "", 2); //$NON-NLS-1$
-
- label = createLabel(composite, Policy.bind("CVSPropertiesPage.port"), 1); //$NON-NLS-1$
- portLabel = createLabel(composite, "", 2); //$NON-NLS-1$
-
- label = createLabel(composite, Policy.bind("CVSPropertiesPage.path"), 1); //$NON-NLS-1$
- pathLabel = createLabel(composite, "", 2); //$NON-NLS-1$
-
- initializeValues();
- passwordText.addListener(SWT.Modify, new Listener() {
- public void handleEvent(Event event) {
- passwordChanged = true;
- }
- });
- userText.addListener(SWT.Modify, new Listener() {
- public void handleEvent(Event event) {
- connectionInfoChanged = true;
- }
- });
- methodType.addListener(SWT.Modify, new Listener() {
- public void handleEvent(Event event) {
- connectionInfoChanged = true;
- }
- });
- 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);
- 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;
- }
- /**
- * 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;
-
- String[] methods = CVSProviderPlugin.getProvider().getSupportedConnectionMethods();
- for (int i = 0; i < methods.length; i++) {
- methodType.add(methods[i]);
- }
- String method = location.getMethod().getName();
- methodType.select(methodType.indexOf(method));
- info = location.getUserInfo(true);
- userText.setText(info.getUsername());
- passwordText.setText("*********"); //$NON-NLS-1$
- hostLabel.setText(location.getHost());
- int port = location.getPort();
- if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT) {
- portLabel.setText(Policy.bind("CVSPropertiesPage.defaultPort")); //$NON-NLS-1$
- } else {
- portLabel.setText("" + port); //$NON-NLS-1$
- }
- pathLabel.setText(location.getRootDirectory());
- }
-
- /*
- * @see PreferencesPage#performOk
- */
- public boolean performOk() {
- if (!connectionInfoChanged && !passwordChanged) {
- return true;
- }
- info.setUsername(userText.getText());
- if (passwordChanged) {
- info.setPassword(passwordText.getText());
- }
- final String type = methodType.getText();
- final String password = passwordText.getText();
- final boolean[] result = new boolean[] { false };
- try {
- new ProgressMonitorDialog(getShell()).run(false, false, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- // Check if the password was the only thing to change.
- if (passwordChanged && !connectionInfoChanged) {
- CVSRepositoryLocation oldLocation = (CVSRepositoryLocation)location;
- oldLocation.setPassword(password);
- oldLocation.updateCache();
- result[0] = true;
- return;
- }
-
- // Create a new repository location with the new information
- CVSRepositoryLocation newLocation = CVSRepositoryLocation.fromString(location.getLocation());
- newLocation.setMethod(type);
- newLocation.setUserInfo(info);
-
- // 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]);
- break;
- }
- }
- }
- if (projects.size() > 0) {
- // To do: warn the user
- boolean r = MessageDialog.openConfirm(getShell(), Policy.bind("CVSRepositoryPropertiesPage.Confirm_Project_Sharing_Changes_1"), Policy.bind("CVSRepositoryPropertiesPage.There_are_projects_in_the_workspace_shared_with_this_repository._The_projects_will_be_updated_with_the_new_information_that_you_have_entered_2")); //$NON-NLS-1$ //$NON-NLS-2$
- if (!r) {
- 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
- CVSProviderPlugin.getProvider().disposeRepository(location);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- result[0] = true;
- }
- });
- } catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- if (t instanceof TeamException) {
- handle((TeamException)t);
- } else if (t instanceof CoreException) {
- handle(((CoreException)t).getStatus());
- } else {
- IStatus status = new Status(IStatus.ERROR, CVSUIPlugin.ID, 1, Policy.bind("internal"), t); //$NON-NLS-1$
- handle(status);
- CVSUIPlugin.log(status);
- }
- } catch (InterruptedException e) {
- }
-
- return result[0];
- }
- /**
- * Shows the given errors to the user.
- */
- protected void handle(TeamException e) {
- handle(e.getStatus());
- }
-
- protected void handle(IStatus status) {
- if (!status.isOK()) {
- IStatus toShow = status;
- if (status.isMultiStatus()) {
- IStatus[] children = status.getChildren();
- if (children.length == 1) {
- toShow = children[0];
- }
- }
- ErrorDialog.openError(getShell(), status.getMessage(), null, toShow);
- }
- }
-}
-
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 dea3cd3a9..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
+++ /dev/null
@@ -1,439 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.Hashtable;
-import java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-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.internal.ccvs.core.CVSProviderPlugin;
-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.core.util.AddDeleteMoveListener;
-import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
-import org.eclipse.team.internal.ccvs.ui.model.CVSAdapterFactory;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.texteditor.WorkbenchChainedTextFontFieldEditor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * UI Plugin for CVS provider-specific workbench functionality.
- */
-public class CVSUIPlugin extends AbstractUIPlugin implements IPropertyChangeListener {
- /**
- * 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$
-
- private Hashtable imageDescriptors = new Hashtable(20);
-
- public final static String ICON_PATH;
- static {
- final String iconPath[] = new String[1];
- final Display display = Display.getDefault();
- display.syncExec(new Runnable() {
- public void run() {
- if (display.getIconDepth() > 4) {
- iconPath[0] = ICVSUIConstants.ICON_PATH_FULL;
- } else {
- iconPath[0] = ICVSUIConstants.ICON_PATH_BASIC;
- }
- }
- });
- ICON_PATH = iconPath[0];
- }
-
- // timeout in milliseconds before displaying a progress monitor dialog
- // (used for normally short-running interactive operations)
- private static final int TIMEOUT = 2000;
-
- /**
- * The singleton plug-in instance
- */
- private static CVSUIPlugin plugin;
-
- /**
- * The repository manager
- */
- private RepositoryManager repositoryManager;
-
- // Property change listener
- IPropertyChangeListener listener = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(TeamUI.GLOBAL_IGNORES_CHANGED)) {
- CVSDecorator.refresh();
- }
- }
- };
-
- /**
- * CVSUIPlugin constructor
- *
- * @param descriptor the plugin descriptor
- */
- public CVSUIPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- plugin = this;
- getPreferenceStore().addPropertyChangeListener(this);
- }
-
- /**
- * 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, ICON_PATH + id);
- } catch (MalformedURLException e) {
- }
- ImageDescriptor desc = ImageDescriptor.createFromURL(url);
- imageDescriptors.put(id, desc);
- }
-
- /**
- * Returns the active workbench page.
- *
- * @return the active workbench page
- */
- public static IWorkbenchPage getActivePage() {
- IWorkbenchWindow window = getPlugin().getWorkbench().getActiveWorkbenchWindow();
- if (window == null) return null;
- return window.getActivePage();
- }
-
- /**
- * 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.getStatus());
- 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 {
- TeamUIPlugin.runWithProgress(parent, cancelable, runnable);
- }
-
- /**
- * Creates a progress monitor and runs the specified runnable.
- *
- * @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 runWithProgressDialog(Shell parent, boolean cancelable,
- final IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
-
- new ProgressMonitorDialog(parent).run(cancelable, 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 RepositoryManager getRepositoryManager() {
- return repositoryManager;
- }
-
- /**
- * Initializes the table of images used in this plugin.
- */
- private void initializeImages() {
- URL baseURL = getDescriptor().getInstallURL();
-
- // objects
- createImageDescriptor(ICVSUIConstants.IMG_REPOSITORY, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_REFRESH, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_NEWLOCATION, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_TAG, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_CLEAR, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_BRANCHES_CATEGORY, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_VERSIONS_CATEGORY, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_PROJECT_VERSION, baseURL);
- createImageDescriptor(ICVSUIConstants.IMG_WIZBAN_BRANCH, 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);
-
- // 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);
- }
-
- /**
- * Initializes the preferences for this plugin if necessary.
- */
- protected void initializePreferences() {
- IPreferenceStore store = getPreferenceStore();
- store.setDefault(ICVSUIConstants.PREF_SHOW_COMMENTS, true);
- store.setDefault(ICVSUIConstants.PREF_SHOW_TAGS, true);
- store.setDefault(ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES, CVSProviderPlugin.DEFAULT_PRUNE);
- store.setDefault(ICVSUIConstants.PREF_TIMEOUT, CVSProviderPlugin.DEFAULT_TIMEOUT);
- store.setDefault(ICVSUIConstants.PREF_SHOW_MODULES, false);
- store.setDefault(ICVSUIConstants.PREF_CONSIDER_CONTENTS, false);
- store.setDefault(ICVSUIConstants.PREF_SHOW_MARKERS, 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_REPLACE_UNMANAGED, true);
- store.setDefault(ICVSUIConstants.PREF_CVS_RSH, CVSProviderPlugin.DEFAULT_CVS_RSH);
- store.setDefault(ICVSUIConstants.PREF_CVS_SERVER, CVSProviderPlugin.DEFAULT_CVS_SERVER);
- store.setDefault(ICVSUIConstants.PREF_PROMPT_ON_CHANGE_GRANULARITY, true);
-
- 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));
- WorkbenchChainedTextFontFieldEditor.startPropagate(store, ICVSUIConstants.PREF_CONSOLE_FONT);
- store.setDefault(ICVSUIConstants.PREF_CONSOLE_AUTO_OPEN, false);
-
- 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_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_ADDED_FLAG, CVSDecoratorConfiguration.DEFAULT_ADDED_FLAG);
- store.setDefault(ICVSUIConstants.PREF_DIRTY_FLAG, CVSDecoratorConfiguration.DEFAULT_DIRTY_FLAG);
- 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);
-
- // 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().setCvsServer(store.getString(ICVSUIConstants.PREF_CVS_SERVER));
- CVSProviderPlugin.getPlugin().setQuietness(CVSPreferencesPage.getQuietnessOptionFor(store.getInt(ICVSUIConstants.PREF_QUIETNESS)));
- CVSProviderPlugin.getPlugin().setShowTasksOnAddAndDelete(store.getBoolean(ICVSUIConstants.PREF_SHOW_MARKERS));
- 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)));
- }
-
- /**
- * @see Plugin#startup()
- */
- public void startup() throws CoreException {
- super.startup();
- Policy.localize("org.eclipse.team.internal.ccvs.ui.messages"); //$NON-NLS-1$
-
- CVSAdapterFactory factory = new CVSAdapterFactory();
- Platform.getAdapterManager().registerAdapters(factory, ICVSRemoteFile.class);
- Platform.getAdapterManager().registerAdapters(factory, ICVSRemoteFolder.class);
- Platform.getAdapterManager().registerAdapters(factory, ICVSRepositoryLocation.class);
-
- initializeImages();
- initializePreferences();
- repositoryManager = new RepositoryManager();
-
- // if the global ignores list is changed then update decorators.
- TeamUI.addPropertyChangeListener(listener);
-
- try {
- repositoryManager.startup();
- } catch (TeamException e) {
- throw new CoreException(e.getStatus());
- }
-
- Console.startup();
- }
-
- /**
- * @see Plugin#shutdown()
- */
- public void shutdown() throws CoreException {
- super.shutdown();
- TeamUI.removePropertyChangeListener(listener);
- try {
- repositoryManager.shutdown();
- } catch (TeamException e) {
- throw new CoreException(e.getStatus());
- }
-
- Console.shutdown();
- }
-
- /**
- * @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- try {
- String property = event.getProperty();
- if(property.equals(ICVSUIConstants.PREF_SHOW_MARKERS)) {
- Boolean b = (Boolean)event.getNewValue();
- if(b.booleanValue() == true) {
- AddDeleteMoveListener.refreshAllMarkers();
- } else {
- AddDeleteMoveListener.clearAllCVSMarkers();
- }
- }
- } catch(CoreException e) {
- log(e.getStatus());
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Console.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Console.java
deleted file mode 100644
index 189f4633f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Console.java
+++ /dev/null
@@ -1,429 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial implementation
- ******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-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.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocumentListener;
-import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.jface.text.TextViewer;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.custom.LineStyleEvent;
-import org.eclipse.swt.custom.LineStyleListener;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSStatus;
-import org.eclipse.team.internal.ccvs.core.client.listeners.IConsoleListener;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IViewPart;
-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.part.ViewPart;
-import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-
-/**
- * Console is a view that displays the communication with the CVS server
- */
-public class Console extends ViewPart {
- public static final String CONSOLE_ID = "org.eclipse.team.ccvs.ui.console"; //$NON-NLS-1$
- private static final DateFormat TIME_FORMAT = new SimpleDateFormat(Policy.bind("Console.resultTimeFormat")); //$NON-NLS-1$
- private static ConsoleDocument document;
- private static List /* of Console */ instances;
-
- private TextViewer viewer;
- private Color commandColor;
- private Color messageColor;
- private Color errorColor;
- private Font consoleFont;
-
- private IDocumentListener documentListener;
- private IPropertyChangeListener propertyChangeListener;
- private TextViewerAction copyAction;
- private TextViewerAction selectAllAction;
- private Action clearOutputAction;
-
- /*
- * Called on UI plugin startup.
- */
- public static void startup() {
- document = new ConsoleDocument();
- instances = new ArrayList();
- CVSProviderPlugin.getPlugin().setConsoleListener(new ConsoleListener());
- }
-
- /*
- * Called on UI plugin shutdown.
- */
- public static void shutdown() {
- document = null;
- instances = null;
- CVSProviderPlugin.getPlugin().setConsoleListener(null);
- }
-
- public Console() {
- }
-
- /*
- * @see WorkbenchPart#dispose
- */
- public void dispose() {
- // remove listeners
- if (documentListener != null) {
- document.removeDocumentListener(documentListener);
- documentListener = null;
- }
- if (propertyChangeListener != null) {
- getPreferenceStore().removePropertyChangeListener(propertyChangeListener);
- propertyChangeListener = null;
- }
- instances.remove(this);
- //if (instances.isEmpty()) document.clear();
-
- // dispose of allocated colors and fonts
- super.dispose();
- if (commandColor != null) {
- commandColor.dispose();
- commandColor = null;
- }
- if (messageColor != null) {
- messageColor.dispose();
- messageColor = null;
- }
- if (errorColor != null) {
- errorColor.dispose();
- errorColor = null;
- }
- if (consoleFont != null) {
- consoleFont.dispose();
- consoleFont = null;
- }
- }
-
- /*
- * @see WorkbenchPart#setFocus()
- */
- public void setFocus() {
- viewer.getTextWidget().setFocus();
- }
-
- /*
- * @see WorkbenchPart#createPartControl(Composite)
- */
- public void createPartControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
-
- updatePreferences(null);
-
- // F1 Help
- WorkbenchHelp.setHelp(composite, IHelpContextIds.CONSOLE_VIEW);
-
- // create the viewer
- viewer = new TextViewer(composite, SWT.V_SCROLL | SWT.H_SCROLL);
- GridData data = new GridData(GridData.FILL_BOTH);
- viewer.getControl().setLayoutData(data);
- viewer.setEditable(false);
- viewer.setDocument(document);
- viewer.getTextWidget().setFont(consoleFont);
-
- // add a selection listener to control enablement of the copy action
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- copyAction.update();
- }
- });
-
- // add a line styler for colouring lines according to their type
- viewer.getTextWidget().addLineStyleListener(new LineStyleListener() {
- public void lineGetStyle(LineStyleEvent event) {
- StyleRange style = new StyleRange(event.lineOffset, event.lineText.length(),
- getConsoleLineColor(event.lineOffset), null);
- event.styles = new StyleRange[] { style };
- }
- });
-
- // create the viewer actions
- createActions();
-
- // add a property change listener to update when preferences change
- propertyChangeListener = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- updatePreferences(event.getProperty());
- }
- };
- getPreferenceStore().addPropertyChangeListener(propertyChangeListener);
-
- // add a document listener for auto-scrolling
- documentListener = new IDocumentListener() {
- public void documentAboutToBeChanged(DocumentEvent event) {
- }
- public void documentChanged(DocumentEvent event) {
- if (viewer == null) return;
- // always focus on the last line without changing the horizontal scrolling index
- // we can get away with doing it this way because the viewer is read only
- StyledText styledText = viewer.getTextWidget();
- if (styledText.isDisposed()) return;
- styledText.setTopIndex(styledText.getLineCount());
- }
- };
- document.addDocumentListener(documentListener);
-
- // we're open -- remember us
- instances.add(this);
- }
-
- /**
- * Create contributed actions
- */
- private void createActions() {
- clearOutputAction = new Action(Policy.bind("Console.clearOutput"), CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_CLEAR)) { //$NON-NLS-1$
- public void run() {
- document.clear();
- }
- };
- clearOutputAction.setToolTipText(Policy.bind("Console.clearOutput")); //$NON-NLS-1$
-
- MenuManager mgr = new MenuManager();
- mgr.setRemoveAllWhenShown(true);
- mgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager mgr) {
- fillContextMenu(mgr);
- }
- });
- Menu menu = mgr.createContextMenu(viewer.getControl());
- viewer.getControl().setMenu(menu);
-
- // Create the local tool bar
- IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager();
- tbm.add(clearOutputAction);
- tbm.update(false);
-
-
- // Create actions for the text editor
- IActionBars actionBars = getViewSite().getActionBars();
-
- copyAction = new TextViewerAction(viewer, ITextOperationTarget.COPY);
- copyAction.setText(Policy.bind("Console.copy")); //$NON-NLS-1$
- actionBars.setGlobalActionHandler(ITextEditorActionConstants.COPY, copyAction);
-
- selectAllAction = new TextViewerAction(viewer, ITextOperationTarget.SELECT_ALL);
- selectAllAction.setText(Policy.bind("Console.selectAll")); //$NON-NLS-1$
- actionBars.setGlobalActionHandler(ITextEditorActionConstants.SELECT_ALL, selectAllAction);
-
- actionBars.updateActionBars();
- }
-
- /**
- * Add the actions to the context menu
- *
- * @param manager the manager of the context menu
- */
- private void fillContextMenu(IMenuManager manager) {
- manager.add(copyAction);
- manager.add(selectAllAction);
- manager.add(new Separator());
- manager.add(clearOutputAction);
- }
-
- /**
- * Returns the color for the line containing the specified offset.
- */
- private Color getConsoleLineColor(int offset) {
- switch (document.getLineType(offset)) {
- case ConsoleDocument.COMMAND:
- case ConsoleDocument.STATUS:
- case ConsoleDocument.DELIMITER:
- return commandColor;
- case ConsoleDocument.MESSAGE:
- return messageColor;
- case ConsoleDocument.ERROR:
- return errorColor;
- default:
- throw new IllegalStateException();
- }
- }
-
- /**
- * Updates the console's font and colors.
- */
- private void updatePreferences(String property) {
- Display display = getViewSite().getShell().getDisplay();
- // update the console colors
- if (property == null ||
- property.equals(ICVSUIConstants.PREF_CONSOLE_COMMAND_COLOR) ||
- property.equals(ICVSUIConstants.PREF_CONSOLE_MESSAGE_COLOR) ||
- property.equals(ICVSUIConstants.PREF_CONSOLE_ERROR_COLOR)) {
- Color oldCommandColor = commandColor;
- Color oldMessageColor = messageColor;
- Color oldErrorColor = errorColor;
- commandColor = createColor(display, ICVSUIConstants.PREF_CONSOLE_COMMAND_COLOR);
- messageColor = createColor(display, ICVSUIConstants.PREF_CONSOLE_MESSAGE_COLOR);
- errorColor = createColor(display, ICVSUIConstants.PREF_CONSOLE_ERROR_COLOR);
- if (oldCommandColor != null) {
- if (viewer != null && ! viewer.getControl().isDisposed()) {
- viewer.refresh();
- }
- oldCommandColor.dispose();
- oldMessageColor.dispose();
- oldErrorColor.dispose();
- }
- }
- // update the console font
- if (property == null ||
- property.equals(ICVSUIConstants.PREF_CONSOLE_FONT)) {
- Font oldConsoleFont = consoleFont;
- consoleFont = createFont(display, ICVSUIConstants.PREF_CONSOLE_FONT);
- if (oldConsoleFont != null) {
- if (viewer != null && ! viewer.getControl().isDisposed()) {
- viewer.getTextWidget().setFont(consoleFont);
- }
- oldConsoleFont.dispose();
- }
- }
- }
-
- /**
- * Returns a color instance based on data from a preference field.
- */
- private Color createColor(Display display, String preference) {
- RGB rgb = PreferenceConverter.getColor(getPreferenceStore(), preference);
- return new Color(display, rgb);
- }
-
- /**
- * Returns a font instance based on data from a preference field.
- */
- private Font createFont(Display display, String preference) {
- FontData fontData = PreferenceConverter.getFontData(getPreferenceStore(), preference);
- return new Font(display, fontData);
- }
-
- /**
- * Appends a line to the console if any views are open.
- */
- private static void appendConsoleLine(final int type, final String line) {
- Display display = Display.getCurrent();
- if (display == null) {
- display = Display.getDefault();
- }
- display.asyncExec(new Runnable() {
- public void run() {
- if (getPreferenceStore().getBoolean(ICVSUIConstants.PREF_CONSOLE_AUTO_OPEN)) {
- findInActivePerspective();
- }
- if (document == null) return;
- document.appendConsoleLine(type, line, instances.isEmpty());
- }
- });
- }
-
- /**
- * Makes the CVS Console view visible in the active perspective. If there
- * isn't a CVS Console view registered <code>null</code> is returned.
- * Otherwise the opened view part is returned.
- *
- * Must be called from the UI thread.
- */
- private static Console findInActivePerspective() {
- try {
- IWorkbenchPage page = CVSUIPlugin.getActivePage();
- IViewPart consolePart = page.findView(CONSOLE_ID);
- if (consolePart == null) {
- IWorkbenchPart activePart = page.getActivePart();
- consolePart = page.showView(CONSOLE_ID);
- //restore focus stolen by the creation of the console
- if (activePart != null) page.activate(activePart);
- } else {
- page.bringToTop(consolePart);
- }
- return (Console) consolePart;
- } catch (PartInitException pe) {
- return null;
- }
- }
-
- /**
- * Returns the console preference store.
- */
- private static IPreferenceStore getPreferenceStore() {
- return CVSUIPlugin.getPlugin().getPreferenceStore();
- }
-
- private static class ConsoleListener implements IConsoleListener {
- private long commandStarted = 0;
-
- public void commandInvoked(String line) {
- commandStarted = System.currentTimeMillis();
- appendConsoleLine(ConsoleDocument.DELIMITER, Policy.bind("Console.preExecutionDelimiter")); //$NON-NLS-1$
- appendConsoleLine(ConsoleDocument.COMMAND, line);
- }
- public void messageLineReceived(String line) {
- appendConsoleLine(ConsoleDocument.MESSAGE, " " + line); //$NON-NLS-1$
- }
- public void errorLineReceived(String line) {
- appendConsoleLine(ConsoleDocument.ERROR, " " + line); //$NON-NLS-1$
- }
- public void commandCompleted(IStatus status, Exception exception) {
- long commandRuntime = System.currentTimeMillis() - commandStarted;
- String time = TIME_FORMAT.format(new Date(commandRuntime));
- String statusText;
- if (status != null && status.getCode() == CVSStatus.SERVER_ERROR) {
- statusText = Policy.bind("Console.resultServerError", time); //$NON-NLS-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$
- }
- } else {
- statusText = Policy.bind("Console.resultOk", time); //$NON-NLS-1$
- }
- appendConsoleLine(ConsoleDocument.STATUS, statusText);
- appendConsoleLine(ConsoleDocument.DELIMITER, Policy.bind("Console.postExecutionDelimiter")); //$NON-NLS-1$
- appendConsoleLine(ConsoleDocument.DELIMITER, ""); //$NON-NLS-1$
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConsoleDocument.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConsoleDocument.java
deleted file mode 100644
index 48c40882a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConsoleDocument.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial implementation
- ******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.text.AbstractDocument;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.DefaultLineTracker;
-import org.eclipse.jface.text.GapTextStore;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSStatus;
-
-public class ConsoleDocument extends AbstractDocument {
- 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 = null;
- private int currentLine = 0;
-
- /**
- * Creates an empty console document.
- */
- public ConsoleDocument() {
- setTextStore(new GapTextStore(512, 1024));
- setLineTracker(new DefaultLineTracker());
- completeInitialization();
- }
-
- /**
- * Clears the console document.
- */
- public void clear() {
- lineTypes = null;
- currentLine = 0;
- set(""); //$NON-NLS-1$
- }
-
- /**
- * Gets the line type for the line containing the specified offset.
- */
- public int getLineType(int offset) {
- try {
- int line = getLineOfOffset(offset);
- if (line < currentLine) return lineTypes[line];
- } catch (BadLocationException e) {
- CVSProviderPlugin.log(CVSException.wrapException(e));
- }
- return 0;
- }
-
- /**
- * Appends a line of the specified type to the end of the console.
- */
- public void appendConsoleLine(int type, String line, boolean purgeExcess) {
- if (lineTypes == null) {
- lineTypes = new int[16];
- } else if (currentLine >= lineTypes.length) {
- int[] oldLineTypes = lineTypes;
- lineTypes = new int[oldLineTypes.length * 2];
- System.arraycopy(oldLineTypes, 0, lineTypes, 0, oldLineTypes.length);
- }
- lineTypes[currentLine++] = type;
- try {
- replace(getLength(), 0, line + "\n"); //$NON-NLS-1$
- if (purgeExcess && type == COMMAND) {
- keepPreviousCommands(2);
- }
- } catch (BadLocationException e) {
- CVSProviderPlugin.log(CVSException.wrapException(e));
- }
- }
-
- /**
- * Return the indicies of the lines that contain command strings
- */
- private int[] getCommandLines() {
- List commandLineList = new ArrayList();
- for (int i = 0; i < currentLine; i++) {
- if (lineTypes[i] == COMMAND) {
- commandLineList.add(new Integer(i));
- }
- }
- int[] commandLines = new int[commandLineList.size()];
- int i = 0;
- for (Iterator iter = commandLineList.iterator(); iter.hasNext(); ) {
- commandLines[i++] = ((Integer) iter.next()).intValue();
- }
- return commandLines;
- }
-
- /**
- * Purge all but the output of the last N commands from the document
- */
- private void keepPreviousCommands(int number) throws BadLocationException{
- // Get the index of the line and character to keep
- int[] commandLines = getCommandLines();
- if (commandLines.length <= number) return;
- int lineIndex = commandLines[commandLines.length - number];
- int characterIndex = getLineOffset(lineIndex);
-
- // Keep everything from the character to the end
- set(get(characterIndex, getLength() - characterIndex));
-
- // Adjust the line types
- int[] oldLineTypes = lineTypes;
- lineTypes = new int[oldLineTypes.length];
- System.arraycopy(oldLineTypes, lineIndex, lineTypes, 0, oldLineTypes.length - lineIndex);
- currentLine -= lineIndex;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConsolePreferencesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConsolePreferencesPage.java
deleted file mode 100644
index c7933a8ac..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConsolePreferencesPage.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial implementation
- ******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.jface.preference.ColorFieldEditor;
-import org.eclipse.jface.preference.IPreferenceStore;
-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.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.texteditor.WorkbenchChainedTextFontFieldEditor;
-
-public class ConsolePreferencesPage extends PreferencePage implements IWorkbenchPreferencePage {
-
- private ColorFieldEditor commandColorEditor;
- private ColorFieldEditor messageColorEditor;
- private ColorFieldEditor errorColorEditor;
- private WorkbenchChainedTextFontFieldEditor fontEditor;
- private Button autoOpenCheckBox;
-
- /**
- * 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.marginHeight = 0;
- layout.marginHeight = 0;
- layout.numColumns = numColumns;
- composite.setLayout(layout);
-
- //GridData
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- composite.setLayoutData(data);
- return composite;
- }
-
- /**
- * @see PreferencePage#createContents(Composite)
- */
- protected Control createContents(Composite parent) {
- Composite composite = createComposite(parent, 2);
- createLabel(composite, Policy.bind("ConsolePreferencePage.consoleColorSettings")); //$NON-NLS-1$
-
- commandColorEditor = createColorFieldEditor(ICVSUIConstants.PREF_CONSOLE_COMMAND_COLOR,
- Policy.bind("ConsolePreferencePage.commandColor"), composite); //$NON-NLS-1$
- messageColorEditor = createColorFieldEditor(ICVSUIConstants.PREF_CONSOLE_MESSAGE_COLOR,
- Policy.bind("ConsolePreferencePage.messageColor"), composite); //$NON-NLS-1$
- errorColorEditor = createColorFieldEditor(ICVSUIConstants.PREF_CONSOLE_ERROR_COLOR,
- Policy.bind("ConsolePreferencePage.errorColor"), composite); //$NON-NLS-1$
-
- fontEditor = new WorkbenchChainedTextFontFieldEditor(ICVSUIConstants.PREF_CONSOLE_FONT,
- Policy.bind("ConsolePreferencePage.font"), composite); //$NON-NLS-1$
- fontEditor.setPreferencePage(this);
- fontEditor.setPreferenceStore(getPreferenceStore());
-
- autoOpenCheckBox = createCheckBox(composite, Policy.bind("ConsolePreferencePage.autoOpen")); //$NON-NLS-1$
-
- initializeValues();
- 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 = 3;
- button.setLayoutData(data);
- return button;
- }
- /**
- * 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 = 3;
- 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());
- new Label(parent, SWT.NONE); // fill in 3rd column
- return editor;
- }
-
- /**
- * Initializes states of the controls from the preference store.
- */
- private void initializeValues() {
- IPreferenceStore store = getPreferenceStore();
- commandColorEditor.load();
- messageColorEditor.load();
- errorColorEditor.load();
- fontEditor.load();
- autoOpenCheckBox.setSelection(store.getBoolean(ICVSUIConstants.PREF_CONSOLE_AUTO_OPEN));
- }
-
- /**
- * @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();
- commandColorEditor.store();
- messageColorEditor.store();
- errorColorEditor.store();
- fontEditor.store();
- store.setValue(ICVSUIConstants.PREF_CONSOLE_AUTO_OPEN, autoOpenCheckBox.getSelection());
- return true;
- }
-
- /**
- * Defaults was clicked. Restore the CVS preferences to
- * their default values
- */
- protected void performDefaults() {
- super.performDefaults();
- IPreferenceStore store = getPreferenceStore();
- commandColorEditor.loadDefault();
- messageColorEditor.loadDefault();
- errorColorEditor.loadDefault();
- fontEditor.loadDefault();
- autoOpenCheckBox.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_CONSOLE_AUTO_OPEN));
- }
-
- /**
- * 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();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DetailsDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DetailsDialog.java
deleted file mode 100644
index 8633e4ab5..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DetailsDialog.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial implementation
- ******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * A simple superclass for detail button dialogs.
- */
-abstract public class DetailsDialog extends Dialog {
- /**
- * The Details button.
- */
- private Button detailsButton;
-
- /**
- * The Ok button.
- */
- private Button okButton;
-
- /**
- * The title of the dialog.
- */
- private String title;
-
- /**
- * The error message
- */
- private Label errorMessageLabel;
-
- /**
- * The SWT list control that displays the error details.
- */
- private Composite detailsComposite;
-
- /**
- * Indicates whether the error details viewer is currently created.
- */
- private boolean detailsCreated = false;
-
- /**
- * Creates a details pane dialog.
- * Note that the dialog will have no visual representation (no widgets)
- * until it is told to open.
- *
- * @param parentShell the shell under which to create this dialog
- * @param dialogTitle the title to use for this dialog
- * @param message the message to show in this dialog
- * @param status the error to show to the user
- * @param displayMask the mask to use to filter the displaying of child items,
- * as per <code>IStatus.matches</code>
- * @see org.eclipse.core.runtime.IStatus#matches
- */
- public DetailsDialog(Shell parentShell, String dialogTitle) {
- super(parentShell);
- this.title = dialogTitle;
- setShellStyle(SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL);
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- * Handles the pressing of the Ok or Details button in this dialog.
- * If the Ok button was pressed then close this dialog. If the Details
- * button was pressed then toggle the displaying of the error details area.
- * Note that the Details button will only be visible if the error being
- * displayed specifies child details.
- */
- protected void buttonPressed(int id) {
- if (id == IDialogConstants.DETAILS_ID) { // was the details button pressed?
- toggleDetailsArea();
- } else {
- super.buttonPressed(id);
- }
- }
-
- /* (non-Javadoc)
- * Method declared in Window.
- */
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(title);
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void createButtonsForButtonBar(Composite parent) {
- // create OK and Details buttons
- okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- detailsButton = createButton(parent, IDialogConstants.DETAILS_ID, IDialogConstants.SHOW_DETAILS_LABEL, false);
- updateEnablements();
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- * Creates and returns the contents of the upper part
- * of the dialog (above the button bar).
- */
- final protected Control createDialogArea(Composite parent) {
- // create composite
- Composite composite = (Composite)super.createDialogArea(parent);
-
- createMainDialogArea(composite);
-
- errorMessageLabel = new Label(composite, SWT.NONE);
- errorMessageLabel.setLayoutData(new GridData(
- GridData.GRAB_HORIZONTAL |
- GridData.HORIZONTAL_ALIGN_FILL));
- errorMessageLabel.setFont(parent.getFont());
- errorMessageLabel.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_RED));
-
- return composite;
- }
-
- /**
- * Creates the dialog's top composite
- *
- * @param parent the parent composite
- */
- abstract protected void createMainDialogArea(Composite parent);
-
- /**
- * Create this dialog's drop-down list component.
- *
- * @param parent the parent composite
- * @return the drop-down list component
- */
- abstract protected Composite createDropDownDialogArea(Composite parent);
-
- /**
- * Toggles the unfolding of the details area. This is triggered by
- * the user pressing the details button.
- */
- private void toggleDetailsArea() {
- Point windowSize = getShell().getSize();
- Point oldSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT);
-
- if (detailsCreated) {
- detailsComposite.dispose();
- detailsCreated = false;
- detailsButton.setText(IDialogConstants.SHOW_DETAILS_LABEL);
- } else {
- detailsComposite = createDropDownDialogArea((Composite)getContents());
- detailsCreated = true;
- detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL);
- }
-
- Point newSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT);
-
- getShell().setSize(new Point(windowSize.x, windowSize.y + (newSize.y - oldSize.y)));
- }
-
- final protected void setErrorMessage(String error) {
- if(errorMessageLabel != null) {
- if(error == null || error.length() == 0) {
- errorMessageLabel.setText(""); //$NON-NLS-1$
- } else {
- errorMessageLabel.setText(error);
- }
- errorMessageLabel.update();
- }
- }
-
- final protected void setPageComplete(boolean complete) {
- if(okButton != null ) {
- okButton.setEnabled(complete);
- }
- }
-
- abstract protected void updateEnablements();
-}
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 acda8d5c8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ExtMethodPreferencePage.java
+++ /dev/null
@@ -1,151 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.resource.JFaceResources;
-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.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.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-public class ExtMethodPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
-
- Text cvsRsh;
- Text cvsServer;
-
- /*
- * @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 = 3;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData());
-
- Label intro = new Label(composite, SWT.LEFT);
- intro.setText(Policy.bind("ExtMethodPreferencePage_message")); //$NON-NLS-1$
- GridData data = new GridData();
- data.horizontalSpan = 3;
- data.horizontalAlignment = GridData.FILL;
- intro.setLayoutData(data);
-
- new Label(composite, SWT.NULL); new Label(composite, SWT.NULL); new Label(composite, SWT.NULL); // spacer
-
- 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);
- }
- }
- });
-
-
- Label l = new Label(composite, SWT.LEFT | SWT.BOLD);
- l.setText(Policy.bind("ExtMethodPreferencePage_Note__5")); //$NON-NLS-1$
- l.setFont(JFaceResources.getBannerFont());
-
- l = new Label(composite, SWT.LEFT);
- l.setText(Policy.bind("ExtMethodPreferencePage_note_CVS_RSH")); //$NON-NLS-1$
- data = new GridData();
- data.horizontalSpan = 2;
- data.horizontalAlignment = GridData.FILL;
- l.setLayoutData(data);
-
- new Label(composite, SWT.NULL); new Label(composite, SWT.NULL); new Label(composite, SWT.NULL); // spacer
-
- 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);
-
- l = new Label(composite, SWT.LEFT | SWT.BOLD);
- l.setText(Policy.bind("ExtMethodPreferencePage_Note__8")); //$NON-NLS-1$
- l.setFont(JFaceResources.getBannerFont());
-
- l = new Label(composite, SWT.LEFT);
- l.setText(Policy.bind("ExtMethodPreferencePage_NoteForCVS_SERVER")); //$NON-NLS-1$
- data = new GridData();
- data.horizontalSpan = 2;
- data.horizontalAlignment = GridData.FILL;
- l.setLayoutData(data);
-
-
- initializeDefaults();
-
- return composite;
- }
-
- protected void initializeDefaults() {
- IPreferenceStore store = getPreferenceStore();
- cvsRsh.setText(store.getString(ICVSUIConstants.PREF_CVS_RSH));
- cvsServer.setText(store.getString(ICVSUIConstants.PREF_CVS_SERVER));
- }
-
- /*
- * 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();
- store.setValue(ICVSUIConstants.PREF_CVS_RSH, cvsRsh.getText());
- store.setValue(ICVSUIConstants.PREF_CVS_SERVER, cvsServer.getText());
- CVSProviderPlugin.getPlugin().setCvsRshCommand(cvsRsh.getText());
- CVSProviderPlugin.getPlugin().setCvsServer(cvsServer.getText());
- CVSUIPlugin.getPlugin().savePluginPreferences();
- return super.performOk();
- }
- /*
- * @see PreferencePage#doGetPreferenceStore()
- */
- protected IPreferenceStore doGetPreferenceStore() {
- return CVSUIPlugin.getPlugin().getPreferenceStore();
- }
-}
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 498571788..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryDropAdapter.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-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);
- 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 9966bb4eb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryFilter.java
+++ /dev/null
@@ -1,64 +0,0 @@
-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;
- }
-} \ No newline at end of file
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 38190ef3f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryFilterAction.java
+++ /dev/null
@@ -1,45 +0,0 @@
-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) {
- }
-} \ No newline at end of file
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 c74b3079e..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryFilterDialog.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- ******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.text.DateFormat;
-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;
-
-public class HistoryFilterDialog extends Dialog {
-
- private boolean dateEntered;
- 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;
- 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[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);
- toDayCombo.setItems(days);
- fromMonthCombo.setItems(months);
- toMonthCombo.setItems(months);
- fromYearCombo.setItems(years);
- toYearCombo.setItems(years);
- fromYearCombo.select(0);
- toYearCombo.select(0);
-
- initializeValues();
- 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) - 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);
- }
- if (historyFilter.toDate != null) {
- calendar.setTime(historyFilter.toDate);
- toDayCombo.select(calendar.get(Calendar.DATE) - 1);
- toMonthCombo.select(calendar.get(Calendar.MONTH));
- 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 calander 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(),
- Integer.parseInt(String.valueOf(fromDayCombo.getText())),
- 00, 00, 00);
- fromDate = calendar.getTime();
-
- //set the calander 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(),
- 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;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistorySorter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistorySorter.java
deleted file mode 100644
index 57c31f1b2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistorySorter.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.Date;
-
-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.ILogEntry;
-
-/**
- * This sorter is used by the HistoryView
- */
-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 = {
- {0, 2, 3, 4, 1}, /* revision */
- {1, 0, 2, 3, 4}, /* tags */
- {2, 0, 3, 4, 1}, /* date */
- {3, 0, 2, 4, 1}, /* author */
- {4, 0, 2, 3, 1} /* 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 = (ILogEntry)o1;
- ILogEntry e2 = (ILogEntry)o2;
- int[] columnSortOrder = SORT_ORDERS_BY_COLUMN[columnNumber];
- int result = 0;
- 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;
- }
-}
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 77a24fb66..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java
+++ /dev/null
@@ -1,736 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.io.InputStream;
-import java.text.DateFormat;
-import java.util.Date;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-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.ErrorDialog;
-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.jface.text.Document;
-import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.jface.text.TextViewer;
-import org.eclipse.jface.viewers.ColumnWeightData;
-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.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.events.SelectionAdapter;
-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.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-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.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ILogEntry;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
-import org.eclipse.team.internal.ccvs.ui.actions.OpenLogEntryAction;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.part.ResourceTransfer;
-import org.eclipse.ui.part.ViewPart;
-import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * 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 CVSTeamProvider provider;
-
- 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 SashForm sashForm;
- private SashForm innerSashForm;
-
- //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;
-
- private Image branchImage;
- private Image versionImage;
-
- private ILogEntry currentSelection;
- private String currentRevision;
-
- class HistoryLabelProvider extends LabelProvider implements ITableLabelProvider {
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
- public String getColumnText(Object element, int columnIndex) {
- ILogEntry entry = (ILogEntry)element;
- switch (columnIndex) {
- case COL_REVISION:
- String revision = entry.getRevision();
- if (file == null) return revision;
- 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$
- }
- }
-
- public static final String VIEW_ID = "org.eclipse.team.ccvs.ui.HistoryView"; //$NON-NLS-1$
-
- /**
- * Adds the action contributions for this view.
- */
- protected void contributeActions() {
- // Refresh (toolbar)
- refreshAction = new Action(Policy.bind("HistoryView.refreshLabel"), CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_REFRESH)) { //$NON-NLS-1$
- public void run() {
- BusyIndicator.showWhile(tableViewer.getTable().getDisplay(), new Runnable() {
- public void run() {
- tableViewer.refresh();
- }
- });
- }
- };
- refreshAction.setToolTipText(Policy.bind("HistoryView.refresh")); //$NON-NLS-1$
-
- // 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"), 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();
- }
- }
- });
-
-
- getRevisionAction = getContextMenuAction(Policy.bind("HistoryView.getRevisionAction"), new IWorkspaceRunnable() { //$NON-NLS-1$
- public void run(IProgressMonitor monitor) throws CoreException {
- ICVSRemoteFile remoteFile = currentSelection.getRemoteFile();
- try {
- if(confirmOverwrite()) {
- CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(file.getProject());
- CVSTag revisionTag = new CVSTag(remoteFile.getRevision(), CVSTag.VERSION);
-
- if(CVSAction.checkForMixingTags(getSite().getShell(), new IResource[] {file}, revisionTag)) {
- provider.update(new IResource[] {file}, new Command.LocalOption[] {Command.UPDATE.IGNORE_LOCAL_CHANGES},
- revisionTag, true /*create backups*/, monitor);
- currentRevision = revisionTag.getName();
- tableViewer.refresh();
- }
- }
- } catch (TeamException e) {
- throw new CoreException(e.getStatus());
- }
- }
- });
-
- // 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));
- // 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));
-
- // 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.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());
- }
- }
- /**
- * Creates the columns for the history table.
- */
- private void createColumns(Table table, TableLayout layout) {
- SelectionListener headerListener = getColumnListener();
- // 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));
- }
- /*
- * Method declared on IWorkbenchPart
- */
- public void createPartControl(Composite parent) {
- 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(tableViewer.getControl(), IHelpContextIds.RESOURCE_HISTORY_VIEW);
- initDragAndDrop();
- }
- 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) {
- 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);
-
- createColumns(table, layout);
-
- TableViewer viewer = new TableViewer(table);
- 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;
- final Object[][] result = new Object[1][];
- try {
- new ProgressMonitorDialog(getViewer().getTable().getShell()).run(true, false, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- entries = remoteFile.getLogEntries(monitor);
- result[0] = entries;
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InterruptedException e) { // ignore cancellation
- result[0] = new Object[0];
- } catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- if (t instanceof TeamException) {
- ErrorDialog.openError(getViewSite().getShell(), null, null, ((TeamException) t).getStatus());
- }
- result[0] = new Object[0];
- }
- return result[0];
- }
- public void dispose() {
- }
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- entries = null;
- }
- });
- viewer.setLabelProvider(new HistoryLabelProvider());
-
- 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());
- }
- });
-
- // By default, reverse sort by revision.
- HistorySorter sorter = new HistorySorter(COL_REVISION);
- sorter.setReversed(true);
- viewer.setSorter(sorter);
-
- 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() {
- if (branchImage != null) {
- branchImage.dispose();
- branchImage = null;
- }
- if (versionImage != null) {
- versionImage.dispose();
- versionImage = null;
- }
- }
- /**
- * Adds the listener that sets the sorter.
- */
- private SelectionListener getColumnListener() {
- /**
- * 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));
- }
- }
- };
- }
- /**
- * 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("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) {
- if (resource instanceof IFile) {
- IFile file = (IFile)resource;
- this.file = file;
- RepositoryProvider teamProvider = RepositoryProvider.getProvider(file.getProject(), CVSProviderPlugin.getTypeId());
- if (teamProvider != null) {
- this.provider = (CVSTeamProvider)teamProvider;
- try {
- ICVSRemoteFile remoteFile = (ICVSRemoteFile)CVSWorkspaceRoot.getRemoteResourceFor(file);
- currentRevision = remoteFile.getRevision();
- tableViewer.setInput(remoteFile);
- setTitle(Policy.bind("HistoryView.titleWithArgument", remoteFile.getName())); //$NON-NLS-1$
- } catch (TeamException e) {
- ErrorDialog.openError(getViewSite().getShell(), null, null, e.getStatus());
- }
- }
- return;
- }
- this.file = null;
- tableViewer.setInput(null);
- setTitle(Policy.bind("HistoryView.title")); //$NON-NLS-1$
- }
-
- /**
- * Shows the history for the given ICVSRemoteFile in the view.
- */
- public void showHistory(ICVSRemoteFile file, String currentRevision) {
- if (file == null) {
- tableViewer.setInput(null);
- setTitle(Policy.bind("HistoryView.title")); //$NON-NLS-1$
- return;
- }
- this.currentRevision = currentRevision;
- this.file = null;
- tableViewer.setInput(file);
- setTitle(Policy.bind("HistoryView.titleWithArgument", file.getName())); //$NON-NLS-1$
- }
-
- private Action getContextMenuAction(String title, 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;
- new ProgressMonitorDialog(getViewSite().getShell()).run(false, true, new WorkspaceModifyOperation() {
- protected void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- action.run(monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- if (t instanceof TeamException) {
- ErrorDialog.openError(getViewSite().getShell(), null, null, ((TeamException)t).getStatus());
- } else if (t instanceof CoreException) {
- IStatus status = ((CoreException)t).getStatus();
- ErrorDialog.openError(getViewSite().getShell(), null, null, status);
- CVSUIPlugin.log(status);
- } else {
- // To do
- }
- } 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()) {
- 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.getStatus());
- }
- }
- return true;
- }
-} \ No newline at end of file
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 b5e09da99..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui;
-
-public interface ICVSUIConstants {
- // image paths
- public final String ICON_PATH_FULL = "icons/full/"; //$NON-NLS-1$
- public final String ICON_PATH_BASIC = "icons/basic/"; //$NON-NLS-1$
-
- // images
-
- // 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$
-
- // 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_PROJECT_VERSION = "obj16/prjversions_rep.gif"; //$NON-NLS-1$
-
- // toolbar
- public final String IMG_REFRESH = "clcl16/refresh.gif"; //$NON-NLS-1$
- public final String IMG_CLEAR = "clcl16/clear_co.gif"; //$NON-NLS-1$
-
- // wizards
- public final String IMG_NEWLOCATION = "wizards/newlocation_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_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_SHOW_MODULES = "pref_show_modules"; //$NON-NLS-1$
- public final String PREF_CVS_RSH = "pref_cvs_rsh"; //$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_SHOW_MARKERS = "pref_show_markers"; //$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_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$
-
- // 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_AUTO_OPEN = "pref_console_auto_open"; //$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_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$
-
- // Wizard banners
- public final String IMG_WIZBAN_SHARE = "wizban/newconnect_wizban.gif"; //$NON-NLS-1$
- public final String IMG_WIZBAN_BRANCH = "wizban/newstream_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$
-
- // 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; //$NON-NLS-1$
- public final int OPTION_PROMPT = 2; //$NON-NLS-1$
- public final int OPTION_AUTOMATIC = 3; //$NON-NLS-1$
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IDecorationNotifier.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IDecorationNotifier.java
deleted file mode 100644
index d465f5893..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IDecorationNotifier.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IResource;
-
-public interface IDecorationNotifier {
-
- /**
- * Answers the next resource that needs decorating.
- */
- public IResource next();
-
- /**
- * Called to associate a decoration to a resource.
- */
- public void decorated(IResource[] resource, CVSDecoration[] decoration);
-
- /**
- * Number of resources remaining to be decorated
- */
- public int remaining();
-}
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 c146f2da8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial implementation
- ******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-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$
-
- // Different uses of the TagSelectionDialog (not done)
- 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_remot_with_existing_dialog_context"; //$NON-NLS-1$
-
- // Different uses of the TagAsVersionDialog (not done)
- public static final String TAG_LOCAL_AS_VERSION_DIALOG = PREFIX + "tag_local_as_version_dialog_context"; //$NON-NLS-1$
- public static final String TAG_REMOTE_AS_VERSION_DIALOG = PREFIX + "tag_remote_as_version_dialog_context"; //$NON-NLS-1$
-
- // Different uses of InputDialog from actions (not done)
- public static final String DEFINE_BRANCH_DIALOG = PREFIX + "define_branch_dialog_context"; //$NON-NLS-1$
- public static final String DEFINE_VERSION_DIALOG = PREFIX + "define_version_dialog_context"; //$NON-NLS-1$
-
- // Wizards
- // (not done)
- public static final String SHARING_WIZARD = PREFIX + "sharing_wizard_context"; //$NON-NLS-1$
- public static final String KEYWORD_SUBSTITUTION_WIZARD = PREFIX + "keyword_substituton_wizard_context"; //$NON-NLS-1$
- public static final String NEW_LOCATION_WIZARD = PREFIX + "new_location_wizard_context"; //$NON-NLS-1$
- public static final String PATCH_WIZARD = PREFIX + "patch_wizard_context"; //$NON-NLS-1$
-
- // Wizard Pages (not done)
- 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_FINISH_PAGE = PREFIX + "sharing_finish_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$
-
- // 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_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_MARKERS_ENABLED = PREFIX + "markers_enabled_pref"; //$NON-NLS-1$
- public static final String PREF_REPLACE_DELETE_UNMANAGED = PREFIX + "replace_deletion_of_unmanaged_pref"; //$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$
-
- // Viewers
- public static final String CATCHUP_RELEASE_VIEWER = PREFIX + "catchup_release_viewer_context"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IPromptCondition.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IPromptCondition.java
deleted file mode 100644
index 4ebe0cd6c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IPromptCondition.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial implementation
- ******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.core.resources.IResource;
-
-/**
- * Input to a confirm prompt
- */
-public interface IPromptCondition {
- /**
- * Answers <code>true</code> if a prompt is required for this resource and
- * false otherwise.
- */
- public boolean needsPrompt(IResource resource);
-
- /**
- * Answers the message to include in the prompt.
- */
- public String promptMessage(IResource resource);
-}
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 c3e72d3bb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IRepositoryListener.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.model.BranchTag;
-
-public interface IRepositoryListener {
- public void repositoryAdded(ICVSRepositoryLocation root);
- public void repositoryRemoved(ICVSRepositoryLocation root);
- public void branchTagsAdded(CVSTag[] tags, ICVSRepositoryLocation root);
- public void branchTagsRemoved(CVSTag[] tags, ICVSRepositoryLocation root);
- public void versionTagsAdded(CVSTag[] tags, ICVSRepositoryLocation root);
- public void versionTagsRemoved(CVSTag[] tags, ICVSRepositoryLocation root);
-}
-
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 571426960..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IgnoreResourcesDialog.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial 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;
-
-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_WIDTH_HINT = 400;
- 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());
-
- createWrappingLabel(top, Policy.bind("IgnoreResourcesDialog.description")); //$NON-NLS-1$
- createIndentedLabel(top, "", 0); // blank line //$NON-NLS-1$
- 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$
- statusMessageLabel.setFont(parent.getFont());
- 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 Label createWrappingLabel(Composite parent, String text) {
- Label label = new Label(parent, SWT.WRAP);
- label.setText(text);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = LABEL_WIDTH_HINT;
- label.setLayoutData(data);
- return label;
- }
-
- 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/OverlayIcon.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/OverlayIcon.java
deleted file mode 100644
index 40f5f2e83..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/OverlayIcon.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- ******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.Arrays;
-
-import org.eclipse.jface.resource.CompositeImageDescriptor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-
-/**
- * An OverlayIcon consists of a main icon and several adornments.
- */
-public abstract class OverlayIcon extends CompositeImageDescriptor {
- // the base image
- private Image base;
- // the overlay images
- private ImageDescriptor[] overlays;
- // the size
- private Point size;
-
- /**
- * OverlayIcon constructor.
- *
- * @param base the base image
- * @param overlays the overlay images
- * @param size the size
- */
- public OverlayIcon(Image base, ImageDescriptor[] overlays, Point size) {
- this.base = base;
- this.overlays = overlays;
- this.size = size;
- }
- /**
- * Superclasses override to draw the overlays.
- */
- protected abstract void drawOverlays(ImageDescriptor[] overlays);
-
- public boolean equals(Object o) {
- if (! (o instanceof OverlayIcon)) return false;
- OverlayIcon other = (OverlayIcon) o;
- return base.equals(other.base) && Arrays.equals(overlays, other.overlays);
- }
-
- public int hashCode() {
- int code = base.hashCode();
- for (int i = 0; i < overlays.length; i++) {
- code ^= overlays[i].hashCode();
- }
- return code;
- }
-
-
- protected void drawCompositeImage(int width, int height) {
- drawImage(base.getImageData(), 0, 0);
- drawOverlays(overlays);
- }
-
- protected Point getSize() {
- return size;
- }
-}
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 6b465cdcb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/OverlayIconCache.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial 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;
-
-/**
- * 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/Policy.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Policy.java
deleted file mode 100644
index 05883a96a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Policy.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.text.MessageFormat;
-import java.util.Locale;
-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.SubProgressMonitor;
-
-public class Policy {
- 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())
- 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);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/PromptingDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/PromptingDialog.java
deleted file mode 100644
index 6ecbf78f2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/PromptingDialog.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial implementation
- ******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * A confirmation dialog helper that will either show a 'yes/no/yes to all/cancel'
- * dialog to confirm an action performed on several resources or if only one
- * resource is specified 'ok/cancel' will be shown.
- */
-public class PromptingDialog {
- private IResource[] resources;
- private Shell shell;
- private String[] buttons;
- private boolean confirmOverwrite = true;
- private IPromptCondition condition;
- private String title;
-
- /**
- * Prompt for the given resources using the specific condition. The prompt dialog will
- * have the title specified.
- */
- public PromptingDialog(Shell shell, IResource[] resources, IPromptCondition condition, String title) {
- this.condition = condition;
- this.resources = resources;
- this.title = title;
- this.shell = shell;
- if(resources.length == 1) {
- buttons = new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL};
- } else {
- buttons = new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.NO_LABEL,
- IDialogConstants.YES_TO_ALL_LABEL,
- IDialogConstants.CANCEL_LABEL};
- }
- }
-
- /**
- * Call to calculate and show prompt. If no resources satisfy the prompt condition
- * a dialog won't be shown. The resources for which the user confirmed the action
- * are returned.
- */
- public IResource[] promptForMultiple() throws InterruptedException {
- List targetResources = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (condition.needsPrompt(resource) && confirmOverwrite) {
- if (confirmOverwrite(condition.promptMessage(resource))) {
- targetResources.add(resource);
- }
- } else {
- targetResources.add(resource);
- }
- }
- return (IResource[]) targetResources.toArray(new IResource[targetResources.size()]);
- }
-
- /**
- * A helper prompt condition for prompting for CVS dirty state.
- */
- public static IPromptCondition getOverwriteLocalChangesPrompt() {
- return new IPromptCondition() {
- public boolean needsPrompt(IResource resource) {
- return CVSDecorator.isDirty(resource);
- }
- public String promptMessage(IResource resource) {
- return Policy.bind("ReplaceWithAction.localChanges", resource.getName());//$NON-NLS-1$
- }
- };
- }
-
- /**
- * Opens the confirmation dialog based on the prompt condition settings.
- */
- private boolean confirmOverwrite(String msg) throws InterruptedException {
- if (!confirmOverwrite) {
- return true;
- }
- final MessageDialog dialog =
- new MessageDialog(shell, title, null, msg, MessageDialog.QUESTION, buttons, 0);
-
- // run in syncExec because callback is from an operation,
- // which is probably not running in the UI thread.
- shell.getDisplay().syncExec(
- new Runnable() {
- public void run() {
- dialog.open();
- }
- });
- switch (dialog.getReturnCode()) {
- case 0://Yes
- return true;
- case 1://No or Cancel
- return false;
- case 2://Yes to all
- confirmOverwrite = false;
- return true;
- case 3://Cancel
- default:
- throw new InterruptedException();
- }
- }
-}
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 d5df7b4b0..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ReleaseCommentDialog.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-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.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
-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;
-
-/**
- * Prompts the user for a multi-line comment for releasing to CVS.
- */
-public class ReleaseCommentDialog extends Dialog {
- private static final int WIDTH_HINT = 350;
- private static final int HEIGHT_HINT = 50;
-
- private String comment = ""; //$NON-NLS-1$
-
- private Text text;
-
- /**
- * ReleaseCommentDialog constructor.
- *
- * @param parentShell the parent of this dialog
- */
- public ReleaseCommentDialog(Shell parentShell) {
- super(parentShell);
- }
- /*
- * @see Dialog#createDialogArea(Composite)
- */
- protected Control createDialogArea(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));
-
- 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.setText(comment);
- 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;
- okPressed();
- }
- }
- });
-
- // set F1 help
- WorkbenchHelp.setHelp(composite, IHelpContextIds.RELEASE_COMMENT_DIALOG);
-
- return composite;
- }
- /**
- * Return the entered comment
- *
- * @return the comment
- */
- public String getComment() {
- return comment;
- }
- /**
- * Set the initial comment
- *
- * @param comment the initial comment
- */
- public void setComment(String comment) {
- this.comment = comment;
- }
- /*
- * @see Dialog#okPressed
- */
- protected void okPressed() {
- comment = text.getText();
- super.okPressed();
- }
-}
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 d1a93b04d..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteFileEditorInput.java
+++ /dev/null
@@ -1,178 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-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 {
- private ICVSRemoteFile file;
- private IStorage storage;
-
- /**
- * Creates FileEditionEditorInput on the given file.
- */
- public RemoteFileEditorInput(ICVSRemoteFile file) {
- this.file = file;
- }
- /**
- * 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
- // to do. For now, just return the name
- //return new Path(file.getProjectName()).append(file.getProjectRelativePath()).toString();
- return getName();
- }
- /**
- * 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) {
- storage = new RemoteFileStorage(file);
- }
- 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() {
- //use path to make sure slashes are correct
- return getName();
- //return new Path(file.getProjectName()).append(file.getProjectRelativePath()).toString();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteFileStorage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteFileStorage.java
deleted file mode 100644
index a3f7a3860..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RemoteFileStorage.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-
-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.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-
-public class RemoteFileStorage extends PlatformObject implements IStorage {
- ICVSRemoteFile file;
- public RemoteFileStorage(ICVSRemoteFile file) {
- this.file = file;
- }
-
- /**
- * Returns an open input stream on the contents of this file.
- * The client is responsible for closing the stream when finished.
- *
- * @return an input stream containing the contents of the file
- * @exception CoreException if this method fails.
- */
- public InputStream getContents() throws CoreException {
- try {
- final InputStream[] holder = new InputStream[1];
- CVSUIPlugin.runWithProgress(null, true /*cancelable*/, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- holder[0] = file.getContents(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- return holder[0];
- } catch (InterruptedException e) {
- // operation canceled
- } catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- if (t instanceof TeamException) {
- throw new CoreException(((TeamException) t).getStatus());
- }
- // should not get here
- }
- return new ByteArrayInputStream(new byte[0]);
- }
- public IPath getFullPath() {
- return new Path(file.getName());
- }
- 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/RepositoriesView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoriesView.java
deleted file mode 100644
index 7e3e136dd..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoriesView.java
+++ /dev/null
@@ -1,313 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.util.Properties;
-
-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.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.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.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSProvider;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.wizards.NewLocationWizard;
-import org.eclipse.team.internal.ccvs.ui.actions.OpenRemoteFileAction;
-import org.eclipse.team.internal.ccvs.ui.model.AllRootsElement;
-import org.eclipse.team.internal.ccvs.ui.model.RemoteContentProvider;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.dialogs.PropertyDialogAction;
-import org.eclipse.ui.part.DrillDownAdapter;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * 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 ViewPart {
- public static final String VIEW_ID = "org.eclipse.team.ccvs.ui.RepositoriesView"; //$NON-NLS-1$
-
- // The tree viewer
- private TreeViewer viewer;
-
- // The root
- private AllRootsElement root;
-
- // Drill down adapter
- private DrillDownAdapter drillPart;
-
- // Actions
- private Action showFoldersAction;
- private Action showModulesAction;
- private OpenRemoteFileAction openAction;
- private Action refreshAction;
- private PropertyDialogAction propertiesAction;
-
- IRepositoryListener listener = new IRepositoryListener() {
- public void repositoryAdded(final ICVSRepositoryLocation root) {
- viewer.getControl().getDisplay().syncExec(new Runnable() {
- public void run() {
- viewer.refresh();
- viewer.setSelection(new StructuredSelection(root));
- }
- });
- }
- public void repositoryRemoved(ICVSRepositoryLocation root) {
- refresh();
- }
- public void branchTagsAdded(CVSTag[] tags, final ICVSRepositoryLocation root) {
- refresh();
- }
- public void branchTagsRemoved(CVSTag[] tags, final ICVSRepositoryLocation root) {
- refresh();
- }
- public void versionTagsAdded(CVSTag[] tags, final ICVSRepositoryLocation root) {
- refresh();
- }
- public void versionTagsRemoved(CVSTag[] tags, final ICVSRepositoryLocation root) {
- refresh();
- }
- private void refresh() {
- Display display = viewer.getControl().getDisplay();
- display.syncExec(new Runnable() {
- public void run() {
- viewer.refresh();
- }
- });
- }
- };
-
- /**
- * Contribute actions to the view
- */
- private void contributeActions() {
- final Shell shell = viewer.getTree().getShell();
- // Create actions
-
- // Refresh (toolbar)
- refreshAction = new Action(Policy.bind("RepositoriesView.refresh"), CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_REFRESH)) { //$NON-NLS-1$
- public void run() {
- viewer.refresh();
- }
- };
- refreshAction.setToolTipText(Policy.bind("RepositoriesView.refresh")); //$NON-NLS-1$
-
- // New Repository (popup)
- final Action 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();
- }
- };
-
- final Action 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();
- }
- };
-
- // Properties
- propertiesAction = new PropertyDialogAction(shell, viewer);
- getViewSite().getActionBars().setGlobalActionHandler(IWorkbenchActionConstants.PROPERTIES, propertiesAction);
- IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
- if (selection.size() == 1 && selection.getFirstElement() instanceof ICVSRepositoryLocation) {
- propertiesAction.setEnabled(true);
- } else {
- propertiesAction.setEnabled(false);
- }
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection ss = (IStructuredSelection)event.getSelection();
- boolean enabled = ss.size() == 1 && ss.getFirstElement() instanceof ICVSRepositoryLocation;
- propertiesAction.setEnabled(enabled);
- }
- });
-
- // 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) {
- // File actions go first (view file)
- manager.add(new Separator(IWorkbenchActionConstants.GROUP_FILE));
-
- // New actions go next
- MenuManager sub = new MenuManager(Policy.bind("RepositoriesView.newSubmenu"), IWorkbenchActionConstants.GROUP_ADD); //$NON-NLS-1$
- sub.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- manager.add(sub);
-
- // Misc additions
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
-
- manager.add(refreshAction);
-
- IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
- if (selection.size() == 1 && selection.getFirstElement() instanceof ICVSRepositoryLocation) {
- manager.add(propertiesAction);
- }
- sub.add(newAction);
- sub.add(newAnonAction);
- }
- });
- 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.update(false);
-
- // Create the open action for double clicks
- openAction = new OpenRemoteFileAction();
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent e) {
- handleDoubleClick(e);
- }
- });
-
- // Add module toggling to the local pull-down menu
- IMenuManager mgr = bars.getMenuManager();
- showFoldersAction = new Action(Policy.bind("RepositoriesView.Show_Folders_6")) { //$NON-NLS-1$
- public void run() {
- CVSUIPlugin.getPlugin().getPreferenceStore().setValue(ICVSUIConstants.PREF_SHOW_MODULES, false);
- showModulesAction.setChecked(false);
- viewer.refresh();
- }
- };
- showModulesAction = new Action(Policy.bind("RepositoriesView.Show_Modules_7")) { //$NON-NLS-1$
- public void run() {
- CVSUIPlugin.getPlugin().getPreferenceStore().setValue(ICVSUIConstants.PREF_SHOW_MODULES, true);
- showFoldersAction.setChecked(false);
- viewer.refresh();
- }
- };
- boolean showModules = CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_SHOW_MODULES);
- showFoldersAction.setChecked(!showModules);
- showModulesAction.setChecked(showModules);
- mgr.add(showFoldersAction);
- mgr.add(showModulesAction);
- bars.updateActionBars();
- }
-
- /*
- * @see WorkbenchPart#createPartControl
- */
- public void createPartControl(Composite parent) {
- initialize();
- viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- viewer.setContentProvider(new RemoteContentProvider());
- viewer.setLabelProvider(new WorkbenchLabelProvider());
- getSite().setSelectionProvider(viewer);
- viewer.setInput(root);
- viewer.setSorter(new RepositorySorter());
- viewer.getControl().addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent event) {
- if (event.keyCode == SWT.F5) {
- if (WorkbenchUserAuthenticator.USE_ALTERNATE_PROMPTER) {
- try {
- ICVSRepositoryLocation[] locations = CVSProvider.getInstance().getKnownRepositories();
- for (int i = 0; i < locations.length; i++) {
- locations[i].flushUserInfo();
- }
- } catch (CVSException e) {
- // Do nothing
- }
- } else {
- refreshAction.run();
- }
- } else if (event.keyCode == SWT.F9 && WorkbenchUserAuthenticator.USE_ALTERNATE_PROMPTER) {
- refreshAction.run();
- }
- }
- });
- drillPart = new DrillDownAdapter(viewer);
- contributeActions();
- CVSUIPlugin.getPlugin().getRepositoryManager().addRepositoryListener(listener);
-
- // F1 Help
- WorkbenchHelp.setHelp(viewer.getControl(), IHelpContextIds.REPOSITORIES_VIEW);
- }
-
- /*
- * @see WorkbenchPart#dispose
- */
- public void dispose() {
- CVSUIPlugin.getPlugin().getRepositoryManager().removeRepositoryListener(listener);
- }
-
- /**
- * 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));
- }
- }
- }
- }
-
- /**
- * Initialize the repositories and actions
- */
- private void initialize() {
- root = new AllRootsElement();
- }
- /*
- * @see WorkbenchPart#setFocus
- */
- public void setFocus() {
- viewer.getControl().setFocus();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryManager.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryManager.java
deleted file mode 100644
index b570102b3..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryManager.java
+++ /dev/null
@@ -1,769 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.EOFException;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSProvider;
-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.ICVSListener;
-import org.eclipse.team.internal.ccvs.core.ICVSProvider;
-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.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.ILogEntry;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-
-/**
- * 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 {
- private static final String STATE_FILE = ".repositoryManagerState"; //$NON-NLS-1$
- private static final int STATE_FILE_VERSION_1 = -1;
-
- // Map ICVSRepositoryLocation -> List of CVSTag
- Hashtable branchTags = new Hashtable();
- // Map ICVSRepositoryLocation -> Hashtable of (Project name -> Set of CVSTag)
- Hashtable versionTags = new Hashtable();
- // Map ICVSRepositoryLocation -> Hashtable of (Project name -> Set of file paths that are project relative)
- Hashtable autoRefreshFiles = new Hashtable();
-
- List listeners = new ArrayList();
-
- // The previously remembered comment
- private static String previousComment = ""; //$NON-NLS-1$
-
- public static boolean notifyRepoView = true;
-
- /**
- * Answer an array of all known remote roots.
- */
- public ICVSRepositoryLocation[] getKnownRoots() {
- return getCVSProvider().getKnownRepositories();
- }
-
- /**
- * Get the list of known branch tags for a given remote root.
- */
- public CVSTag[] getKnownBranchTags(ICVSFolder project) {
- ICVSRepositoryLocation location = getRepositoryLocationFor(project);
- return getKnownBranchTags(location);
- }
-
- public CVSTag[] getKnownBranchTags(ICVSRepositoryLocation location) {
- Set set = (Set)branchTags.get(location);
- if (set == null) return new CVSTag[0];
- return (CVSTag[])set.toArray(new CVSTag[0]);
- }
-
- /**
- * Get the list of known version tags for a given project.
- */
- public CVSTag[] getKnownVersionTags(ICVSFolder project) {
- try {
- ICVSRepositoryLocation location = getRepositoryLocationFor(project);
- String name = new Path(project.getFolderSyncInfo().getRepository()).segment(0);
- Set result = new HashSet();
- Hashtable table = (Hashtable)versionTags.get(location);
- if (table == null) {
- return (CVSTag[])result.toArray(new CVSTag[result.size()]);
- }
- Set set = (Set)table.get(name);
- if (set == null) {
- return (CVSTag[])result.toArray(new CVSTag[result.size()]);
- }
- result.addAll(set);
- return (CVSTag[])result.toArray(new CVSTag[0]);
- } catch(CVSException e) {
- CVSUIPlugin.log(e.getStatus());
- return new CVSTag[0];
- }
- }
-
- public Map getKnownProjectsAndVersions(ICVSRepositoryLocation location) {
- return (Hashtable)versionTags.get(location);
- }
-
- /*
- * Fetches tags from .project and .vcm_meta 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 void refreshDefinedTags(ICVSFolder project, boolean notify, IProgressMonitor monitor) throws TeamException {
- List filesToRefresh = new ArrayList(Arrays.asList(getAutoRefreshFiles(project)));
- monitor.beginTask(Policy.bind("RepositoryManager.refreshDefinedTags"), filesToRefresh.size() * 10); //$NON-NLS-1$
- try {
- ICVSRepositoryLocation location = CVSProvider.getInstance().getRepository(project.getFolderSyncInfo().getRoot());
- List tags = new ArrayList();
- for (Iterator it = filesToRefresh.iterator(); it.hasNext();) {
- String relativePath = (String)it.next();
- ICVSFile file = null;
- if (project instanceof ICVSRemoteFolder) {
- // There should be a better way of doing this.
- ICVSRemoteFolder parentFolder = location.getRemoteFolder(new Path(project.getName()).append(relativePath).removeLastSegments(1).toString(), CVSTag.DEFAULT);
- ICVSResource[] resources = parentFolder.fetchChildren(Policy.subMonitorFor(monitor, 5));
- for (int i = 0; i < resources.length; i++) {
- if (resources[i] instanceof ICVSRemoteFile && resources[i].getName().equals(new Path(relativePath).lastSegment())) {
- file = (ICVSFile)resources[i];
- }
- }
- } else {
- file = project.getFile(relativePath);
- }
- if (file != null) {
- tags.addAll(Arrays.asList(fetchDefinedTagsFor(file, project, location,
- Policy.subMonitorFor(monitor, 5))));
- } else {
- monitor.worked(5);
- }
- }
- // add all tags in one pass so that the listeners only get one notification for
- // versions and another for branches
- List branches = new ArrayList();
- List versions = new ArrayList();
- for (Iterator it = tags.iterator(); it.hasNext();) {
- CVSTag element = (CVSTag) it.next();
- if (element.getType() == CVSTag.BRANCH) {
- branches.add(element);
- } else {
- versions.add(element);
- }
- }
-
- // Hack for optimizing refreshing of repo view
- notifyRepoView = false;
- addBranchTags(project, (CVSTag[]) branches.toArray(new CVSTag[branches.size()]));
- if (notify) {
- notifyRepoView = true;
- }
- addVersionTags(project, (CVSTag[]) versions.toArray(new CVSTag[versions.size()]));
- notifyRepoView = true;
- } catch (CVSException e) {
- throw new TeamException(e.getStatus());
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Accept branch tags for any CVS resource. However, for the time being,
- * the given branch tags are added to the list of known tags for the resource's
- * remote root.
- */
- public void addBranchTags(ICVSResource resource, CVSTag[] tags) {
- ICVSRepositoryLocation location = getRepositoryLocationFor(resource);
- addBranchTags(location, tags);
- }
-
- public void addBranchTags(ICVSRepositoryLocation location, CVSTag[] tags) {
- Set set = (Set)branchTags.get(location);
- if (set == null) {
- set = new HashSet();
- branchTags.put(location, set);
- }
- for (int i = 0; i < tags.length; i++) {
- set.add(tags[i]);
- }
- Iterator it = listeners.iterator();
- while (it.hasNext() && notifyRepoView) {
- IRepositoryListener listener = (IRepositoryListener)it.next();
- listener.branchTagsAdded(tags, location);
- }
- }
-
- /**
- * 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) {
- CVSTag[] branchTags = getKnownBranchTags(root);
- Hashtable vTags = (Hashtable)this.versionTags.get(root);
- this.branchTags.remove(root);
- this.versionTags.remove(root);
- this.autoRefreshFiles.remove(root);
- Iterator it = listeners.iterator();
- while (it.hasNext()) {
- IRepositoryListener listener = (IRepositoryListener)it.next();
- listener.branchTagsRemoved(branchTags, root);
- if (vTags != null) {
- Iterator keyIt = vTags.keySet().iterator();
- while (keyIt.hasNext()) {
- String projectName = (String)keyIt.next();
- Set tagSet = (Set)vTags.get(projectName);
- CVSTag[] versionTags = (CVSTag[])tagSet.toArray(new CVSTag[0]);
- listener.versionTagsRemoved(versionTags, root);
- }
- }
- listener.repositoryRemoved(root);
- }
- }
-
- /**
- * Accept version 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 addVersionTags(ICVSResource resource, CVSTag[] tags) {
- try {
- // Make sure there is a version tag table for the location
- ICVSRepositoryLocation location = getRepositoryLocationFor(resource);
- Hashtable table = (Hashtable)versionTags.get(location);
- if (table == null) {
- table = new Hashtable();
- versionTags.put(location, table);
- }
-
- // Get the name to cache the version tags with
- ICVSFolder parent;
- if (resource.isFolder()) {
- parent = (ICVSFolder)resource;
- } else {
- parent = resource.getParent();
- }
- if (!parent.isCVSFolder()) return;
- String name = new Path(parent.getFolderSyncInfo().getRepository()).segment(0);
-
- // Make sure there is a table for the ancestor that holds the tags
- Set set = (Set)table.get(name);
- if (set == null) {
- set = new HashSet();
- table.put(name, set);
- }
-
- // Store the tag with the appropriate ancestor
- for (int i = 0; i < tags.length; i++) {
- set.add(tags[i]);
- }
-
- // Notify any listeners
- Iterator it = listeners.iterator();
- while (it.hasNext() && notifyRepoView) {
- IRepositoryListener listener = (IRepositoryListener)it.next();
- listener.versionTagsAdded(tags, location);
- }
- } catch (CVSException e) {
- CVSUIPlugin.log(e.getStatus());
- }
- }
-
- public void addAutoRefreshFiles(ICVSFolder project, String[] relativeFilePaths) {
- ICVSRepositoryLocation location = getRepositoryLocationFor(project);
- initDefaultAutoRefreshFiles(project);
- Hashtable table = (Hashtable)autoRefreshFiles.get(location);
- Set set = (Set)table.get(project.getName());
- for (int i = 0; i < relativeFilePaths.length; i++) {
- set.add(relativeFilePaths[i]);
- }
- }
-
- public void removeAutoRefreshFiles(ICVSFolder project, String[] relativeFilePaths) {
- ICVSRepositoryLocation location = getRepositoryLocationFor(project);
- initDefaultAutoRefreshFiles(project);
- Hashtable table = (Hashtable)autoRefreshFiles.get(location);
- if (table == null) return;
- Set set = (Set)table.get(project.getName());
- if (set == null) return;
- for (int i = 0; i < relativeFilePaths.length; i++) {
- set.remove(relativeFilePaths[i]);
- }
- }
-
- public String[] getAutoRefreshFiles(ICVSFolder project) {
- ICVSRepositoryLocation location = getRepositoryLocationFor(project);
- initDefaultAutoRefreshFiles(project);
- Hashtable table = (Hashtable)autoRefreshFiles.get(location);
- Set set = (Set)table.get(project.getName());
- return (String[])set.toArray(new String[0]);
- }
-
- private void initDefaultAutoRefreshFiles(ICVSFolder project) {
- ICVSRepositoryLocation location = getRepositoryLocationFor(project);
- Hashtable table = (Hashtable)autoRefreshFiles.get(location);
- if (table == null) {
- table = new Hashtable();
- autoRefreshFiles.put(location, table);
- }
- Set set = (Set)table.get(project.getName());
- if (set == null) {
- String projectName = project.getName();
- set = new HashSet();
- table.put(projectName, set);
- set.add(".project"); //$NON-NLS-1$
- set.add(".vcm_meta"); //$NON-NLS-1$
- }
- }
-
- /**
- * Remove the given branch tag from the list of known tags for the
- * given remote root.
- */
- public void removeBranchTag(ICVSFolder project, CVSTag[] tags) {
- ICVSRepositoryLocation location = getRepositoryLocationFor(project);
- removeBranchTag(location, tags);
- }
-
- public void removeBranchTag(ICVSRepositoryLocation location, CVSTag[] tags) {
- Set set = (Set)branchTags.get(location);
- if (set == null) return;
- for (int i = 0; i < tags.length; i++) {
- set.remove(tags[i]);
- }
- Iterator it = listeners.iterator();
- while (it.hasNext() && notifyRepoView) {
- IRepositoryListener listener = (IRepositoryListener)it.next();
- listener.branchTagsRemoved(tags, location);
- }
- }
-
- /**
- * Remove the given tags from the list of known tags for the
- * given remote root.
- */
- public void removeVersionTags(ICVSFolder project, CVSTag[] tags) {
- ICVSRepositoryLocation location = getRepositoryLocationFor(project);
- Hashtable table = (Hashtable)versionTags.get(location);
- if (table == null) return;
- Set set = (Set)table.get(project.getName());
- if (set == null) return;
- for (int i = 0; i < tags.length; i++) {
- set.remove(tags[i]);
- }
- Iterator it = listeners.iterator();
- while (it.hasNext() && notifyRepoView) {
- IRepositoryListener listener = (IRepositoryListener)it.next();
- listener.versionTagsRemoved(tags, location);
- }
- }
-
- public void startup() throws TeamException {
- loadState();
- CVSProviderPlugin.getProvider().addRepositoryListener(new ICVSListener() {
- public void repositoryAdded(ICVSRepositoryLocation root) {
- rootAdded(root);
- }
- public void repositoryRemoved(ICVSRepositoryLocation root) {
- rootRemoved(root);
- }
- });
- }
-
- public void shutdown() throws TeamException {
- saveState();
- }
-
- private void loadState() throws TeamException {
- IPath pluginStateLocation = CVSUIPlugin.getPlugin().getStateLocation().append(STATE_FILE);
- File file = pluginStateLocation.toFile();
- if (file.exists()) {
- try {
- DataInputStream dis = new DataInputStream(new FileInputStream(file));
- try {
- readState(dis);
- } finally {
- dis.close();
- }
- } catch (IOException e) {
- CVSUIPlugin.log(new Status(Status.ERROR, CVSUIPlugin.ID, TeamException.UNABLE, Policy.bind("RepositoryManager.ioException"), e)); //$NON-NLS-1$
- } catch (TeamException e) {
- CVSUIPlugin.log(e.getStatus());
- }
- }
- }
-
- private void saveState() throws TeamException {
- IPath pluginStateLocation = CVSUIPlugin.getPlugin().getStateLocation();
- File tempFile = pluginStateLocation.append(STATE_FILE + ".tmp").toFile(); //$NON-NLS-1$
- File stateFile = pluginStateLocation.append(STATE_FILE).toFile();
- try {
- DataOutputStream dos = new DataOutputStream(new FileOutputStream(tempFile));
- try {
- writeState(dos);
- } finally {
- dos.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(DataOutputStream dos) throws IOException {
- // Write the repositories
- Collection repos = Arrays.asList(getKnownRoots());
- // Write out version number for file.
- // We write it as an int so we can read either the repoSize or the version in the readState
- // XXX We should come up with a more long term solution.
- dos.writeInt(STATE_FILE_VERSION_1);
- dos.writeInt(repos.size());
- Iterator it = repos.iterator();
- while (it.hasNext()) {
- ICVSRepositoryLocation root = (ICVSRepositoryLocation)it.next();
- dos.writeUTF(root.getLocation());
- CVSTag[] branchTags = getKnownBranchTags(root);
- dos.writeInt(branchTags.length);
- for (int i = 0; i < branchTags.length; i++) {
- dos.writeUTF(branchTags[i].getName());
- dos.writeInt(branchTags[i].getType());
- }
- // write number of projects for which there are tags in this root
- Hashtable table = (Hashtable)versionTags.get(root);
- if (table == null) {
- dos.writeInt(0);
- } else {
- dos.writeInt(table.size());
- // for each project, write the name of the project, number of tags, and each tag.
- Iterator projIt = table.keySet().iterator();
- while (projIt.hasNext()) {
- String name = (String)projIt.next();
- dos.writeUTF(name);
- Set tagSet = (Set)table.get(name);
- dos.writeInt(tagSet.size());
- Iterator tagIt = tagSet.iterator();
- while (tagIt.hasNext()) {
- CVSTag tag = (CVSTag)tagIt.next();
- dos.writeUTF(tag.getName());
- }
- }
- }
- // write number of projects for which there were customized auto refresh files
- table = (Hashtable)autoRefreshFiles.get(root);
- if (table == null) {
- dos.writeInt(0);
- } else {
- dos.writeInt(table.size());
- // for each project, write the name of the project, number of filename then each file name
- Iterator projIt = table.keySet().iterator();
- while (projIt.hasNext()) {
- String name = (String)projIt.next();
- dos.writeUTF(name);
- Set tagSet = (Set)table.get(name);
- dos.writeInt(tagSet.size());
- Iterator filenameIt = tagSet.iterator();
- while (filenameIt.hasNext()) {
- String filename = (String)filenameIt.next();
- dos.writeUTF(filename);
- }
- }
- }
- }
- }
- private void readState(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 = CVSProviderPlugin.getProvider().getRepository(dis.readUTF());
-
- // 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);
- }
- addBranchTags(root, branchTags);
-
- // read the number of projects for this root that have version tags
- int projSize = dis.readInt();
- if (projSize > 0) {
- Hashtable projTable = new Hashtable();
- versionTags.put(root, projTable);
- for (int j = 0; j < projSize; j++) {
- String name = dis.readUTF();
- Set tagSet = new HashSet();
- projTable.put(name, tagSet);
- int numTags = dis.readInt();
- for (int k = 0; k < numTags; k++) {
- tagSet.add(new CVSTag(dis.readUTF(), CVSTag.VERSION));
- }
- Iterator it = listeners.iterator();
- while (it.hasNext()) {
- IRepositoryListener listener = (IRepositoryListener)it.next();
- listener.versionTagsAdded((CVSTag[])tagSet.toArray(new CVSTag[0]), root);
- }
- }
- }
- // read the auto refresh filenames for this project
- if (version1) {
- try {
- projSize = dis.readInt();
- if (projSize > 0) {
- Hashtable autoRefreshTable = new Hashtable();
- autoRefreshFiles.put(root, autoRefreshTable);
- for (int j = 0; j < projSize; j++) {
- String name = dis.readUTF();
- Set filenames = new HashSet();
- autoRefreshTable.put(name, filenames);
- int numFilenames = dis.readInt();
- for (int k = 0; k < numFilenames; k++) {
- filenames.add(dis.readUTF());
- }
- }
- }
- } catch (EOFException e) {
- // auto refresh files are not persisted, continue and save them next time.
- }
- }
- }
- }
-
- public void addRepositoryListener(IRepositoryListener listener) {
- listeners.add(listener);
- }
-
- public void removeRepositoryListener(IRepositoryListener listener) {
- listeners.remove(listener);
- }
-
- /**
- * Add the given resources to their associated providers.
- * This schedules the resources for addition; they still need to be committed.
- */
- public void add(IResource[] resources, IProgressMonitor monitor) throws TeamException {
- Hashtable table = getProviderMapping(resources);
- Set keySet = table.keySet();
- monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$
- monitor.setTaskName(Policy.bind("RepositoryManager.adding")); //$NON-NLS-1$
- Iterator iterator = keySet.iterator();
- while (iterator.hasNext()) {
- IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1000);
- CVSTeamProvider provider = (CVSTeamProvider)iterator.next();
- provider.setComment(previousComment);
- List list = (List)table.get(provider);
- IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
- provider.add(providerResources, IResource.DEPTH_ZERO, subMonitor);
- }
- }
-
- /**
- * Delete the given resources from their associated providers.
- * This schedules the resources for deletion; they still need to be committed.
- */
- public void delete(IResource[] resources, IProgressMonitor monitor) throws TeamException {
- Hashtable table = getProviderMapping(resources);
- Set keySet = table.keySet();
- monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$
- monitor.setTaskName(Policy.bind("RepositoryManager.deleting")); //$NON-NLS-1$
- Iterator iterator = keySet.iterator();
- while (iterator.hasNext()) {
- IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1000);
- CVSTeamProvider provider = (CVSTeamProvider)iterator.next();
- provider.setComment(previousComment);
- List list = (List)table.get(provider);
- IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
- provider.delete(providerResources, subMonitor);
- }
- }
-
- public void update(IResource[] resources, Command.LocalOption[] options, boolean createBackups, IProgressMonitor monitor) throws TeamException {
- Hashtable table = getProviderMapping(resources);
- Set keySet = table.keySet();
- monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$
- monitor.setTaskName(Policy.bind("RepositoryManager.updating")); //$NON-NLS-1$
- 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()]);
- provider.update(providerResources, options, null, createBackups, subMonitor);
- }
- }
-
- /**
- * Mark the files as merged.
- */
- public void merged(IRemoteSyncElement[] elements) throws TeamException {
- Hashtable table = getProviderMapping(elements);
- Set keySet = table.keySet();
- Iterator iterator = keySet.iterator();
- while (iterator.hasNext()) {
- CVSTeamProvider provider = (CVSTeamProvider)iterator.next();
- provider.setComment(previousComment);
- List list = (List)table.get(provider);
- IRemoteSyncElement[] providerElements = (IRemoteSyncElement[])list.toArray(new IRemoteSyncElement[list.size()]);
- provider.merged(providerElements);
- }
- }
-
- /**
- * Return the entered comment or null.
- * Persist the entered release comment for the next caller.
- */
- public String promptForComment(final Shell shell) {
- final int[] result = new int[1];
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- ReleaseCommentDialog dialog = new ReleaseCommentDialog(shell);
- dialog.setComment(previousComment);
- result[0] = dialog.open();
- if (result[0] != ReleaseCommentDialog.OK) return;
- previousComment = dialog.getComment();
- }
- });
- if (result[0] != ReleaseCommentDialog.OK) return null;
- return previousComment;
- }
-
- /**
- * Commit the given resources to their associated providers.
- *
- * @param resources the resources to commit
- * @param monitor the progress monitor
- */
- public void commit(IResource[] resources, String comment, IProgressMonitor monitor) throws TeamException {
- Hashtable table = getProviderMapping(resources);
- Set keySet = table.keySet();
- monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$
- monitor.setTaskName(Policy.bind("RepositoryManager.committing")); //$NON-NLS-1$
- Iterator iterator = keySet.iterator();
- while (iterator.hasNext()) {
- IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1000);
- CVSTeamProvider provider = (CVSTeamProvider)iterator.next();
- provider.setComment(comment);
- List list = (List)table.get(provider);
- IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
- provider.checkin(providerResources, IResource.DEPTH_INFINITE, subMonitor);
- }
- }
-
- /**
- * Helper method. Return a hashtable mapping provider to a list of resources
- * shared with that provider.
- */
- private Hashtable getProviderMapping(IResource[] resources) {
- Hashtable result = new Hashtable();
- 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;
- }
- /**
- * Helper method. Return a hashtable mapping provider to a list of IRemoteSyncElements
- * shared with that provider.
- */
- private Hashtable getProviderMapping(IRemoteSyncElement[] elements) {
- Hashtable result = new Hashtable();
- for (int i = 0; i < elements.length; i++) {
- RepositoryProvider provider = RepositoryProvider.getProvider(elements[i].getLocal().getProject(), CVSProviderPlugin.getTypeId());
- List list = (List)result.get(provider);
- if (list == null) {
- list = new ArrayList();
- result.put(provider, list);
- }
- list.add(elements[i]);
- }
- return result;
- }
-
- /**
- * Returns Branch and Version tags for the given files
- */
- public CVSTag[] getTags(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[0]);
- }
-
- public ICVSRepositoryLocation getRepositoryLocationFor(ICVSResource resource) {
- try {
- ICVSFolder folder;
- if (resource.isFolder()) {
- folder = (ICVSFolder)resource;
- } else {
- folder = resource.getParent();
- }
- if (folder.isCVSFolder()) {
- ICVSRepositoryLocation location = CVSProvider.getInstance().getRepository(folder.getFolderSyncInfo().getRoot());
- return location;
- }
- return null;
- } catch (CVSException e) {
- CVSUIPlugin.log(e.getStatus());
- return null;
- }
- }
-
- /*
- * Fetches and caches the tags found on the provided remote file.
- */
- private CVSTag[] fetchDefinedTagsFor(ICVSFile file, ICVSFolder project,
- ICVSRepositoryLocation location, IProgressMonitor monitor) throws TeamException {
- if (file != null && file.exists()) {
- return getTags(file, monitor);
- }
- return new CVSTag[0];
- }
-
- private ICVSProvider getCVSProvider() {
- return CVSProviderPlugin.getProvider();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositorySorter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositorySorter.java
deleted file mode 100644
index 936419430..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositorySorter.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.team.core.sync.IRemoteResource;
-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.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.model.BranchTag;
-
-public class RepositorySorter extends ViewerSorter {
- public int category(Object element) {
- if (element instanceof ICVSRemoteFolder) {
- return 1;
- }
- if (element instanceof ICVSRemoteFile) {
- return 2;
- }
- 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 BranchTag && o2 instanceof BranchTag) {
- CVSTag tag1 = ((BranchTag)o1).getTag();
- CVSTag tag2 = ((BranchTag)o2).getTag();
- return tag1.compareTo(tag2);
- }
- if (o1 instanceof ICVSRepositoryLocation && o2 instanceof ICVSRepositoryLocation) {
- return ((ICVSRepositoryLocation)o1).getLocation().compareTo(((ICVSRepositoryLocation)o2).getLocation());
- }
- return super.compare(viewer, o1, o2);
- }
-}
-
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 1c614dd66..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResizableWizardDialog.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-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 5dcc2e5fb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.compare.CompareUI;
-import org.eclipse.compare.IStreamContentAccessor;
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.compare.structuremergeviewer.IStructureComparator;
-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.sync.IRemoteResource;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-
-/**
- * A class for comparing ICVSRemoteResource objects
- */
-public class ResourceEditionNode implements IStructureComparator, ITypedElement, IStreamContentAccessor {
- 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 {
- IRemoteResource[] members = resource.members(monitor);
- children = new ResourceEditionNode[members.length];
- for (int i = 0; i < members.length; i++) {
- children[i] = new ResourceEditionNode((ICVSRemoteResource)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).getStatus());
- }
- }
- }
- }
- return children;
- }
-
- /**
- * @see IStreamContentAccessor#getContents()
- */
- public InputStream getContents() throws CoreException {
- if (resource == null) {
- return null;
- }
- try {
- final InputStream[] holder = new InputStream[1];
- CVSUIPlugin.runWithProgress(null, true /*cancelable*/, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- holder[0] = resource.getContents(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- return holder[0];
- } catch (InterruptedException e) {
- // operation canceled
- } catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- if (t instanceof TeamException) {
- throw new CoreException(((TeamException) t).getStatus());
- }
- // should not get here
- }
- 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();
- }
-}
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 cdfff20fe..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourcePropertiesPage.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-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$
- }
- 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 4c503a395..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/SimpleContentProvider.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-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/TagAsVersionDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagAsVersionDialog.java
deleted file mode 100644
index 96b633364..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagAsVersionDialog.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial implementation
- ******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-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.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.ui.merge.TagElement;
-import org.eclipse.team.internal.ccvs.ui.merge.TagRootElement;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-public class TagAsVersionDialog extends DetailsDialog {
-
- private ICVSFolder folder;
-
- private Text tagText;
-
- private String tagName = ""; //$NON-NLS-1$
-
- private static final int TABLE_HEIGHT_HINT = 150;
-
- private TableViewer existingVersionTable;
-
- public TagAsVersionDialog(Shell parentShell, String title, ICVSFolder folder) {
- super(parentShell, title);
- this.folder = folder;
- }
-
- /**
- * @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.GRAB_VERTICAL |
- GridData.HORIZONTAL_ALIGN_FILL |
- GridData.VERTICAL_ALIGN_CENTER);
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);;
- label.setLayoutData(data);
- label.setFont(parent.getFont());
-
- 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();
- }
- }
- );
- }
-
- 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);
- data.heightHint = TABLE_HEIGHT_HINT;
- 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);
- }
-
- /**
- * @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);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite.setFont(parent.getFont());
-
- Label label = new Label(composite, SWT.WRAP);
- label.setText(Policy.bind("TagAction.existingVersions")); //$NON-NLS-1$
- GridData data = new GridData(
- GridData.GRAB_HORIZONTAL |
- GridData.GRAB_VERTICAL |
- GridData.HORIZONTAL_ALIGN_FILL |
- GridData.VERTICAL_ALIGN_CENTER);
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);;
- label.setLayoutData(data);
- label.setFont(composite.getFont());
-
- existingVersionTable = createTable(composite);
- existingVersionTable.setContentProvider(new WorkbenchContentProvider());
- existingVersionTable.setLabelProvider(new WorkbenchLabelProvider());
- existingVersionTable.setSorter(new ViewerSorter() {
- public int compare(Viewer v, Object o1, Object o2) {
- int result = super.compare(v, o1, o2);
- if (o1 instanceof TagElement && o2 instanceof TagElement) {
- return -result;
- }
- return result;
- }
- });
- existingVersionTable.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection)existingVersionTable.getSelection();
- if(!selection.isEmpty()) {
- TagElement element = (TagElement)((IStructuredSelection)existingVersionTable.getSelection()).getFirstElement();
- if(element!=null) {
- tagText.setText(element.getTag().getName());
- }
- }
- }
- });
-
- Runnable afterRefresh = new Runnable() {
- public void run() {
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- existingVersionTable.refresh();
- }
- });
- }
- };
-
- Runnable afterConfigure = new Runnable() {
- public void run() {
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- existingVersionTable.setInput(new TagRootElement(folder, CVSTag.VERSION));
- }
- });
- }
- };
-
- TagConfigurationDialog.createTagDefinitionButtons(getShell(), composite, new ICVSFolder[] {folder},
- convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT),
- convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH),
- afterRefresh, afterConfigure);
-
- existingVersionTable.setInput(new TagRootElement(folder, CVSTag.VERSION));
-
- return composite;
- }
-
- /**
- * Validates tag name
- */
- protected void updateEnablements() {
- String message = null;
- boolean exists = false;
- 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);
- }
-
- /**
- * Answers if the given tag name already exists
- */
- protected boolean doesTagNameExists(String name) {
- CVSTag[] tags = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownVersionTags(folder);
- for (int i = 0; i < tags.length; i++) {
- if(tags[i].getName().equals(name)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns the tag name entered into this dialog
- */
- public String getTagName() {
- return tagName;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagConfigurationDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagConfigurationDialog.java
deleted file mode 100644
index 6c8d326d6..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagConfigurationDialog.java
+++ /dev/null
@@ -1,737 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial implementation
- ******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-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.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.TableColumn;
-import org.eclipse.swt.widgets.Tree;
-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.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ILogEntry;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.merge.ProjectElement;
-import org.eclipse.team.internal.ccvs.ui.merge.TagElement;
-import org.eclipse.team.internal.ccvs.ui.model.CVSFileElement;
-import org.eclipse.team.internal.ccvs.ui.model.CVSFolderElement;
-import org.eclipse.team.internal.ccvs.ui.model.CVSRootFolderElement;
-import org.eclipse.team.internal.ccvs.ui.model.RemoteContentProvider;
-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 ProjectElement cvsDefinedTagsRootElement;
-
- // list of auto-refresh files
- private org.eclipse.swt.widgets.List autoRefreshFileList;
-
- // folders from which their children files can be examined for tags
- private ICVSFolder[] roots;
- private ICVSFolder root;
-
- // enable selecting auto-refresh files
- private boolean allowSettingAutoRefreshFiles = true;
-
- // sizing default hints
- private final int ALLOWREFRESH_WIDTH = 500;
- private final int ALLOWREFRESH_HEIGHT = 625;
- private final int NOREFRESH_WIDTH = 500;
- private final int NOREFRESH_HEIGHT = 550;
-
- // 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;
-
- public TagConfigurationDialog(Shell shell, ICVSFolder[] roots) {
- super(shell);
- setShellStyle(SWT.CLOSE|SWT.RESIZE);
- this.roots = roots;
- this.root = roots[0];
- if(roots.length>1) {
- allowSettingAutoRefreshFiles = false;
- }
-
- 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);
- if(roots.length==1) {
- newShell.setText(Policy.bind("TagConfigurationDialog.1", roots[0].getName())); //$NON-NLS-1$
- } else {
- newShell.setText(Policy.bind("TagConfigurationDialog.2", Integer.toString(roots.length))); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * @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;
- shell.setLayout (gridLayout);
-
- Label description = new Label(shell,SWT.WRAP);
- description.setText(Policy.bind("TagConfigurationDialog.4")); //$NON-NLS-1$
- data = new GridData (GridData.FILL_BOTH);
- data.widthHint = 300;
- data.horizontalSpan = 2;
- description.setLayoutData(data);
-
- Label cvsResourceTreeLabel = new Label (shell, SWT.NONE);
- cvsResourceTreeLabel.setText (Policy.bind("TagConfigurationDialog.5")); //$NON-NLS-1$
- data = new GridData ();
- data.horizontalSpan = 1;
- cvsResourceTreeLabel.setLayoutData (data);
-
- Label cvsTagTreeLabel = new Label (shell, SWT.NONE);
- cvsTagTreeLabel.setText (Policy.bind("TagConfigurationDialog.6")); //$NON-NLS-1$
- data = new GridData ();
- data.horizontalSpan = 1;
- cvsTagTreeLabel.setLayoutData (data);
-
- Tree tree = new Tree(shell, 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);
- if(roots.length==1) {
- cvsResourceTree.setInput(new CVSFolderElement(roots[0], false /*don't include unmanaged resources*/));
- } else {
- cvsResourceTree.setInput(new CVSRootFolderElement(roots));
- }
-
- cvsResourceTree.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateShownTags();
- updateEnablements();
- }
- });
-
- Table table = new Table(shell, 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);
- TableLayout layout = new TableLayout();
- layout.addColumnData(new ColumnWeightData(60, true));
- table.setLayout(layout);
- TableColumn col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
- cvsTagTree = new CheckboxTableViewer(table);
- cvsTagTree.setContentProvider(new WorkbenchContentProvider());
- cvsTagTree.setLabelProvider(new WorkbenchLabelProvider());
- cvsTagTree.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateEnablements();
- }
- });
-
- 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 type2 - type1;
- }
- 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 ProjectElement(roots[0], ProjectElement.INCLUDE_BRANCHES | ProjectElement.INCLUDE_VERSIONS);
- cvsDefinedTagsRootElement.getBranches().add(CVSUIPlugin.getPlugin().getRepositoryManager().getKnownBranchTags(root));
- cvsDefinedTagsRootElement.getVersions().add(CVSUIPlugin.getPlugin().getRepositoryManager().getKnownVersionTags(root));
- cvsDefinedTagsTree.setInput(cvsDefinedTagsRootElement);
- cvsDefinedTagsTree.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateEnablements();
- }
- });
- cvsDefinedTagsTree.setSorter(new ViewerSorter() {
- public int compare(Viewer v, Object o1, Object o2) {
- int result = super.compare(v, o1, o2);
- if (o1 instanceof TagElement && o2 instanceof TagElement) {
- return -result;
- }
- return result;
- }
- });
-
- 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();
- }
- });
-
- 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();
- }
- });
-
- 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();
- }
- });
-
- 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);
- autoRefreshFileList.setItems(CVSUIPlugin.getPlugin().getRepositoryManager().getAutoRefreshFiles(roots[0]));
- 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();
- 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(cvsDefinedTagsRootElement.getBranches().getTags()));
- knownTags.addAll(Arrays.asList(cvsDefinedTagsRootElement.getVersions().getTags()));
- 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 {
- String relativePath = ((CVSFileElement)it.next()).getCVSFile().getRelativePath(root);
- if(autoRefreshFileList.indexOf(relativePath)==-1) {
- autoRefreshFileList.add(relativePath);
- }
- } catch(CVSException e) {
- }
- }
- }
- }
- }
-
- private CVSTag[] getTagsFor(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 void rememberCheckedTags() {
- Object[] checked = cvsTagTree.getCheckedElements();
- for (int i = 0; i < checked.length; i++) {
- CVSTag tag = ((TagElement)checked[i]).getTag();
- if(tag.getType() == CVSTag.BRANCH) {
- cvsDefinedTagsRootElement.getBranches().add(new CVSTag[] {tag});
- } else {
- cvsDefinedTagsRootElement.getVersions().add(new CVSTag[] {tag});
- }
- }
- cvsDefinedTagsTree.refresh();
- }
-
- private void deleteSelected() {
- IStructuredSelection selection = (IStructuredSelection)cvsDefinedTagsTree.getSelection();
- if (!selection.isEmpty()) {
- Iterator it = selection.iterator();
- while(it.hasNext()) {
- Object o = it.next();
- if(o instanceof TagElement) {
- CVSTag tag = ((TagElement)o).getTag();
- if(tag.getType() == CVSTag.BRANCH) {
- cvsDefinedTagsRootElement.getBranches().remove(tag);
- } else if(tag.getType()==CVSTag.VERSION) {
- cvsDefinedTagsRootElement.getVersions().remove(tag);
- }
- }
- }
- }
- cvsDefinedTagsTree.refresh();
- cvsDefinedTagsTree.getTree().setFocus();
- }
-
- private boolean isTagSelectedInKnownTagTree() {
- IStructuredSelection selection = (IStructuredSelection)cvsDefinedTagsTree.getSelection();
- if (!selection.isEmpty()) {
- final List versions = new ArrayList();
- final List branches = new ArrayList();
- Iterator it = selection.iterator();
- while(it.hasNext()) {
- Object o = it.next();
- if(o instanceof TagElement) {
- return true;
- }
- }
- }
- return false;
- }
-
- private void removeAllKnownTags() {
- cvsDefinedTagsRootElement.getBranches().removeAll();
- cvsDefinedTagsRootElement.getVersions().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() {
- // save auto refresh file names
- if(allowSettingAutoRefreshFiles) {
- RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- String[] oldFileNames = manager.getAutoRefreshFiles(root);
- manager.removeAutoRefreshFiles(root, oldFileNames);
- String[] newFileNames = autoRefreshFileList.getItems();
- if(newFileNames.length!=0) {
- manager.addAutoRefreshFiles(root, autoRefreshFileList.getItems());
- }
- }
-
- // save defined tags
- CVSTag[] branches = cvsDefinedTagsRootElement.getBranches().getTags();
- CVSTag[] versions = cvsDefinedTagsRootElement.getVersions().getTags();
-
- // update all project with the same version tags
- RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- manager.notifyRepoView = false;
- CVSTag[] oldTags = manager.getKnownBranchTags(root);
- manager.removeBranchTag(root, oldTags);
- for(int i = 0; i < roots.length; i++) {
- if(branches.length>0) {
- manager.addBranchTags(root, branches);
- }
- oldTags = manager.getKnownVersionTags(roots[i]);
- manager.removeVersionTags(roots[i], oldTags);
- if(versions.length>0) {
- manager.addVersionTags(roots[i], versions);
- }
- }
- // XXX hack to force repo view to refresh only once
- manager.notifyRepoView = true;
- manager.addVersionTags(root, new CVSTag[0]);
- // end hack
-
- super.okPressed();
- }
-
- /*
- * 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 static Button createTagRefreshButton(final Shell shell, Composite composite, String title, final ICVSFolder folder, final Runnable runnable) {
- Button refreshButton = new Button(composite, SWT.PUSH);
- refreshButton.setText (title);
- refreshButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- try {
- CVSUIPlugin.runWithProgress(shell, true /*cancelable*/, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- CVSUIPlugin.getPlugin().getRepositoryManager().refreshDefinedTags(folder, true, monitor);
- runnable.run();
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InterruptedException e) {
- // operation cancelled
- } catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- if (t instanceof TeamException) {
- ErrorDialog.openError(shell, Policy.bind("TagConfigurationDialog.14"), t.getMessage(), ((TeamException) t).getStatus()); //$NON-NLS-1$
- }
- }
- }
- });
- updateEnablementOnRefreshButton(refreshButton, folder);
- return refreshButton;
- }
-
- public static void createTagDefinitionButtons(final Shell shell, Composite composite, final ICVSFolder[] folders, int hHint, int wHint, final Runnable afterRefresh, final Runnable afterConfigure) {
- Composite buttonComp = new Composite(composite, 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);
-
- final Button refreshButton = TagConfigurationDialog.createTagRefreshButton(shell, buttonComp, Policy.bind("TagConfigurationDialog.20"), folders[0], afterRefresh); //$NON-NLS-1$
- data = new GridData();
- if(hHint!=0 && wHint!=0) {
- data.heightHint = hHint;
- int widthHint = wHint;
- data.widthHint = Math.max(widthHint, refreshButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- }
- 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 ();
- if(hHint!=0 && wHint!=0) {
- data.heightHint = hHint;
- int widthHint = wHint;
- data.widthHint = Math.max(widthHint, addButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- }
- 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, folders);
- d.open();
- updateEnablementOnRefreshButton(refreshButton, folders[0]);
- afterConfigure.run();
- }
- });
-
- WorkbenchHelp.setHelp(refreshButton, IHelpContextIds.TAG_CONFIGURATION_REFRESHACTION);
- WorkbenchHelp.setHelp(addButton, IHelpContextIds.TAG_CONFIGURATION_OVERVIEW);
- }
-
- private static void updateEnablementOnRefreshButton(Button refreshButton, ICVSFolder project) {
- String[] files = CVSUIPlugin.getPlugin().getRepositoryManager().getAutoRefreshFiles(project);
- refreshButton.setEnabled(files.length != 0);
- }
-
- /**
- * @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) {
- height = ALLOWREFRESH_HEIGHT;
- width = ALLOWREFRESH_WIDTH;
- }
- } else {
- try {
- height = settings.getInt(NOREFRESH_HEIGHT_KEY);
- width = settings.getInt(NOREFRESH_WIDTH_KEY);
- } catch(NumberFormatException e) {
- height = NOREFRESH_HEIGHT;
- width = NOREFRESH_WIDTH;
- }
- }
- 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);
- 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();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagSelectionDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagSelectionDialog.java
deleted file mode 100644
index bff293169..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagSelectionDialog.java
+++ /dev/null
@@ -1,292 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-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.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.merge.ProjectElement;
-import org.eclipse.team.internal.ccvs.ui.merge.TagElement;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-/**
- * Dialog to prompt the user to choose a tag for a selected resource
- */
-public class TagSelectionDialog extends Dialog {
- private ICVSFolder[] folders;
- private int includeFlags;
- private CVSTag result;
-
- public static final int INCLUDE_HEAD_TAG = ProjectElement.INCLUDE_HEAD_TAG;
- public static final int INCLUDE_BASE_TAG = ProjectElement.INCLUDE_BASE_TAG;
- public static final int INCLUDE_BRANCHES = ProjectElement.INCLUDE_BRANCHES;
- public static final int INCLUDE_VERSIONS = ProjectElement.INCLUDE_VERSIONS;
- public static final int INCLUDE_ALL_TAGS = ProjectElement.INCLUDE_ALL_TAGS;
-
- // widgets;
- private TreeViewer tagTree;
- private Button okButton;
-
- // dialog title, should indicate the action in which the tag selection
- // dialog is being shown
- private String title;
- private String message;
-
- private boolean recurse = true;
- private boolean showRecurse;
-
- // constants
- private static final int SIZING_DIALOG_WIDTH = 400;
- private static final int SIZING_DIALOG_HEIGHT = 250;
-
- /**
- * Creates a new TagSelectionDialog.
- * @param resource The resource to select a version for.
- */
- public TagSelectionDialog(Shell parentShell, IProject[] projects, String title, String message, int includeFlags, boolean showRecurse) {
- this(parentShell, getCVSFoldersFor(projects), title, message, includeFlags, showRecurse); //$NON-NLS-1$
- }
-
- private static ICVSFolder[] getCVSFoldersFor(IProject[] projects) {
- ICVSFolder[] folders = new ICVSFolder[projects.length];
- for (int i = 0; i < projects.length; i++) {
- folders[i] = CVSWorkspaceRoot.getCVSFolderFor(projects[i]);
- }
- return folders;
- }
-
- /**
- * Creates a new TagSelectionDialog.
- * @param resource The resource to select a version for.
- */
- public TagSelectionDialog(Shell parentShell, ICVSFolder[] folders, String title, String message, int includeFlags, boolean showRecurse) {
- super(parentShell);
- this.folders = folders;
- this.title = title;
- this.message = message;
- this.includeFlags = includeFlags;
- this.showRecurse = showRecurse;
- setShellStyle(getShellStyle() | SWT.RESIZE);
- }
-
- /* (non-Javadoc)
- * Method declared on Window.
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(title);
- }
-
- /**
- * 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);
-
- Composite inner = new Composite(top, SWT.NULL);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = SIZING_DIALOG_WIDTH;
- data.heightHint = SIZING_DIALOG_HEIGHT;
- inner.setLayoutData(data);
- GridLayout layout = new GridLayout();
- inner.setLayout(layout);
-
- Label l = new Label (inner, SWT.NONE);
- l.setText(message); //$NON-NLS-1$
-
- tagTree = createTree(inner);
- tagTree.setInput(new ProjectElement(folders[0], includeFlags));
- Runnable refresh = new Runnable() {
- public void run() {
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- tagTree.refresh();
- }
- });
- }
- };
-
- if(showRecurse) {
- final Button recurseCheck = new Button(top, 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);
- }
-
-
- TagConfigurationDialog.createTagDefinitionButtons(getShell(), top, folders,
- convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT),
- convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH),
- refresh, refresh);
-
- Label seperator = new Label(top, SWT.SEPARATOR | SWT.HORIZONTAL);
- data = new GridData (GridData.FILL_BOTH);
- data.horizontalSpan = 2;
- seperator.setLayoutData(data);
-
- updateEnablement();
-
- 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;
- }
-
- protected TreeViewer createTree(Composite parent) {
- Tree tree = new Tree(parent, SWT.SINGLE | SWT.BORDER);
- tree.setLayoutData(new GridData(GridData.FILL_BOTH));
- TreeViewer result = new TreeViewer(tree);
- result.setContentProvider(new WorkbenchContentProvider());
- result.setLabelProvider(new WorkbenchLabelProvider());
- result.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateEnablement();
- }
- });
- // select and close on double click
- // To do: use defaultselection instead of double click
- result.getTree().addMouseListener(new MouseAdapter() {
- public void mouseDoubleClick(MouseEvent e) {
- IStructuredSelection selection = (IStructuredSelection)tagTree.getSelection();
- if (!selection.isEmpty() && (selection.getFirstElement() instanceof TagElement)) {
- okPressed();
- }
- }
- });
- result.setSorter(new RepositorySorter());
- return result;
- }
-
- /**
- * Returns the selected tag.
- */
- public CVSTag getResult() {
- return result;
- }
-
- public boolean getRecursive() {
- return recurse;
- }
-
- /**
- * Initializes the dialog contents.
- */
- protected void initialize() {
- okButton.setEnabled(false);
- }
-
- /**
- * 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() {
- IStructuredSelection selection = (IStructuredSelection)tagTree.getSelection();
- Object o = selection.getFirstElement();
- TagElement element = (TagElement)o;
- result = element.getTag();
- super.okPressed();
- }
-
-
- /**
- * Updates the dialog enablement.
- */
- protected void updateEnablement() {
- if(okButton!=null) {
- IStructuredSelection selection = (IStructuredSelection)tagTree.getSelection();
- if (selection.isEmpty() || !(selection.getFirstElement() instanceof TagElement)) {
- okButton.setEnabled(false);
- } else {
- okButton.setEnabled(true);
- }
- }
- }
-}
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 bc31608e5..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TextViewerAction.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-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);
- }
- }
-} \ No newline at end of file
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 99a5cbf90..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) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - 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 IRunnableContext.
- * 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 d81c52f08..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/UserValidationDialog.java
+++ /dev/null
@@ -1,186 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-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.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;
-
-/**
- * A dialog for prompting for a username and password
- */
-public class UserValidationDialog extends Dialog {
- // widgets
- protected Text usernameField;
- protected Text passwordField;
-
- protected String domain;
- protected String defaultUsername;
- protected String password = null;
-
- // whether or not the username can be changed
- protected boolean isUsernameMutable = 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 main = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- main.setLayout(layout);
- main.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- if (message != null) {
- Label messageLabel = new Label(main, SWT.WRAP);
- messageLabel.setText(message);
- messageLabel.setForeground(messageLabel.getDisplay().getSystemColor(SWT.COLOR_RED));
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 3;
- messageLabel.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$
- }
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 3;
- label.setLayoutData(data);
-
- createUsernameFields(main);
- createPasswordFields(main);
-
- return main;
- }
- /**
- * 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);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH);
- passwordField.setLayoutData(data);
- passwordField.setEchoChar('*');
-
- // spacer
- new Label(parent, SWT.NONE);
- }
- /**
- * 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.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH);
- usernameField.setLayoutData(data);
-
- // spacer
- new Label(parent, SWT.NONE);
- }
- /**
- * 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;
- }
- /**
- * 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;
- }
-}
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 1dbf4981c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/VersionCollator.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.text.Collator;
-import java.util.Vector;
-
-public class VersionCollator {
- static final int WORD = 0;
- static final int NUMBER = 1;
-
- public int compare(String version1, String version2) {
- if (version1 == null && version2 == null) return 0;
- if (version1 == null) return -1;
- if (version2 == null) return 1;
- String[] version1Segments = getStringSegments(version1);
- String[] version2Segments = getStringSegments(version2);
- Collator collator = Collator.getInstance();
- for (int i = 0; i < version1Segments.length && i < version2Segments.length; i++) {
- int oneType = isNumber(version1Segments[i]) ? NUMBER : WORD;
- int twoType = isNumber(version2Segments[i]) ? NUMBER : WORD;
- if (oneType != twoType) {
- return collator.compare(version1, version2);
- }
- if (oneType == NUMBER) {
- int intOne = Integer.parseInt(version1Segments[i]);
- int intTwo = Integer.parseInt(version2Segments[i]);
- if (intOne != intTwo) return (intOne < intTwo) ? -1 : 1;
- } else {
- int result = collator.compare(version1Segments[i], version2Segments[i]);
- if (result != 0) return result;
- }
- }
- if (version1Segments.length != version2Segments.length) {
- return version1Segments.length < version2Segments.length ? -1 : 1;
- }
- return 0;
- }
- String[] getStringSegments(String string) {
- int size = string.length();
- if (size == 0) return new String[0];
- StringBuffer buffer = new StringBuffer();
- Vector vector = new Vector();
- int current = Character.isDigit(string.charAt(0)) ? NUMBER : WORD;
- for (int i = 0; i < size; i++) {
- char ch = string.charAt(i);
- int newCurrent = Character.isDigit(string.charAt(i)) ? NUMBER : WORD;
- if (newCurrent != current) {
- vector.addElement(buffer.toString());
- buffer = new StringBuffer();
- current = newCurrent;
- }
- buffer.append(ch);
- }
- vector.addElement(buffer.toString());
- String[] result = new String[vector.size()];
- vector.toArray(result);
- return result;
- }
- boolean isNumber(String string) {
- return Character.isDigit(string.charAt(0));
- }
-}
-
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 f132d525f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkbenchUserAuthenticator.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial implementation
- ******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.IFileTypeInfo;
-import org.eclipse.team.core.IIgnoreInfo;
-import org.eclipse.team.core.Team;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.IUserAuthenticator;
-import org.eclipse.team.internal.ccvs.core.IUserInfo;
-
-/**
- * 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();
- if (display != null) {
- promptForPassword(location, userinfo.getUsername(), message, userinfo.isUsernameMutable(), result);
- } else {
- // sync exec in default thread
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- 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]);
- }
-
- /**
- * 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 void promptForPassword(final ICVSRepositoryLocation location, final String username, final String message, final boolean userMutable, final String[] result) {
- Display display = Display.getCurrent();
- Shell shell = new Shell(display);
- UserValidationDialog dialog = new UserValidationDialog(shell, location.getLocation(), (username==null)?"":username, message);//$NON-NLS-1$
- dialog.setUsernameMutable(userMutable);
- dialog.open();
- shell.dispose();
-
- result[0] = dialog.getUsername();
- result[1] = dialog.getPassword();
- }
-
- /**
- * Special alternate prompting. Returns the password. Username must be fixed.
- */
- private String alternatePromptForPassword(final String username) {
- Display display = Display.getCurrent();
- Shell shell = new Shell(display);
- AlternateUserValidationDialog dialog = new AlternateUserValidationDialog(shell, (username == null) ? "" : username); //$NON-NLS-1$
- dialog.setUsername(username);
- int result = dialog.open();
- shell.dispose();
- if (result == Dialog.CANCEL) return null;
- return dialog.getPassword();
- }
- /**
- * Special alternate prompting.
- */
- public void alternatePromptForUserInfo(final IUserInfo userinfo) throws CVSException {
- // 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]);
- }
-}
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 56956f429..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-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.CVSProviderPlugin;
-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.ui.Policy;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-/**
- * AddAction performs a 'cvs add' command on the selected resources. If a
- * container is selected, its children are recursively added.
- */
-public class AddAction extends CVSAction {
- /*
- * @see CVSAction#execute()
- */
- public void execute(IAction action) {
- run(new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- try {
- Hashtable table = getProviderMapping();
- Set keySet = table.keySet();
- monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$
- monitor.setTaskName(Policy.bind("AddAction.adding")); //$NON-NLS-1$
- 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()]);
- provider.add(providerResources, IResource.DEPTH_INFINITE, subMonitor);
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- }, Policy.bind("AddAction.add"), this.PROGRESS_DIALOG); //$NON-NLS-1$
-
- }
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- IResource[] resources = getSelectedResources();
- if (resources.length == 0) return false;
- for (int i = 0; i < resources.length; i++) {
- RepositoryProvider provider = RepositoryProvider.getProvider(resources[i].getProject(), CVSProviderPlugin.getTypeId());
- if(provider == null) return false;
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
- if(cvsResource.isFolder()) {
- if(((ICVSFolder)cvsResource).isCVSFolder()) return false;
- } else {
- if (cvsResource.isManaged()) return false;
- }
- }
- return true;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddToWorkspaceAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddToWorkspaceAction.java
deleted file mode 100644
index 49bbf9e77..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddToWorkspaceAction.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.io.File;
-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.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.client.Checkout;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.PromptingDialog;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-/**
- * Add some remote resources to the workspace. Current implementation:
- * -Works only for remote folders
- * -Does not prompt for project name; uses folder name instead
- */
-public class AddToWorkspaceAction extends CheckoutAction {
- /**
- * Returns the selected remote folders.
- * Remove any module aliases as they may cause problems on checkout this way
- */
- protected ICVSRemoteFolder[] getSelectedRemoteFolders() {
- ICVSRemoteFolder[] allFolders = super.getSelectedRemoteFolders();
- if (allFolders.length == 0) return allFolders;
- ArrayList resources = new ArrayList();
- for (int i = 0; i < allFolders.length; i++) {
- ICVSRemoteFolder folder = allFolders[i];
- if (!Checkout.ALIAS.isElementOf(folder.getLocalOptions())) {
- resources.add(folder);
- }
- }
- return (ICVSRemoteFolder[])resources.toArray(new ICVSRemoteFolder[resources.size()]);
- }
-
- /*
- * @see CVSAction#execute()
- */
- public void execute(IAction action) {
- run(new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- try {
- ICVSRemoteFolder[] folders = getSelectedRemoteFolders();
-
- List targetProjects = new ArrayList();
- Map targetFolders = new HashMap();
- for (int i = 0; i < folders.length; i++) {
- String name = folders[i].getName();
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
- targetFolders.put(name, folders[i]);
- targetProjects.add(project);
- }
-
- IResource[] projects = (IResource[]) targetProjects.toArray(new IResource[targetProjects.size()]);
-
- PromptingDialog prompt = new PromptingDialog(getShell(), projects,
- getOverwriteLocalAndFileSystemPrompt(),
- Policy.bind("ReplaceWithAction.confirmOverwrite"));//$NON-NLS-1$
- projects = prompt.promptForMultiple();
-
- monitor.beginTask(null, 100);
- if (projects.length != 0) {
- IProject[] localFolders = new IProject[projects.length];
- ICVSRemoteFolder[] remoteFolders = new ICVSRemoteFolder[projects.length];
- for (int i = 0; i < projects.length; i++) {
- localFolders[i] = (IProject)projects[i];
- remoteFolders[i] = (ICVSRemoteFolder)targetFolders.get(projects[i].getName());
- }
-
- monitor.setTaskName(getTaskName(remoteFolders));
- CVSProviderPlugin.getProvider().checkout(remoteFolders, localFolders, Policy.subMonitorFor(monitor, 100));
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- }, Policy.bind("AddToWorkspaceAction.checkoutFailed"), this.PROGRESS_DIALOG); //$NON-NLS-1$
- }
-
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- ICVSRemoteFolder[] resources = getSelectedRemoteFolders();
- if (resources.length == 0) return false;
- for (int i = 0; i < resources.length; i++) {
- if (resources[i] instanceof ICVSRepositoryLocation) return false;
- }
- return true;
- }
-} \ No newline at end of file
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 36cfbf898..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial implementation
- ******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-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.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.action.IAction;
-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.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.ICVSResource;
-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.BranchPromptDialog;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.RepositoryManager;
-
-/**
- * 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 CVSAction {
-
- /*
- * @see CVSAction#execute()
- */
- public void execute(IAction action) {
- final Shell shell = getShell();
- final IResource[] resources = getSelectedResources();
- boolean allSticky = areAllResourcesSticky(resources);
-
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(resources[0].getProject());
- final BranchPromptDialog dialog = new BranchPromptDialog(getShell(),
- Policy.bind("BranchWizard.title"), //$NON-NLS-1$
- folder,
- allSticky,
- calculateInitialVersionName(resources,allSticky));
-
- if (dialog.open() != InputDialog.OK) return;
-
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- String tagString = dialog.getBranchTagName();
- boolean update = dialog.getUpdate();
- String versionString = dialog.getVersionTagName();
- CVSTag rootVersionTag = null;
- final CVSTag branchTag = new CVSTag(tagString, CVSTag.BRANCH);
- if (versionString != null) {
- rootVersionTag = new CVSTag(versionString, CVSTag.VERSION);
- }
-
- // 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
- if (update) {
- if(!CVSAction.checkForMixingTags(getShell(), resources, branchTag)) {
- return;
- }
- }
-
- RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- Hashtable table = getProviderMapping(resources);
- Set keySet = table.keySet();
- monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$
- MultiStatus status = new MultiStatus(CVSUIPlugin.ID, IStatus.INFO, Policy.bind("BranchWizard.errorBranching"), null); //$NON-NLS-1$
- 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()]);
- ICVSRepositoryLocation root = provider.getCVSWorkspaceRoot().getRemoteLocation();
- try {
- if (!areAllResourcesSticky(resources)) {
- // version everything in workspace with the root version tag specified in dialog
- provider.makeBranch(providerResources, rootVersionTag, branchTag, update, true, subMonitor);
- } else {
- // all resources are versions, use that version as the root of the branch
- provider.makeBranch(providerResources, null, branchTag, update, true, subMonitor);
- }
- if (rootVersionTag != null || update) {
- for (int i = 0; i < providerResources.length; i++) {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(providerResources[i]);
- if (rootVersionTag != null) {
- manager.addVersionTags(cvsResource, new CVSTag[] { rootVersionTag });
- }
- if (update) {
- manager.addBranchTags(cvsResource, new CVSTag[] { branchTag });
- }
- }
- }
- } catch (TeamException e) {
- status.merge(e.getStatus());
- }
- }
- if (!status.isOK()) {
- throw new InvocationTargetException(new CVSException(status));
- }
- } catch(CVSException e) {
- throw new InvocationTargetException(e);
- }
- }
- }, Policy.bind("BranchWizard.errorBranching"), this.PROGRESS_DIALOG); //$NON-NLS-1$
- }
-
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() {
- try {
- return isSelectionNonOverlapping();
- } catch(TeamException e) {
- CVSUIPlugin.log(e.getStatus());
- return false;
- }
- }
-
- /**
- * 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==tag.VERSION) {
- return true;
- }
- }
- } catch(CVSException e) {
- CVSUIPlugin.log(e.getStatus());
- 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.getStatus());
- versionName = ""; //$NON-NLS-1$
- }
- return versionName;
- }
-}
-
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 46adb7536..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
+++ /dev/null
@@ -1,390 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial implementation
- ******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-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.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.IStructuredSelection;
-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.CVSStatus;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-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.ui.actions.TeamAction;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Superclass for all CVS actions. It provides helper enablement
- * methods and common pre-run and post-run hadling.
- */
-abstract public class CVSAction extends TeamAction {
-
- private List accumulatedStatus = new ArrayList();
-
- /**
- * Common run method for all CVS actions.
- *
- * [Note: it would be nice to have common CVS error handling
- * placed here and have all CVS actions subclass. For example
- * error handling UI could provide a retry facility for actions
- * if they have failed.]
- */
- final public void run(IAction action) {
- accumulatedStatus.clear();
- if(needsToSaveDirtyEditors()) {
- if(!saveAllEditors()) {
- return;
- }
- }
- try {
- execute(action);
- if ( ! accumulatedStatus.isEmpty()) {
- handle(null);
- }
- } 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);
- }
- }
-
- /**
- * 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();
- }
- ErrorDialog.openError(getShell(), title, message, statusToDisplay);
- }
-
- /**
- * Actions must override to do their work.
- */
- abstract protected void execute(IAction action) throws InvocationTargetException, InterruptedException;
-
- /**
- * Answers if the action would like dirty editors to saved
- * based on the CVS preference before running the action. By
- * default most CVS action modify the workspace and thus should
- * save dirty editors.
- */
- protected boolean needsToSaveDirtyEditors() {
- return true;
- }
-
- /**
- * Answers <code>true</code> if the current selection contains resource that don't
- * have overlapping paths and <code>false</code> otherwise.
- */
- protected boolean isSelectionNonOverlapping() throws TeamException {
- IResource[] resources = getSelectedResources();
- // allow operation for non-overlapping resource selections
- if(resources.length>0) {
- List validPaths = new ArrayList(2);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
-
- // only allow cvs resources to be selected
- if(RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId()) == null) {
- return false;
- }
-
- // check if this resource overlaps other selections
- IPath resourceFullPath = resource.getFullPath();
- if(!validPaths.isEmpty()) {
- for (Iterator it = validPaths.iterator(); it.hasNext();) {
- IPath path = (IPath) it.next();
- if(path.isPrefixOf(resourceFullPath) ||
- resourceFullPath.isPrefixOf(path)) {
- return false;
- }
- }
- }
- validPaths.add(resourceFullPath);
-
- // ensure that resources are managed
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if(cvsResource.isFolder()) {
- if( ! ((ICVSFolder)cvsResource).isCVSFolder()) return false;
- } else {
- if( ! cvsResource.isManaged()) return false;
- }
- }
- return true;
- }
- return false;
- }
-
- /**
- * Returns the selected CVS resources
- */
- protected ICVSResource[] getSelectedCVSResources() {
- ArrayList resources = null;
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = ((IStructuredSelection) 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 = ((IStructuredSelection) 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];
- }
-
- /**
- * 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();
- if (!CVSTag.equalTags(tag, parentTag)) {
- 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() {
- IWorkbenchPage oldPage = CVSUIPlugin.getActivePage();
- boolean confirm = option == ICVSUIConstants.OPTION_PROMPT;
- IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
- for (int i = 0; i < windows.length; i++) {
- IWorkbenchPage[] pages = windows[i].getPages();
- for (int j = 0; j < pages.length; j++) {
- okToContinue[0] = pages[j].saveAllEditors(confirm);
- }
- }
- if (oldPage != null) {
- oldPage.getWorkbenchWindow().getShell().setFocus();
- }
- }
- });
- }
- return okToContinue[0];
- }
-} \ No newline at end of file
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 13d581da6..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAction.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial implementation
- ******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashSet;
-import java.util.Set;
-import java.io.File;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-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.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.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.IPromptCondition;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.PromptingDialog;
-
-/**
- * The purpose of the CheckoutAction is to allow the checkout of module aliases into the
- */
-public class CheckoutAction extends CVSAction {
-
- /**
- * @see CVSAction#execute(IAction)
- */
- protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
-
- // Fetch the module expansions for the folder
- final ICVSRemoteFolder[] remoteFolders = getSelectedRemoteFolders();
- final String[][] expansions = new String[1][0];
- expansions[0] = null;
- CVSUIPlugin.runWithProgressDialog(getShell(), true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- expansions[0] = CVSProviderPlugin.getProvider().getExpansions(remoteFolders, monitor);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- if (expansions[0] == null) return;
-
- // If the folder exists, inform the user that it will be overridden
- Set targetProjects = new HashSet();
- for (int i = 0; i < expansions[0].length; i++) {
- String string = expansions[0][i];
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(new Path(string).segment(0));
- targetProjects.add(project);
- }
- IResource[] projects = (IResource[]) targetProjects.toArray(new IResource[targetProjects.size()]);
- PromptingDialog prompt = new PromptingDialog(getShell(), projects,
- getOverwriteLocalAndFileSystemPrompt(),
- Policy.bind("ReplaceWithAction.confirmOverwrite"));//$NON-NLS-1$
- if (prompt.promptForMultiple().length != projects.length) return;
-
- CVSUIPlugin.runWithProgressDialog(getShell(), true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- monitor.beginTask(getTaskName(remoteFolders), 100);
- monitor.setTaskName(getTaskName(remoteFolders));
- CVSProviderPlugin.getProvider().checkout(remoteFolders, null, Policy.subMonitorFor(monitor, 100));
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- });
- }
-
- /**
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- return getSelectedRemoteFolders().length == 1;
- }
-
- protected static String getTaskName(ICVSRemoteFolder[] remoteFolders) {
- if (remoteFolders.length == 1) {
- ICVSRemoteFolder folder = remoteFolders[0];
- return Policy.bind("AddToWorkspace.taskName1", folder.getRepositoryRelativePath()); //$NON-NLS-1$
- }
- else {
- return Policy.bind("AddToWorkspace.taskNameN", new Integer(remoteFolders.length).toString()); //$NON-NLS-1$
- }
- }
-
- protected IPromptCondition getOverwriteLocalAndFileSystemPrompt() {
- return new IPromptCondition() {
- // prompt if resource in workspace exists or exists in local file system
- public boolean needsPrompt(IResource resource) {
- File localLocation = getFileLocation(resource);
- if(resource.exists() || localLocation.exists()) {
- return true;
- }
- return false;
- }
- public String promptMessage(IResource resource) {
- File localLocation = getFileLocation(resource);
- if(resource.exists()) {
- return Policy.bind("AddToWorkspaceAction.thisResourceExists", resource.getName());//$NON-NLS-1$
- } else {
- return Policy.bind("AddToWorkspaceAction.thisExternalFileExists", resource.getName());//$NON-NLS-1$
- }//$NON-NLS-1$
- }
- private File getFileLocation(IResource resource) {
- return new File(resource.getParent().getLocation().toFile(), resource.getName());
- }
- };
- }
-}
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 ef6e107cb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAsAction.java
+++ /dev/null
@@ -1,201 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.Dialog;
-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.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.PromptingDialog;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.NewProjectAction;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.dialogs.ProjectLocationSelectionDialog;
-
-/**
- * Add a remote resource to the workspace. Current implementation:
- * -Works only for remote folders
- * -Does not prompt for project name; uses folder name instead
- */
-public class CheckoutAsAction extends AddToWorkspaceAction {
- /*
- * @see IActionDelegate#run(IAction)
- */
- public void execute(IAction action) {
-
- final ICVSRemoteFolder[] folders = getSelectedRemoteFolders();
- if (folders.length != 1) return;
- final String name = folders[0].getName();
-
- // Fetch the members of the folder to see if they contain a .project file.
- final boolean[] hasProjectMetaFile = new boolean[] { false };
- final boolean[] errorOccured = new boolean[] { false };
- run(new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- try {
- folders[0].members(monitor);
- } catch (TeamException e) {
- errorOccured[0] = true;
- throw new InvocationTargetException(e);
- }
- // Check for the existance of the .project file
- try {
- folders[0].getFile(".project"); //$NON-NLS-1$
- hasProjectMetaFile[0] = true;
- } catch (TeamException e) {
- // We couldn't retrieve the meta file so assume it doesn't exist
- hasProjectMetaFile[0] = false;
- }
- // If the above failed, look for the old .vcm_meta file
- if (! hasProjectMetaFile[0]) {
- try {
- folders[0].getFile(".vcm_meta"); //$NON-NLS-1$
- hasProjectMetaFile[0] = true;
- } catch (TeamException e) {
- // We couldn't retrieve the meta file so assume it doesn't exist
- hasProjectMetaFile[0] = false;
- }
- }
- }
- }, Policy.bind("CheckoutAsAction.checkoutFailed"), this.PROGRESS_DIALOG); //$NON-NLS-1$
- if (errorOccured[0]) return;
-
- // Prompt outside a workspace runnable so that the project creation delta can be heard
- IProject newProject = null;
- if ( ! hasProjectMetaFile[0]) {
- newProject = getNewProject(name);
- if (newProject == null) return;
- }
-
- final IProject createdProject = newProject;
- run(new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- try {
- IProject project;
- if (hasProjectMetaFile[0]) {
- // Prompt for name
- final Shell shell = getShell();
- final int[] result = new int[] { Dialog.OK };
- project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
- final ProjectLocationSelectionDialog dialog = new ProjectLocationSelectionDialog(shell, project);
- dialog.setTitle(Policy.bind("CheckoutAsAction.enterProjectTitle", name)); //$NON-NLS-1$
-
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- result[0] = dialog.open();
- }
- });
- if (result[0] != Dialog.OK) return;
-
- Object[] destinationPaths = dialog.getResult();
- if (destinationPaths == null) return;
- String newName = (String) destinationPaths[0];
- IPath newLocation = new Path((String) destinationPaths[1]);
-
- // prompt if the project exists locally
- project = ResourcesPlugin.getWorkspace().getRoot().getProject(newName);
- PromptingDialog prompt = new PromptingDialog(getShell(), new IResource[] { project },
- getOverwriteLocalAndFileSystemPrompt(), Policy.bind("ReplaceWithAction.confirmOverwrite"));//$NON-NLS-1$
- if (prompt.promptForMultiple().length == 0) return;
-
- monitor.beginTask(null, 100);
- monitor.setTaskName(Policy.bind("CheckoutAsAction.taskname", name, newName)); //$NON-NLS-1$
-
- // create the project
- try {
- if (newLocation.equals(Platform.getLocation())) {
- // create in default location
- project.create(Policy.subMonitorFor(monitor, 3));
- } else {
- // create in some other location
- IProjectDescription desc = ResourcesPlugin.getWorkspace().newProjectDescription(project.getName());
- desc.setLocation(newLocation);
- project.create(desc, Policy.subMonitorFor(monitor, 3));
- }
- project.open(Policy.subMonitorFor(monitor, 2));
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- }
- } else {
- project = createdProject;
- monitor.beginTask(null, 95);
- monitor.setTaskName(Policy.bind("CheckoutAsAction.taskname", name, createdProject.getName())); //$NON-NLS-1$
- }
-
- CVSProviderPlugin.getProvider().checkout(folders, new IProject[] { project }, Policy.subMonitorFor(monitor, 95));
-
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- }, Policy.bind("CheckoutAsAction.checkoutFailed"), this.PROGRESS_DIALOG); //$NON-NLS-1$
- }
-
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- return getSelectedRemoteFolders().length == 1;
- }
-
- /**
- * Get a new project.
- *
- * The suggestedName is not currently used but is a desired capability.
- */
- private IProject getNewProject(String suggestedName) {
- NewProjectListener listener = new NewProjectListener();
- ResourcesPlugin.getWorkspace().addResourceChangeListener(listener, IResourceChangeEvent.POST_CHANGE);
- (new NewProjectAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow())).run();
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(listener);
- return listener.getNewProject();
- }
-
- 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;
- }
- }
-} \ No newline at end of file
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 18495b38b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-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.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-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.RepositoryManager;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-/**
- * Action for checking in files to a CVS provider.
- * Prompts the user for a release comment.
- */
-public class CommitAction extends CVSAction {
- /*
- * @see IActionDelegate#run(IAction)
- */
- public void execute(IAction action) {
- run(new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- try {
- RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- String comment = promptForComment(manager);
- if (comment != null) {
- manager.commit(getSelectedResources(), comment, monitor);
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- }, Policy.bind("CommitAction.commitFailed"), PROGRESS_DIALOG); //$NON-NLS-1$
- }
-
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- IResource[] resources = getSelectedResources();
- if (resources.length == 0) return false;
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId());
- if (provider == null) return false;
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if (resource.getType()!=IResource.PROJECT&&!cvsResource.isManaged()) return false;
- }
- return true;
- }
-
- /**
- * Prompts the user for a release comment.
- * @return the comment, or null to cancel
- */
- protected String promptForComment(RepositoryManager manager) {
- return manager.promptForComment(getShell());
- }
-}
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 bffaca4bd..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteResourcesAction.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.compare.CompareUI;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.core.ILogEntry;
-import org.eclipse.team.internal.ccvs.ui.CVSCompareEditorInput;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.ResourceEditionNode;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-
-/**
- * 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) {
- 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;
- }
- ResourceEditionNode left = new ResourceEditionNode(editions[0]);
- ResourceEditionNode right = new ResourceEditionNode(editions[1]);
- CompareUI.openCompareEditor(new CVSCompareEditorInput(left, right));
- }
-
- /**
- * Returns the selected remote resources
- */
- protected ICVSRemoteResource[] getSelectedRemoteResources() {
- ArrayList resources = null;
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = ((IStructuredSelection)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];
- }
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- ICVSRemoteResource[] resources = getSelectedRemoteResources();
- return resources.length == 2;
- }
- /*
- * @see CVSAction#needsToSaveDirtyEditors()
- */
- protected boolean needsToSaveDirtyEditors() {
- return false;
- }
-}
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 427edfafd..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.compare.CompareUI;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.team.core.RepositoryProvider;
-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.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.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.CVSLocalCompareEditorInput;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-public class CompareWithRemoteAction extends CompareWithTagAction {
-
- public void execute(IAction action) {
- IResource[] resources;
- resources = getSelectedResources();
- CVSTag[] tags = new CVSTag[resources.length];
- try {
- for (int i = 0; i < resources.length; i++) {
- tags[i] = getTag(resources[i]);
- }
- CompareUI.openCompareEditor(new CVSLocalCompareEditorInput(resources, tags));
- } catch(CVSException e) {
- ErrorDialog.openError(getShell(), Policy.bind("CompareWithRemoteAction.compare"), //$NON-NLS-1$
- Policy.bind("CompareWithRemoteAction.noRemoteLong"), e.getStatus()); //$NON-NLS-1$
- }
- }
-
- protected CVSTag getTag(IResource resource) throws CVSException {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- CVSTag tag = null;
- if (cvsResource.isFolder()) {
- FolderSyncInfo folderInfo = ((ICVSFolder)cvsResource).getFolderSyncInfo();
- if (folderInfo!=null) {
- tag = folderInfo.getTag();
- if(tag == null) {
- tag = CVSTag.DEFAULT;
- }
- }
- } else {
- ResourceSyncInfo info = cvsResource.getSyncInfo();
- if (info != null) {
- tag = info.getTag();
- }
- }
- if (tag==null) {
- if (cvsResource.getParent().isCVSFolder()) {
- tag = cvsResource.getParent().getFolderSyncInfo().getTag();
- if(tag == null) {
- tag = CVSTag.DEFAULT;
- }
- }
- }
- return tag;
- }
-
- protected boolean isEnabled() {
- IResource[] resources = getSelectedResources();
- if(resources.length>0) {
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if(RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId()) == null) {
- return false;
- }
- try {
- if(getTag(resource) == null) {
- return false;
- }
- } catch(CVSException e) {
- return false;
- }
- }
- return true;
- }
- return false;
- }
-} \ No newline at end of file
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 cffa5e774..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-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.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.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.CVSCompareRevisionsInput;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-
-public class CompareWithRevisionAction extends CVSAction {
- /**
- * 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;
- }
- }
-
- public void execute(IAction action) {
-
- // 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();
- }
- }, Policy.bind("CompareWithRevisionAction.compare"), this.PROGRESS_BUSYCURSOR); //$NON-NLS-1$
-
- 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);
- }
- }
- }, Policy.bind("CompareWithRevisionAction.compare"), this.PROGRESS_DIALOG); //$NON-NLS-1$
-
- if (entries[0] == null) return;
-
- // Show the compare viewer
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- CompareUI.openCompareEditor(new CVSCompareRevisionsInput((IFile)getSelectedResources()[0], entries[0]));
- }
- }, Policy.bind("CompareWithRevisionAction.compare"), this.PROGRESS_BUSYCURSOR); //$NON-NLS-1$
- }
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- IResource[] resources = getSelectedResources();
- if (resources.length != 1) return false;
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resources[0]);
- return cvsResource.isManaged();
- }
-
- /*
- * @see CVSAction#needsToSaveDirtyEditors()
- */
- protected boolean needsToSaveDirtyEditors() {
- return false;
- }
-} \ No newline at end of file
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 880b407b8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.compare.CompareUI;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.ui.CVSLocalCompareEditorInput;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.TagSelectionDialog;
-
-public class CompareWithTagAction extends CVSAction {
-
- public void execute(IAction action) {
- final CVSTag tag;
- final ICVSRemoteResource[] remoteResource = new ICVSRemoteResource[] { null };
- final IResource[] resources = getSelectedResources();
-
- IProject[] projects = new IProject[resources.length];
- for (int i = 0; i < resources.length; i++) {
- projects[i] = resources[i].getProject();
- }
- TagSelectionDialog dialog = new TagSelectionDialog(getShell(), projects, Policy.bind("CompareWithTagAction.message"), //$NON-NLS-1$
- Policy.bind("TagSelectionDialog.Select_a_Tag_1"), TagSelectionDialog.INCLUDE_ALL_TAGS, false); //$NON-NLS-1$ //$NON-NLS-2$
- dialog.setBlockOnOpen(true);
- int result = dialog.open();
- if (result == Dialog.CANCEL || dialog.getResult() == null) {
- return;
- }
- tag = dialog.getResult();
- if (tag == null) return;
- CompareUI.openCompareEditor(new CVSLocalCompareEditorInput(resources, tag));
- }
-
-
-
- protected boolean isEnabled() {
- try {
- return isSelectionNonOverlapping();
- } catch(TeamException e) {
- CVSUIPlugin.log(e.getStatus());
- return false;
- }
- }
-
- /*
- * @see CVSAction#needsToSaveDirtyEditors()
- */
- protected boolean needsToSaveDirtyEditors() {
- return false;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ConfigureTagsFromRepoView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ConfigureTagsFromRepoView.java
deleted file mode 100644
index 59acd975e..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ConfigureTagsFromRepoView.java
+++ /dev/null
@@ -1,123 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-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.core.runtime.IStatus;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IInputValidator;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.IStructuredSelection;
-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.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.TagConfigurationDialog;
-import org.eclipse.team.internal.ccvs.ui.model.BranchCategory;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-
-/**
- * DefineTagAction remembers a tag by name
- */
-public class ConfigureTagsFromRepoView extends CVSAction {
- IInputValidator validator = new IInputValidator() {
- public String isValid(String newText) {
- IStatus status = CVSTag.validateTagName(newText);
- if (status.isOK()) return null;
- return status.getMessage();
- }
- };
-
- /**
- * Returns the selected remote roots
- */
- protected ICVSRepositoryLocation[] getSelectedRemoteRoots() {
- ArrayList resources = null;
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = ((IStructuredSelection) selection).iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof ICVSRepositoryLocation) {
- resources.add(next);
- continue;
- }
- if (next instanceof BranchCategory) {
- resources.add(((BranchCategory)next).getRepository(next));
- continue;
- }
- if (next instanceof IAdaptable) {
- IAdaptable a = (IAdaptable) next;
- Object adapter = a.getAdapter(ICVSRepositoryLocation.class);
- if (adapter instanceof ICVSRepositoryLocation) {
- resources.add(adapter);
- continue;
- }
- }
- }
- }
- if (resources != null && !resources.isEmpty()) {
- ICVSRepositoryLocation[] result = new ICVSRepositoryLocation[resources.size()];
- resources.toArray(result);
- return result;
- }
- return new ICVSRepositoryLocation[0];
- }
-
- /*
- * @see IActionDelegate#run(IAction)
- */
- public void execute(IAction action) {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- final ICVSRepositoryLocation[] roots = getSelectedRemoteRoots();
- if (roots.length != 1) return;
- final Shell shell = getShell();
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- try {
- ICVSRemoteResource[] folders = roots[0].members(CVSTag.DEFAULT, false, null);
- ICVSFolder[] cvsFolders = new ICVSFolder[folders.length];
- for (int i = 0; i < folders.length; i++) {
- cvsFolders[i] = (ICVSFolder)folders[i];
- }
- TagConfigurationDialog d = new TagConfigurationDialog(shell, cvsFolders);
- d.open();
- } catch(CVSException e) {
- ErrorDialog.openError(shell, Policy.bind("ConfigureTagsFromRepoViewConfigure_Tag_Error_1"), Policy.bind("ConfigureTagsFromRepoViewError_retreiving_root_folders_from_repository_2"), e.getStatus()); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- });
- }
- }, Policy.bind("ConfigureTagsFromRepoViewConfiguring_branch_tags_3"), this.PROGRESS_BUSYCURSOR); //$NON-NLS-1$
- }
-
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- ICVSRepositoryLocation[] roots = getSelectedRemoteRoots();
- if (roots.length != 1) return false;
- return true;
- }
-
- /*
- * @see CVSAction#needsToSaveDirtyEditors()
- */
- protected boolean needsToSaveDirtyEditors() {
- return false;
- }
-} \ No newline at end of file
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 7cfe27ec8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ConfigureTagsFromRepoViewOnFolder.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-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.jface.viewers.IStructuredSelection;
-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.TagConfigurationDialog;
-import org.eclipse.team.internal.ccvs.ui.model.RemoteModule;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-
-/**
- * DefineTagAction remembers a tag by name
- */
-public class ConfigureTagsFromRepoViewOnFolder extends TeamAction {
- /**
- * Returns the selected remote folders
- */
- protected ICVSRemoteFolder[] getSelectedRemoteFolders() {
- ArrayList resources = null;
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = ((IStructuredSelection) selection).iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof ICVSRemoteFolder) {
- if(new Path(((ICVSRemoteFolder)next).getRepositoryRelativePath()).segmentCount()==1) {
- resources.add(next);
- }
- continue;
- }
- if(next instanceof RemoteModule) {
- resources.add((ICVSRemoteFolder)((RemoteModule)next).getCVSResource());
- }
- }
- }
- if (resources != null && !resources.isEmpty()) {
- return (ICVSRemoteFolder[])resources.toArray(new ICVSRemoteFolder[resources.size()]);
- }
- return new ICVSRemoteFolder[0];
- }
-
- /*
- * @see IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- 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] = (ICVSFolder)roots[i];
- }
- TagConfigurationDialog d = new TagConfigurationDialog(shell, cvsFolders);
- d.open();
- }
- });
- }
- }, Policy.bind("ConfigureTagsFromRepoViewOnFolderConfiguring_branch_tags_1"), this.PROGRESS_BUSYCURSOR); //$NON-NLS-1$
- }
-
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- ICVSRemoteFolder[] roots = getSelectedRemoteFolders();
- if (roots.length == 0) return false;
- return true;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ContentAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ContentAction.java
deleted file mode 100644
index 4b2bfd486..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ContentAction.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial implementation
- ******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.sync.ILocalSyncElement;
-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.sync.CVSSyncCompareInput;
-import org.eclipse.ui.IEditorActionDelegate;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.actions.ActionDelegate;
-
-public class ContentAction extends ActionDelegate implements IEditorActionDelegate {
-
- /**
- * Is <code>null</code> if the current active editor is not a compare editor
- * with a CVS editor input. Or else this input refer to the input in the active
- * CVS compare editor.
- */
- private CVSSyncCompareInput syncInput;
-
- /**
- * Should only be called if action is enabled and the current active editor is a
- * CVS compare editor.
- *
- * @see IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- final IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- if (store.getBoolean(ICVSUIConstants.PREF_PROMPT_ON_CHANGE_GRANULARITY)) {
- Shell shell = syncInput.getViewer().getControl().getShell();
- AvoidableMessageDialog dialog = new AvoidableMessageDialog(
- shell,
- Policy.bind("ContentAction.Confirm_Long_Operation_1"), //$NON-NLS-1$
- null, // accept the default window icon
- Policy.bind("ContentAction.Changing_this_setting_will_involve_contacting_the_server_and_may_be_long-running_2"), //$NON-NLS-1$
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL},
- 0);
-
- boolean result = dialog.open() == 0;
- if (result && dialog.isDontShowAgain()) {
- store.setValue(ICVSUIConstants.PREF_PROMPT_ON_CHANGE_GRANULARITY, false);
- }
- if (!result) return;
- }
- syncInput.setSyncGranularity(action.isChecked() ? ILocalSyncElement.GRANULARITY_CONTENTS : ILocalSyncElement.GRANULARITY_TIMESTAMP);
- }
-
- /**
- * Called when the active editor changes. Enablement of this action depends
- * on the editor type and editr input of the active editor.
- *
- * @see IEditorActionDelegate#setActiveEditor(IAction, IEditorPart)
- */
- public void setActiveEditor(IAction action, IEditorPart targetEditor) {
- if (targetEditor != null) {
- IEditorInput input = targetEditor.getEditorInput();
- if (input instanceof CVSSyncCompareInput) {
- this.syncInput = (CVSSyncCompareInput)input;
- action.setEnabled(true);
- action.setChecked(syncInput.getSyncGranularity() == ILocalSyncElement.GRANULARITY_CONTENTS);
- return;
- }
- }
- syncInput = null;
- action.setEnabled(false);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CopyRepositoryNameAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CopyRepositoryNameAction.java
deleted file mode 100644
index 436b907b6..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CopyRepositoryNameAction.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-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.ui.actions.TeamAction;
-
-public class CopyRepositoryNameAction extends TeamAction {
- protected boolean isEnabled() throws TeamException {
- return true;
- }
- public void run(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 = ((IStructuredSelection)selection).iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- 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/actions/DefineBranchAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/DefineBranchAction.java
deleted file mode 100644
index 6273c5408..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/DefineBranchAction.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-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.core.runtime.IStatus;
-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.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-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.Policy;
-import org.eclipse.team.internal.ccvs.ui.model.BranchCategory;
-import org.eclipse.team.internal.ccvs.ui.model.BranchTag;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-
-/**
- * DefineTagAction remembers a tag by name
- */
-public class DefineBranchAction extends TeamAction {
- IInputValidator validator = new IInputValidator() {
- public String isValid(String newText) {
- IStatus status = CVSTag.validateTagName(newText);
- if (status.isOK()) return null;
- return status.getMessage();
- }
- };
-
- /**
- * Returns the selected remote roots
- */
- protected ICVSRepositoryLocation[] getSelectedRemoteRoots() {
- ArrayList resources = null;
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = ((IStructuredSelection) selection).iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof ICVSRepositoryLocation) {
- resources.add(next);
- continue;
- }
- if (next instanceof BranchCategory) {
- resources.add(((BranchCategory)next).getRepository(next));
- continue;
- }
- if (next instanceof IAdaptable) {
- IAdaptable a = (IAdaptable) next;
- Object adapter = a.getAdapter(ICVSRepositoryLocation.class);
- if (adapter instanceof ICVSRepositoryLocation) {
- resources.add(adapter);
- continue;
- }
- }
- }
- }
- if (resources != null && !resources.isEmpty()) {
- ICVSRepositoryLocation[] result = new ICVSRepositoryLocation[resources.size()];
- resources.toArray(result);
- return result;
- }
- return new ICVSRepositoryLocation[0];
- }
- /*
- * @see IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- final ICVSRepositoryLocation[] roots = getSelectedRemoteRoots();
- if (roots.length != 1) return;
- Shell shell = getShell();
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- InputDialog dialog = new InputDialog(getShell(), Policy.bind("DefineBranchAction.enterTag"), Policy.bind("DefineBranchAction.enterTagLong"), null, validator); //$NON-NLS-1$ //$NON-NLS-2$
- if (dialog.open() == InputDialog.OK) {
- CVSTag tag = new CVSTag(dialog.getValue(), CVSTag.BRANCH);
- CVSUIPlugin.getPlugin().getRepositoryManager().addBranchTags(roots[0], new CVSTag[] {tag});
- }
- }
- });
- }
- }, Policy.bind("DefineBranchAction.tag"), this.PROGRESS_BUSYCURSOR); //$NON-NLS-1$
-
- }
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- ICVSRepositoryLocation[] roots = getSelectedRemoteRoots();
- if (roots.length != 1) return false;
- return true;
- }
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/DefineVersionAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/DefineVersionAction.java
deleted file mode 100644
index b5c152783..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/DefineVersionAction.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-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.core.runtime.IStatus;
-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.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-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.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.model.RemoteModule;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-
-/**
- * DefineTagAction remembers a tag by name.
- *
- * This action needs to be reworked in order to associate tags with individual
- * projects, rather than define them globally (for all projects).
- *
- * The selection object for this action is a RemoteModule.
- */
-public class DefineVersionAction extends TeamAction {
- IInputValidator validator = new IInputValidator() {
- public String isValid(String newText) {
- IStatus status = CVSTag.validateTagName(newText);
- if (status.isOK()) return null;
- return status.getMessage();
- }
- };
-
- /**
- * Returns the selected remote projects
- */
- protected RemoteModule[] getSelectedRemoteModules() {
- ArrayList resources = null;
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = ((IStructuredSelection)selection).iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof RemoteModule) {
- resources.add(next);
- continue;
- }
- if (next instanceof IAdaptable) {
- IAdaptable a = (IAdaptable) next;
- Object adapter = a.getAdapter(RemoteModule.class);
- if (adapter instanceof RemoteModule) {
- resources.add(adapter);
- continue;
- }
- }
- }
- }
- if (resources != null && !resources.isEmpty()) {
- RemoteModule[] result = new RemoteModule[resources.size()];
- resources.toArray(result);
- return result;
- }
- return new RemoteModule[0];
- }
- /*
- * @see IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- final RemoteModule[] projects = getSelectedRemoteModules();
- if (projects.length != 1) return;
- Shell shell = getShell();
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- InputDialog dialog = new InputDialog(getShell(), Policy.bind("DefineVersionAction.enterTag"), Policy.bind("DefineVersionAction.enterTagLong"), null, validator); //$NON-NLS-1$ //$NON-NLS-2$
- if (dialog.open() == InputDialog.OK) {
- ICVSRemoteResource resource = projects[0].getCVSResource();
- CVSTag tag = new CVSTag(dialog.getValue(), CVSTag.VERSION);
- CVSUIPlugin.getPlugin().getRepositoryManager().addVersionTags((ICVSFolder)resource, new CVSTag[] {tag});
- }
- }
- });
- }
- }, Policy.bind("DefineVersionAction.tag"), this.PROGRESS_DIALOG); //$NON-NLS-1$
- }
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- RemoteModule[] projects = getSelectedRemoteModules();
- if (projects.length != 1) return false;
- return true;
- }
-}
-
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 f9e6b4dfe..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
-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.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-
-/**
- * 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 CVSAction {
- /**
- * Makes sure that the projects of all selected resources are shared.
- * Returns true if all resources are shared, and false otherwise.
- */
- protected boolean checkSharing(IResource[] resources) {
- for (int i = 0; i < resources.length; i++) {
- CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(
- resources[i].getProject(),
- CVSProviderPlugin.getTypeId());
- if (provider==null) {
- return false;
- }
- }
- return true;
- }
-
- /** (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();
- GenerateDiffFileWizard wizard = new GenerateDiffFileWizard(new StructuredSelection(resources), resources[0]);
- wizard.setWindowTitle(title);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.setMinimumPageSize(350, 250);
- dialog.open();
- }
-
- /** (Non-javadoc)
- * Method declared on IActionDelegate.
- */
- protected boolean isEnabled() throws TeamException {
- IResource[] resources = getSelectedResources();
- if(resources.length != 1) {
- return false;
- }
- if (!resources[0].isAccessible() || !checkSharing(new IResource[] {resources[0]})) return false;
- return true;
- }
-} \ No newline at end of file
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 2c5ccf48c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-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.ErrorDialog;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-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.ui.actions.TeamAction;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-public class IgnoreAction extends TeamAction {
- protected boolean isEnabled() throws TeamException {
- IResource[] resources = getSelectedResources();
- if (resources.length == 0) return false;
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (resource.getType() == IResource.PROJECT) return false;
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if (cvsResource.isManaged()) return false;
- if (cvsResource.isIgnored()) return false;
- }
- return true;
- }
- public void run(final IAction action) {
- run(new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- IResource[] resources = getSelectedResources();
- IgnoreResourcesDialog dialog = new IgnoreResourcesDialog(getShell(), resources);
- if (dialog.open() != IgnoreResourcesDialog.OK) return;
-
- try {
- 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);
- }
- // fix the action enablement
- if (action != null) action.setEnabled(isEnabled());
- } catch (TeamException e) {
- ErrorDialog.openError(getShell(), null, null, e.getStatus());
- return;
- }
- }
- }, Policy.bind("IgnoreAction.ignore"), PROGRESS_BUSYCURSOR); //$NON-NLS-1$
- }
-}
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 e1b49c206..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial 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.core.TeamException;
-import org.eclipse.team.internal.ccvs.ui.merge.MergeWizard;
-
-public class MergeAction extends CVSAction {
-
- /*
- * @see CVSAction#execute()
- */
- public void execute(IAction action) {
- final Shell shell = getShell();
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- MergeWizard wizard = new MergeWizard();
- wizard.setResources(getSelectedResources());
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.open();
- }
- });
- }
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- return isSelectionNonOverlapping();
- }
-}
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 990851d80..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MoveRemoteTagAction.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - 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 java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.IStructuredSelection;
-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.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-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.RTag;
-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;
-import org.eclipse.team.internal.ccvs.ui.TagSelectionDialog;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-
-public class MoveRemoteTagAction extends TagInRepositoryAction {
-
- private boolean recursive;
-
- /**
- * @see TagRemoteAction#getLocalOptions()
- */
- protected LocalOption[] getLocalOptions() {
- LocalOption[] options;
- if(recursive) {
- options = new LocalOption[] {RTag.FORCE_REASSIGNMENT, RTag.CLEAR_FROM_REMOVED};
- } else {
- options = new LocalOption[] {RTag.FORCE_REASSIGNMENT, RTag.CLEAR_FROM_REMOVED, Command.DO_NOT_RECURSE};
- }
- return options;
- }
-
- /**
- * @see TagRemoteAction#promptForTag(ICVSFolder[])
- */
- protected CVSTag promptForTag(ICVSFolder[] folders) {
- // Allow the user to select a tag
- TagSelectionDialog dialog = new TagSelectionDialog(getShell(), folders,
- Policy.bind("MoveTagAction.title"), //$NON-NLS-1$
- Policy.bind("MoveTagAction.message"), TagSelectionDialog.INCLUDE_BRANCHES | TagSelectionDialog.INCLUDE_VERSIONS, true); //$NON-NLS-1$
- dialog.setBlockOnOpen(true);
- if (dialog.open() == Dialog.CANCEL) {
- return null;
- }
- CVSTag tag = dialog.getResult();
- if (tag != null) {
- recursive = dialog.getRecursive();
- }
- return tag;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/NewCVSAnonEclipseConnection.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/NewCVSAnonEclipseConnection.java
deleted file mode 100644
index 8f0dc59e4..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/NewCVSAnonEclipseConnection.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.Properties;
-
-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 NewCVSAnonEclipseConnection 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);
- }
- 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();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/NewCVSRepositoryAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/NewCVSRepositoryAction.java
deleted file mode 100644
index 36a1c5917..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/NewCVSRepositoryAction.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-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/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 08deba206..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/NewRepositoryAction.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial 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.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;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-public class NewRepositoryAction 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) {
- 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 97bfff122..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenLogEntryAction.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-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.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-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.Policy;
-import org.eclipse.team.internal.ccvs.ui.RemoteFileEditorInput;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-
-public class OpenLogEntryAction extends TeamAction {
- /**
- * Returns the selected remote files
- */
- protected ILogEntry[] getSelectedLogEntries() {
- ArrayList entries = null;
- if (!selection.isEmpty()) {
- entries = new ArrayList();
- Iterator elements = ((IStructuredSelection) selection).iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof ILogEntry) {
- entries.add((ILogEntry)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 IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- IWorkbenchPage page = CVSUIPlugin.getPlugin().getWorkbench().getActiveWorkbenchWindow().getActivePage();
- final ILogEntry[] entries = getSelectedLogEntries();
- for (int i = 0; i < entries.length; i++) {
- try {
- if (entries[i].isDeletion()) {
- MessageDialog.openError(getShell(), Policy.bind("OpenLogEntryAction.deletedTitle"), Policy.bind("OpenLogEntryAction.deleted")); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- page.openEditor(new RemoteFileEditorInput(entries[i].getRemoteFile()), "org.eclipse.ui.DefaultTextEditor"); //$NON-NLS-1$
- }
- } catch (PartInitException e) {
- throw new InvocationTargetException(e);
- }
- }
- }
- }, Policy.bind("OpenLogEntryAction.open"), PROGRESS_BUSYCURSOR); //$NON-NLS-1$
- }
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- ILogEntry[] entries = getSelectedLogEntries();
- if (entries.length == 0) return false;
- return true;
- }
- /** (Non-javadoc)
- * Method declared on IActionDelegate.
- */
- public void selectionChanged(IAction action, ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- this.selection = (IStructuredSelection) selection;
- //this action can be invoked by double-click, in which case
- //there is no target action
- if (action != null) {
- try {
- action.setEnabled(isEnabled());
- } catch (TeamException e) {
- action.setEnabled(false);
- }
- }
- }
- }
-} \ No newline at end of file
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 87ce63ce1..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenRemoteFileAction.java
+++ /dev/null
@@ -1,131 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-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.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-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.Policy;
-import org.eclipse.team.internal.ccvs.ui.RemoteFileEditorInput;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorRegistry;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-
-public class OpenRemoteFileAction extends TeamAction {
- /**
- * Returns the selected remote files
- */
- protected ICVSRemoteFile[] getSelectedRemoteFiles() {
- ArrayList resources = null;
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = ((IStructuredSelection) 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 IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
-/* IWorkbenchPage page = CVSUIPlugin.getPlugin().getWorkbench().getActiveWorkbenchWindow().getActivePage();
- ICVSRemoteFile[] files = getSelectedRemoteFiles();
- for (int i = 0; i < files.length; i++) {
- try {
- page.openEditor(new RemoteFileEditorInput(files[i]), "org.eclipse.ui.DefaultTextEditor"); //$NON-NLS-1$
- } catch (PartInitException e) {
- throw new InvocationTargetException(e);
- }
- }*/
-
- 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 {
- page.openEditor(new RemoteFileEditorInput(files[i]), id);
- } catch (PartInitException e) {
- throw new InvocationTargetException(e);
- }
- }
- }
- }, Policy.bind("OpenRemoteFileAction.open"), this.PROGRESS_BUSYCURSOR); //$NON-NLS-1$
- }
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- ICVSRemoteFile[] resources = getSelectedRemoteFiles();
- if (resources.length == 0) return false;
- return true;
- }
- /** (Non-javadoc)
- * Method declared on IActionDelegate.
- */
- public void selectionChanged(IAction action, ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- this.selection = (IStructuredSelection) selection;
- //this action can be invoked by double-click, in which case
- //there is no target action
- if (action != null) {
- try {
- action.setEnabled(isEnabled());
- } catch (TeamException e) {
- action.setEnabled(false);
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RemoveBranchTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RemoveBranchTagAction.java
deleted file mode 100644
index 5ac9ad0ed..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RemoveBranchTagAction.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.core.TeamException;
-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.RepositoryManager;
-import org.eclipse.team.internal.ccvs.ui.model.BranchTag;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-
-/**
- * RemoveBranchTagAction removes a tag.
- */
-public class RemoveBranchTagAction extends TeamAction {
- /**
- * Returns the selected versions
- */
- protected BranchTag[] getSelectedBranchTags() {
- ArrayList tags = null;
- if (!selection.isEmpty()) {
- tags = new ArrayList();
- Iterator elements = ((IStructuredSelection)selection).iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof BranchTag) {
- tags.add(next);
- continue;
- }
- }
- }
- if (tags != null && !tags.isEmpty()) {
- BranchTag[] result = new BranchTag[tags.size()];
- tags.toArray(result);
- return result;
- }
- return new BranchTag[0];
- }
- /*
- * @see IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- BranchTag[] tags = getSelectedBranchTags();
- if (tags.length == 0) return;
- RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- for (int i = 0; i < tags.length; i++) {
- BranchTag tag = tags[i];
- manager.removeBranchTag(tag.getRoot(), new CVSTag[] {tag.getTag()});
- }
- }
- }, Policy.bind("RemoveBranchTagAction.removeTag"), this.PROGRESS_BUSYCURSOR); //$NON-NLS-1$
-
- }
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- BranchTag[] tags = getSelectedBranchTags();
- if (tags.length == 0) return false;
- for (int i = 0; i < tags.length; i++) {
- if (tags[i].getTag().getName().equals("HEAD")) return false; //$NON-NLS-1$
- }
- return true;
- }
-}
-
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RemoveRootAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RemoveRootAction.java
deleted file mode 100644
index 7c837be5f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RemoveRootAction.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-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.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.jface.viewers.IStructuredSelection;
-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.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.core.ICVSProvider;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-
-/**
- * RemoveRootAction removes a repository
- */
-public class RemoveRootAction extends TeamAction {
- /**
- * Returns the selected remote files
- */
- protected ICVSRepositoryLocation[] getSelectedRemoteRoots() {
- ArrayList resources = null;
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = ((IStructuredSelection) selection).iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof ICVSRepositoryLocation) {
- resources.add(next);
- continue;
- }
- if (next instanceof IAdaptable) {
- IAdaptable a = (IAdaptable) next;
- Object adapter = a.getAdapter(ICVSRepositoryLocation.class);
- if (adapter instanceof ICVSRemoteFile) {
- resources.add(adapter);
- continue;
- }
- }
- }
- }
- if (resources != null && !resources.isEmpty()) {
- ICVSRepositoryLocation[] result = new ICVSRepositoryLocation[resources.size()];
- resources.toArray(result);
- return result;
- }
- return new ICVSRepositoryLocation[0];
- }
- /*
- * @see IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- ICVSRepositoryLocation[] roots = getSelectedRemoteRoots();
- if (roots.length == 0) return;
- ICVSProvider provider = CVSProviderPlugin.getProvider();
- for (int i = 0; i < roots.length; i++) {
- try {
-
- // Check if any projects are shared with the repository
- boolean shared = false;
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- 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 = true;
- break;
- }
- }
- }
-
- // This will notify the RepositoryManager of the removal
- if (shared) {
- Shell shell = getShell();
- final String location = roots[i].getLocation();
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- MessageDialog.openInformation(getShell(), Policy.bind("RemoteRootAction.Unable_to_Discard_Location_1"), Policy.bind("RemoteRootAction.Projects_in_the_local_workspace_are_shared_with__2") + location); //$NON-NLS-1$ //$NON-NLS-2$
- }
- });
- } else {
- provider.disposeRepository(roots[i]);
- }
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- }
- }
- }, Policy.bind(Policy.bind("RemoteRootAction.RemoveRootAction.removeRoot_3")), this.PROGRESS_DIALOG); //$NON-NLS-1$
-
- }
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- ICVSRepositoryLocation[] roots = getSelectedRemoteRoots();
- return roots.length > 0;
- }
-}
-
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 005bbc238..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-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.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.ui.IPromptCondition;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.PromptingDialog;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-public class ReplaceWithRemoteAction extends CVSAction {
- public void execute(IAction action) {
- run(new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- try {
- PromptingDialog dialog = new PromptingDialog(getShell(), getSelectedResources(),
- getPromptCondition(), Policy.bind("ReplaceWithAction.confirmOverwrite"));//$NON-NLS-1$
- IResource[] resources = dialog.promptForMultiple();
- if(resources.length == 0) {
- // nothing to do
- return;
- }
- // Do the replace
- Hashtable table = getProviderMapping(resources);
- Set keySet = table.keySet();
- monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$
- monitor.setTaskName(Policy.bind("ReplaceWithRemoteAction.replacing")); //$NON-NLS-1$
- 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()]);
- provider.get(providerResources, IResource.DEPTH_INFINITE, subMonitor);
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- }, Policy.bind("ReplaceWithRemoteAction.problemMessage"), PROGRESS_DIALOG); //$NON-NLS-1$
- }
- protected boolean isEnabled() throws TeamException {
- IResource[] resources = getSelectedResources();
- if (resources.length == 0) return false;
- for (int i = 0; i < resources.length; i++) {
- CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(resources[i].getProject(), CVSProviderPlugin.getTypeId());
- if (provider == null) return false;
- if (!provider.hasRemote(resources[i])) return false;
- }
- return true;
- }
- /**
- * Note: This method is designed to be overridden by test cases.
- */
- protected IPromptCondition getPromptCondition() {
- return PromptingDialog.getOverwriteLocalChangesPrompt();
- }
-}
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 c3f1b186b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java
+++ /dev/null
@@ -1,131 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-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.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.PromptingDialog;
-import org.eclipse.team.internal.ccvs.ui.TagSelectionDialog;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-/**
- * Action for replace with tag.
- */
-public class ReplaceWithTagAction extends CVSAction {
- /*
- * Method declared on IActionDelegate.
- */
- public void execute(IAction action) {
-
- // Setup the holders
- final IResource[] resource = 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 {
- PromptingDialog prompt = new PromptingDialog(getShell(), getSelectedResources(),
- PromptingDialog.getOverwriteLocalChangesPrompt(),
- Policy.bind("ReplaceWithAction.confirmOverwrite"));//$NON-NLS-1$
- final IResource[] resources = prompt.promptForMultiple();
- if(resources.length == 0) {
- // nothing to do
- return;
- }
- // show the tags for the projects of the selected resources
- IProject[] projects = new IProject[resources.length];
- for (int i = 0; i < resources.length; i++) {
- projects[i] = resources[i].getProject();
- }
- TagSelectionDialog dialog = new TagSelectionDialog(getShell(), projects, Policy.bind("ReplaceWithTagAction.message"), Policy.bind("TagSelectionDialog.Select_a_Tag_1"), //$NON-NLS-1$ //$NON-NLS-2$
- TagSelectionDialog.INCLUDE_ALL_TAGS, true /*show recurse*/); //$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, tag[0])) {
- tag[0] = null;
- return;
- }
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- }
- }, Policy.bind("ReplaceWithTagAction.replace"), this.PROGRESS_BUSYCURSOR); //$NON-NLS-1$
-
- if (tag[0] == null) return;
-
- // Display a progress dialog while replacing
- run(new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- try {
- int depth = recurse[0] ? IResource.DEPTH_INFINITE : IResource.DEPTH_ONE;
- Hashtable table = getProviderMapping();
- Set keySet = table.keySet();
- monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$
- monitor.setTaskName(Policy.bind("ReplaceWithTagAction.replacing", tag[0].getName())); //$NON-NLS-1$
- 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()]);
- provider.get(providerResources, depth, tag[0], Policy.subMonitorFor(monitor, 100));
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- }, Policy.bind("ReplaceWithTagAction.replace"), this.PROGRESS_DIALOG); //$NON-NLS-1$
- }
-
- protected boolean isEnabled() {
- try {
- return isSelectionNonOverlapping();
- } catch(TeamException e) {
- CVSUIPlugin.log(e.getStatus());
- return false;
- }
- }
-
- protected boolean equalTags(CVSTag tag1, CVSTag tag2) {
- if (tag1 == null) tag1 = CVSTag.DEFAULT;
- if (tag2 == null) tag2 = CVSTag.DEFAULT;
- return tag1.equals(tag2);
- }
-}
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 d031b69f5..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SetKeywordSubstitutionAction.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.wizard.WizardDialog;
-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.ICVSResource;
-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.ui.ResizableWizardDialog;
-import org.eclipse.team.internal.ccvs.ui.wizards.KSubstWizard;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-
-/**
- * TagAction tags the selected resources with a version tag specified by the user.
- */
-public class SetKeywordSubstitutionAction extends CVSAction {
- 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);
- dialog.setMinimumPageSize(350, 250);
- dialog.open();
- previousOption = wizard.getKSubstOption();
- }
-
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- IResource[] resources = getSelectedResources();
- if (resources.length == 0) return false;
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- // resource must be local
- if (! resource.isAccessible()) return false;
- // provider must be CVS
- RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId());
- if (provider == null) return false;
- // resource must either be a project, or it must be managed
- if (resource.getType() != IResource.PROJECT) {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if (! cvsResource.isManaged()) return false;
- }
- }
- return true;
- }
-}
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 122114814..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowCVSPerspectiveAction.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-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);
- }
- }
-} \ No newline at end of file
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 66fa15468..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowHistoryAction.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IFile;
-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.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.HistoryView;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.core.TeamPlugin;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-
-public class ShowHistoryAction extends TeamAction {
- /**
- * Returns the selected remote files
- */
- protected ICVSRemoteFile[] getSelectedRemoteFiles() {
- ArrayList resources = null;
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = ((IStructuredSelection) 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 IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- ICVSRemoteFile[] files = getSelectedRemoteFiles();
- HistoryView view = HistoryView.openInActivePerspective();
- if (view != null) {
- view.showHistory(files[0], null /* no current revision */);
- }
- }
- }, Policy.bind("ShowHistoryAction.showHistory"), this.PROGRESS_BUSYCURSOR); //$NON-NLS-1$
- }
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- ICVSRemoteFile[] resources = getSelectedRemoteFiles();
- return resources.length == 1;
- }
- /** (Non-javadoc)
- * Method declared on IActionDelegate.
- */
- public void selectionChanged(IAction action, ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- this.selection = (IStructuredSelection) selection;
- //this action can be invoked by double-click, in which case
- //there is no target action
- if (action != null) {
- try {
- action.setEnabled(isEnabled());
- } catch (TeamException e) {
- action.setEnabled(false);
- handle(e, null, null);
- }
- }
- }
- }
-} \ No newline at end of file
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 002ad05c6..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowResourceInHistoryAction.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IFile;
-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.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.HistoryView;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-
-public class ShowResourceInHistoryAction extends TeamAction {
- /*
- * @see IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- IResource[] resources = getSelectedResources();
- if (resources.length != 1) return;
- HistoryView view = HistoryView.openInActivePerspective();
- if (view != null) {
- view.showHistory(resources[0]);
- }
- }
- }, Policy.bind("ShowHistoryAction.showHistory"), this.PROGRESS_BUSYCURSOR); //$NON-NLS-1$
- }
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- // Show Resource In History is enabled for resources which have been committed.
- IResource[] resources = getSelectedResources();
- if (resources.length != 1) return false;
- IResource resource = resources[0];
- if (!(resource instanceof IFile)) return false;
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if (!cvsResource.isManaged()) return false;
- if (cvsResource.getSyncInfo().isAdded()) return false;
- return true;
- }
- /** (Non-javadoc)
- * Method declared on IActionDelegate.
- */
- public void selectionChanged(IAction action, ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- this.selection = (IStructuredSelection) selection;
- //this action can be invoked by double-click, in which case
- //there is no target action
- if (action != null) {
- try {
- action.setEnabled(isEnabled());
- } catch (TeamException e) {
- action.setEnabled(false);
- handle(e, null, null);
- }
- }
- }
- }
-} \ No newline at end of file
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 1799c7864..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.sync.CVSSyncCompareInput;
-import org.eclipse.team.internal.ui.sync.SyncCompareInput;
-import org.eclipse.team.internal.ui.sync.SyncView;
-import org.eclipse.ui.PartInitException;
-
-/**
- * Action for catchup/release in popup menus.
- */
-public class SyncAction extends CVSAction {
- public void execute(IAction action) {
- IResource[] resources = getSelectedResources();
- SyncView view = (SyncView)CVSUIPlugin.getActivePage().findView(SyncView.VIEW_ID);
- if (view == null) {
- view = SyncView.findInActivePerspective();
- }
- if (view != null) {
- try {
- CVSUIPlugin.getActivePage().showView(SyncView.VIEW_ID);
- } catch (PartInitException e) {
- CVSUIPlugin.log(e.getStatus());
- }
- view.showSync(getCompareInput(resources));
- }
- }
- protected boolean isEnabled() throws TeamException {
- IResource[] resources = getSelectedResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (!resource.isAccessible()) return false;
- if (resource.getType() == IResource.PROJECT) continue;
- // If the resource is not managed and its parent is not managed, disable.
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if (!cvsResource.isManaged()) {
- // The resource is not managed. See if its parent is managed.
- if (!cvsResource.getParent().isCVSFolder()) return false;
- }
- }
- return true;
- }
- protected SyncCompareInput getCompareInput(IResource[] resources) {
- return new CVSSyncCompareInput(resources);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncOutgoingAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncOutgoingAction.java
deleted file mode 100644
index 7e67071b0..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncOutgoingAction.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.team.internal.ccvs.ui.sync.CVSSyncCompareInput;
-import org.eclipse.team.internal.ui.sync.SyncCompareInput;
-
-/**
- * Action for catchup/release in popup menus.
- */
-public class SyncOutgoingAction extends SyncAction {
- protected SyncCompareInput getCompareInput(IResource[] resources) {
- return new CVSSyncCompareInput(resources, true);
- }
-}
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 72d4fd9ad..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java
+++ /dev/null
@@ -1,185 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-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.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IInputValidator;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-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.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.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.CVSDecorator;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.PromptingDialog;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-
-/**
- * TagAction tags the selected resources with a version tag specified by the user.
- */
-public class TagAction extends CVSAction {
- // The previously remembered tag
- private static String previousTag = ""; //$NON-NLS-1$
-
- /**
- * @see CVSAction#execute(IAction)
- */
- public void execute(IAction action) throws InvocationTargetException, InterruptedException {
-
- // Prompt for any uncommitted changes
- PromptingDialog prompt = new PromptingDialog(getShell(), getSelectedResources(),
- getPromptCondition(), Policy.bind("TagAction.uncommittedChangesTitle"));//$NON-NLS-1$
- final IResource[] resources;
- try {
- resources = prompt.promptForMultiple();
- } catch(InterruptedException e) {
- return;
- }
- if(resources.length == 0) {
- // nothing to do
- return;
- }
-
- // Prompt for the tag name
- final String[] result = new String[1];
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(resources[0].getProject());
- result[0] = promptForTag(folder);
- }
- });
- if (result[0] == null) return;
-
- // Tag the local resources, divided by project/provider
- CVSUIPlugin.runWithProgressDialog(getShell(), true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- 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()]);
- CVSTag tag = new CVSTag(result[0], CVSTag.VERSION);
- try {
- addStatus(provider.tag(providerResources, IResource.DEPTH_INFINITE, tag, subMonitor));
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- // Cache the new tag creation even if the tag may have had warnings.
- CVSUIPlugin.getPlugin().getRepositoryManager().addVersionTags(
- CVSWorkspaceRoot.getCVSFolderFor(provider.getProject()),
- new CVSTag[] {tag});
-
- }
- previousTag = result[0];
- }
- });
- }
-
- /**
- * Override to dislay the number of tag operations that succeeded
- */
- protected IStatus getStatusToDisplay(IStatus[] problems) {
- // We accumulated 1 status per resource above.
- IStatus[] status = getAccumulatedStatus();
- int resourceCount = status.length;
-
- MultiStatus combinedStatus;
- if(resourceCount == 1) {
- combinedStatus = new MultiStatus(CVSUIPlugin.ID, 0, Policy.bind("TagAction.tagProblemsMessage"), null); //$NON-NLS-1$
- } else {
- combinedStatus = new MultiStatus(CVSUIPlugin.ID, 0, Policy.bind("TagAction.tagProblemsMessageMultiple", //$NON-NLS-1$
- Integer.toString(resourceCount - problems.length), Integer.toString(problems.length)), null); //$NON-NLS-1$
- }
- for (int i = 0; i < problems.length; i++) {
- combinedStatus.merge(problems[i]);
- }
- return combinedStatus;
- }
-
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- IResource[] resources = getSelectedResources();
- if (resources.length == 0) return false;
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId());
- if (provider == null) return false;
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if(cvsResource.isFolder()) {
- if (! ((ICVSFolder)cvsResource).isCVSFolder()) return false;
- } else {
- ResourceSyncInfo info = cvsResource.getSyncInfo();
- if(info==null || info.isAdded()) return false;
- }
- }
- return true;
- }
-
- /**
- * Prompts the user for a tag name.
- * Note: This method is designed to be overridden by test cases.
- * @return the tag, or null to cancel
- */
- protected String promptForTag(ICVSFolder folder) {
- TagAsVersionDialog dialog = new TagAsVersionDialog(getShell(),
- Policy.bind("TagAction.tagResources"), //$NON-NLS-1$
- folder);
- if (dialog.open() != InputDialog.OK) return null;
- return dialog.getTagName();
- }
- /**
- * Note: This method is designed to be overridden by test cases.
- */
- protected IPromptCondition getPromptCondition() {
- return new IPromptCondition() {
- public boolean needsPrompt(IResource resource) {
- return CVSDecorator.isDirty(resource);
- }
- public String promptMessage(IResource resource) {
- return Policy.bind("TagAction.uncommittedChanges", resource.getName());//$NON-NLS-1$
- }
- };
- }
-
- protected String getErrorTitle() {
- return Policy.bind("TagAction.tagErrorTitle"); //$NON-NLS-1$
- }
-
- protected String getWarningTitle() {
- return Policy.bind("TagAction.tagWarningTitle"); //$NON-NLS-1$
- }
-}
-
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 d1f8a18eb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagInRepositoryAction.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - 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.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.SubProgressMonitor;
-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.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-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.client.Command;
-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;
-
-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 CVSAction#execute(IAction)
- */
- public void execute(IAction action) throws InvocationTargetException, InterruptedException {
-
- // Prompt for the tag
- final ICVSResource[] resources = getSelectedCVSResources();
- final CVSTag[] tag = new CVSTag[] { null };
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- // Collect the parent folders from which to determine the tags to show
- ICVSFolder[] folders = new ICVSFolder[resources.length];
- for (int i = 0; i < resources.length; i++) {
- if (resources[i].isFolder()) {
- folders[i] = (ICVSFolder)resources[i];
- } else {
- folders[i] = resources[i].getParent();
- }
- }
- tag[0] = promptForTag(folders);
- }
- });
- if (tag[0] == null) return;
-
- CVSUIPlugin.runWithProgressDialog(getShell(), true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- try {
- monitor.beginTask(null, 1000 * resources.length);
- for (int i = 0; i < resources.length; i++) {
- IStatus status = ((ICVSRemoteResource)resources[i]).tag(tag[0], getLocalOptions(), new SubProgressMonitor(monitor, 1000));
- addStatus(status);
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- }
-
- /**
- * Prompt for the tag to be used by the tagging operation. The default behavior
- * is to prompt for a name and return a version tag of that name.
- *
- * Subclasses can override.
- *
- * @param folders the folders from which to obtain a list of existing tags
- * @return CVSTag the tag chosen
- */
- protected CVSTag promptForTag(ICVSFolder[] folders) {
- String name = promptForTag(folders[0]);
- return new CVSTag(name, CVSTag.VERSION);
- }
-
- /**
- * Return the local options that should be used with the rtag command
- */
- protected LocalOption[] getLocalOptions() {
- return Command.NO_LOCAL_OPTIONS;
- }
-
- /**
- * Override to dislay the number of tag operations that succeeded
- */
- protected IStatus getStatusToDisplay(IStatus[] problems) {
- // We accumulated 1 status per resource above.
- IStatus[] status = getAccumulatedStatus();
- int resourceCount = status.length;
-
- MultiStatus combinedStatus;
- if(resourceCount == 1) {
- combinedStatus = new MultiStatus(CVSUIPlugin.ID, 0, Policy.bind("TagInRepositoryAction.tagProblemsMessage"), null); //$NON-NLS-1$
- } else {
- combinedStatus = new MultiStatus(CVSUIPlugin.ID, 0, Policy.bind("TagInRepositoryAction.tagProblemsMessageMultiple"), null); //$NON-NLS-1$
- }
- for (int i = 0; i < problems.length; i++) {
- combinedStatus.merge(problems[i]);
- }
- return combinedStatus;
- }
-}
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 ba57d7b0a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java
+++ /dev/null
@@ -1,205 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.lang.reflect.InvocationTargetException;
-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.runtime.IProgressMonitor;
-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.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.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.Team;
-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.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.util.InfiniteSubProgressMonitor;
-import org.eclipse.team.internal.ccvs.ui.CVSDecorator;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-/**
- * 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 TeamAction {
-
- static class DeleteProjectDialog extends MessageDialog {
-
- private IProject[] projects;
- private boolean deleteContent = false;
- private Button radio1;
- private 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
- this.projects = projects;
- }
-
- 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);
-
- 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 run(IAction action) {
- final Exception[] exceptions = new Exception[] {null};
- if(confirmDeleteProjects()) {
- try {
- new ProgressMonitorDialog(getShell()).run(true, true, getOperation());
- } catch (InvocationTargetException e) {
- exceptions[0] = e;
- } catch (InterruptedException e) {
- exceptions[0] = null;
- }
- }
- if (exceptions[0] != null) {
- handle(exceptions[0], null, Policy.bind("Unmanage.unmanagingError")); //$NON-NLS-1$
- }
- }
-
- private IRunnableWithProgress getOperation() {
- return new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- Hashtable table = getProviderMapping();
- Set keySet = table.keySet();
- monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$
- monitor.setTaskName(Policy.bind("Unmanage.unmanaging")); //$NON-NLS-1$
- Iterator iterator = keySet.iterator();
- while (iterator.hasNext()) {
- IProgressMonitor subMonitor = new InfiniteSubProgressMonitor(monitor, 1000);
- subMonitor.beginTask(null, 100);
- CVSTeamProvider provider = (CVSTeamProvider)iterator.next();
- List list = (List)table.get(provider);
- IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
- for (int i = 0; i < providerResources.length; i++) {
- IResource resource = providerResources[i];
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor((IContainer) resource);
- try {
- if(deleteContent) {
- folder.unmanage(Policy.subMonitorFor(subMonitor, 10));
- }
- } finally {
- // We want to remove the nature even if the unmanage operation fails
- Team.removeNatureFromProject((IProject)resource, CVSProviderPlugin.getTypeId(), Policy.subMonitorFor(subMonitor, 10));
- }
- }
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- };
- }
-
- 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 TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- IResource[] resources = getSelectedResources();
- if (resources.length == 0) return false;
- for (int i = 0; i < resources.length; i++) {
- if(resources[i].getType()!=IResource.PROJECT) return false;
- RepositoryProvider provider = RepositoryProvider.getProvider(resources[i].getProject(), CVSProviderPlugin.getTypeId());
- if (provider == null) return false;
- }
- return true;
- }
-} \ No newline at end of file
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 648da5d78..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-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.CVSProviderPlugin;
-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.client.Command;
-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.ui.actions.TeamAction;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-/**
- * 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 CVSAction {
- /*
- * @see IActionDelegate#run(IAction)
- */
- public void execute(IAction action) {
- run(new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- try {
- Hashtable table = getProviderMapping();
- Set keySet = table.keySet();
- monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$
- monitor.setTaskName(Policy.bind("UpdateAction.updating")); //$NON-NLS-1$
- 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()]);
- provider.update(providerResources, Command.NO_LOCAL_OPTIONS, null, true /*createBackups*/, subMonitor);
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- }, Policy.bind("UpdateAction.update"), this.PROGRESS_DIALOG); //$NON-NLS-1$
-
- }
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- IResource[] resources = getSelectedResources();
- if (resources.length == 0) return false;
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId());
- if (provider == null) return false;
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- ResourceSyncInfo info = cvsResource.getSyncInfo();
- if(cvsResource.isFolder()) {
- if(!((ICVSFolder)cvsResource).isCVSFolder()) return false;
- } else {
- if (!cvsResource.isManaged() || info.isAdded()) return false;
- }
- }
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeEditorInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeEditorInput.java
deleted file mode 100644
index bdb35a6d8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeEditorInput.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.merge;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.compare.structuremergeviewer.ICompareInput;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteResource;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.resources.CVSRemoteSyncElement;
-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.Policy;
-import org.eclipse.team.internal.ccvs.ui.sync.CVSSyncCompareInput;
-import org.eclipse.team.internal.ui.sync.MergeResource;
-import org.eclipse.team.internal.ui.sync.SyncView;
-import org.eclipse.team.internal.ui.sync.TeamFile;
-
-public class MergeEditorInput extends CVSSyncCompareInput {
- CVSTag start;
- CVSTag end;
-
- public MergeEditorInput(IResource[] resources, CVSTag start, CVSTag end) {
- // we have to perform content comparison since files in different branches
- // may have different revisions but the same contents. Consider these files
- // for merge purposes as equal.
- super(resources, IRemoteSyncElement.GRANULARITY_CONTENTS);
- this.start = start;
- this.end = end;
- }
- public Viewer createDiffViewer(Composite parent) {
- Viewer viewer = super.createDiffViewer(parent);
- getViewer().syncModeChanged(SyncView.SYNC_MERGE);
- return viewer;
- }
- protected IRemoteSyncElement[] createSyncElements(IProgressMonitor monitor) throws TeamException {
- IResource[] resources = getResources();
- IRemoteSyncElement[] trees = new IRemoteSyncElement[resources.length];
- int work = 100 * resources.length;
- monitor.beginTask(null, work);
- try {
- for (int i = 0; i < trees.length; i++) {
- IResource resource = resources[i];
- IRemoteResource base = CVSWorkspaceRoot.getRemoteTree(resource, start, Policy.subMonitorFor(monitor, 50));
- IRemoteResource remote = CVSWorkspaceRoot.getRemoteTree(resource, end, Policy.subMonitorFor(monitor, 50));
- trees[i] = new CVSRemoteSyncElement(true /*three way*/, resource, base, remote);
- }
- } finally {
- monitor.done();
- }
- return trees;
- }
- public CVSTag getStartTag() {
- return start;
- }
- public CVSTag getEndTag() {
- return end;
- }
- public String getTitle() {
- return Policy.bind("MergeEditorInput.title", start.getName(), end.getName()); //$NON-NLS-1$
- }
- public boolean isSaveNeeded() {
- return false;
- }
- protected void contentsChanged(ICompareInput source) {
- }
-
- /*
- * Override collectResourceChanges to only determine the true sync state for incomming changes
- */
- protected IDiffElement collectResourceChanges(IDiffContainer parent, IRemoteSyncElement tree, IProgressMonitor pm) {
- if ( ! tree.isContainer()) {
- CVSRemoteSyncElement cvsTree = (CVSRemoteSyncElement)tree;
- RemoteFile base = (RemoteFile)cvsTree.getBase();
- RemoteFile remote = (RemoteFile)cvsTree.getRemote();
- if (base != null && remote != null && base.getRevision().equals(remote.getRevision())) {
- // If the base and remote are the same, we don't have an incomming change
- MergeResource mergeResource = new MergeResource(tree);
- TeamFile file = new TeamFile(parent, mergeResource, IRemoteSyncElement.IN_SYNC, getShell());
- return file;
- }
- }
- return super.collectResourceChanges(parent, tree, pm);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java
deleted file mode 100644
index 62e954198..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.merge;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.compare.CompareUI;
-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.CVSTag;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-public class MergeWizard extends Wizard {
- MergeWizardStartPage startPage;
- MergeWizardEndPage endPage;
- IResource[] resources;
-
- public void addPages() {
-
- // when merging multiple resources, use the tags found on the first selected
- // resource. This makes sense because you would typically merge resources that
- // have a common context and are versioned and branched together.
- IProject projectForTagRetrieval = resources[0].getProject();
-
- setWindowTitle(Policy.bind("MergeWizard.title")); //$NON-NLS-1$
- ImageDescriptor mergeImage = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_MERGE);
- startPage = new MergeWizardStartPage("startPage", Policy.bind("MergeWizard.start"), mergeImage); //$NON-NLS-1$ //$NON-NLS-2$
- startPage.setProject(projectForTagRetrieval);
- addPage(startPage);
- endPage = new MergeWizardEndPage("endPage", Policy.bind("MergeWizard.end"), mergeImage, startPage); //$NON-NLS-1$ //$NON-NLS-2$
- endPage.setProject(projectForTagRetrieval);
- addPage(endPage);
- }
-
- /*
- * @see IWizard#performFinish()
- */
- public boolean performFinish() {
- CVSTag startTag = startPage.getTag();
- CVSTag endTag = endPage.getTag();
- CompareUI.openCompareEditor(new MergeEditorInput(resources, startTag, endTag));
- return true;
- }
-
- /*
- * Set the resources that should be merged.
- */
- public void setResources(IResource[] resources) {
- this.resources = resources;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardEndPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardEndPage.java
deleted file mode 100644
index bef0586b4..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardEndPage.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.merge;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.wizards.CVSWizardPage;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-public class MergeWizardEndPage extends CVSWizardPage {
- IProject project;
- TreeViewer tree;
- CVSTag result;
- ICVSRemoteFolder remote;
- // for accessing the start tag
- MergeWizardStartPage startPage;
-
- /**
- * MergeWizardEndPage constructor.
- *
- * @param pageName the name of the page
- * @param title the title of the page
- * @param titleImage the image for the page
- */
- public MergeWizardEndPage(String pageName, String title, ImageDescriptor titleImage, MergeWizardStartPage startPage) {
- super(pageName, title, titleImage);
- setDescription(Policy.bind("MergeWizardEndPage.description")); //$NON-NLS-1$
- this.startPage = startPage;
- }
- /*
- * @see IDialogPage#createControl(Composite)
- */
- public void createControl(Composite parent) {
- Composite composite = createComposite(parent, 2);
- // set F1 help
- // WorkbenchHelp.setHelp(composite, new DialogPageContextComputer (this, ITeamHelpContextIds.REPO_CONNECTION_MAIN_PAGE));
-
- tree = createTree(composite);
- tree.setContentProvider(new WorkbenchContentProvider());
- tree.setLabelProvider(new WorkbenchLabelProvider());
- tree.setSorter(new ViewerSorter() {
- public int compare(Viewer v, Object o1, Object o2) {
- int result = super.compare(v, o1, o2);
- if (o1 instanceof TagElement && o2 instanceof TagElement) {
- return -result;
- }
- return result;
- }
- });
- tree.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- Object selected = ((IStructuredSelection)tree.getSelection()).getFirstElement();
- if (selected instanceof TagElement) {
- result = ((TagElement)selected).getTag();
- if(!result.equals(startPage.getTag())) {
- setPageComplete(true);
- setMessage(null);
- } else {
- setMessage(Policy.bind("MergeWizardEndPage.duplicateTagSelected", result.getName()), WARNING); //$NON-NLS-1$
- setPageComplete(false);
- }
- } else {
- setMessage(null);
- result = null;
- setPageComplete(false);
- }
- }
- });
- setControl(composite);
- tree.setInput(new ProjectElement(CVSWorkspaceRoot.getCVSFolderFor(project), ProjectElement.INCLUDE_ALL_TAGS));
- setPageComplete(false);
- }
- protected TreeViewer createTree(Composite parent) {
- Tree tree = new Tree(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.SINGLE);
- tree.setLayoutData(new GridData(GridData.FILL_BOTH));
- return new TreeViewer(tree);
- }
- public void setProject(IProject project) {
- this.project = project;
- try {
- this.remote = (ICVSRemoteFolder) CVSWorkspaceRoot.getRemoteResourceFor(project);
- } catch (TeamException e) {
- // To do
- }
- }
- public CVSTag getTag() {
- return result;
- }
- /**
- * @see IDialogPage#setVisible(boolean)
- */
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- // refresh the tree because tags may of been added in the previous page
- tree.refresh();
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardStartPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardStartPage.java
deleted file mode 100644
index f326a7a5c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardStartPage.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.merge;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ColumnWeightData;
-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.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.swt.SWT;
-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.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.TagConfigurationDialog;
-import org.eclipse.team.internal.ccvs.ui.wizards.CVSWizardPage;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-public class MergeWizardStartPage extends CVSWizardPage {
- TableViewer table;
- CVSTag result;
- IProject project;
-
- private static final int TABLE_HEIGHT_HINT = 350;
-
- /**
- * MergeWizardStartPage constructor.
- *
- * @param pageName the name of the page
- * @param title the title of the page
- * @param titleImage the image for the page
- */
- public MergeWizardStartPage(String pageName, String title, ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- setDescription(Policy.bind("MergeWizardStartPage.description")); //$NON-NLS-1$
- }
- 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);
- data.heightHint = TABLE_HEIGHT_HINT;
- 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);
- }
- /*
- * @see IDialogPage#createControl(Composite)
- */
- public void createControl(Composite parent) {
- Composite composite = createComposite(parent, 1);
- // set F1 help
- // WorkbenchHelp.setHelp(composite, new DialogPageContextComputer (this, ITeamHelpContextIds.REPO_CONNECTION_MAIN_PAGE));
-
- table = createTable(composite);
- table.setContentProvider(new WorkbenchContentProvider());
- table.setLabelProvider(new WorkbenchLabelProvider());
- table.setSorter(new ViewerSorter() {
- public int compare(Viewer v, Object o1, Object o2) {
- int result = super.compare(v, o1, o2);
- if (o1 instanceof TagElement && o2 instanceof TagElement) {
- return -result;
- }
- return result;
- }
- });
- table.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection)table.getSelection();
- if(!selection.isEmpty()) {
- TagElement element = (TagElement)((IStructuredSelection)table.getSelection()).getFirstElement();
- if(element!=null) {
- result = element.getTag();
- setPageComplete(true);
- }
- }
- }
- });
- table.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- getContainer().showPage(getNextPage());
- }
- });
-
- Runnable afterRefresh = new Runnable() {
- public void run() {
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- table.refresh();
- }
- });
- }
- };
-
- Runnable afterConfigure = new Runnable() {
- public void run() {
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- initialize();
- }
- });
- }
- };
-
- setControl(composite);
- TagConfigurationDialog.createTagDefinitionButtons(getShell(), composite, new ICVSFolder[] {CVSWorkspaceRoot.getCVSFolderFor(project)},
- convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT),
- convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH),
- afterRefresh, afterConfigure);
- initialize();
- setPageComplete(false);
- }
- private void initialize() {
- ICVSFolder cvsProject = CVSWorkspaceRoot.getCVSFolderFor(project);
- table.setInput(new TagRootElement(cvsProject, CVSTag.VERSION));
- }
- public void setProject(IProject project) {
- this.project = project;
- }
- public CVSTag getTag() {
- return result;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/OverrideUpdateMergeAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/OverrideUpdateMergeAction.java
deleted file mode 100644
index 151e7625f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/OverrideUpdateMergeAction.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.merge;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ccvs.ui.sync.CVSSyncCompareInput;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.SyncSet;
-
-public class OverrideUpdateMergeAction extends UpdateMergeAction {
- public OverrideUpdateMergeAction(CVSSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
- super(model, sp, label, shell);
- }
- /*
- * Override removeNonApplicableNodes because conflicting nodes should not be removed from this set.
- */
- protected void removeNonApplicableNodes(SyncSet set, int syncMode) {
- set.removeOutgoingNodes();
- set.removeIncomingNodes();
- }
- protected boolean isEnabled(ITeamNode node) {
- // The force update action is enabled only for conflicting and outgoing changes
- SyncSet set = new SyncSet(new StructuredSelection(node));
- return (set.hasConflicts() && hasRealChanges(node, new int[] { ITeamNode.CONFLICTING }));
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/ProjectElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/ProjectElement.java
deleted file mode 100644
index de81143ea..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/ProjectElement.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.merge;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-public class ProjectElement implements IAdaptable, IWorkbenchAdapter {
- ICVSFolder project;
- TagRootElement branches;
- TagRootElement versions;
- int includeFlags;
-
- 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_ALL_TAGS = INCLUDE_HEAD_TAG | INCLUDE_BASE_TAG | INCLUDE_BRANCHES | INCLUDE_VERSIONS;
-
- public ProjectElement(ICVSFolder project, int includeFlags) {
- this.project = project;
- this.includeFlags = includeFlags;
- if (this.includeFlags == 0) this.includeFlags = INCLUDE_ALL_TAGS;
- if ((includeFlags & INCLUDE_BRANCHES) > 0) {
- branches = new TagRootElement(project, CVSTag.BRANCH);
- }
- if ((includeFlags & INCLUDE_VERSIONS) > 0) {
- versions = new TagRootElement(project, CVSTag.VERSION);
- }
- }
-
- public Object[] getChildren(Object o) {
- ArrayList children = new ArrayList(4);
- if ((includeFlags & INCLUDE_HEAD_TAG) > 0) {
- children.add(new TagElement(CVSTag.DEFAULT));
- }
- if ((includeFlags & INCLUDE_BASE_TAG) > 0) {
- children.add(new TagElement(CVSTag.BASE));
- }
- if ((includeFlags & INCLUDE_BRANCHES) > 0) {
- children.add(branches);
- }
- if ((includeFlags & INCLUDE_VERSIONS) > 0) {
- children.add(versions);
- }
- return (Object[]) children.toArray(new Object[children.size()]);
- }
- public int getIncludeFlags() {
- return includeFlags;
- }
- public TagRootElement getBranches() {
- return branches;
- }
- public TagRootElement getVersions() {
- return versions;
- }
- 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/merge/TagElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/TagElement.java
deleted file mode 100644
index 6f29a98d5..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/TagElement.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.merge;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-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.ui.model.IWorkbenchAdapter;
-
-public class TagElement implements IWorkbenchAdapter, IAdaptable {
- CVSTag tag;
- public TagElement(CVSTag tag) {
- 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) {
- if (tag.getType() == CVSTag.BRANCH || tag == CVSTag.DEFAULT) {
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_TAG);
- } else {
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_PROJECT_VERSION);
- }
- }
- public String getLabel(Object o) {
- return tag.getName();
- }
- public Object getParent(Object o) {
- return null;
- }
- public CVSTag getTag() {
- return tag;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/TagRootElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/TagRootElement.java
deleted file mode 100644
index 18dd5e98b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/TagRootElement.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.merge;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-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.ICVSFolder;
-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 TagRootElement implements IWorkbenchAdapter, IAdaptable {
- private ICVSFolder project;
- private List cachedTags;
- private int typeOfTagRoot;
-
- public TagRootElement(ICVSFolder project, int typeOfTagRoot) {
- this.typeOfTagRoot = typeOfTagRoot;
- this.project = project;
- }
-
- public TagRootElement(ICVSFolder project, int typeOfTagRoot, CVSTag[] tags) {
- this(project, typeOfTagRoot);
- add(tags);
- }
-
- public Object[] getChildren(Object o) {
- CVSTag[] childTags = new CVSTag[0];
- if(cachedTags==null) {
- if(typeOfTagRoot==CVSTag.BRANCH) {
- childTags = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownBranchTags(project);
- } else if(typeOfTagRoot==CVSTag.VERSION) {
- childTags = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownVersionTags(project);
- }
- } else {
- childTags = getTags();
- }
- TagElement[] result = new TagElement[childTags.length];
- for (int i = 0; i < childTags.length; i++) {
- result[i] = new TagElement(childTags[i]);
- }
- return result;
- }
- public void removeAll() {
- if(cachedTags!=null) {
- cachedTags.clear();
- }
- }
- public void add(CVSTag[] tags) {
- if(cachedTags==null) {
- cachedTags = new ArrayList(tags.length);
- }
- cachedTags.addAll(Arrays.asList(tags));
- }
- public void remove(CVSTag tag) {
- if(cachedTags!=null) {
- cachedTags.remove(tag);
- }
- }
- public CVSTag[] getTags() {
- if(cachedTags!=null) {
- return (CVSTag[]) cachedTags.toArray(new CVSTag[cachedTags.size()]);
- } else {
- return new CVSTag[0];
- }
- }
- 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 {
- 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 {
- return Policy.bind("VersionsElement.versions"); //$NON-NLS-1$
- }
- }
- public Object getParent(Object o) {
- return null;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/UpdateMergeAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/UpdateMergeAction.java
deleted file mode 100644
index 7cb8ea1ec..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/UpdateMergeAction.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.merge;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IContainer;
-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.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteResource;
-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.ICVSRunnable;
-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.CVSRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.RepositoryManager;
-import org.eclipse.team.internal.ccvs.ui.sync.CVSSyncCompareInput;
-import org.eclipse.team.internal.ccvs.ui.sync.UpdateSyncAction;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-
-/*
- * To be done:
- * 1. add another action that allows a force merge merging since we can't tell the manual vs automatic conflicts when building the sync tree.
- * 2. fix progress monitoring
- */
-public class UpdateMergeAction extends UpdateSyncAction {
- public UpdateMergeAction(CVSSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
- super(model, sp, label, shell);
- }
-
- /*
- * @see UpdateSyncAction#runUpdateDeep(IProgressMonitor, List, RepositoryManager)
- * incoming-change
- * incoming-deletion
- */
- protected void runUpdateDeep(ITeamNode[] nodes, RepositoryManager manager, IProgressMonitor monitor) throws TeamException {
- ITeamNode[] incoming = removeOutgoing(nodes);
- monitor.beginTask(null, 1000 * incoming.length);
- try {
- for (int i = 0; i < incoming.length; i++) {
- CVSRemoteSyncElement element = CVSSyncCompareInput.getSyncElementFrom(incoming[i]);
- if(element!=null) {
- makeRemoteLocal(element, new SubProgressMonitor(monitor, 1000));
- }
- }
- } finally {
- monitor.done();
- }
- }
-
- /*
- * @see UpdateSyncAction#runUpdateIgnoreLocalShallow(IProgressMonitor, List, RepositoryManager)
- * incoming-addition
- * incoming-conflict (no-merge)
- */
- protected void runUpdateIgnoreLocalShallow(ITeamNode[] nodes, RepositoryManager manager, IProgressMonitor monitor) throws TeamException {
- runUpdateDeep(nodes, manager, monitor);
- }
-
- /*
- * @see UpdateSyncAction#runUpdateShallow(ITeamNode[], RepositoryManager, IProgressMonitor)
- * incoming-conflict (auto-mergeable)
- */
- protected void runUpdateShallow(ITeamNode[] nodes, RepositoryManager manager, IProgressMonitor monitor) throws TeamException {
- mergeWithLocal(nodes, manager, false, monitor);
- }
-
- protected void mergeWithLocal(ITeamNode[] nodes, RepositoryManager manager, boolean createBackup, IProgressMonitor monitor) throws TeamException {
- CVSTag startTag = ((MergeEditorInput)getDiffModel()).getStartTag();
- CVSTag endTag = ((MergeEditorInput)getDiffModel()).getEndTag();
-
- Command.LocalOption[] options = new Command.LocalOption[] {
- Command.DO_NOT_RECURSE,
- Update.makeArgumentOption(Update.JOIN, startTag.getName()),
- Update.makeArgumentOption(Update.JOIN, endTag.getName()) };
-
- // run a join update using the start and end tags and the join points
- manager.update(getIResourcesFrom(nodes), options, createBackup, monitor);
- }
-
- private ITeamNode[] removeOutgoing(ITeamNode[] nodes) {
- // no filter done yet
- return nodes;
- }
-
- /*
- * If called on a new folder, the folder will become an outgoing addition.
- */
- private void makeRemoteLocal(CVSRemoteSyncElement element, IProgressMonitor monitor) throws CVSException {
- IRemoteResource remote = element.getRemote();
- final IResource local = element.getLocal();
- try {
- if(remote==null) {
- // Need a runnable so that move/delete hook is disabled
- final CoreException[] exception = new CoreException[] { null };
- CVSWorkspaceRoot.getCVSFolderFor(local.getParent()).run(new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- try {
- local.delete(false, monitor);
- } catch(CoreException e) {
- exception[0] = e;
- }
- }
- }, monitor);
- if (exception[0] != null) {
- throw exception[0];
- }
- } else {
- if(remote.isContainer()) {
- if(!local.exists()) {
- ((IFolder)local).create(false /*don't force*/, true /*local*/, monitor);
- }
- } else {
- monitor.beginTask(null, 200);
- try {
- IFile localFile = (IFile)local;
- if(local.exists()) {
- localFile.setContents(remote.getContents(Policy.subMonitorFor(monitor, 100)), false /*don't force*/, true /*keep history*/, Policy.subMonitorFor(monitor, 100));
- } else {
- if (!localFile.getParent().exists()) {
- IContainer parent = localFile.getParent();
- while (!parent.exists()) {
- IFolder folder = (IFolder)parent;
- folder.create(false, true, null);
- parent = parent.getParent();
- }
- }
- localFile.create(remote.getContents(Policy.subMonitorFor(monitor, 100)), 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$
- } catch(TeamException e) {
- throw new CVSException(Policy.bind("UpdateMergeActionProblems_merging_remote_resources_into_workspace_2"), e); //$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/merge/UpdateWithForcedJoinAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/UpdateWithForcedJoinAction.java
deleted file mode 100644
index 6dcbb2d66..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/UpdateWithForcedJoinAction.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.merge;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.util.Assert;
-import org.eclipse.team.internal.ccvs.ui.RepositoryManager;
-import org.eclipse.team.internal.ccvs.ui.sync.CVSSyncCompareInput;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.SyncSet;
-
-/*
- * Used only in the merge editor. This action allows the user to select a single conflict and use
- * the cvs update -j command to merge the changes. This is required because when building the
- * sync tree for a merge the cvs command 'cvs -n update -j -j' does not tell us which files
- * can be auto-merged. This action then allows the user to run the merge without having to
- * individually select each difference and use the 'copy right to left' buttons.
- */
-public class UpdateWithForcedJoinAction extends UpdateMergeAction {
- public UpdateWithForcedJoinAction(CVSSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
- super(model, sp, label, shell);
- }
-
- /*
- * @see UpdateSyncAction#runUpdateDeep(ITeamNode[], RepositoryManager, IProgressMonitor)
- */
- protected void runUpdateDeep(ITeamNode[] nodes, RepositoryManager manager, IProgressMonitor monitor) throws TeamException {
- // cannot be called from this action
- Assert.isTrue(false);
- }
-
- /*
- * @see UpdateSyncAction#runUpdateIgnoreLocalShallow(ITeamNode[], RepositoryManager, IProgressMonitor)
- */
- protected void runUpdateIgnoreLocalShallow(ITeamNode[] nodes, RepositoryManager manager, IProgressMonitor monitor) throws TeamException {
- // force an update -j -j to be called on the conflict
- mergeWithLocal(nodes, manager, true, monitor);
- }
-
- /*
- * @see UpdateSyncAction#runUpdateShallow(ITeamNode[], RepositoryManager, IProgressMonitor)
- */
- protected void runUpdateShallow(ITeamNode[] nodes, RepositoryManager manager, IProgressMonitor monitor) throws TeamException {
- // cannot be called from this action
- Assert.isTrue(false);
- }
-
- /*
- * @see MergeAction#isEnabled(ITeamNode)
- */
- protected boolean isEnabled(ITeamNode node) {
- int kind = node.getKind();
- if ((node.getChangeDirection() == IRemoteSyncElement.CONFLICTING) &&
- (kind & IRemoteSyncElement.AUTOMERGE_CONFLICT) == 0) {
- return true;
- } else {
- return false;
- }
- }
- /*
- * @see UpdateSyncAction#promptForConflicts()
- */
- protected boolean promptForConflicts() {
- // don't prompt for overriding conflicts, because this action is simply merging and creating a backup copy of the original file.
- return true;
- }
-
- /*
- * Override removeNonApplicableNodes because conflicting nodes should not be removed from this set.
- */
- protected void removeNonApplicableNodes(SyncSet set, int syncMode) {
- set.removeOutgoingNodes();
- set.removeIncomingNodes();
- }
-}
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 117728ef6..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
+++ /dev/null
@@ -1,725 +0,0 @@
-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
-
-nameAndRevision={0} {1}
-currentRevision=*{0}
-
-AddAction.add=Add
-AddAction.adding=Adding...
-
-AddToWorkspaceAction.checkoutFailed=Problems encountered performing checkout
-AddToWorkspaceAction.thisResourceExists=The resource ''{0}'' already exists in the workspace. Overwrite?
-AddToWorkspaceAction.thisExternalFileExists=The folder ''{0}'' exists in the local file system. Overwrite?
-AddToWorkspaceAction.confirmOverwrite=Confirm Overwrite
-
-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=&Error:
-ConsolePreferencePage.font=Console font setting:
-ConsolePreferencePage.autoOpen=&Show CVS Console when there is output
-
-CVSAction.errorTitle=Errors Occured
-CVSAction.warningTitle=Warnings Occured
-CVSAction.multipleProblemsMessage=Multiple problems occured:
-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 others resources in the project will be sychronized with another tag. \n\nDo you wish to continue?
-
-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 Merged
-CVSCatchupReleaseViewer.addAction=&Add to Version Control
-
-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.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=Compare {0} <workspace> and versions
-CVSCompareRevisionsInput.errorReplacingTitle=Unable to Replace
-CVSCompareRevisionsInput.errorReplacingMessage=Resource(s) could not be loaded. A communication error may have occured, 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}]
-
-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=(none)
-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.root=Repository Root:
-CVSFolderPropertiesPage.repository=Repository Path:
-CVSFolderPropertiesPage.static=Static:
-
-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 path:
-CVSPropertiesPage.module=Module:
-CVSPropertiesPage.defaultPort=Default
-CVSPropertiesPage.tag=Tag:
-CVSPropertiesPage.update=Change &Tag...
-
-CVSPreferencePage.description=General CVS settings:
-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 occured. You may want to consider using "Somewhat quiet" mode instead.
-CVSPreferencePage.considerContentsInCompare=Con&sider file contents in comparisons
-CVSPreferencePage.showAddRemoveMarkers=Show added/deleted &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 (default)
-CVSPreferencePage.level7=7
-CVSPreferencePage.level8=8
-CVSPreferencePage.level9=9 (highest compression)
-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
-
-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 when you are finished, \
- select 'Mark as Merged' to make this file an outgoing change.
-
-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?
-
-CheckoutAsAction.checkoutFailed=Problems encountered performing checkout
-CheckoutAsAction.enterProjectTitle=Check Out {0} As...
-CheckoutAsAction.taskname=Checking out "{0}" from CVS as "{1}"
-
-CommitAction.commitFailed=Problems encountered performing commit
-
-CommitSyncAction.questionRelease=You have changes that conflict with the server. Release those changes?
-CommitSyncAction.titleRelease=Release Conflicts?
-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.useDefaultPort=Use &Default Port
-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=failed due to a server error {0}
-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.preExecutionDelimiter=***
-Console.postExecutionDelimiter=***
-
-DefineVersionAction.enterTag=Enter Version Tag
-DefineVersionAction.enterTagLong=Enter the name of the version:
-
-DefineBranchAction.enterTag=Enter Branch Tag
-DefineBranchAction.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 Compare with 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
-
-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.getContentsAction=&Get Contents
-HistoryView.getRevisionAction=Get &Revision
-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.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?
-
-IgnoreAction.ignore=Error Ignoring Resource
-
-MergeAction.problemsDuringSync=Problems During Synchronization
-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}
-
-MergeWizardEndPage.branches=Branches
-MergeWizardEndPage.description=This is the version or branch that contains the work you would like to merge.
-MergeWizardEndPage.duplicateTagSelected=Cannot select {0} because it has already been selected as the start tag.
-
-MergeWizardStartPage.description=This is the version you created when you branched.
-
-MergeWizard.title=Merge
-MergeWizard.start=Select the Merge Start Point
-MergeWizard.end=Select the Merge End Point
-MergeWizard.preparing=Preparing merge wizard
-MergeWizard.preparingStart=Fetching tags for start page
-MergeWizard.preparingEnd=Fetching tags for end page
-
-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 Repositories View
-NewLocationWizard.validationFailedText={0}. Keep location anyway?
-NewLocationWizard.validationFailedTitle=Unable to Validate
-NewLocationWizard.exception=Unable to create repository location
-
-OpenLogEntryAction.open=Open
-OpenLogEntryAction.deletedTitle=Resource is Deleted
-OpenLogEntryAction.deleted=The selected revision represents a deletion. It cannot be opened.
-
-OpenRemoteFileAction.open=Open
-
-ReleaseCommentDialog.title=Commit Comment
-ReleaseCommentDialog.enterComment=Please enter a comment.
-
-RemoteFolderElement.nameAndTag={0} {1}
-
-RemoveRootAction.removeRoot=Error Discarding Location
-
-RemoveBranchTagAction.removeTag=Discard Branch
-RemoveModuleVersionAction.removeTag=Discard Version
-
-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?
-
-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
-
-RepositoriesView.refresh=&Refresh View
-RepositoriesView.new=&Repository Location...
-RepositoriesView.newSubmenu=&New
-RepositoriesView.Show_Folders_6=Show Folders
-RepositoriesView.Show_Modules_7=Show Modules
-RepositoriesView.newAnonCVS=&Anonymous Repository Location to dev.eclipse.org...
-
-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 Occured
-
-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 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=&Text without keyword substitution (-ko)
-KSubstWizardSelectionPage.textLabel=\
- Text files are stored in the repository in a neutral format but are retrieved in the platform's native text encoding.\n\
- CVS supports conflict resolution and differencing of text files with single line granularity.
-KSubstWizardSelectionPage.textWithSubstitutionsButton=Text with &keyword substitution
-KSubstWizardSelectionPage.textWithSubstitutionsLabel=\
- Text 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.
-
-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.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.title=Share Project
-SharingWizard.heading=Configure a Project to Use CVS
-SharingWizard.enterInformation=Enter Repository Location Information
-SharingWizard.enterModuleName=Enter Module Name
-SharingWizard.readyToFinish=Ready to Share Project
-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=Show in Resource History
-ShowHistoryAction.noHistory=No History Available
-ShowHistoryAction.noHistoryLong=No resource history available for selected resources.
-
-SyncAction.sync=Synchronize
-
-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
-TagAction.enterTag=Please enter a version tag:
-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 reported tagging the resources.
-
-UpdateAction.update=Problems encountered performing update
-UpdateAction.updating=Updating...
-
-UpdateWizard.title=Update
-UpdateWizard.updatePage=Update
-
-UpdateWizardPage.description=&Select a tag to update the project sharing to:
-UpdateWizardPage.overwrite=&Overwrite local changes
-
-UserValidationDialog.required=Password Required
-UserValidationDialog.labelUser=Enter a user name and password for the following repository:\n{0}
-UserValidationDialog.labelPassword=Enter a password for {0} in the following repository:\n{1}
-UserValidationDialog.password=Password:
-UserValidationDialog.user=User name:
-
-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 occured 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?
-
-
-AddToWorkspace.taskName1=Checking out ''{0}'' from CVS
-AddToWorkspace.taskNameN=Checking out {0} folders from CVS
-
-Enter_a_valid_file_name_or_select_the_clipboard_option_1=Enter a valid file name or select the clipboard option
-Save_To_Clipboard_2=Save To Clipboard
-Save_In_File_System_3=Save In File System
-Browse..._4=Browse...
-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 folder 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 Compare With Patch feature)
-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
-
-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?
-
-Example__1=Example:
-Text_Labels_12=Text
-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 Format:
-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=&Label decoration for outgoing:
-Label_decorat&ion_for_added__22=Label decorat&ion for added:
-Icon_Overlays_24=Icons
-Sho&w_outgoing_25=Sho&w outgoing
-Show_has_&remote_26=Show has &remote
-S&how_is_added_27=S&how 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_subsitution_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.\nThese values should be the same as the \'ext\' CVS command-line environment variable settings.
-ExtMethodPreferencePage_CVS_RSH=CVS_RSH:
-ExtMethodPreferencePage_Browse=&Browse...
-ExtMethodPreferencePage_Details=Select a program or script
-ExtMethodPreferencePage_Note__5=Note:
-ExtMethodPreferencePage_note_CVS_RSH=The RSH command must fit the following calling pattern:\n<CVS_RSH> <HOST> -l <USERNAME> <CVS_SERVER>\nThis program will be called to connect to the remote CVS server
-ExtMethodPreferencePage_CVS_SERVER__7=CVS_SERVER:
-ExtMethodPreferencePage_Note__8=Note:
-ExtMethodPreferencePage_NoteForCVS_SERVER=This is the name of the remote CVS server program.\nChange this setting only if the remote CVS server name\nis different than the default
-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
-CVSAddResolutionGenerator.Add_Resource_to_CVS_1=Add Resource to CVS
-CVSAddResolutionGenerator.Add_Resource_and_Children_to_CVS_2=Add Resource and Children to CVS
-CVSAddResolutionGenerator.Add_to_.cvsignore_3=Add to .cvsignore
-CVSRemoveResolutionGenerator.Commit_Deletion_to_CVS_1=Commit Deletion to CVS
-CVSRemoveResolutionGenerator.Undo_Deletion_from_Local_History_2=Undo Deletion from Local History
-CVSRemoveResolutionGenerator.No_local_history_available._Try_undoing_from_the_server_3=No local history available. Try undoing from the server
-CVSRemoveResolutionGenerator.Undo_Deletion_from_CVS_Server_4=Undo Deletion from CVS Server
-CVSRemoveResloutionGenerator.Commit_Deletion_to_CVS_1=Commit Deletion to CVS
-CVSRemoveResloutionGenerator.Undo_Deletion_from_Local_History_2=Undo Deletion from Local History
-CVSRemoveResloutionGenerator.No_local_history_available._Try_undoing_from_the_server_3=No local history available. Try undoing from the server
-CVSRemoveResloutionGenerator.Undo_Deletion_from_CVS_Server_4=Undo Deletion from CVS Server
-
-TagConfigurationDialog.1=Tag Configuration for {0}
-TagConfigurationDialog.2=Tag Configuration for {0} projects
-TagConfigurationDialog.4=Configure the branch and version tags you will see in the workbench for these projects.
-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.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
-ConfigureTagsFromRepoViewError_retreiving_root_folders_from_repository_2=Error retreiving root folders from repository
-ConfigureTagsFromRepoViewConfiguring_branch_tags_3=Configuring branch tags
-ConfigureTagsFromRepoViewOnFolderConfiguring_branch_tags_1=Configuring branch tags
-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
-RemoteRootAction.RemoveRootAction.removeRoot_3=RemoveRootAction.removeRoot
-BranchCategory.Branches_1=Branches
-GroupedByVersionCategory.Versions_1=Versions
-VersionCategory.Versions_1=Versions
-HistoryView.[...]_4=[...]
-
-RepositoryManager.refreshDefinedTags=Refreshing defined tags
-
-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...
-CVSRepositoryPropertiesPage.Confirm_Project_Sharing_Changes_1=Confirm Project Sharing Changes
-CVSRepositoryPropertiesPage.There_are_projects_in_the_workspace_shared_with_this_repository._The_projects_will_be_updated_with_the_new_information_that_you_have_entered_2=There are projects in the workspace shared with this repository. The projects will be updated with the new information that you have entered
-
-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.description=\
- You have requested to exclude some resources from version control. \
- This will not affect resources already under version control.
-IgnoreResourcesDialog.prompt=Select what to add to the .cvsignore file in the parent folder of each selected resource:
-IgnoreResourcesDialog.addNameEntryButton=Add patterns to ignore each resource by name.
-IgnoreResourcesDialog.addNameEntryExample=Examples: file1.so, file2.so, .rcfile, bin
-IgnoreResourcesDialog.addExtensionEntryButton=Add wildcard patterns to ignore all resources with the same extension.
-IgnoreResourcesDialog.addExtensionEntryExample=Examples: *.so, *.rcfile, bin
-IgnoreResourcesDialog.addCustomEntryButton=Add a 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: eg. {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
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 bcebf58b9..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/AllRootsElement.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.IAdaptable;
-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[] getChildren(Object o) {
- return CVSUIPlugin.getPlugin().getRepositoryManager().getKnownRoots();
- }
- 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 dfa68ede9..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/BranchCategory.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-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.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;
-/**
- * BranchCategory is the model element for the branches category
- * for a particular repsitory 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 CVSModelElement implements IAdaptable {
- private ICVSRepositoryLocation repository;
-
- /**
- * TeamStreamsCategory constructor.
- */
- public BranchCategory(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;
- }
-
- /**
- * 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[] getChildren(Object o) {
- CVSTag[] tags = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownBranchTags(repository);
- BranchTag[] branchElements = new BranchTag[tags.length];
- for (int i = 0; i < tags.length; i++) {
- branchElements[i] = new BranchTag(tags[i], repository);
- }
- return branchElements;
- }
-
- /**
- * 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$
- }
-
- /**
- * 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/BranchTag.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/BranchTag.java
deleted file mode 100644
index d9290538a..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/BranchTag.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-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.ui.model.IWorkbenchAdapter;
-
-public class BranchTag extends CVSModelElement implements IAdaptable {
- CVSTag tag;
- ICVSRepositoryLocation root;
-
- /**
- * Create a branch tag
- */
- public BranchTag(CVSTag tag, ICVSRepositoryLocation root) {
- this.tag = tag;
- this.root = root;
- }
- public ICVSRepositoryLocation getRoot() {
- return root;
- }
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
- }
- public CVSTag getTag() {
- return tag;
- }
- public boolean equals(Object o) {
- if (!(o instanceof BranchTag)) return false;
- BranchTag t = (BranchTag)o;
- if (!tag.equals(t.tag)) return false;
- return root.equals(t.root);
- }
- public int hashCode() {
- return root.hashCode() ^ tag.hashCode();
- }
- /**
- * Return children of the root with this tag.
- */
- public Object[] getChildren(Object o) {
- // Return the remote elements for the tag
- final Object[][] result = new Object[1][];
- try {
- CVSUIPlugin.runWithProgress(null, true /*cancelable*/, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- result[0] = root.members(tag, store.getBoolean(ICVSUIConstants.PREF_SHOW_MODULES), monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InterruptedException e) {
- return new Object[0];
- } catch (InvocationTargetException e) {
- handle(e.getTargetException());
- }
- return result[0];
- }
- public ImageDescriptor getImageDescriptor(Object object) {
- if (!(object instanceof BranchTag)) return null;
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_TAG);
- }
- public String getLabel(Object o) {
- if (!(o instanceof BranchTag)) return null;
- return ((BranchTag)o).tag.getName();
- }
- public Object getParent(Object o) {
- if (!(o instanceof BranchTag)) return null;
- return ((BranchTag)o).root;
- }
-} \ No newline at end of file
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 e009a2448..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSAdapterFactory.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-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.ui.model.IWorkbenchAdapter;
-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) {
- if (adaptableObject instanceof ICVSRemoteFile) {
- return fileAdapter;
- } else if (adaptableObject instanceof ICVSRepositoryLocation) {
- return rootAdapter;
- } else if (adaptableObject instanceof ICVSRemoteFolder) {
- return folderAdapter;
- }
- return null;
- }
- if (IPropertySource.class == adapterType) {
- return getPropertySource(adaptableObject);
- }
- return null;
- }
- /** (Non-javadoc)
- * Method declared on IAdapterFactory.
- */
- public Class[] getAdapterList() {
- return new Class[] {IWorkbenchAdapter.class, IPropertySource.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 {
- cachedPropertyValue = null;
- }
- return cachedPropertyValue;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSFileElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSFileElement.java
deleted file mode 100644
index 6b21d0bcc..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSFileElement.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-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.ui.PlatformUI;
-
-public class CVSFileElement extends CVSResourceElement {
-
- private ICVSFile file;
-
- public CVSFileElement(ICVSFile file) {
- this.file = file;
- }
-
- /**
- * Initial implementation: return null;
- */
- public Object[] getChildren(Object o) {
- 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(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;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSFolderElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSFolderElement.java
deleted file mode 100644
index cd079708b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSFolderElement.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-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.team.core.TeamException;
-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.ui.CVSUIPlugin;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-
-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[] getChildren(Object o) {
- final Object[][] result = new Object[1][];
- try {
- CVSUIPlugin.runWithProgress(null, true /*cancelable*/, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- 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);
- }
- }
- result[0] = elements;
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InterruptedException e) {
- return new Object[0];
- } catch (InvocationTargetException e) {
- handle(e.getTargetException());
- return new Object[0];
- }
- return result[0];
- }
- /**
- * 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/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 e665a85e0..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSModelElement.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-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.model.IWorkbenchAdapter;
-
-public abstract class CVSModelElement implements IWorkbenchAdapter {
- /**
- * Handles exceptions that occur in CVS model elements.
- */
- protected void handle(Throwable t) {
- IStatus error = null;
- 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("simpleInternal"), t); //$NON-NLS-1$
- }
-
- Shell shell = new Shell(Display.getDefault());
-
- if (error.getSeverity() == IStatus.INFO) {
- MessageDialog.openInformation(shell, Policy.bind("information"), error.getMessage()); //$NON-NLS-1$
- } else {
- ErrorDialog.openError(shell, Policy.bind("exception"), null, error); //$NON-NLS-1$
- }
- shell.dispose();
- // Let's log non-team exceptions
- if (!(t instanceof TeamException)) {
- CVSUIPlugin.log(error);
- }
- }
-}
-
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 5ccbfe112..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFilePropertySource.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.ErrorDialog;
-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.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) {
- Throwable t = e.getTargetException();
- if (t instanceof TeamException) {
- Shell shell = new Shell(Display.getDefault());
- ErrorDialog.openError(shell, null, null, ((TeamException) t).getStatus());
- shell.dispose();
- }
- }
- }
-}
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 9f14d6f29..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFolderPropertySource.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-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 a0fab60e5..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRepositoryLocationPropertySource.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-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 8ed4aaa08..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRepositoryRootElement.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-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;
-
-/**
- * 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)) return null;
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_REPOSITORY);
- }
- public String getLabel(Object o) {
- if (!(o instanceof ICVSRepositoryLocation)) return null;
- ICVSRepositoryLocation root = (ICVSRepositoryLocation)o;
- return root.getLocation();
- }
- public Object getParent(Object o) {
- return null;
- }
- public Object[] getChildren(Object o) {
- if (!(o instanceof ICVSRepositoryLocation)) return null;
- return new Object[] {
- new BranchTag(CVSTag.DEFAULT, (ICVSRepositoryLocation)o),
- new BranchCategory((ICVSRepositoryLocation)o),
- new VersionCategory((ICVSRepositoryLocation)o)
- };
- }
-} \ No newline at end of file
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 9246cefab..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSResourceElement.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-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();
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRootFolderElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRootFolderElement.java
deleted file mode 100644
index b78dc3da1..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRootFolderElement.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- ******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.model;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-
-public class CVSRootFolderElement extends CVSResourceElement {
-
- ICVSFolder[] roots;
-
- public CVSRootFolderElement(ICVSFolder[] roots) {
- this.roots = roots;
- }
-
- /**
- * @see IWorkbenchAdapter#getChildren(Object)
- */
- public Object[] getChildren(Object o) {
- CVSFolderElement[] folders = new CVSFolderElement[roots.length];
- for (int i = 0; i < roots.length; i++) {
- folders[i] = new CVSFolderElement(roots[i], false);
- }
- return folders;
- }
-
- /**
- * @see IWorkbenchAdapter#getImageDescriptor(Object)
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return null;
- }
-
- /**
- * @see CVSResourceElement#getCVSResource()
- */
- public ICVSResource getCVSResource() {
- return null;
- }
-}
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 63ff74dc6..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/GroupedByVersionCategory.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-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.Path;
-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.
- */
- public Object[] getChildren(Object o) {
- //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, new Path(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/RemoteContentProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteContentProvider.java
deleted file mode 100644
index a90794dfb..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteContentProvider.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-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.resources.RemoteResource;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-
-/**
- * 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 {
- /* (non-Javadoc)
- * Method declared on WorkbenchContentProvider.
- */
- public boolean hasChildren(Object element) {
- if (element == null) {
- return false;
- }
- // 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 BranchTag) {
- return true;
- } else if(element instanceof RemoteModule) {
- return true;
- }
- return super.hasChildren(element);
- }
-}
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 f6f3be1cf..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteFileElement.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-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[] getChildren(Object o) {
- 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(e);
- return null;
- }
- }
-} \ No newline at end of file
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 3ece5f021..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteFolderElement.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-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.team.core.TeamException;
-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.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-
-public class RemoteFolderElement extends RemoteResourceElement {
- public Object[] getChildren(final Object o) {
- if (!(o instanceof ICVSRemoteFolder)) return null;
- final Object[][] result = new Object[1][];
- try {
- CVSUIPlugin.runWithProgress(null, true /*cancelable*/, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- result[0] = ((ICVSRemoteFolder)o).members(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InterruptedException e) {
- return new Object[0];
- } catch (InvocationTargetException e) {
- handle(e.getTargetException());
- }
- return result[0];
- }
- /**
- * 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.VERSION) {
- 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;
- return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
- }
-}
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 987a63c34..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteModule.java
+++ /dev/null
@@ -1,129 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-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.ICVSRemoteFolder;
-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.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.RepositoryManager;
-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 RemoteModule extends CVSModelElement implements IAdaptable {
- 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;
- 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. The children of the RemoteModule
- * are the versions for that module.
- */
- public Object[] getChildren(Object o) {
- final Object[][] result = new Object[1][];
- try {
- CVSUIPlugin.runWithProgress(null, true /*cancelable*/, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- try {
- manager.refreshDefinedTags(folder, false, monitor);
- } catch(TeamException e) {
- // continue
- }
- CVSTag[] tags = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownVersionTags(folder);
- Object[] versions = new Object[tags.length];
- for (int i = 0; i < versions.length; i++) {
- versions[i] = folder.getRepository().getRemoteFolder(folder.getRepositoryRelativePath(), tags[i]);
- }
- result[0] = versions;
- }
- });
- } catch (InterruptedException e) {
- return new Object[0];
- } catch (InvocationTargetException e) {
- handle(e.getTargetException());
- }
- return result[0];
- }
-
- /**
- * 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;
- }
-}
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 0f6987e34..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteResourceElement.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-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;
- return null;
- }
-} \ No newline at end of file
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 41bc0d194..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/RemoteVersionModule.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-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.ICVSRemoteFolder;
-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.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[] getChildren(Object o) {
- 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/VersionCategory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/VersionCategory.java
deleted file mode 100644
index d24419aac..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/VersionCategory.java
+++ /dev/null
@@ -1,118 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-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.ICVSRemoteFolder;
-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.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-public class VersionCategory extends CVSModelElement implements IAdaptable {
- 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;
- 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[] getChildren(Object o) {
- final Object[][] result = new Object[1][];
- try {
- CVSUIPlugin.runWithProgress(null, true /*cancelable*/, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- ICVSRemoteResource[] resources = repository.members(CVSTag.DEFAULT,
- store.getBoolean(ICVSUIConstants.PREF_SHOW_MODULES), monitor);
- Object[] modules = new Object[resources.length];
- for (int i = 0; i < resources.length; i++) {
- modules[i] = new RemoteModule((ICVSRemoteFolder)resources[i], VersionCategory.this);
- }
- result[0] = modules;
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InterruptedException e) {
- return new Object[0];
- } catch (InvocationTargetException e) {
- handle(e.getTargetException());
- }
- return result[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("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;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/AddSyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/AddSyncAction.java
deleted file mode 100644
index a0a244d54..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/AddSyncAction.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial implementation
- ******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui.sync;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.Vector;
-
-import org.eclipse.compare.structuremergeviewer.DiffContainer;
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-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.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-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.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.syncinfo.MutableResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.core.resources.CVSRemoteSyncElement;
-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.RepositoryManager;
-import org.eclipse.team.internal.ui.sync.ChangedTeamContainer;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.SyncSet;
-import org.eclipse.team.internal.ui.sync.SyncView;
-import org.eclipse.team.internal.ui.sync.TeamFile;
-
-/**
- * This is a CVS sync view action that will
- */
-public class AddSyncAction extends MergeAction {
- public AddSyncAction(CVSSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
- super(model, sp, label, shell);
- }
-
- protected SyncSet run(SyncSet syncSet, IProgressMonitor monitor) {
- boolean result = saveIfNecessary();
- if (!result) return null;
-
- ITeamNode[] changed = syncSet.getChangedNodes();
- if (changed.length == 0) {
- return syncSet;
- }
- List additions = new ArrayList();
-
- try {
- for (int i = 0; i < changed.length; i++) {
- int kind = changed[i].getKind();
- // leave the added nodes in the sync view. Their sync state
- // won't change but the decoration should.
- IResource resource = changed[i].getResource();
- if ((kind & Differencer.DIRECTION_MASK) == ITeamNode.CONFLICTING) {
- if (resource.getType() == IResource.FOLDER) {
- makeInSync(changed[i]);
- } else {
- makeAdded(changed[i]);
- }
- } else {
- if (resource.getType() == resource.FILE) {
- additions.add(resource);
- }
- }
- }
-
- RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- if (additions.size() != 0) {
- manager.add((IResource[])additions.toArray(new IResource[0]), monitor);
- }
-
- // for all files ensure that parent folders are made in sync after
- // the add completes.
- for (int i = 0; i < changed.length; i++) {
- ITeamNode node = changed[i];
- IResource resource = changed[i].getResource();
- if (resource.getType() == resource.FILE) {
- syncSet.remove(node);
- }
- }
- } catch (final TeamException e) {
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- ErrorDialog.openError(getShell(), null, null, e.getStatus());
- }
- });
- return null;
- }
-
- return syncSet;
- }
-
- protected void makeAdded(ITeamNode changed)
- throws TeamException, CVSException {
- // Fake the add locally since add command will fail
- makeInSync(changed.getParent());
- CVSRemoteSyncElement syncElement = (CVSRemoteSyncElement)((TeamFile)changed).getMergeResource().getSyncElement();
- ICVSResource remote = (ICVSResource)syncElement.getRemote();
- MutableResourceSyncInfo info = remote.getSyncInfo().cloneMutable();
- info.setTimeStamp(null);
- info.setAdded();
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)changed.getResource());
- cvsFile.setSyncInfo(info);
- }
-
- /**
- * Enabled for folders and files that aren't added.
- */
- protected boolean isEnabled(ITeamNode node) {
- try {
- return new CVSSyncSet(new StructuredSelection(node)).hasNonAddedChanges();
- } catch (CVSException e) {
- CVSUIPlugin.log(e.getStatus());
- return false;
- }
- }
-
- /**
- * Remove all nodes that aren't files and folders that need to be added.
- */
- protected void removeNonApplicableNodes(SyncSet set, int syncMode) {
- set.removeIncomingNodes();
- ((CVSSyncSet)set).removeAddedChanges();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java
deleted file mode 100644
index 7377efc21..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java
+++ /dev/null
@@ -1,462 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.sync;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.structuremergeviewer.DiffContainer;
-import org.eclipse.compare.structuremergeviewer.DiffElement;
-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.action.Action;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteResource;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ILogEntry;
-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.CVSDecoration;
-import org.eclipse.team.internal.ccvs.ui.CVSDecorationRunnable;
-import org.eclipse.team.internal.ccvs.ui.CVSDecoratorConfiguration;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.HistoryView;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.OverlayIcon;
-import org.eclipse.team.internal.ccvs.ui.OverlayIconCache;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.merge.OverrideUpdateMergeAction;
-import org.eclipse.team.internal.ccvs.ui.merge.UpdateMergeAction;
-import org.eclipse.team.internal.ccvs.ui.merge.UpdateWithForcedJoinAction;
-import org.eclipse.team.internal.ui.sync.CatchupReleaseViewer;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.MergeResource;
-import org.eclipse.team.internal.ui.sync.SyncView;
-import org.eclipse.team.internal.ui.sync.TeamFile;
-import org.eclipse.team.ui.ISharedImages;
-import org.eclipse.team.ui.TeamImages;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-public class CVSCatchupReleaseViewer extends CatchupReleaseViewer {
- // Actions
- private UpdateSyncAction updateAction;
- private ForceUpdateSyncAction forceUpdateAction;
-
- private CommitSyncAction commitAction;
- private ForceCommitSyncAction forceCommitAction;
-
- private UpdateMergeAction updateMergeAction;
- private UpdateWithForcedJoinAction updateWithJoinAction;
- private OverrideUpdateMergeAction forceUpdateMergeAction;
-
- private IgnoreAction ignoreAction;
- private HistoryAction showInHistory;
-
- private Action confirmMerge;
- private AddSyncAction addAction;
-
- private static class DiffOverlayIcon extends OverlayIcon {
- private static final int HEIGHT = 16;
- private static final int WIDTH = 22;
- public DiffOverlayIcon(Image baseImage, ImageDescriptor[] overlays) {
- super(baseImage, overlays, new Point(WIDTH, HEIGHT));
- }
- protected void drawOverlays(ImageDescriptor[] overlays) {
- for (int i = 0; i < overlays.length; i++) {
- ImageDescriptor overlay = overlays[i];
- ImageData overlayData = overlay.getImageData();
- drawImage(overlayData, 0, 0);
- }
- }
- }
-
- private static class HistoryAction extends Action implements ISelectionChangedListener {
- IStructuredSelection selection;
- public HistoryAction(String label) {
- super(label);
- }
- public void run() {
- if (selection.isEmpty()) {
- return;
- }
- HistoryView view = HistoryView.openInActivePerspective();
- if (view == null) {
- return;
- }
- ITeamNode node = (ITeamNode)selection.getFirstElement();
- IRemoteSyncElement remoteSyncElement = ((TeamFile)node).getMergeResource().getSyncElement();
- ICVSRemoteFile remoteFile = (ICVSRemoteFile)remoteSyncElement.getRemote();
- IResource local = remoteSyncElement.getLocal();
- ICVSRemoteFile baseFile = (ICVSRemoteFile)remoteSyncElement.getBase();
-
- // can only show history if remote exists or local has a base.
- String currentRevision = null;
- try {
- currentRevision = baseFile!=null ? baseFile.getRevision(): null;
- } catch(TeamException e) {
- CVSUIPlugin.log(e.getStatus());
- }
- if(remoteFile!=null) {
- view.showHistory(remoteFile, currentRevision);
- } else if(baseFile!=null) {
- view.showHistory(baseFile, currentRevision);
- }
- }
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- if (!(selection instanceof IStructuredSelection)) {
- setEnabled(false);
- return;
- }
- IStructuredSelection ss = (IStructuredSelection)selection;
- if (ss.size() != 1) {
- setEnabled(false);
- return;
- }
- ITeamNode first = (ITeamNode)ss.getFirstElement();
- if (first instanceof TeamFile) {
- // can only show history on elements that have a remote file
- this.selection = ss;
- IRemoteSyncElement remoteSyncElement = ((TeamFile)first).getMergeResource().getSyncElement();
- if(remoteSyncElement.getRemote() != null || remoteSyncElement.getBase() != null) {
- setEnabled(true);
- } else {
- setEnabled(false);
- }
- } else {
- this.selection = null;
- setEnabled(false);
- }
- }
- }
-
- public CVSCatchupReleaseViewer(Composite parent, CVSSyncCompareInput model) {
- super(parent, model);
- initializeActions(model);
- initializeLabelProvider();
- // set F1 help
- WorkbenchHelp.setHelp(this.getControl(), IHelpContextIds.CATCHUP_RELEASE_VIEWER);
- }
-
- private void initializeLabelProvider() {
- final ImageDescriptor conflictDescriptor = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_MERGEABLE_CONFLICT);
- final ImageDescriptor hasRemoteDescriptor = TeamImages.getImageDescriptor(ISharedImages.IMG_CHECKEDIN_OVR);
- final ImageDescriptor addedDescriptor = TeamImages.getImageDescriptor(ISharedImages.IMG_CHECKEDOUT_OVR);
- final LabelProvider oldProvider = (LabelProvider)getLabelProvider();
- setLabelProvider(new LabelProvider() {
- private OverlayIconCache iconCache = new OverlayIconCache();
-
- public void dispose() {
- iconCache.disposeAll();
- oldProvider.dispose();
- }
- public Image getImage(Object element) {
- Image image = oldProvider.getImage(element);
- if (element instanceof ITeamNode) {
- ITeamNode node = (ITeamNode)element;
- int kind = node.getKind();
- IResource resource = node.getResource();
-
- // use the default cvs image decorations
- if(resource.exists()) {
- CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId());
- List overlays = new ArrayList();
- List stdOverlays = CVSDecorationRunnable.computeLabelOverlaysFor(node.getResource(), false, provider);
- if(stdOverlays != null) {
- overlays.addAll(stdOverlays);
- }
- if ((kind & IRemoteSyncElement.AUTOMERGE_CONFLICT) != 0) {
- overlays.add(conflictDescriptor);
- }
- if(!overlays.isEmpty()) {
- return iconCache.getImageFor(new DiffOverlayIcon(image,
- (ImageDescriptor[]) overlays.toArray(
- new ImageDescriptor[overlays.size()])));
- } else {
- return image;
- }
- }
- }
- return image;
- }
- public String getText(Object element) {
- if (element instanceof ITeamNode) {
- ITeamNode node = (ITeamNode)element;
- IResource resource = node.getResource();
- if (resource.exists()) {
-
- // use the default text decoration preferences
- CVSDecoration decoration = CVSDecorationRunnable.computeTextLabelFor(resource, false /*don't show dirty*/);
- String format = decoration.getFormat();
- Map bindings = decoration.getBindings();
-
- // don't show the revision number, it will instead be shown in
- // the label for the remote/base/local files editors
- bindings.remove(CVSDecoratorConfiguration.FILE_REVISION);
-
- bindings.put(CVSDecoratorConfiguration.RESOURCE_NAME, oldProvider.getText(element));
- return CVSDecoratorConfiguration.bind(format, bindings);
- }
- }
- return oldProvider.getText(element);
- }
- });
- }
-
- protected void fillContextMenu(IMenuManager manager) {
- super.fillContextMenu(manager);
- if (showInHistory != null) {
- manager.add(showInHistory);
- }
- manager.add(new Separator());
- switch (getSyncMode()) {
- case SyncView.SYNC_INCOMING:
- updateAction.update(SyncView.SYNC_INCOMING);
- manager.add(updateAction);
- forceUpdateAction.update(SyncView.SYNC_INCOMING);
- manager.add(forceUpdateAction);
- manager.add(new Separator());
- manager.add(confirmMerge);
- break;
- case SyncView.SYNC_OUTGOING:
- addAction.update(SyncView.SYNC_OUTGOING);
- manager.add(addAction);
- commitAction.update(SyncView.SYNC_OUTGOING);
- manager.add(commitAction);
- forceCommitAction.update(SyncView.SYNC_OUTGOING);
- manager.add(forceCommitAction);
- ignoreAction.update();
- manager.add(ignoreAction);
- manager.add(new Separator());
- manager.add(confirmMerge);
- break;
- case SyncView.SYNC_BOTH:
- addAction.update(SyncView.SYNC_BOTH);
- manager.add(addAction);
- commitAction.update(SyncView.SYNC_BOTH);
- manager.add(commitAction);
- updateAction.update(SyncView.SYNC_BOTH);
- manager.add(updateAction);
- manager.add(new Separator());
- forceCommitAction.update(SyncView.SYNC_BOTH);
- manager.add(forceCommitAction);
- forceUpdateAction.update(SyncView.SYNC_BOTH);
- manager.add(forceUpdateAction);
- manager.add(new Separator());
- manager.add(confirmMerge);
- break;
- case SyncView.SYNC_MERGE:
- updateMergeAction.update(SyncView.SYNC_INCOMING);
- forceUpdateMergeAction.update(SyncView.SYNC_INCOMING);
- updateWithJoinAction.update(SyncView.SYNC_INCOMING);
- manager.add(updateMergeAction);
- manager.add(forceUpdateMergeAction);
- manager.add(updateWithJoinAction);
- break;
- }
- }
-
- /**
- * Creates the actions for this viewer.
- */
- private void initializeActions(final CVSSyncCompareInput diffModel) {
- Shell shell = getControl().getShell();
- commitAction = new CommitSyncAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.commit"), shell); //$NON-NLS-1$
- forceCommitAction = new ForceCommitSyncAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.forceCommit"), shell); //$NON-NLS-1$
- updateAction = new UpdateSyncAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.update"), shell); //$NON-NLS-1$
- forceUpdateAction = new ForceUpdateSyncAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.forceUpdate"), shell); //$NON-NLS-1$
- updateMergeAction = new UpdateMergeAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.update"), shell); //$NON-NLS-1$
- ignoreAction = new IgnoreAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.ignore"), shell); //$NON-NLS-1$
- updateWithJoinAction = new UpdateWithForcedJoinAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.mergeUpdate"), shell); //$NON-NLS-1$
- forceUpdateMergeAction = new OverrideUpdateMergeAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.forceUpdate"), shell); //$NON-NLS-1$
- addAction = new AddSyncAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.addAction"), shell); //$NON-NLS-1$
-
- // Show in history view
- showInHistory = new HistoryAction(Policy.bind("CVSCatchupReleaseViewer.showInHistory")); //$NON-NLS-1$
- addSelectionChangedListener(showInHistory);
-
- // confirm merge
- confirmMerge = new Action(Policy.bind("CVSCatchupReleaseViewer.confirmMerge"), null) { //$NON-NLS-1$
- public void run() {
- ISelection s = getSelection();
- if (!(s instanceof IStructuredSelection) || s.isEmpty()) {
- return;
- }
- List needsMerge = new ArrayList();
- for (Iterator it = ((IStructuredSelection)s).iterator(); it.hasNext();) {
- final Object element = it.next();
- if(element instanceof DiffElement) {
- mergeRecursive((IDiffElement)element, needsMerge);
- }
- }
- TeamFile[] files = (TeamFile[]) needsMerge.toArray(new TeamFile[needsMerge.size()]);
- if(files.length != 0) {
- try {
- for (int i = 0; i < files.length; i++) {
- TeamFile teamFile = (TeamFile)files[i];
- CVSUIPlugin.getPlugin().getRepositoryManager().merged(new IRemoteSyncElement[] {teamFile.getMergeResource().getSyncElement()});
- teamFile.merged();
- }
- } catch(TeamException e) {
- ErrorDialog.openError(getControl().getShell(), null, null, e.getStatus());
- }
- }
- refresh();
- }
-
- public boolean isEnabled() {
- ISelection s = getSelection();
- if (!(s instanceof IStructuredSelection) || s.isEmpty()) {
- return false;
- }
- for (Iterator it = ((IStructuredSelection)s).iterator(); it.hasNext();) {
- Object element = (Object) it.next();
- if(element instanceof TeamFile) {
- TeamFile file = (TeamFile)element;
- if(file.hasBeenSaved()) {
- int direction = file.getChangeDirection();
- int type = file.getChangeType();
- if(direction == IRemoteSyncElement.INCOMING ||
- direction == IRemoteSyncElement.CONFLICTING) {
- continue;
- }
- }
- }
- return false;
- }
- return true;
- }
- };
- }
-
- protected void mergeRecursive(IDiffElement element, List needsMerge) {
- if(element instanceof DiffContainer) {
- DiffContainer container = (DiffContainer)element;
- IDiffElement[] children = container.getChildren();
- for (int i = 0; i < children.length; i++) {
- mergeRecursive(children[i], needsMerge);
- }
- } else if(element instanceof TeamFile) {
- TeamFile file = (TeamFile)element;
- needsMerge.add(file);
- }
- }
-
- /**
- * Provide CVS-specific labels for the editors.
- */
- protected void updateLabels(MergeResource resource) {
- CompareConfiguration config = getCompareConfiguration();
- String name = resource.getName();
- config.setLeftLabel(Policy.bind("CVSCatchupReleaseViewer.workspaceFile", name)); //$NON-NLS-1$
-
- IRemoteSyncElement syncTree = resource.getSyncElement();
- IRemoteResource remote = syncTree.getRemote();
- if (remote != null) {
- try {
- final ICVSRemoteFile remoteFile = (ICVSRemoteFile)remote;
- String revision = remoteFile.getRevision();
- final String[] author = new String[] { "" }; //$NON-NLS-1$
- try {
- CVSUIPlugin.runWithProgress(getTree().getShell(), true /*cancelable*/,
- new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ILogEntry logEntry = remoteFile.getLogEntry(monitor);
- author[0] = logEntry.getAuthor();
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InterruptedException e) { // ignore cancellation
- } catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- if (t instanceof TeamException) {
- throw (TeamException) t;
- }
- // should not get here
- }
- config.setRightLabel(Policy.bind("CVSCatchupReleaseViewer.repositoryFileRevision", new Object[] {name, revision, author[0]})); //$NON-NLS-1$
- } catch (TeamException e) {
- ErrorDialog.openError(getControl().getShell(), null, null, e.getStatus());
- config.setRightLabel(Policy.bind("CVSCatchupReleaseViewer.repositoryFile", name)); //$NON-NLS-1$
- }
- } else {
- config.setRightLabel(Policy.bind("CVSCatchupReleaseViewer.noRepositoryFile")); //$NON-NLS-1$
- }
-
- IRemoteResource base = syncTree.getBase();
- if (base != null) {
- try {
- String revision = ((ICVSRemoteFile)base).getRevision();
- config.setAncestorLabel(Policy.bind("CVSCatchupReleaseViewer.commonFileRevision", new Object[] {name, revision} )); //$NON-NLS-1$
- } catch (TeamException e) {
- ErrorDialog.openError(getControl().getShell(), null, null, e.getStatus());
- config.setRightLabel(Policy.bind("CVSCatchupReleaseViewer.commonFile", name)); //$NON-NLS-1$
- }
- } else {
- config.setAncestorLabel(Policy.bind("CVSCatchupReleaseViewer.noCommonFile")); //$NON-NLS-1$
- }
-
- IResource local = syncTree.getLocal();
- if (local != null) {
- if (!local.exists()) {
- config.setLeftLabel(Policy.bind("CVSCatchupReleaseViewer.No_workspace_file_1")); //$NON-NLS-1$
- } else {
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)local);
- ResourceSyncInfo info = null;
- try {
- info = cvsFile.getSyncInfo();
- name = local.getName();
- String revision = null;
- if (info != null) {
- revision = info.getRevision();
- if (info.isAdded() || info.isDeleted()) {
- revision = null;
- }
- }
- if (revision != null) {
- config.setLeftLabel(Policy.bind("CVSCatchupReleaseViewer.commonFileRevision", name, revision)); //$NON-NLS-1$
- } else {
- config.setLeftLabel(Policy.bind("CVSCatchupReleaseViewer.commonFile", name)); //$NON-NLS-1$
- }
- } catch (CVSException e) {
- ErrorDialog.openError(getControl().getShell(), null, null, e.getStatus());
- config.setLeftLabel(Policy.bind("CVSCatchupReleaseViewer.commonFile", name)); //$NON-NLS-1$
- }
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java
deleted file mode 100644
index 601470c6d..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java
+++ /dev/null
@@ -1,381 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.sync;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.compare.structuremergeviewer.ICompareInput;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-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.jface.dialogs.ErrorDialog;
-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.viewers.Viewer;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.ILocalSyncElement;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
-import org.eclipse.team.internal.ccvs.core.client.Session;
-import org.eclipse.team.internal.ccvs.core.resources.CVSRemoteSyncElement;
-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.ui.sync.CatchupReleaseViewer;
-import org.eclipse.team.internal.ui.sync.ChangedTeamContainer;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.SyncCompareInput;
-import org.eclipse.team.internal.ui.sync.TeamFile;
-
-public class CVSSyncCompareInput extends SyncCompareInput {
- private IResource[] resources;
- private boolean onlyOutgoing = false;
-
- public CVSSyncCompareInput(IResource[] resources) {
- this(resources, false);
- }
-
- protected CVSSyncCompareInput(IResource[] resources, int granularity) {
- super(granularity);
- this.resources = resources;
- }
-
- public CVSSyncCompareInput(IResource[] resources, boolean onlyOutgoing) {
- super(CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_CONSIDER_CONTENTS) ? ILocalSyncElement.GRANULARITY_CONTENTS : ILocalSyncElement.GRANULARITY_TIMESTAMP);
- this.onlyOutgoing = onlyOutgoing;
- this.resources = resources;
- }
-
- /**
- * Overridden to create a custom DiffTreeViewer in the top left pane of the CompareProvider.
- *
- * Subclasses must create and return a new CatchupReleaseViewer, and set the viewer
- * using setViewer().
- */
- public Viewer createDiffViewer(Composite parent) {
- CatchupReleaseViewer catchupReleaseViewer = new CVSCatchupReleaseViewer(parent, this);
- setViewer(catchupReleaseViewer);
-// catchupReleaseViewer.getTree().addMouseMoveListener(new MouseMoveListener() {
-// /**
-// * @see MouseMoveListener#mouseMove(MouseEvent)
-// */
-// public void mouseMove(MouseEvent e) {
-// final Tree tree = (Tree)e.widget;
-// TreeItem item = tree.getItem(new Point(e.x, e.y));
-// final TeamFile file;
-// if (item != null) {
-// // Hack: this is the only way to get an item from the tree viewer
-// Object o = item.getData();
-// if (o instanceof TeamFile) {
-// file = (TeamFile)o;
-// } else file = null;
-// } else file = null;
-//
-// // avoid redundant updates -- identity test is good enough here
-// if (file == previousTeamFile) return;
-// previousTeamFile = file;
-// getShell().getDisplay().asyncExec(new Runnable() {
-// public void run() {
-// updateToolTip(tree, file);
-// }
-// });
-// }
-// });
- return catchupReleaseViewer;
- }
-
-// protected void updateToolTip(Tree tree, TeamFile file) {
-// String newText = null;
-// if (file != null && file.getChangeDirection() != ITeamNode.OUTGOING) {
-// IRemoteSyncElement element = file.getMergeResource().getSyncElement();
-// final ICVSRemoteFile remoteFile = (ICVSRemoteFile)element.getRemote();
-// final ILogEntry[] logEntry = new ILogEntry[1];
-// if (remoteFile != null) {
-// try {
-// CVSUIPlugin.runWithProgress(getViewer().getTree().getShell(), true /*cancelable*/,
-// new IRunnableWithProgress() {
-// public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
-// try {
-// logEntry[0] = remoteFile.getLogEntry(monitor);
-// } catch (TeamException ex) {
-// throw new InvocationTargetException(ex);
-// }
-// }
-// });
-// } catch (InterruptedException ex) {
-// // ignore cancellation
-// } catch (InvocationTargetException ex) {
-// // ignore the exception
-// }
-// }
-// if (logEntry[0] != null) {
-// newText = logEntry[0].getComment();
-// }
-// }
-// if (tree.isDisposed()) return;
-// String oldText = tree.getToolTipText();
-// if (newText == oldText || newText != null && newText.equals(oldText)) return;
-// tree.setToolTipText(newText);
-// }
-
- protected IRemoteSyncElement[] createSyncElements(IProgressMonitor monitor) throws TeamException {
- if (onlyOutgoing) {
- // Find the outgoing changes in each selected resource
- final List outgoing = new ArrayList();
- try {
- for (int i = 0; i < resources.length; i++) {
- resources[i].accept(new IResourceVisitor() {
- public boolean visit(IResource resource) throws CoreException {
- // if resource is a file and is dirty, add it to the list
- if (resource.getType() == IResource.FILE) {
- if (isDirty((IFile)resource)) {
- outgoing.add(resource);
- }
- }
- return true;
- }
- });
- }
- } catch (CoreException e) {
- ErrorDialog.openError(getShell(), Policy.bind("simpleInternal"), Policy.bind("internal"), e.getStatus()); //$NON-NLS-1$ //$NON-NLS-2$
- CVSUIPlugin.log(e.getStatus());
- return new IRemoteSyncElement[0];
- }
- final TeamException[] exception = new TeamException[1];
- final IFile[] files = (IFile[])outgoing.toArray(new IFile[outgoing.size()]);
- final IRemoteSyncElement[] trees = new IRemoteSyncElement[files.length];
- Session.run(null, null, true, new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- int work = 1000 * resources.length;
- monitor.beginTask(null, work);
- try {
- for (int i = 0; i < trees.length; i++) {
- trees[i] = CVSWorkspaceRoot.getRemoteSyncTree(files[i], null, Policy.subMonitorFor(monitor, 1000));
- }
- } catch (TeamException e) {
- exception[0] = e;
- } finally {
- monitor.done();
- }
- }
- }, monitor);
- if (exception[0] != null) throw exception[0];
- return trees;
- } else {
- IRemoteSyncElement[] trees = new IRemoteSyncElement[resources.length];
- int work = 1000 * resources.length;
- monitor.beginTask(null, work);
- try {
- for (int i = 0; i < trees.length; i++) {
- trees[i] = CVSWorkspaceRoot.getRemoteSyncTree(resources[i], null, Policy.subMonitorFor(monitor, 1000));
- }
- } finally {
- monitor.done();
- }
- return trees;
- }
- }
-
- protected void updateView() {
- // Update the view
- if (getDiffRoot().hasChildren()) {
- getViewer().refresh();
- } else {
- getViewer().setInput(null);
- }
-
- // Update the status line
- updateStatusLine();
- }
-
- /**
- * Overridden to mark the source as merged.
- */
- protected void compareInputChanged(ICompareInput source) {
- super.compareInputChanged(source);
- updateView();
-
- // prompt user with warning
- Shell shell = getShell();
- if(shell != null) {
- // prompt
- if(source instanceof TeamFile) {
- TeamFile file = (TeamFile)source;
- int direction = file.getChangeDirection();
- int type = file.getChangeType();
- if(direction == IRemoteSyncElement.INCOMING ||
- direction == IRemoteSyncElement.CONFLICTING) {
- promptForConfirmMerge(getShell());
- }
- }
- }
- }
-
- /*
- * Helper method to get cvs elements from the selection in the sync editor input
- */
- public static CVSRemoteSyncElement getSyncElementFrom(Object node) {
- CVSRemoteSyncElement element = null;
- if (node instanceof TeamFile) {
- element = (CVSRemoteSyncElement)((TeamFile)node).getMergeResource().getSyncElement();
- } else if (node instanceof ChangedTeamContainer) {
- element = (CVSRemoteSyncElement)((ChangedTeamContainer)node).getMergeResource().getSyncElement();
- }
- return element;
- }
-
- /*
- * Returns the resources in this input.
- */
- public IResource[] getResources() {
- return resources;
- }
-
- /*
- * Inform user that when changes are merged in the sync view that confirm
- * merge should be called to finish the merge.
- */
- private void promptForConfirmMerge(final Shell shell) {
- final IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- if(!store.getBoolean(ICVSUIConstants.PREF_PROMPT_ON_SAVING_IN_SYNC)) {
- return;
- };
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- AvoidableMessageDialog dialog = new AvoidableMessageDialog(
- shell,
- Policy.bind("CVSSyncCompareInput.confirmMergeMessageTitle"), //$NON-NLS-1$
- null, // accept the default window icon
- Policy.bind("CVSSyncCompareInput.confirmMergeMessage"), //$NON-NLS-1$
- MessageDialog.INFORMATION,
- new String[] {IDialogConstants.OK_LABEL},
- 0);
- dialog.open();
- if(dialog.isDontShowAgain()) {
- store.setValue(ICVSUIConstants.PREF_PROMPT_ON_SAVING_IN_SYNC, false);
- }
- }
- });
- }
-
- /**
- * Wrap the input preparation in a CVS session run so open sessions will be reused and
- * file contents under the same remote root folder will be fetched using the same connection.
- *
- * Also run with refresh prompting if one of the resources is out of sync with the local
- * file system.
- */
- public Object prepareInput(IProgressMonitor pm) throws InterruptedException, InvocationTargetException {
- final Object[] result = new Object[] { null };
- final Exception[] exception = new Exception[] {null};
- try {
- Session.run(null, null, false, new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- try {
- CVSUIPlugin.runWithRefresh(getShell(), resources, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- result[0] = CVSSyncCompareInput.super.prepareInput(monitor);
- }
- }, monitor);
- } catch (InterruptedException e) {
- exception[0] = e;
- } catch (InvocationTargetException e) {
- exception[0] = e;
- }
- }
- }, pm);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
-
- if (exception[0] != null) {
- if (exception[0] instanceof InvocationTargetException) {
- throw (InvocationTargetException)exception[0];
- } else {
- throw (InterruptedException)exception[0];
- }
- }
-
- return result[0];
- }
-
- /**
- * Adjust the sync info (to conflicting change) for locally deleted
- * folders (i.e. outgoing folder deletions)
- * that have incoming or conflicting changes in one or more children.
- *
- * @see MergeAction#removeNodes(ITeamNode[])
- */
- protected IDiffElement collectResourceChanges(IDiffContainer parent, IRemoteSyncElement tree, IProgressMonitor pm) {
- IDiffElement element = super.collectResourceChanges(parent, tree, pm);
- int kind = element.getKind();
- if ((element instanceof ChangedTeamContainer)
- && ((kind & Differencer.CHANGE_TYPE_MASK) == Differencer.DELETION)
- && ((kind & Differencer.DIRECTION_MASK) == ITeamNode.OUTGOING)) {
- // Check the children to see if there are any incomming changes
- if (hasIncomingChanges((ChangedTeamContainer)element)) {
- ((ChangedTeamContainer)element).setKind(ITeamNode.CONFLICTING | Differencer.CHANGE);
- }
- }
- return element;
- }
-
- private boolean hasIncomingChanges(ChangedTeamContainer container) {
- IDiffElement[] children = container.getChildren();
- for (int i = 0; i < children.length; i++) {
- IDiffElement element = children[i];
- int direction = element.getKind() & Differencer.DIRECTION_MASK;
- if (direction == ITeamNode.CONFLICTING || direction == ITeamNode.INCOMING) {
- return true;
- }
- if (element instanceof ChangedTeamContainer) {
- boolean hasIncomingChanges = hasIncomingChanges((ChangedTeamContainer)element);
- if (hasIncomingChanges) return true;
- }
- }
- return false;
- }
-
- /*
- * Copied from CVSDecorator
- */
- private static boolean isDirty(ICVSFile cvsFile) {
- try {
- // file is dirty or file has been merged by an update
- if(!cvsFile.isIgnored()) {
- return cvsFile.isModified();
- } else {
- return false;
- }
- } catch (CVSException e) {
- //if we get an error report it to the log but assume dirty
- CVSUIPlugin.log(e.getStatus());
- return true;
- }
- }
-
- /*
- * Copied from CVSDecorator
- */
- private static boolean isDirty(IFile file) {
- return isDirty(CVSWorkspaceRoot.getCVSFileFor(file));
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareUnsharedInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareUnsharedInput.java
deleted file mode 100644
index 4698e911f..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareUnsharedInput.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- ******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.sync;
-
-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.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-public class CVSSyncCompareUnsharedInput extends CVSSyncCompareInput {
-
- private ICVSRepositoryLocation location;
- private String moduleName;
- private CVSTag tag;
-
- public CVSSyncCompareUnsharedInput(IProject project, ICVSRepositoryLocation location, String moduleName, CVSTag tag) {
- super(new IResource[] { project });
- this.location = location;
- this.moduleName = moduleName;
- this.tag = tag;
- }
-
- protected IRemoteSyncElement[] createSyncElements(IProgressMonitor monitor) throws TeamException {
- IResource[] resources = getResources();
- IRemoteSyncElement[] trees = new IRemoteSyncElement[resources.length];
- int work = 1000 * resources.length;
- monitor.beginTask(null, work);
- try {
- for (int i = 0; i < trees.length; i++) {
- trees[i] = CVSWorkspaceRoot.getRemoteSyncTree((IProject)resources[i], location, moduleName, tag, Policy.subMonitorFor(monitor, 1000));
- }
- } finally {
- monitor.done();
- }
- return trees;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncSet.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncSet.java
deleted file mode 100644
index 9b13e0632..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncSet.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.sync;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.util.Iterator;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-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.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.SyncSet;
-
-/**
- * This class contains a set of CVS resources that are slated to be
- * synchronized. This adds CVS specific handling to the common sync set
- * class, specifically to deal with non-added outgoing changes.
- */
-public class CVSSyncSet extends SyncSet {
-
- /**
- * Creates a new sync set on the nodes in the given selection.
- */
- public CVSSyncSet(IStructuredSelection nodeSelection) {
- super(nodeSelection);
- }
-
- public boolean hasNonAddedChanges() throws CVSException {
- for (Iterator it = getSyncSet().iterator(); it.hasNext();) {
- ITeamNode node = (ITeamNode)it.next();
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(node.getResource());
- if(cvsResource.isFolder()) {
- if(! ((ICVSFolder)cvsResource).isCVSFolder()) {
- return true;
- }
- } else if(! cvsResource.isManaged()) {
- return true;
- }
- }
- return false;
- }
-
- public boolean hasCommitableChanges() throws CVSException {
- for (Iterator it = getSyncSet().iterator(); it.hasNext();) {
- ITeamNode node = (ITeamNode)it.next();
- // outgoing file that is added is a commit candidate
- if (node.getChangeDirection() == IRemoteSyncElement.OUTGOING) {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(node.getResource());
- if(!cvsResource.isFolder() && cvsResource.isManaged()) {
- return true;
- }
- }
- }
- return false;
- }
-
- public boolean removeNonAddedChanges() {
- for (Iterator it = getSyncSet().iterator(); it.hasNext();) {
- try {
- ITeamNode node = (ITeamNode)it.next();
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(node.getResource());
- if (cvsResource.exists()) {
- if(cvsResource.isFolder()) {
- if(!((ICVSFolder)cvsResource).isCVSFolder()) {
- it.remove();
- }
- } else {
- if(!cvsResource.isManaged()) {
- it.remove();
- }
- }
- }
- } catch (CVSException e) {
- // isManaged or isCVSFolder threw an exception
- // Log it and continue
- CVSUIPlugin.log(e.getStatus());
- }
- }
- return false;
- }
-
- public boolean removeAddedChanges() {
- for (Iterator it = getSyncSet().iterator(); it.hasNext();) {
- try {
- ITeamNode node = (ITeamNode)it.next();
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(node.getResource());
- if(cvsResource.isFolder()) {
- if(((ICVSFolder)cvsResource).isCVSFolder()) {
- it.remove();
- }
- } else {
- if(cvsResource.isManaged()) {
- it.remove();
- }
- }
- } catch (CVSException e) {
- // isManaged or isCVSFolder threw an exception
- // Log it and continue
- CVSUIPlugin.log(e.getStatus());
- }
- }
- return false;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CommitSyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CommitSyncAction.java
deleted file mode 100644
index fe29c1ad9..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CommitSyncAction.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui.sync;
-
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.SyncSet;
-
-/**
- * Override ForceCommitSyncAction to only work on outgoing nodes
- */
-public class CommitSyncAction extends ForceCommitSyncAction {
- public CommitSyncAction(CVSSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
- super(model, sp, label, shell);
- }
-
- protected boolean isEnabled(ITeamNode node) {
- // The commit action is enabled only for non-conflicting outgoing changes
- CVSSyncSet set = new CVSSyncSet(new StructuredSelection(node));
- try {
- return set.hasCommitableChanges();
- } catch (CVSException e) {
- CVSUIPlugin.log(e.getStatus());
- return false;
- }
- }
-
- protected void removeNonApplicableNodes(SyncSet set, int syncMode) {
- set.removeConflictingNodes();
- set.removeIncomingNodes();
- ((CVSSyncSet)set).removeNonAddedChanges();
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ForceCommitSyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ForceCommitSyncAction.java
deleted file mode 100644
index bfc8dc0e1..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ForceCommitSyncAction.java
+++ /dev/null
@@ -1,319 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui.sync;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.Vector;
-
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-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.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.resources.CVSRemoteSyncElement;
-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.RepositoryManager;
-import org.eclipse.team.internal.ui.sync.ChangedTeamContainer;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.SyncSet;
-import org.eclipse.team.internal.ui.sync.SyncView;
-import org.eclipse.team.internal.ui.sync.TeamFile;
-
-public class ForceCommitSyncAction extends MergeAction {
- public ForceCommitSyncAction(CVSSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
- super(model, sp, label, shell);
- }
-
- protected SyncSet run(SyncSet syncSet, IProgressMonitor monitor) {
- boolean result = saveIfNecessary();
- if (!result) return null;
-
- // If there is a conflict in the syncSet, we need to prompt the user before proceeding.
- if (syncSet.hasConflicts() || syncSet.hasIncomingChanges()) {
- switch (promptForConflicts(syncSet)) {
- case 0:
- // Yes, synchronize conflicts as well
- break;
- case 1:
- // No, only synchronize non-conflicting changes.
- syncSet.removeConflictingNodes();
- syncSet.removeIncomingNodes();
- break;
- case 2:
- default:
- // Cancel
- return null;
- }
- }
- ITeamNode[] changed = syncSet.getChangedNodes();
- if (changed.length == 0) {
- return syncSet;
- }
- List commits = new ArrayList();
- List additions = new ArrayList();
- List deletions = new ArrayList();
- List toMerge = new ArrayList();
- List incoming = new ArrayList();
-
- // A list of diff elements in the sync set which are incoming folder additions
- List parentCreationElements = new ArrayList();
- // A list of diff elements in the sync set which are folder conflicts
- List parentConflictElements = new ArrayList();
-
- for (int i = 0; i < changed.length; i++) {
- int kind = changed[i].getKind();
- IResource resource = changed[i].getResource();
- if (resource.getType() == resource.FILE) {
- commits.add(resource);
- }
- IDiffContainer parent = changed[i].getParent();
- if (parent != null) {
- int parentKind = changed[i].getParent().getKind();
- if (((parentKind & Differencer.CHANGE_TYPE_MASK) == Differencer.ADDITION) &&
- ((parentKind & Differencer.DIRECTION_MASK) == ITeamNode.INCOMING)) {
- parentCreationElements.add(parent);
- } else if ((parentKind & Differencer.DIRECTION_MASK) == ITeamNode.CONFLICTING) {
- parentConflictElements.add(parent);
- }
- }
- switch (kind & Differencer.DIRECTION_MASK) {
- case ITeamNode.INCOMING:
- // Incoming change. Make it outgoing before committing.
- incoming.add(changed[i]);
- break;
- case ITeamNode.OUTGOING:
- switch (kind & Differencer.CHANGE_TYPE_MASK) {
- case Differencer.ADDITION:
- // Outgoing addition. 'add' it before committing.
- additions.add(resource);
- break;
- case Differencer.DELETION:
- // Outgoing deletion. 'delete' it before committing.
- deletions.add(resource);
- break;
- case Differencer.CHANGE:
- // Outgoing change. Just commit it.
- break;
- }
- break;
- case ITeamNode.CONFLICTING:
- if (changed[i] instanceof TeamFile) {
- toMerge.add(((TeamFile)changed[i]).getMergeResource().getSyncElement());
- }
- break;
- }
- }
- try {
- RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- String comment = promptForComment(manager);
- if (comment == null) {
- // User cancelled. Remove the nodes from the sync set.
- return null;
- }
- if (parentCreationElements.size() > 0) {
- // 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.
- Iterator it = parentCreationElements.iterator();
- while (it.hasNext()) {
- makeInSync((IDiffElement)it.next());
- }
- }
- if (parentConflictElements.size() > 0) {
- // If a node has a parent that is a folder conflict, that means that the folder
- // exists locally but has no sync info. In order to get the node, we have to
- // create the sync info for the folder (and any applicable parents) before we
- // get the node itself.
- Iterator it = parentConflictElements.iterator();
- while (it.hasNext()) {
- makeInSync((IDiffElement)it.next());
- }
- }
-
- // Handle any real incomming deletions by unmanaging them before adding
- Iterator it = incoming.iterator();
- Set incomingDeletions = new HashSet(incoming.size());
- while (it.hasNext()) {
- ITeamNode node = (ITeamNode)it.next();
- collectIncomingDeletions(node, incomingDeletions, monitor);
- if ((node instanceof TeamFile) && !additions.contains(node)) {
- CVSRemoteSyncElement element = (CVSRemoteSyncElement)((TeamFile)node).getMergeResource().getSyncElement();
- element.makeOutgoing(monitor);
- }
- }
- it = incomingDeletions.iterator();
- while (it.hasNext()) {
- ITeamNode node = (ITeamNode)it.next();
- CVSRemoteSyncElement syncElement;
- if (node instanceof TeamFile) {
- syncElement = (CVSRemoteSyncElement)((TeamFile)node).getMergeResource().getSyncElement();
- } else {
- syncElement = (CVSRemoteSyncElement)((ChangedTeamContainer)node).getMergeResource().getSyncElement();
- }
- additions.add(syncElement.getLocal());
- CVSWorkspaceRoot.getCVSResourceFor(syncElement.getLocal()).unmanage(null);
- }
-
- if (additions.size() != 0) {
- manager.add((IResource[])additions.toArray(new IResource[0]), monitor);
- }
- if (deletions.size() != 0) {
- manager.delete((IResource[])deletions.toArray(new IResource[0]), monitor);
- }
- if (toMerge.size() != 0) {
- manager.merged((IRemoteSyncElement[])toMerge.toArray(new IRemoteSyncElement[0]));
- }
- manager.commit((IResource[])commits.toArray(new IResource[commits.size()]), comment, monitor);
-
- // Reset the timestamps for any files that were not committed
- // because their contents match that of the server
- for (Iterator iter = commits.iterator(); iter.hasNext(); ) {
- IResource resource = (IResource)iter.next();
- if (resource.getType() == IResource.FILE) {
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)resource);
- // If the file is still modified after the commit, it probably is a pseudo change
- if (cvsFile.exists() && cvsFile.isModified()) {
- cvsFile.setTimeStamp(cvsFile.getSyncInfo().getTimeStamp());
- }
- }
- }
-
- } catch (final TeamException e) {
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- ErrorDialog.openError(getShell(), null, null, e.getStatus());
- }
- });
- return null;
- }
-
- return syncSet;
- }
-
- protected boolean isEnabled(ITeamNode node) {
- // The force commit action is enabled only for conflicting and incoming changes
- CVSSyncSet set = new CVSSyncSet(new StructuredSelection(node));
- if (syncMode == SyncView.SYNC_OUTGOING) {
- return (set.hasConflicts() && hasRealChanges(node, new int[] { ITeamNode.CONFLICTING }));
- } else {
- return ((set.hasIncomingChanges() || set.hasConflicts()) && hasRealChanges(node, new int[] { ITeamNode.CONFLICTING, ITeamNode.INCOMING }));
- }
- }
-
- /**
- * 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(SyncSet 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) {
- return manager.promptForComment(getShell());
- }
-
- protected void removeNonApplicableNodes(SyncSet set, int syncMode) {
- set.removeOutgoingNodes();
- if (syncMode != SyncView.SYNC_BOTH) {
- set.removeIncomingNodes();
- }
- ((CVSSyncSet)set).removeNonAddedChanges();
- }
-
- /*
- * Handle incoming folder deletion.
- *
- * Special handling is required in the case were a folder has been deleted remotely
- * (i.e using "rm -rf" on the server).
- *
- * We need to determine if there is a remote folder corresponding to this folder
- * If there isn't, we need to unmanage the local resource and then add the folder
- * Unfortunately, unmanaging may effect the state of the children which are also incoming deletions
- */
- private void collectIncomingDeletions(ITeamNode node, Set additions, IProgressMonitor monitor) throws TeamException {
- if (isIncomingDeletion(node) && ! additions.contains(node) && ! existsRemotely(node, monitor)) {
-
- // Make sure that the parent is handled
- IDiffContainer parent = node.getParent();
- if (isIncomingDeletion((ITeamNode)parent)) {
- collectIncomingDeletions((ITeamNode)parent, additions, monitor);
- }
-
- // Add the node to the list
- additions.add(node);
- }
- }
-
- private boolean isIncomingDeletion(ITeamNode node) {
- return (node.getChangeDirection() == ITeamNode.INCOMING && node.getChangeType() == Differencer.DELETION);
- }
-
- /*
- * For files, use the remote of the sync element to determine whether there is a remote or not.
- * For folders, if there is no remote in the tree check remotely in case the folder was pruned
- */
- private boolean existsRemotely(ITeamNode node, IProgressMonitor monitor) throws TeamException {
-
- CVSRemoteSyncElement syncElement;
- if (node instanceof TeamFile) {
- syncElement = (CVSRemoteSyncElement)((TeamFile)node).getMergeResource().getSyncElement();
- } else {
- syncElement = (CVSRemoteSyncElement)((ChangedTeamContainer)node).getMergeResource().getSyncElement();
- }
- if (syncElement.getRemote() != null) {
- return true;
- }
- if (syncElement.getLocal().getType() == IResource.FILE) {
- return false;
- }
- return CVSWorkspaceRoot.getRemoteResourceFor(syncElement.getLocal()).exists(monitor);
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ForceUpdateSyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ForceUpdateSyncAction.java
deleted file mode 100644
index 957eabae8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ForceUpdateSyncAction.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- ******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.sync;
-
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.SyncSet;
-import org.eclipse.team.internal.ui.sync.SyncView;
-
-public class ForceUpdateSyncAction extends UpdateSyncAction {
-
- public ForceUpdateSyncAction(CVSSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
- super(model, sp, label, shell);
- }
-
- protected boolean isEnabled(ITeamNode node) {
- // The force update action is enabled only for conflicting and outgoing changes
- SyncSet set = new SyncSet(new StructuredSelection(node));
- if (syncMode == SyncView.SYNC_INCOMING) {
- return (set.hasConflicts() && hasRealChanges(node, new int[] { ITeamNode.CONFLICTING }));
- } else {
- return ((set.hasOutgoingChanges() || set.hasConflicts()) && hasRealChanges(node, new int[] { ITeamNode.CONFLICTING, ITeamNode.OUTGOING }));
- }
- }
-
- protected void removeNonApplicableNodes(SyncSet set, int syncMode) {
- set.removeIncomingNodes();
- if (syncMode != SyncView.SYNC_BOTH) {
- set.removeOutgoingNodes();
- }
- }
- protected boolean promptForConflicts() {
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/IgnoreAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/IgnoreAction.java
deleted file mode 100644
index 132b76e03..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/IgnoreAction.java
+++ /dev/null
@@ -1,128 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.sync;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.compare.structuremergeviewer.DiffContainer;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-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.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.IgnoreResourcesDialog;
-import org.eclipse.team.internal.ui.sync.ChangedTeamContainer;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.MergeResource;
-import org.eclipse.team.internal.ui.sync.SyncSet;
-import org.eclipse.team.internal.ui.sync.TeamFile;
-import org.eclipse.team.internal.ui.sync.UnchangedTeamContainer;
-
-public class IgnoreAction extends Action {
- Shell shell;
- private CVSSyncCompareInput diffModel;
- private ISelectionProvider selectionProvider;
-
- public IgnoreAction(CVSSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
- super(label);
- this.shell = shell;
- this.diffModel = model;
- this.selectionProvider = sp;
- }
- public void run() {
- IStructuredSelection selection = (IStructuredSelection)selectionProvider.getSelection();
- if (selection.isEmpty()) return;
- // Do the update
- Object first = selection.getFirstElement();
- ICVSResource cvsResource = null;
- IResource resource = null;
- if (first instanceof TeamFile) {
- resource = ((TeamFile)first).getMergeResource().getResource();
- cvsResource = CVSWorkspaceRoot.getCVSFileFor((IFile) resource);
- } else if (first instanceof ChangedTeamContainer) {
- resource = ((ChangedTeamContainer)first).getMergeResource().getResource();
- cvsResource = CVSWorkspaceRoot.getCVSFolderFor((IContainer) resource);
- }
- if (resource != null) {
- try {
- IgnoreResourcesDialog dialog = new IgnoreResourcesDialog(shell, new IResource[] {resource});
- if (dialog.open() != IgnoreResourcesDialog.OK) return;
- String pattern = dialog.getIgnorePatternFor(resource);
- cvsResource.setIgnoredAs(pattern);
- } catch (CVSException e) {
- ErrorDialog.openError(shell, null, null, e.getStatus());
- return;
- }
- removeNodes(new SyncSet(selection).getChangedNodes());
- diffModel.refresh();
- }
- }
- /**
- * Enabled if only one item is selected and it is an outgoing addition.
- *
- * This may be a folder or a single file, which will be handled differently.
- */
- protected boolean isEnabled(Object[] nodes) {
- if (nodes.length != 1) return false;
- if (!(nodes[0] instanceof ITeamNode)) return false;
- ITeamNode node = (ITeamNode)nodes[0];
- if (node.getKind() != (ITeamNode.OUTGOING | IRemoteSyncElement.ADDITION)) return false;
- IResource resource = node.getResource();
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- try {
- if (cvsResource.isManaged()) return false;
- if (cvsResource.isIgnored()) return false;
- } catch (CVSException e) {
- CVSUIPlugin.log(e.getStatus());
- return false;
- }
- return true;
- }
- public void update() {
- IStructuredSelection selection = (IStructuredSelection)selectionProvider.getSelection();
- setEnabled(isEnabled(selection.toArray()));
- }
- /**
- * The given nodes have been synchronized. Remove them from
- * the sync set.
- */
- private void removeNodes(final ITeamNode[] nodes) {
- // Update the model
- for (int i = 0; i < nodes.length; i++) {
- if (nodes[i].getClass() == UnchangedTeamContainer.class) {
- // Unchanged containers get removed automatically when all
- // children are removed
- continue;
- }
- if (nodes[i].getClass() == ChangedTeamContainer.class) {
- // If this node still has children, convert to an
- // unchanged container, then it will disappear when
- // all children have been removed.
- ChangedTeamContainer container = (ChangedTeamContainer)nodes[i];
- IDiffElement[] children = container.getChildren();
- if (children.length > 0) {
- IDiffContainer parent = container.getParent();
- UnchangedTeamContainer unchanged = new UnchangedTeamContainer(parent, container.getResource());
- for (int j = 0; j < children.length; j++) {
- unchanged.add(children[j]);
- }
- parent.removeToRoot(container);
- continue;
- }
- // No children, it will get removed below.
- }
- nodes[i].getParent().removeToRoot(nodes[i]);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/MergeAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/MergeAction.java
deleted file mode 100644
index 8864367b5..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/MergeAction.java
+++ /dev/null
@@ -1,349 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.sync;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.resources.CVSRemoteSyncElement;
-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.ui.sync.ChangedTeamContainer;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.SyncSet;
-import org.eclipse.team.internal.ui.sync.UnchangedTeamContainer;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-/**
- * Applies merge related actions to the selected ITeamNodes.
- */
-abstract class MergeAction extends Action {
- public static final int CHECKIN = 0;
- public static final int GET = 1;
- public static final int DELETE_REMOTE = 2;
- public static final int DELETE_LOCAL = 3;
-
- private CVSSyncCompareInput diffModel;
- private ISelectionProvider selectionProvider;
-
- protected int syncMode;
- private Shell shell;
-
- /**
- * Creates a MergeAction which works on selection and doesn't commit changes.
- */
- public MergeAction(CVSSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
- super(label);
- this.diffModel = model;
- this.selectionProvider = sp;
- this.shell = shell;
- }
-
- protected Shell getShell() {
- return shell;
- }
-
- protected CVSSyncCompareInput getDiffModel() {
- return diffModel;
- }
-
- /**
- * Returns true if at least one node can perform the specified action.
- */
- private boolean isEnabled(Object[] nodes) {
- for (int i = 0; i < nodes.length; i++) {
- if (nodes[i] instanceof ITeamNode) {
- ITeamNode node = (ITeamNode)nodes[i];
- if (isEnabled(node)) {
- return true;
- }
- } else {
- if (nodes[i] instanceof IDiffContainer)
- if (isEnabled(((IDiffContainer)nodes[i]).getChildren()))
- return true;
- }
- }
- return false;
- }
-
- protected abstract boolean isEnabled(ITeamNode node);
-
- /**
- * Perform the sychronization operation.
- */
- public void run() {
- ISelection s = selectionProvider.getSelection();
- if (!(s instanceof IStructuredSelection) || s.isEmpty()) {
- return;
- }
- final SyncSet set = new CVSSyncSet((IStructuredSelection)s);
- removeNonApplicableNodes(set, syncMode);
- final SyncSet[] result = new SyncSet[1];
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- result[0] = MergeAction.this.run(set, monitor);
- }
- };
- try {
- run(op, Policy.bind("MergeAction.problemsDuringSync")); //$NON-NLS-1$
- } catch (InterruptedException e) {
- }
- if (result[0] != null) {
- // all returned nodes that have a changed sync kind are assumed
- // to have been operated on and will be removed from the diff tree.
- removeNodes(result[0].getChangedNodes());
-
- // any node that claims that it's IN_SYNC will be automatically
- // filtered from the diff tree - see DiffElement.setKind().
- diffModel.updateView();
- }
- }
-
- protected abstract void removeNonApplicableNodes(SyncSet set, int syncMode);
-
- /**
- * The given nodes have been synchronized. Remove them from
- * the sync set.
- *
- * For folders that are outgoing deletions, we may need to leave the
- * folder as is or adjust the sync kind depending on the sync kind of
- * the folder's children.
- *
- * @see CVSSyncCompareInput#collectResourceChanges(IDiffContainer, IRemoteSyncElement, IProgressMonitor)
- */
- private void removeNodes(final ITeamNode[] nodes) {
- // Update the model
- Set outgoingFolderDeletions = new HashSet();
- for (int i = 0; i < nodes.length; i++) {
- if (nodes[i].getClass() == UnchangedTeamContainer.class) {
- // Unchanged containers get removed automatically when all
- // children are removed
- continue;
- }
- if (nodes[i].getClass() == ChangedTeamContainer.class) {
- // If this node still has children, convert to an
- // unchanged container, then it will disappear when
- // all children have been removed.
- ChangedTeamContainer container = (ChangedTeamContainer)nodes[i];
- IDiffElement[] children = container.getChildren();
- if (children.length > 0) {
- if (isLocallyDeletedFolder(container)) {
- // For locally deleted folders, we postpone the handling until all other children are removed
- outgoingFolderDeletions.add(container);
- } else {
- IDiffContainer parent = container.getParent();
- UnchangedTeamContainer unchanged = new UnchangedTeamContainer(parent, container.getResource());
- for (int j = 0; j < children.length; j++) {
- unchanged.add(children[j]);
- }
- parent.removeToRoot(container);
- }
- continue;
- }
- // No children, it will get removed below.
- } else if (nodes[i].getParent().getClass() == ChangedTeamContainer.class) {
- // If the parent is a locally deleted folder, we may want to update it's sync state as well
- if (isLocallyDeletedFolder(nodes[i].getParent())) {
- outgoingFolderDeletions.add(nodes[i].getParent());
- }
- }
- nodes[i].getParent().removeToRoot(nodes[i]);
- }
- // Remove any locally deleted folders from the sync tree as appropriate
- for (Iterator iter = outgoingFolderDeletions.iterator(); iter.hasNext();) {
- removeLocallyDeletedFolder((ChangedTeamContainer)iter.next());
- }
- }
-
- /**
- * Updates the action with the latest selection, setting enablement
- * as necessary.
- */
- public void update(int syncMode) {
- this.syncMode = syncMode;
- IStructuredSelection selection = (IStructuredSelection)selectionProvider.getSelection();
- setEnabled(isEnabled(selection.toArray()));
- }
-
- /**
- * Subclasses must implement this method, which performs action-specific code.
- *
- * It may return the sync set which was passed in, or null.
- */
- protected abstract SyncSet run(SyncSet syncSet, IProgressMonitor monitor);
-
- /**
- * Helper method to run a runnable in a progress monitor dialog, and display any errors.
- */
- protected void run(IRunnableWithProgress op, String problemMessage) throws InterruptedException {
- ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
- try {
- dialog.run(true, true, op);
- } catch (InvocationTargetException e) {
- Throwable throwable = e.getTargetException();
- IStatus error = null;
- if (throwable instanceof CoreException) {
- error = ((CoreException)throwable).getStatus();
- } else {
- error = new Status(IStatus.ERROR, CVSUIPlugin.ID, 1, Policy.bind("simpleInternal") , throwable); //$NON-NLS-1$
- }
- ErrorDialog.openError(shell, problemMessage, error.getMessage(), error);
- CVSUIPlugin.log(error);
- }
- }
-
- /**
- * Helper method. Check if a save is necessary. If it is, prompt the user to save.
- * Return true if all necessary saves have been performed, false otherwise.
- */
- protected boolean saveIfNecessary() {
- return getDiffModel().saveIfNecessary();
- }
-
- /**
- * Answer true if the given diff element represents a locally deleted CVS folder.
- * The sync state of locally deleted CVS folders is either outgoing deletion or
- * conflicting change.
- */
- protected boolean isLocallyDeletedFolder(IDiffElement element) {
- if ( ! (element.getType() == IDiffElement.FOLDER_TYPE)) return false;
- int kind = element.getKind();
- return (((kind & Differencer.CHANGE_TYPE_MASK) == Differencer.DELETION) &&
- ((kind & Differencer.DIRECTION_MASK) == ITeamNode.OUTGOING))
- || (((kind & Differencer.CHANGE_TYPE_MASK) == Differencer.CHANGE) &&
- ((kind & Differencer.DIRECTION_MASK) == ITeamNode.CONFLICTING));
- }
-
- /**
- * Recreate any parents that are outgoing folder deletions
- */
- protected void recreateLocallyDeletedFolder(IDiffElement element) throws TeamException {
- // Recursively make the parent element (and its parents) in sync.
- // Walk up and find the parents which need to be made in sync too. (For
- // each parent that doesn't already have sync info).
- if (element == null) return;
- if (element instanceof ChangedTeamContainer) {
- CVSRemoteSyncElement syncElement = (CVSRemoteSyncElement)((ChangedTeamContainer)element).getMergeResource().getSyncElement();
- // recreate the folder
- ICVSFolder cvsFolder = (ICVSFolder) CVSWorkspaceRoot.getCVSResourceFor(syncElement.getLocal());
- if (! cvsFolder.exists()) {
- recreateLocallyDeletedFolder(element.getParent());
- cvsFolder.mkdir();
- syncElement.makeInSync(Policy.monitorFor(null));
- ((ChangedTeamContainer)element).makeInSync();
- }
- }
- }
-
- /**
- * Adjust the sync kind of the locally deleted folder and remove
- * the folder if it doesn't contain any real changes
- */
- private void removeLocallyDeletedFolder(ChangedTeamContainer container) {
- boolean hasIncoming = hasRealChanges(container, new int[] { ITeamNode.INCOMING });
- boolean hasOutgoing = hasRealChanges(container, new int[] { ITeamNode.OUTGOING });
- boolean hasConflicting = hasRealChanges(container, new int[] { ITeamNode.CONFLICTING });
- IDiffContainer parent = container.getParent();
- if (hasConflicting || (hasOutgoing && hasIncoming)) {
- // Leave as a conflict
- return;
- } else if (hasOutgoing) {
- // Convert to an outgoing deletion
- container.setKind(ITeamNode.OUTGOING | Differencer.DELETION);
- } else if (hasIncoming) {
- container.setKind(ITeamNode.INCOMING | Differencer.ADDITION);
- } else {
- // The folder is empty, remove it
- if (parent != null) {
- parent.removeToRoot(container);
- }
- }
- // The parent may need adjusting as well
- if (parent != null && isLocallyDeletedFolder(parent)) {
- removeLocallyDeletedFolder((ChangedTeamContainer)parent);
- }
- }
-
- /**
- * Look for real changes of the given type. Real changes are those that
- * are not locally deleted folders that are persisted as phantoms
- * to report local file deletions to the server.
- */
- protected boolean hasRealChanges(IDiffElement node, int[] changeDirections) {
- // For regular nodes (i.e. not local folder deletions), check the sync kind of the node
- if ( ! isLocallyDeletedFolder(node)) {
- int direction = node.getKind() & Differencer.DIRECTION_MASK;
- for (int i = 0; i < changeDirections.length; i++) {
- if (direction == changeDirections[i]) {
- return true;
- }
- }
- }
- // For folders, check their children (if we didn't get a match above)
- if (node.getType() == node.FOLDER_TYPE) {
- IDiffElement[] children = ((IDiffContainer)node).getChildren();
- for (int i = 0; i < children.length; i++) {
- if (hasRealChanges(children[i], changeDirections)) {
- return true;
- }
- }
- }
- // If no matches occured above, we don't have any "real" changes in the given directions
- return false;
- }
-
- /**
- * Recursively make the parent element (and its parents) in sync.
- * Walk up and find the parents which need to be made in sync too. (For
- * each parent that doesn't already have sync info).
- */
- protected void makeInSync(IDiffElement parentElement) throws TeamException {
- ArrayList v = new ArrayList();
- int parentKind = parentElement.getKind();
- int direction = parentKind & Differencer.DIRECTION_MASK;
- int change = parentKind & Differencer.CHANGE_TYPE_MASK;
- while ((change == Differencer.ADDITION) &&
- ((direction == ITeamNode.INCOMING) || (direction == ITeamNode.CONFLICTING))) {
- v.add(0, parentElement);
- parentElement = parentElement.getParent();
- parentKind = parentElement == null ? 0 : parentElement.getKind();
- direction = parentKind & Differencer.DIRECTION_MASK;
- change = parentKind & Differencer.CHANGE_TYPE_MASK;
- }
- Iterator parentIt = v.iterator();
- while (parentIt.hasNext()) {
- IDiffElement next = (IDiffElement)parentIt.next();
- if (next instanceof ChangedTeamContainer) {
- CVSRemoteSyncElement syncElement = (CVSRemoteSyncElement)((ChangedTeamContainer)next).getMergeResource().getSyncElement();
- // Create the sync info
- syncElement.makeInSync(Policy.monitorFor(null));
- ((ChangedTeamContainer)next).setKind(IRemoteSyncElement.IN_SYNC);
- }
- }
- }
-}
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 3dd338bcc..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ToolTipMessageDialog.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.sync; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ 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/sync/UpdateSyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/UpdateSyncAction.java
deleted file mode 100644
index 2bb5b0c57..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/UpdateSyncAction.java
+++ /dev/null
@@ -1,399 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2002 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- ******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui.sync;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.Vector;
-
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-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.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-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.CVSRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.RepositoryManager;
-import org.eclipse.team.internal.ui.sync.ChangedTeamContainer;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.SyncSet;
-import org.eclipse.team.internal.ui.sync.TeamFile;
-
-/**
- * UpdateSyncAction is run on a set of sync nodes when the "Update" menu item is performed
- * in the Synchronize view.
- *
- * This class is also used as the super class of the merge update actions for regular and forced
- * update.
- */
-public class UpdateSyncAction extends MergeAction {
- public static class ConfirmDialog extends MessageDialog {
-
- private boolean autoMerge = true;
- private Button radio1;
- private Button radio2;
-
- public ConfirmDialog(Shell parentShell) {
- super(
- parentShell,
- Policy.bind("UpdateSyncAction.Conflicting_changes_found_1"), //$NON-NLS-1$
- null, // accept the default window icon
- Policy.bind("UpdateSyncAction.You_have_local_changes_you_are_about_to_overwrite_2"), //$NON-NLS-1$
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL},
- 0); // yes is the default
- }
-
- 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("UpdateSyncAction.Only_update_resources_that_can_be_automatically_merged_3")); //$NON-NLS-1$
-
- radio2 = new Button(composite, SWT.RADIO);
- radio2.addSelectionListener(selectionListener);
-
- radio2.setText(Policy.bind("UpdateSyncAction.Update_all_resources,_overwriting_local_changes_with_remote_contents_4")); //$NON-NLS-1$
-
- // set initial state
- radio1.setSelection(autoMerge);
- radio2.setSelection(!autoMerge);
-
- return composite;
- }
-
- private SelectionListener selectionListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- Button button = (Button)e.widget;
- if (button.getSelection()) {
- autoMerge = (button == radio1);
- }
- }
- };
-
- public boolean getAutomerge() {
- return autoMerge;
- }
- }
-
- public UpdateSyncAction(CVSSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
- super(model, sp, label, shell);
- }
-
- protected SyncSet run(final SyncSet syncSet, IProgressMonitor monitor) {
- boolean result = saveIfNecessary();
- if (!result) return null;
-
- // If there are conflicts or outgoing changes in the syncSet, we need to warn the user.
- boolean onlyUpdateAutomergeable = false;
- if (syncSet.hasConflicts() || syncSet.hasOutgoingChanges()) {
- if (syncSet.hasAutoMergeableConflicts()) {
- switch (promptForMergeableConflicts()) {
- case 0: // cancel
- return null;
- case 1: // only update auto-mergeable conflicts
- onlyUpdateAutomergeable = true;
- syncSet.removeNonMergeableNodes();
- break;
- case 2: // update all conflicts
- onlyUpdateAutomergeable = false;
- break;
- }
- } else {
- if (! promptForConflicts()) return null;
- }
- }
-
- ITeamNode[] changed = syncSet.getChangedNodes();
- if (changed.length == 0) {
- return syncSet;
- }
-
- List updateIgnoreLocalShallow = new ArrayList();
- List updateDeep = new ArrayList();
- List updateShallow = new ArrayList();
-
- // A list of diff elements in the sync set which are incoming folder additions
- Set parentCreationElements = new HashSet();
- // A list of diff elements in the sync set which are folder conflicts
- Set parentConflictElements = new HashSet();
- // A list of diff elements in the sync set which are outgoing folder deletions
- Set parentDeletionElements = new HashSet();
- // A list of the team nodes that we need to perform makeIncoming on
- List makeIncoming = new ArrayList();
- // A list of diff elements that need to be unmanaged and locally deleted
- List deletions = new ArrayList();
-
- for (int i = 0; i < changed.length; i++) {
- IDiffContainer parent = changed[i].getParent();
- if (parent != null) {
- int parentKind = changed[i].getParent().getKind();
- if (((parentKind & Differencer.CHANGE_TYPE_MASK) == Differencer.ADDITION) &&
- ((parentKind & Differencer.DIRECTION_MASK) == ITeamNode.INCOMING)) {
- parentCreationElements.add(parent);
- } else if (isLocallyDeletedFolder(parent)) {
- parentDeletionElements.add(parent);
- } else if ((parentKind & Differencer.DIRECTION_MASK) == ITeamNode.CONFLICTING) {
- parentConflictElements.add(parent);
- }
- }
- ITeamNode changedNode = changed[i];
- IResource resource = changedNode.getResource();
- int kind = changedNode.getKind();
- switch (kind & Differencer.DIRECTION_MASK) {
- case ITeamNode.INCOMING:
- switch (kind & Differencer.CHANGE_TYPE_MASK) {
- case Differencer.ADDITION:
- updateIgnoreLocalShallow.add(changedNode);
- break;
- case Differencer.DELETION:
- case Differencer.CHANGE:
- updateDeep.add(changedNode);
- break;
- }
- break;
- case ITeamNode.OUTGOING:
- switch (kind & Differencer.CHANGE_TYPE_MASK) {
- case Differencer.ADDITION:
- // Unmanage the file if necessary and delete it.
- deletions.add(changedNode);
- break;
- case Differencer.DELETION:
- if (resource.getType() == IResource.FILE) {
- makeIncoming.add(changedNode);
- updateDeep.add(changedNode);
- }
- break;
- case Differencer.CHANGE:
- updateIgnoreLocalShallow.add(changedNode);
- break;
- }
- break;
- case ITeamNode.CONFLICTING:
- switch (kind & Differencer.CHANGE_TYPE_MASK) {
- case Differencer.ADDITION:
- if(changedNode instanceof IDiffContainer) {
- parentConflictElements.add(changedNode);
- } else {
- makeIncoming.add(changedNode);
- deletions.add(changedNode);
- updateIgnoreLocalShallow.add(changedNode);
- }
- break;
- case Differencer.DELETION:
- // Doesn't happen, these nodes don't appear in the tree.
- break;
- case Differencer.CHANGE:
- if (resource.getType() == IResource.FILE) {
- // Depends on the flag.
- if (onlyUpdateAutomergeable && (changedNode.getKind() & IRemoteSyncElement.AUTOMERGE_CONFLICT) != 0) {
- updateShallow.add(changedNode);
- } else {
- // Check to see if there is a remote
- if (((TeamFile)changedNode).getMergeResource().getSyncElement().getRemote() == null) {
- // If a locally modified file has no remote, "update -C" will fail.
- // We must unmanage and delete the file ourselves
- deletions.add(changedNode);
- } else {
- updateIgnoreLocalShallow.add(changedNode);
- // If the resource doesn't exist remotely, we must ensure the sync info will allow the above update.
- if (!resource.exists()) {
- makeIncoming.add(changedNode);
- }
- }
- }
- } else {
- // Conflicting change on a folder only occurs if the folder has been deleted locally
- // The folder should only be recreated if there were children in the changed set.
- // Such folders would have been added to the parentDeletionElements set above
- }
- break;
- }
- break;
- }
- }
- try {
- // Calculate the total amount of work needed
- int work = (makeIncoming.size() + (deletions.size() * 2) + updateShallow.size() + updateIgnoreLocalShallow.size() + updateDeep.size()) * 100;
- monitor.beginTask(null, work);
-
- RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- if (parentDeletionElements.size() > 0) {
- // If a node has a parent that is an outgoing folder deletion, we have to
- // recreate that folder locally (it's sync info already exists locally).
- // We must do this for all outgoing folder deletions (recursively)
- // in the case where there are multiple levels of outgoing folder deletions.
- Iterator it = parentDeletionElements.iterator();
- while (it.hasNext()) {
- recreateLocallyDeletedFolder((IDiffElement)it.next());
- }
- }
- if (parentCreationElements.size() > 0) {
- // 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.
- Iterator it = parentCreationElements.iterator();
- while (it.hasNext()) {
- IDiffElement element = (IDiffElement)it.next();
- makeInSync(element);
- // Remove the folder from the update shallow list since we have it locally now
- updateIgnoreLocalShallow.remove(element);
- }
- }
- if (parentConflictElements.size() > 0) {
- // If a node has a parent that is a folder conflict, that means that the folder
- // exists locally but has no sync info. In order to get the node, we have to
- // create the sync info for the folder (and any applicable parents) before we
- // get the node itself.
- Iterator it = parentConflictElements.iterator();
- while (it.hasNext()) {
- makeInSync((IDiffElement)it.next());
- }
- }
- // Make any outgoing changes or deletions into incoming changes before updating.
- Iterator it = makeIncoming.iterator();
- while (it.hasNext()) {
- ITeamNode node = (ITeamNode)it.next();
- CVSRemoteSyncElement element = CVSSyncCompareInput.getSyncElementFrom(node);
- element.makeIncoming(Policy.subMonitorFor(monitor, 100));
- }
- // Outgoing additions must be unmanaged (if necessary) and locally deleted.
- it = deletions.iterator();
- while (it.hasNext()) {
- ITeamNode node = (ITeamNode)it.next();
- CVSRemoteSyncElement element = CVSSyncCompareInput.getSyncElementFrom(node);
- element.makeIncoming(Policy.subMonitorFor(monitor, 100));
- element.getLocal().delete(true, Policy.subMonitorFor(monitor, 100));
- }
-
- if (updateShallow.size() > 0) {
- runUpdateShallow((ITeamNode[])updateShallow.toArray(new ITeamNode[updateShallow.size()]), manager, Policy.subMonitorFor(monitor, 100));
- }
- if (updateIgnoreLocalShallow.size() > 0) {
- runUpdateIgnoreLocalShallow((ITeamNode[])updateIgnoreLocalShallow.toArray(new ITeamNode[updateIgnoreLocalShallow.size()]), manager, Policy.subMonitorFor(monitor, 100));
- }
- if (updateDeep.size() > 0) {
- runUpdateDeep((ITeamNode[])updateDeep.toArray(new ITeamNode[updateDeep.size()]), manager, Policy.subMonitorFor(monitor, 100));
- }
- } catch (final TeamException e) {
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- ErrorDialog.openError(getShell(), null, null, e.getStatus());
- }
- });
- return null;
- } catch (final CoreException e) {
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- ErrorDialog.openError(getShell(), Policy.bind("simpleInternal"), Policy.bind("internal"), e.getStatus()); //$NON-NLS-1$ //$NON-NLS-2$
- }
- });
- CVSUIPlugin.log(e.getStatus());
- return null;
- } finally {
- monitor.done();
- }
- return syncSet;
- }
-
- protected void runUpdateDeep(ITeamNode[] nodes, RepositoryManager manager, IProgressMonitor monitor) throws TeamException {
- manager.update(getIResourcesFrom(nodes), Command.NO_LOCAL_OPTIONS, false, monitor);
- }
-
- protected void runUpdateIgnoreLocalShallow(ITeamNode[] nodes, RepositoryManager manager, IProgressMonitor monitor) throws TeamException {
- manager.update(getIResourcesFrom(nodes), new Command.LocalOption[] { Update.IGNORE_LOCAL_CHANGES, Command.DO_NOT_RECURSE }, false, monitor);
- }
-
- protected void runUpdateShallow(ITeamNode[] nodes, RepositoryManager manager, IProgressMonitor monitor) throws TeamException {
- manager.update(getIResourcesFrom(nodes), new Command.LocalOption[] { Command.DO_NOT_RECURSE }, false, monitor);
- }
-
- protected IResource[] getIResourcesFrom(ITeamNode[] nodes) {
- List resources = new ArrayList(nodes.length);
- for (int i = 0; i < nodes.length; i++) {
- resources.add(nodes[i].getResource());
- }
- return (IResource[]) resources.toArray(new IResource[resources.size()]);
- }
-
- protected boolean isEnabled(ITeamNode node) {
- // The update action is enabled only for non-conflicting incoming changes
- return new SyncSet(new StructuredSelection(node)).hasIncomingChanges();
- }
-
- /**
- * Prompt for mergeable conflicts.
- * Note: This method is designed to be overridden by test cases.
- * @return 0 to cancel, 1 to only update mergeable conflicts, 2 to overwrite if unmergeable
- */
- protected int promptForMergeableConflicts() {
- final boolean doAutomerge[] = new boolean[] {false};
- final int[] result = new int[] {Dialog.CANCEL};
- final Shell shell = getShell();
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- ConfirmDialog dialog = new ConfirmDialog(shell);
- result[0] = dialog.open();
- doAutomerge[0] = dialog.getAutomerge();
- }
- });
- if (result[0] == Dialog.CANCEL) return 0;
- return doAutomerge[0] ? 1 : 2;
- }
-
- /**
- * Prompt for non-automergeable conflicts.
- * Note: This method is designed to be overridden by test cases.
- * @return false to cancel, true to overwrite local changes
- */
- protected boolean promptForConflicts() {
- final boolean[] result = new boolean[] { false };
- final Shell shell = getShell();
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- result[0] = MessageDialog.openQuestion(shell, Policy.bind("UpdateSyncAction.Overwrite_local_changes__5"), Policy.bind("UpdateSyncAction.You_have_local_changes_you_are_about_to_overwrite._Do_you_wish_to_continue__6")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- });
- return result[0];
- }
- protected void removeNonApplicableNodes(SyncSet set, int syncMode) {
- set.removeConflictingNodes();
- set.removeOutgoingNodes();
- }
-}
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 96983ae56..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSWizardPage.java
+++ /dev/null
@@ -1,238 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.Collection;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.Viewer;
-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.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.model.WorkbenchViewerSorter;
-
-/**
- * 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;
-
- /**
- * 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);
- }
- /**
- * 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
- * @return the newly-created coposite
- */
- protected Composite createComposite(Composite parent, int numColumns) {
- Composite composite = new Composite(parent, SWT.NULL);
-
- // GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- composite.setLayout(layout);
-
- // GridData
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- composite.setLayoutData(data);
- 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, int widthHint) {
- 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 = indent;
- data.grabExcessHorizontalSpace = true;
- data.widthHint = widthHint;
- 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);
- 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;
- }
-}
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 86489ac09..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardAutoconnectPage.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.dialogs.ErrorDialog;
-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.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.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.Policy;
-
-/**
- * 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);
- setControl(composite);
-
- 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 == location.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);
- }
-
- 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
- ErrorDialog.openError(getContainer().getShell(), Policy.bind("ConfigurationWizardAutoconnectPage.noSyncInfo"), Policy.bind("ConfigurationWizardAutoconnectPage.noCVSDirectory"), null); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- location = CVSRepositoryLocation.fromString(info.getRoot());
- } catch (TeamException e) {
- Shell shell = new Shell(Display.getDefault());
- ErrorDialog.openError(shell, null, null, e.getStatus());
- shell.dispose();
- }
- }
-}
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 09d3d40fe..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java
+++ /dev/null
@@ -1,477 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-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.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-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.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.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-/**
- * 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;
-
- private static final int COMBO_HISTORY_LENGTH = 5;
-
- private Properties properties = null;
-
- // 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);
- // set F1 help
- // WorkbenchHelp.setHelp(composite, new DialogPageContextComputer (this, ITeamHelpContextIds.REPO_CONNECTION_MAIN_PAGE));
-
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- 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 = createTextField(g);
- passwordText.setEchoChar('*');
-
- 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);
-
- // 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.Selection, 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();
- }
- });
- }
-
- initializeValues();
- updateWidgetEnablements();
- hostCombo.setFocus();
-
- setControl(composite);
- }
- /**
- * 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;
- }
-
- /**
- * @see CVSWizardPage#finish
- */
- public boolean finish(IProgressMonitor monitor) {
- // Set the result to be the current values
- 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$
- this.properties = result;
-
- saveWidgetValues();
-
- return true;
- }
- /**
- * Returns the properties for the repository connection
- *
- * @return the properties or null
- */
- public Properties getProperties() {
- return properties;
- }
- /**
- * 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
- String[] methods = CVSProviderPlugin.getProvider().getSupportedConnectionMethods();
- for (int i = 0; i < methods.length; i++) {
- connectionMethodCombo.add(methods[i]);
- }
-
- connectionMethodCombo.select(0);
- useDefaultPort.setSelection(true);
-
- if(properties != null) {
- String method = (String)properties.getProperty("connection"); //$NON-NLS-1$
- if (method == null) {
- connectionMethodCombo.select(0);
- } else {
- connectionMethodCombo.select(connectionMethodCombo.indexOf(method));
- }
-
- String user = (String)properties.getProperty("user"); //$NON-NLS-1$
- if (user != null) {
- userCombo.setText(user);
- }
-
- String password = (String)properties.getProperty("password"); //$NON-NLS-1$
- if (password != null) {
- passwordText.setText(password);
- }
-
- String host = (String)properties.getProperty("host"); //$NON-NLS-1$
- if (host != null) {
- hostCombo.setText(host);
- }
-
- String port = (String)properties.getProperty("port"); //$NON-NLS-1$
- if (port != null) {
- useCustomPort.setSelection(true);
- portText.setText(port);
- }
-
- String repositoryPath = (String)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();
- if (user.length() == 0) {
- setErrorMessage(null);
- setPageComplete(false);
- return;
- }
- if ((user.indexOf('@') != -1) || (user.indexOf(':') != -1)) {
- setErrorMessage(Policy.bind("ConfigurationWizardMainPage.invalidUserName")); //$NON-NLS-1$
- setPageComplete(false);
- return;
- }
-
- String host = hostCombo.getText();
- if (host.length() == 0) {
- setErrorMessage(null);
- setPageComplete(false);
- return;
- }
- if (host.indexOf(':') != -1) {
- setErrorMessage(Policy.bind("ConfigurationWizardMainPage.invalidHostName")); //$NON-NLS-1$
- setPageComplete(false);
- return;
- }
-
- if (portText.isEnabled()) {
- if (portText.getText().length() == 0) {
- setErrorMessage(null);
- setPageComplete(false);
- return;
- }
- try {
- Integer.parseInt(portText.getText());
- } catch (NumberFormatException e) {
- setErrorMessage(Policy.bind("ConfigurationWizardMainPage.invalidPort")); //$NON-NLS-1$
- setPageComplete(false);
- return;
- }
- }
-
- if (repositoryPathCombo.getText().length() == 0) {
- setErrorMessage(null);
- setPageComplete(false);
- return;
- } else {
- String pathString = repositoryPathCombo.getText();
- IPath path = new Path(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) == ' ') {
- setErrorMessage(Policy.bind("ConfigurationWizardMainPage.invalidPathWithSpaces")); //$NON-NLS-1$
- setPageComplete(false);
- return;
- }
- }
- // 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
- setErrorMessage(Policy.bind("ConfigurationWizardMainPage.useNTFormat")); //$NON-NLS-1$
- } else {
- setErrorMessage(Policy.bind("ConfigurationWizardMainPage.invalidPathWithSlashes")); //$NON-NLS-1$
- }
- setPageComplete(false);
- return;
- }
- }
- setErrorMessage(null);
- setPageComplete(true);
- }
-
- public boolean getValidate() {
- return validate;
- }
-}
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 193697eac..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileOperation.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-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.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;
- private boolean toClipboard;
-
- GenerateDiffFileOperation(IResource resource, File file, boolean toClipboard, LocalOption[] options, Shell shell) {
- this.resource = resource;
- this.outputFile = file;
- this.shell = shell;
- this.options = options;
- this.toClipboard = toClipboard;
- }
-
- /**
- * @see IRunnableWithProgress#run(IProgressMonitor)
- */
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- monitor.beginTask("", 500); //$NON-NLS-1$
- monitor.setTaskName(
- Policy.bind("GenerateCVSDiff.working")); //$NON-NLS-1$
-
- OutputStream os;
- if(toClipboard) {
- os = new ByteArrayOutputStream();
- } else {
- os = new FileOutputStream(outputFile);
- }
- try {
- CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId());
- provider.diff(resource, options, new PrintStream(os), new SubProgressMonitor(monitor, 500));
- } finally {
- os.close();
- }
-
- boolean emptyDiff = false;
-
- if(toClipboard) {
- ByteArrayOutputStream baos = (ByteArrayOutputStream)os;
- if(baos.size() == 0) {
- emptyDiff = true;
- } else {
- TextTransfer plainTextTransfer = TextTransfer.getInstance();
- Clipboard clipboard= new Clipboard(shell.getDisplay());
- clipboard.setContents(
- new String[]{baos.toString()},
- new Transfer[]{plainTextTransfer});
- clipboard.dispose();
- }
- } else {
- if(outputFile.length() == 0) {
- emptyDiff = true;
- outputFile.delete();
- }
- }
-
- //check for empty diff and report
- if (emptyDiff) {
- MessageDialog.openInformation(
- shell,
- Policy.bind("GenerateCVSDiff.noDiffsFoundTitle"), //$NON-NLS-1$
- Policy.bind("GenerateCVSDiff.noDiffsFoundMsg")); //$NON-NLS-1$
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } catch(IOException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
-} \ No newline at end of file
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 b20a368ed..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileWizard.java
+++ /dev/null
@@ -1,549 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-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.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-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.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.Display;
-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.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.Policy;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.internal.misc.ContainerContentProvider;
-import org.eclipse.ui.internal.misc.ResourceAndContainerGroup;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-/**
- * A wizard for creating a patch file by running the CVS diff command.
- */
-public class GenerateDiffFileWizard extends Wizard {
-
- private PatchFileSelectionPage mainPage;
- private PatchFileCreationOptionsPage optionsPage;
-
- private IStructuredSelection selection;
- private IResource resource;
-
- /**
- * Page to select a patch file. Overriding validatePage was necessary to allow
- * entering a file name that already exists.
- */
- private class PatchFileSelectionPage extends WizardPage {
-
- private IStructuredSelection currentSelection;
- private ResourceAndContainerGroup resourceGroup;
- private Text filenameCombo;
- private Button browseButton;
-
- private TreeViewer treeViewer;
- private IContainer selectedContainer;
- private Text workspaceFilename;
- private Button saveInFilesystem;
- private Button saveInWorkspace;
- private Button saveToClipboard;
-
- public final int CLIPBOARD = 1;
- public final int FILESYSTEM = 2;
- public final int WORKSPACE = 3;
-
- // sizing constants
- private static final int SIZING_SELECTION_PANE_HEIGHT = 125;
- private static final int SIZING_SELECTION_PANE_WIDTH = 200;
-
- PatchFileSelectionPage(String pageName, String title, ImageDescriptor image, IStructuredSelection selection) {
- super(pageName, title, image);
- this.currentSelection = selection;
- setPageComplete(false);
- }
-
- /**
- * Allow the user to finish if a valid file has been entered.
- */
- protected boolean validatePage() {
- boolean valid = false;
-
- switch(getSaveType()) {
- case WORKSPACE:
- if(selectedContainer!=null && getWorkspaceFile()!=null) {
- valid = true;
- }
- break;
- case FILESYSTEM:
- if(new File(getFilesystemFile()).isAbsolute()) {
- valid = true;
- }
- break;
- case CLIPBOARD:
- valid = true;
- break;
- }
-
- // Avoid draw flicker by clearing error message
- // if all is valid.
- if (valid) {
- setMessage(null);
- setErrorMessage(null);
- } else {
- setErrorMessage(Policy.bind("Enter_a_valid_file_name_or_select_the_clipboard_option_1")); //$NON-NLS-1$
- }
- setPageComplete(valid);
- return valid;
- }
-
- /**
- * Answers a full path to a file system file or <code>null</code> if the user
- * selected to save the patch in the workspace.
- */
- public String getFilesystemFile() {
- if(saveInFilesystem.getSelection()) {
- return filenameCombo.getText();
- }
- return null;
- }
-
- /**
- * Answers a workspace file or <code>null</code> if the user selected to save
- * the patch outside of the workspace.
- */
- public IFile getWorkspaceFile() {
- if(saveInWorkspace.getSelection() && selectedContainer !=null) {
- String filename = workspaceFilename.getText();
- if(filename==null || filename.length() == 0) {
- return null;
- }
- return selectedContainer.getFile(new Path(workspaceFilename.getText()));
- }
- return null;
- }
-
- /**
- * Allow the user to chose to save the patch to the workspace or outside
- * of the workspace.
- */
- 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);
-
- // Clipboard
- saveToClipboard= new Button(composite, SWT.RADIO);
- saveToClipboard.setText(Policy.bind("Save_To_Clipboard_2")); //$NON-NLS-1$
- saveToClipboard.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- validatePage();
- updateEnablements();
- }
- });
-
- // File System
- saveInFilesystem= new Button(composite, SWT.RADIO);
- saveInFilesystem.setText(Policy.bind("Save_In_File_System_3")); //$NON-NLS-1$
- saveInFilesystem.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- validatePage();
- updateEnablements();
- }
- });
-
- Composite nameGroup = new Composite(composite,SWT.NONE);
- layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginWidth = 0;
- nameGroup.setLayout(layout);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- nameGroup.setLayoutData(data);
-
- filenameCombo= new Text(nameGroup, SWT.BORDER);
- GridData gd= new GridData(GridData.FILL_HORIZONTAL);
- filenameCombo.setLayoutData(gd);
- filenameCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validatePage();
- }
- });
-
- browseButton = new Button(nameGroup, SWT.NULL);
- browseButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- browseButton.setText(Policy.bind("Browse..._4")); //$NON-NLS-1$
- browseButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- FileDialog d = new FileDialog(getShell());
- d.setText(Policy.bind("Save_Patch_As_5")); //$NON-NLS-1$
- d.setFileName(Policy.bind("patch.txt_6")); //$NON-NLS-1$
- String file = d.open();
- if(file!=null) {
- IPath path = new Path(file);
- setFilesystemFilename(path.toOSString());
- }
- }
- });
-
- // Workspace
- saveInWorkspace= new Button(composite, SWT.RADIO);
- saveInWorkspace.setText(Policy.bind("Save_In_Workspace_7")); //$NON-NLS-1$
- saveInWorkspace.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- validatePage();
- updateEnablements();
- }
- });
- createTreeViewer(composite);
- }
-
- /**
- * Sets the file name in the file system text.
- */
- protected void setFilesystemFilename(String filename) {
- filenameCombo.setText(filename);
- }
-
- /**
- * Create the tree viewer that shows the container available in the workspace. The user
- * can then enter a filename in the text box below the viewer.
- */
- protected void createTreeViewer(Composite parent) {
- // Create tree viewer inside drill down.
- new Label(parent, SWT.LEFT).setText(Policy.bind("Select_a_folder_then_type_in_the_file_name__8")); //$NON-NLS-1$
-
- treeViewer = new TreeViewer(parent, SWT.BORDER);
- ContainerContentProvider cp = new ContainerContentProvider();
- cp.showClosedProjects(false);
- GridData data = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL |
- GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
-
- data.widthHint = SIZING_SELECTION_PANE_WIDTH;
- data.heightHint = SIZING_SELECTION_PANE_HEIGHT;
-
- treeViewer.getTree().setLayoutData(data);
- treeViewer.setContentProvider(cp);
- treeViewer.setLabelProvider(new WorkbenchLabelProvider());
- treeViewer.addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection)event.getSelection();
- containerSelectionChanged((IContainer) selection.getFirstElement()); // allow null
- validatePage();
- }
- });
-
- treeViewer.addDoubleClickListener(
- new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- ISelection selection = event.getSelection();
- if (selection instanceof IStructuredSelection) {
- Object item = ((IStructuredSelection)selection).getFirstElement();
- if (treeViewer.getExpandedState(item))
- treeViewer.collapseToLevel(item, 1);
- else
- treeViewer.expandToLevel(item, 1);
- }
- }
- });
-
- // This has to be done after the viewer has been laid out
- treeViewer.setInput(ResourcesPlugin.getWorkspace());
-
- // name group
- Composite nameGroup = new Composite(parent,SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginWidth = 0;
- nameGroup.setLayout(layout);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- nameGroup.setLayoutData(data);
-
- Label label = new Label(nameGroup,SWT.NONE);
- label.setText(Policy.bind("Fi&le_name__9")); //$NON-NLS-1$
-
- // resource name entry field
- workspaceFilename = new Text(nameGroup,SWT.BORDER);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- workspaceFilename.setLayoutData(data);
- workspaceFilename.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validatePage();
- }
- });
- }
-
- /**
- * Enable and disable controls based on the selected radio button.
- */
- protected void updateEnablements() {
- int type = getSaveType();
-
- browseButton.setEnabled(type==FILESYSTEM);
- filenameCombo.setEnabled(type==FILESYSTEM);
- treeViewer.getTree().setEnabled(type==WORKSPACE);
- workspaceFilename.setEnabled(type==WORKSPACE);
- }
-
- /**
- * Answers the type of the patch file destination.
- */
- public int getSaveType() {
- if(saveInFilesystem.getSelection()) {
- return FILESYSTEM;
- } else if(saveToClipboard.getSelection()) {
- return CLIPBOARD;
- } else {
- return WORKSPACE;
- }
- }
-
- /**
- * Remember the container selected in the tree viewer.
- */
- public void containerSelectionChanged(IContainer container) {
- selectedContainer = container;
- }
- }
- // end of PatchFileSelectionPage
-
- /**
- * Page to select the options for creating the patch.
- */
- public class PatchFileCreationOptionsPage extends WizardPage {
-
- private Button recurseOption;
- private Button contextDiffOption;
- private Button unifiedDiffOption;
- private Button regularDiffOption;
- private Button includeNewFilesOptions;
-
- /**
- * Constructor for PatchFileCreationOptionsPage.
- */
- protected PatchFileCreationOptionsPage(String pageName) {
- super(pageName);
- }
-
- /**
- * Constructor for PatchFileCreationOptionsPage.
- */
- protected PatchFileCreationOptionsPage(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);
-
- 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$
- }
-
- /**
- * 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(Diff.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()]);
- }
- }
- // end of PatchFileCreationOptionsPage
-
- public GenerateDiffFileWizard(IStructuredSelection selection, IResource resource) {
- super();
- this.selection = selection;
- this.resource = resource;
- setWindowTitle(Policy.bind("GenerateCVSDiff.title")); //$NON-NLS-1$
- initializeDefaultPageImageDescriptor();
- }
-
- public void addPages() {
- String pageTitle = Policy.bind("GenerateCVSDiff.pageTitle"); //$NON-NLS-1$
- String pageDescription = Policy.bind("GenerateCVSDiff.pageDescription"); //$NON-NLS-1$
- mainPage = new PatchFileSelectionPage(pageTitle, pageTitle, CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_DIFF), selection);
- mainPage.setDescription(pageDescription);
- addPage(mainPage);
-
- 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 PatchFileCreationOptionsPage(pageTitle, pageTitle, CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_DIFF));
- optionsPage.setDescription(pageDescription);
- addPage(optionsPage);
- }
-
- /**
- * Initializes this creation wizard using the passed workbench and
- * object selection.
- *
- * @param workbench the current workbench
- * @param selection the current object selection
- */
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- }
- /**
- * Declares the wizard banner iamge descriptor
- */
- protected void initializeDefaultPageImageDescriptor() {
- String iconPath;
- if (Display.getCurrent().getIconDepth() > 4) {
- iconPath = "icons/full/"; //$NON-NLS-1$
- } else {
- iconPath = "icons/basic/"; //$NON-NLS-1$
- }
- try {
- URL installURL = CVSUIPlugin.getPlugin().getDescriptor().getInstallURL();
- 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() {
- String fs = mainPage.getFilesystemFile();
- IFile ws = mainPage.getWorkspaceFile();
- int type = mainPage.getSaveType();
-
- try {
- if(type != mainPage.CLIPBOARD) {
- File file = new File(fs!=null ? fs : ws.getLocation().toOSString());
- if (file.exists()) {
- // prompt then delete
- String title = Policy.bind("GenerateCVSDiff.overwriteTitle"); //$NON-NLS-1$
- 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) {
- // cancel
- return false;
- }
- }
- getContainer().run(false, true, new GenerateDiffFileOperation(resource, file, false, optionsPage.getOptions(), getShell()));
- if(type==mainPage.WORKSPACE) {
- ws.getParent().refreshLocal(IResource.DEPTH_ONE, null);
- }
- } else {
- getContainer().run(false, true, new GenerateDiffFileOperation(resource, null, true, optionsPage.getOptions(), getShell()));
- }
- return true;
- } catch (InterruptedException e1) {
- return true;
- } catch(CoreException e) {
- ErrorDialog.openError(getShell(), Policy.bind("GenerateCVSDiff.error"), null, e.getStatus()); //$NON-NLS-1$
- return false;
- } catch (InvocationTargetException e2) {
- if (e2.getTargetException() instanceof CoreException) {
- CoreException e = (CoreException) e2.getTargetException();
- ErrorDialog.openError(getShell(), Policy.bind("GenerateCVSDiff.error"), null, e.getStatus()); //$NON-NLS-1$
- return false;
- } else {
- Throwable target = e2.getTargetException();
- if (target instanceof RuntimeException) {
- throw (RuntimeException) target;
- }
- if (target instanceof Error) {
- throw (Error) target;
- }
- }
- return true;
- }
- }
-} \ No newline at end of file
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 1e9c17944..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizard.java
+++ /dev/null
@@ -1,401 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-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.ErrorDialog;
-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.custom.BusyIndicator;
-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.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;
-
- 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);
- }
-
- 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();
- return summaryPage;
- }
-
- public IWizardPage getPreviousPage(IWizardPage page) {
- if (page == summaryPage) {
- 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 {
- 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();
-
- IStatus status = provider.setKeywordSubstitution(providerFiles,
- Policy.subMonitorFor(monitor, workPerProvider));
- if (status.getCode() != CVSStatus.OK) {
- messages.add(status);
- }
- }
- } 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$
- }
- ErrorDialog.openError(getShell(), title, message, statusToDisplay);
- }
- return true;
- } catch (InterruptedException e1) {
- return true;
- } catch (InvocationTargetException e2) {
- if (e2.getTargetException() instanceof CoreException) {
- CoreException e = (CoreException) e2.getTargetException();
- ErrorDialog.openError(getShell(), Policy.bind("KSubstWizard.problemsMessage"), null, e.getStatus()); //$NON-NLS-1$
- return false;
- } else {
- Throwable target = e2.getTargetException();
- if (target instanceof RuntimeException) {
- throw (RuntimeException) target;
- }
- if (target instanceof Error) {
- throw (Error) target;
- }
- }
- return true;
- }
- }
-
- 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()) {
- 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) {
- ErrorDialog.openError(getShell(), Policy.bind("KSubstWizard.problemsMessage"), null, e.getStatus()); //$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;
- }
-}
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 15452e3bf..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardDirtyFilesPage.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-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.Policy;
-import org.eclipse.team.internal.ccvs.ui.wizards.KSubstWizard.KSubstChangeElement;
-
-/**
- * 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);
- createWrappingLabel(top, Policy.bind("KSubstWizardDirtyFilesPage.contents"), 0, LABEL_WIDTH_HINT); //$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$
- }
-
- 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;
- }
-}
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 3707688e8..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardSelectionPage.java
+++ /dev/null
@@ -1,144 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-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.Policy;
-
-/**
- * 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);
-
- 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, LABEL_WIDTH_HINT);
-
- // 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();
- }
-
- /**
- * 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 435f73975..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardSharedFilesPage.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-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.Policy;
-import org.eclipse.team.internal.ccvs.ui.wizards.KSubstWizard.KSubstChangeElement;
-
-/**
- * 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, LABEL_WIDTH_HINT); //$NON-NLS-1$
-
- 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$
- }
-
- 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;
- }
-}
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 42f2964c2..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/KSubstWizardSummaryPage.java
+++ /dev/null
@@ -1,272 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-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.Policy;
-import org.eclipse.team.internal.ccvs.ui.wizards.KSubstWizard.KSubstChangeElement;
-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, LABEL_WIDTH_HINT); //$NON-NLS-1$
-
- 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);
- }
-
- /**
- * 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
- TableEditor tableEditor = 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();
- }
-}
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 20b756fd4..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModuleSelectionPage.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-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.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-public class ModuleSelectionPage extends CVSWizardPage {
- Button useProjectNameButton;
- Button useSpecifiedNameButton;
- Text text;
-
- String result;
- boolean useProjectName = true;
-
- public ModuleSelectionPage(String pageName, String title, ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- }
-
- public void createControl(Composite parent) {
- Composite composite = createComposite(parent, 2);
- // set F1 help
- // WorkbenchHelp.setHelp(composite, new DialogPageContextComputer (this, ITeamHelpContextIds.REPO_CONNECTION_MAIN_PAGE));
-
- useProjectNameButton = createRadioButton(composite, Policy.bind("ModuleSelectionPage.moduleIsProject"), 2); //$NON-NLS-1$
- useSpecifiedNameButton = createRadioButton(composite, Policy.bind("ModuleSelectionPage.specifyModule"), 1); //$NON-NLS-1$
- useProjectNameButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- useProjectName = useProjectNameButton.getSelection();
- if (useProjectName) {
- text.setEnabled(false);
- result = null;
- setPageComplete(true);
- } else {
- text.setEnabled(true);
- result = text.getText();
- if (result.length() == 0) {
- result = null;
- setPageComplete(false);
- } else {
- setPageComplete(true);
- }
- }
- }
- });
-
- text = createTextField(composite);
- text.setEnabled(false);
- text.addListener(SWT.Modify, new Listener() {
- public void handleEvent(Event event) {
- result = text.getText();
- if (result.length() == 0) {
- result = null;
- setPageComplete(false);
- } else {
- setPageComplete(true);
- }
- }
- });
- useSpecifiedNameButton.setSelection(false);
- useProjectNameButton.setSelection(true);
- setControl(composite);
- setPageComplete(true);
- }
- public String getModuleName() {
- return result;
- }
- public boolean useProjectName() {
- return useProjectName;
- }
-}
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 d0131d891..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/NewLocationWizard.java
+++ /dev/null
@@ -1,127 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Properties;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-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.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.ICVSProvider;
-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;
-
-public class NewLocationWizard extends Wizard {
- private ConfigurationWizardMainPage mainPage;
-
- private Properties properties = null;
-
- public NewLocationWizard() {
- IDialogSettings workbenchSettings = CVSUIPlugin.getPlugin().getDialogSettings();
- IDialogSettings section = workbenchSettings.getSection("NewLocationWizard");//$NON-NLS-1$
- if (section == null) {
- section = workbenchSettings.addNewSection("NewLocationWizard");//$NON-NLS-1$
- }
- 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() {
- mainPage.finish(new NullProgressMonitor());
- Properties properties = mainPage.getProperties();
- final ICVSRepositoryLocation[] root = new ICVSRepositoryLocation[1];
- ICVSProvider provider = CVSProviderPlugin.getProvider();
- try {
- root[0] = provider.createRepository(properties);
- if (mainPage.getValidate()) {
- try {
- new ProgressMonitorDialog(getShell()).run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- root[0].validateConnection(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InterruptedException e) {
- return false;
- } catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- if (t instanceof TeamException) {
- throw (TeamException)t;
- }
- }
- }
- provider.addRepository(root[0]);
- } catch (TeamException e) {
- IStatus error = e.getStatus();
- if (root[0] == null) {
- // Exception creating the root, we cannot continue
- ErrorDialog.openError(getContainer().getShell(), Policy.bind("NewLocationWizard.exception"), null, error); //$NON-NLS-1$
- return false;
- } else {
- // Exception validating. We can continue if the user wishes.
- if (error.isMultiStatus() && error.getChildren().length == 1) {
- error = error.getChildren()[0];
- }
-
- boolean keep = false;
- if (error.isMultiStatus()) {
- ErrorDialog.openError(getContainer().getShell(), Policy.bind("NewLocationWizard.validationFailedTitle"), null, error); //$NON-NLS-1$
- } else {
- keep = MessageDialog.openQuestion(getContainer().getShell(),
- Policy.bind("NewLocationWizard.validationFailedTitle"), //$NON-NLS-1$
- Policy.bind("NewLocationWizard.validationFailedText", new Object[] {error.getMessage()})); //$NON-NLS-1$
- }
- try {
- if (keep) {
- provider.addRepository(root[0]);
- } else {
- provider.disposeRepository(root[0]);
- }
- } catch (TeamException e1) {
- ErrorDialog.openError(getContainer().getShell(), Policy.bind("exception"), null, e1.getStatus()); //$NON-NLS-1$
- return false;
- }
- return keep;
- }
- }
- return true;
- }
-}
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 ec2db3509..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RepositorySelectionPage.java
+++ /dev/null
@@ -1,131 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ColumnWeightData;
-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.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.wizard.IWizardPage;
-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.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-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.ui.internal.model.AdaptableList;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-/**
- * 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;
-
- /**
- * 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) {
- Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
- table.setLayoutData(new GridData(GridData.FILL_BOTH));
- 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, 2);
- // set F1 help
- // WorkbenchHelp.setHelp(composite, new DialogPageContextComputer (this, ITeamHelpContextIds.REPO_CONNECTION_MAIN_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("RepositorySelectionPage.description")); //$NON-NLS-1$
-
- useExistingRepo = createRadioButton(composite, Policy.bind("RepositorySelectionPage.useExisting"), 2); //$NON-NLS-1$
- table = createTable(composite);
- 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);
- }
- });
- useNewRepo = createRadioButton(composite, Policy.bind("RepositorySelectionPage.useNew"), 2); //$NON-NLS-1$
-
- 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();
- }
- /**
- * Initializes states of the controls.
- */
- private void initializeValues() {
- ICVSRepositoryLocation[] locations = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownRoots();
- 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;
- }
-}
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 aef81547c..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java
+++ /dev/null
@@ -1,367 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.util.Properties;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.ErrorDialog;
-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.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-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.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.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.TagSelectionDialog;
-import org.eclipse.team.internal.ui.sync.SyncView;
-import org.eclipse.team.ui.IConfigurationWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.team.internal.ccvs.ui.sync.CVSSyncCompareInput;
-import org.eclipse.team.internal.ccvs.ui.sync.CVSSyncCompareUnsharedInput;
-
-/**
- * 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 {
- // 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 tells the user what's going to happen.
- private SharingWizardFinishPage finishPage;
-
- public SharingWizard() {
- IDialogSettings workbenchSettings = CVSUIPlugin.getPlugin().getDialogSettings();
- IDialogSettings section = workbenchSettings.getSection("NewLocationWizard");//$NON-NLS-1$
- if (section == null) {
- section = workbenchSettings.addNewSection("NewLocationWizard");//$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);
- addPage(autoconnectPage);
- } else {
- ICVSRepositoryLocation[] locations = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownRoots();
- if (locations.length > 0) {
- locationPage = new RepositorySelectionPage("importPage", Policy.bind("SharingWizard.importTitle"), sharingImage); //$NON-NLS-1$ //$NON-NLS-2$
- addPage(locationPage);
- }
- createLocationPage = new ConfigurationWizardMainPage("createLocationPage", Policy.bind("SharingWizard.enterInformation"), sharingImage); //$NON-NLS-1$ //$NON-NLS-2$
- addPage(createLocationPage);
- createLocationPage.setDialogSettings(getDialogSettings());
- modulePage = new ModuleSelectionPage("modulePage", Policy.bind("SharingWizard.enterModuleName"), sharingImage); //$NON-NLS-1$ //$NON-NLS-2$
- addPage(modulePage);
- finishPage = new SharingWizardFinishPage("finishPage", Policy.bind("SharingWizard.readyToFinish"), sharingImage); //$NON-NLS-1$ //$NON-NLS-2$
- addPage(finishPage);
- }
- }
- public boolean canFinish() {
- IWizardPage page = getContainer().getCurrentPage();
- if (page == locationPage) {
- if (locationPage.getLocation() == null) {
- return createLocationPage.isPageComplete();
- } else {
- return modulePage.useProjectName() || modulePage.getModuleName() != null;
- }
- } else if (page == modulePage) {
- return modulePage.useProjectName() || modulePage.getModuleName() != null;
- } else if (page == finishPage) {
- return true;
- }
- return super.canFinish();
- }
- 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) {
- if (page == autoconnectPage) return null;
- if (page == locationPage) {
- if (locationPage.getLocation() == null) {
- return createLocationPage;
- } else {
- return modulePage;
- }
- }
- if (page == createLocationPage) {
- return modulePage;
- }
- if (page == modulePage) {
- return finishPage;
- }
- return null;
- }
- /*
- * @see IWizard#performFinish
- */
- public boolean performFinish() {
- final boolean[] result = new boolean[] { true };
- try {
- final boolean[] doSync = new boolean[] { false };
- final boolean[] projectExists = new boolean[] { false };
- getContainer().run(false, false, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- try {
- monitor.beginTask("", 100); //$NON-NLS-1$
- if (autoconnectPage != null) {
- // Autoconnect to the repository using CVS/ directories
-
- FolderSyncInfo info = autoconnectPage.getFolderSyncInfo();
- if (info == null) {
- // Error!
- return;
- }
-
- // Get the repository location (the get will add the locatin to the provider)
- boolean isPreviouslyKnown = CVSProviderPlugin.getProvider().isKnownRepository(info.getRoot());
- ICVSRepositoryLocation location = CVSProviderPlugin.getProvider().getRepository(info.getRoot());
-
- // Validate the connection if the user wants to
- boolean validate = autoconnectPage.getValidate();
- if (validate) {
- // Do the validation
- try {
- location.validateConnection(new SubProgressMonitor(monitor, 50));
- } catch (TeamException e) {
- // Exception validating. We can continue if the user wishes.
- boolean keep = 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) {
- // Remove the root
- try {
- if (!isPreviouslyKnown) {
- CVSProviderPlugin.getProvider().disposeRepository(location);
- }
- } catch (TeamException e1) {
- ErrorDialog.openError(getContainer().getShell(), Policy.bind("exception"), null, e1.getStatus()); //$NON-NLS-1$
- }
- result[0] = false;
- return;
- }
- // They want to keep the connection anyway. Fall through.
- }
- }
-
- // Set the sharing
- CVSProviderPlugin.getProvider().setSharing(project, info, new SubProgressMonitor(monitor, 50));
- } else {
- // Import
- doSync[0] = true;
- // Make sure the directory does not already exist on the server.
- // If it does, return false.
- ICVSRepositoryLocation location;
- boolean isKnown;
- try {
- location = getLocation();
- isKnown = CVSProviderPlugin.getProvider().isKnownRepository(location.getLocation());
- location.validateConnection(monitor);
- String moduleName = getModuleName();
- ICVSRemoteFolder folder = location.getRemoteFolder(moduleName, null);
- if (folder.exists(new SubProgressMonitor(monitor, 50))) {
- projectExists[0] = true;
- boolean sync = MessageDialog.openQuestion(getShell(), Policy.bind("SharingWizard.couldNotImport"), Policy.bind("SharingWizard.couldNotImportLong", getModuleName())); //$NON-NLS-1$ //$NON-NLS-2$
- result[0] = sync;
- doSync[0] = sync;
- return;
- }
- } catch (TeamException e) {
- ErrorDialog.openError(getShell(), null, null, e.getStatus());
- result[0] = false;
- doSync[0] = false;
- return;
- }
- // Add the location to the provider if it is new
- if (!isKnown) {
- CVSProviderPlugin.getProvider().addRepository(location);
- }
- // Create the remote module for the project
- CVSProviderPlugin.getProvider().createModule(location, project, getModuleName(), new SubProgressMonitor(monitor, 50));
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- });
- if (doSync[0]) {
- // Sync of the project
- SyncView view = (SyncView)CVSUIPlugin.getActivePage().findView(SyncView.VIEW_ID);
- if (view == null) {
- view = SyncView.findInActivePerspective();
- }
- if (view != null) {
- try {
- CVSUIPlugin.getActivePage().showView(SyncView.VIEW_ID);
- } catch (PartInitException e) {
- CVSUIPlugin.log(e.getStatus());
- }
- CVSSyncCompareInput input;
- if (projectExists[0]) {
- try {
- ICVSRepositoryLocation location = getLocation();
- String moduleName = getModuleName();
- TagSelectionDialog dialog = new TagSelectionDialog(getShell(),
- new ICVSFolder[] {(ICVSFolder)location.getRemoteFolder(moduleName, null)},
- Policy.bind("SharingWizard.selectTagTitle"), //$NON-NLS-1$
- Policy.bind("SharingWizard.selectTag"), TagSelectionDialog.INCLUDE_HEAD_TAG | TagSelectionDialog.INCLUDE_BRANCHES, false /*don't show recurse option*/); //$NON-NLS-1$
- dialog.setBlockOnOpen(true);
- if (dialog.open() == Dialog.CANCEL) {
- return false;
- }
- CVSTag tag = dialog.getResult();
- input = new CVSSyncCompareUnsharedInput(project, getLocation(), moduleName, tag);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- } else {
- input = new CVSSyncCompareInput(new IResource[] {project});
- }
- view.showSync(input);
- }
- }
- } catch (InterruptedException e) {
- return true;
- } catch (InvocationTargetException e) {
- Throwable target = e.getTargetException();
- if (target instanceof RuntimeException) {
- throw (RuntimeException)target;
- }
- if (target instanceof Error) {
- throw (Error)target;
- } else if (target instanceof TeamException) {
- ErrorDialog.openError(getContainer().getShell(), null, null, ((TeamException)target).getStatus());
- }
- }
-
- return result[0];
- }
-
- /**
- * Return an ICVSRepositoryLocation
- */
- private ICVSRepositoryLocation getLocation() throws TeamException {
- // If the import page has a location, use it.
- if (locationPage != null) {
- ICVSRepositoryLocation location = locationPage.getLocation();
- if (location != null) return location;
- }
-
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- createLocationPage.finish(new NullProgressMonitor());
- }
- });
- Properties properties = createLocationPage.getProperties();
- return CVSProviderPlugin.getProvider().createRepository(properties);
- }
- /**
- * Return the module name.
- */
- private String getModuleName() {
- String moduleName = modulePage.getModuleName();
- if (moduleName == null) moduleName = project.getName();
- return moduleName;
- }
- /*
- * @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) {
- final IStatus[] status = new IStatus[] { null };
- if (e.getTargetException() instanceof CoreException) {
- status[0] = ((CoreException)e.getTargetException()).getStatus();
- } else if (e.getTargetException() instanceof TeamException) {
- status[0] = ((TeamException)e.getTargetException()).getStatus();
- } else {
- status[0] = new Status(IStatus.ERROR, CVSUIPlugin.ID, 0, e.getTargetException().getMessage(), e.getTargetException());
- }
- Runnable runnable = new Runnable() {
- public void run() {
- Shell shell = null;
- if (getContainer() != null) {
- shell = getContainer().getShell();
- }
- ErrorDialog.openError(shell, null, null, status[0]);
- }
- };
- if (shell == null) {
- Display.getDefault().syncExec(runnable);
- } else {
- runnable.run();
- }
- } catch (InterruptedException e) {
- }
- return isCVSFolder[0];
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardFinishPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardFinishPage.java
deleted file mode 100644
index db68d29cd..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardFinishPage.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.jface.resource.ImageDescriptor;
-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.Policy;
-
-public class SharingWizardFinishPage extends CVSWizardPage {
- public SharingWizardFinishPage(String pageName, String title, ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- }
-
- /*
- * @see IDialogPage#createControl(Composite)
- */
- public void createControl(Composite parent) {
- Composite composite = createComposite(parent, 1);
- Label label = new Label(composite, SWT.LEFT | SWT.WRAP);
- label.setText(Policy.bind("SharingWizardFinishPage.message")); //$NON-NLS-1$
- GridData data = new GridData();
- data.widthHint = 350;
- label.setLayoutData(data);
- setControl(composite);
- }
-}
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 d05a3f9a9..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizard.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-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.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.wizard.Wizard;
-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.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-
-public class UpdateWizard extends Wizard {
-
- UpdateWizardPage updatePage;
- IProject project;
-
- public UpdateWizard() {
- setNeedsProgressMonitor(true);
- setWindowTitle(Policy.bind("UpdateWizard.title")); //$NON-NLS-1$
- }
-
- public void addPages() {
- // Provide a progress monitor to indicate what is going on
- try {
- new ProgressMonitorDialog(getShell()).run(false, false, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- monitor.beginTask(null, 100);
- updatePage = new UpdateWizardPage("updatePage", Policy.bind("UpdateWizard.updatePage"), CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_SHARE)); //$NON-NLS-1$ //$NON-NLS-2$
- updatePage.setProject(project);
- addPage(updatePage);
- monitor.done();
- }
- });
- } catch (InvocationTargetException e) {
- CVSUIPlugin.log(new Status(IStatus.ERROR, CVSUIPlugin.ID, 0, Policy.bind("internal"), e.getTargetException())); //$NON-NLS-1$
- } catch (InterruptedException e) {
- // Ignore
- }
- }
-
- /*
- * @see IWizard#performFinish()
- */
- public boolean performFinish() {
- final boolean[] result = new boolean[] {false};
- try {
- getContainer().run(false, false, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- try {
- CVSTeamProvider provider = ((CVSTeamProvider)RepositoryProvider.getProvider(project));
- provider.update(new IResource[] { project }, updatePage.getLocalOptions(),
- updatePage.getTag(), true /*createBackups*/, monitor);
- result[0] = true;
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- });
- } catch (InterruptedException e) {
- return true;
- } catch (InvocationTargetException e) {
- Throwable target = e.getTargetException();
- if (target instanceof CVSException) {
- ErrorDialog.openError(getShell(), null, null, ((CVSException)target).getStatus());
- return false;
- }
- if (target instanceof RuntimeException) {
- throw (RuntimeException)target;
- }
- if (target instanceof Error) {
- throw (Error)target;
- }
- }
- return result[0];
- }
-
- public void setProject(IProject project) {
- this.project = project;
- }
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizardPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizardPage.java
deleted file mode 100644
index 20d8292b0..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizardPage.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package org.eclipse.team.internal.ccvs.ui.wizards;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-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.swt.widgets.Tree;
-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.ICVSRemoteFolder;
-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.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.TagConfigurationDialog;
-import org.eclipse.team.internal.ccvs.ui.merge.ProjectElement;
-import org.eclipse.team.internal.ccvs.ui.merge.TagElement;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-public class UpdateWizardPage extends CVSWizardPage {
-
- IProject project;
- TreeViewer tree;
- CVSTag result;
- ICVSRemoteFolder remote;
- boolean doOverwrite;
-
- public UpdateWizardPage(String pageName, String title, ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- }
-
- /*
- * @see IDialogPage#createControl(Composite)
- */
- public void createControl(Composite parent) {
- Composite composite = createComposite(parent, 2);
- // set F1 help
- // WorkbenchHelp.setHelp(composite, new DialogPageContextComputer (this, ITeamHelpContextIds.REPO_CONNECTION_MAIN_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("UpdateWizardPage.description")); //$NON-NLS-1$
-
- tree = createTree(composite);
- tree.setContentProvider(new WorkbenchContentProvider());
- tree.setLabelProvider(new WorkbenchLabelProvider());
- tree.setSorter(new ViewerSorter() {
- public int compare(Viewer v, Object o1, Object o2) {
- int result = super.compare(v, o1, o2);
- if (o1 instanceof TagElement && o2 instanceof TagElement) {
- return -result;
- }
- return result;
- }
- });
- tree.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- Object selected = ((IStructuredSelection)tree.getSelection()).getFirstElement();
- if (selected instanceof TagElement) {
- result = ((TagElement)selected).getTag();
- setPageComplete(true);
- } else {
- result = null;
- setPageComplete(false);
- }
- }
- });
-
- createLabel(composite, ""); //$NON-NLS-1$
- createLabel(composite, ""); //$NON-NLS-1$
-
- doOverwrite = false;
- final Button overwrite = new Button(composite, SWT.CHECK);
- data = new GridData();
- data.horizontalSpan = 2;
- overwrite.setLayoutData(data);
- overwrite.setText(Policy.bind("UpdateWizardPage.overwrite")); //$NON-NLS-1$
- overwrite.setSelection(doOverwrite);
- overwrite.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- doOverwrite = overwrite.getSelection();
- }
- });
-
- setControl(composite);
- tree.setInput(new ProjectElement(CVSWorkspaceRoot.getCVSFolderFor(project), ProjectElement.INCLUDE_ALL_TAGS));
-
- Runnable refresh = new Runnable() {
- public void run() {
- tree.refresh();
- }
- };
- TagConfigurationDialog.createTagDefinitionButtons(getShell(), composite, new ICVSFolder[] {CVSWorkspaceRoot.getCVSFolderFor(project)},
- convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT),
- convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH), refresh, refresh);
-
- Label seperator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
- data = new GridData (GridData.FILL_BOTH);
- data.horizontalSpan = 2;
- seperator.setLayoutData(data);
-
- setPageComplete(false);
- }
-
- protected TreeViewer createTree(Composite parent) {
- Tree tree = new Tree(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.SINGLE);
- tree.setLayoutData(new GridData(GridData.FILL_BOTH));
- return new TreeViewer(tree);
- }
-
- public void setProject(IProject project) {
- this.project = project;
- try {
- this.remote = (ICVSRemoteFolder) CVSWorkspaceRoot.getRemoteResourceFor(project);
- } catch (TeamException e) {
- // To do
- }
- }
-
- public CVSTag getTag() {
- return result;
- }
-
- public LocalOption[] getLocalOptions() {
- if (doOverwrite) {
- return new LocalOption[] { Update.IGNORE_LOCAL_CHANGES };
- }
- return Command.NO_LOCAL_OPTIONS;
- }
-}

Back to the top